8000 Share Permissions by tommoor · Pull Request #761 · outline/outline · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Share Permissions #761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions app/components/Checkbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// @flow
import * as React from 'react';
import styled from 'styled-components';
import HelpText from 'components/HelpText';

export type Props = {
checked?: boolean,
label?: string,
className?: string,
note?: string,
};

const LabelText = styled.span`
font-weight: 500;
margin-left: 10px;
`;

const Wrapper = styled.div`
padding-bottom: 8px;
`;

const Label = styled.label`
display: flex;
align-items: center;
`;

export default function Checkbox({
label,
note,
className,
short,
...rest
}: Props) {
return (
<React.Fragment>
<Wrapper>
<Label>
<input type="checkbox" {...rest} />
{label && <LabelText>{label}</LabelText>}
</Label>
{note && <HelpText small>{note}</HelpText>}
</Wrapper>
</React.Fragment>
);
}
1 change: 1 addition & 0 deletions app/components/HelpText/HelpText.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from 'styled-components';
const HelpText = styled.p`
margin-top: 0;
color: ${props => props.theme.slateDark};
font-size: ${props => (props.small ? '13px' : 'auto')};
`;

export default HelpText;
6 changes: 6 additions & 0 deletions app/components/Sidebar/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DocumentIcon,
ProfileIcon,
SettingsIcon,
PadlockIcon,
CodeIcon,
UserIcon,
LinkIcon,
Expand Down Expand Up @@ -61,6 +62,11 @@ class SettingsSidebar extends React.Component<Props> {
Details
</SidebarLink>
)}
{user.isAdmin && (
<SidebarLink to="/settings/security" icon={<PadlockIcon />}>
Security
</SidebarLink>
)}
<SidebarLink to="/settings/people" icon={<UserIcon />}>
People
</SidebarLink>
Expand Down
2 changes: 1 addition & 1 deletion app/components/Toasts/components/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const Container = styled.li`
align-items: center;
animation: ${fadeAndScaleIn} 100ms ease;
margin: 8px 0;
padding: 8px;
padding: 10px 12px;
color: ${props => props.theme.white};
background: ${props => props.theme[props.type]};
font-size: 15px;
Expand Down
21 changes: 13 additions & 8 deletions app/menus/DocumentMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import { MoreIcon } from 'outline-icons';

import Document from 'models/Document';
import UiStore from 'stores/UiStore';
import AuthStore from 'stores/AuthStore';
import { documentMoveUrl } from 'utils/routeHelpers';
import { DropdownMenu, DropdownMenuItem } from ' 5D32 components/DropdownMenu';

type Props = {
ui: UiStore,
auth: AuthStore,
label?: React.Node,
history: Object,
document: Document,
Expand Down Expand Up @@ -69,7 +71,8 @@ class DocumentMenu extends React.Component<Props> {
};

render() {
const { document, label, className, showPrint } = this.props;
const { document, label, className, showPrint, auth } = this.props;
const canShareDocuments = auth.team && auth.team.sharing;

return (
<DropdownMenu label={label || <MoreIcon />} className={className}>
Expand All @@ -91,12 +94,14 @@ class DocumentMenu extends React.Component<Props> {
Star
</DropdownMenuItem>
)}
<DropdownMenuItem
>
title="Create a public share link"
>
Share link…
</DropdownMenuItem>
{canShareDocuments && (
<DropdownMenuItem
>
title="Create a public share link"
< AE96 /td> >
Share link…
</DropdownMenuItem>
)}
<hr />
<DropdownMenuItem
>
Expand All @@ -123,4 +128,4 @@ class DocumentMenu extends React.Component<Props> {
}
}

export default withRouter(inject('ui')(DocumentMenu));
export default withRouter(inject('ui', 'auth')(DocumentMenu));
2 changes: 2 additions & 0 deletions app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Document from 'scenes/Document';
import Search from 'scenes/Search';
import Settings from 'scenes/Settings';
import Details from 'scenes/Settings/Details';
import Security from 'scenes/Settings/Security';
import People from 'scenes/Settings/People';
import Slack from 'scenes/Settings/Slack';
import Shares from 'scenes/Settings/Shares';
Expand Down Expand Up @@ -43,6 +44,7 @@ export default function Routes() {
<Route exact path="/drafts" component={Drafts} />
<Route exact path="/settings" component={Settings} />
<Route exact path="/settings/details" component={Details} />
<Route exact path="/settings/security" component={Security} />
<Route exact path="/settings/people" component={People} />
<Route exact path="/settings/shares" component={Shares} />
<Route exact path="/settings/tokens" component={Tokens} />
Expand Down
11 changes: 8 additions & 3 deletions app/scenes/Document/components/Header.js