From 04a2b4ff8ef0a1c77391f017693e19da03896c7b Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Wed, 30 Sep 2020 14:07:20 +0530 Subject: css --- src/client/views/DocumentButtonBar.tsx | 2 +- src/client/views/nodes/DocumentLinksButton.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/client/views/DocumentButtonBar.tsx b/src/client/views/DocumentButtonBar.tsx index c5fd3c777..ca5cb590f 100644 --- a/src/client/views/DocumentButtonBar.tsx +++ b/src/client/views/DocumentButtonBar.tsx @@ -242,7 +242,7 @@ export class DocumentButtonBar extends React.Component<{ views: () => (DocumentV get menuButton() { const targetDoc = this.view0?.props.Document; return !targetDoc ? (null) :
{`Open Context Menu`}
}> -
this.openContextMenu(e)}> +
this.openContextMenu(e)}>
; } diff --git a/src/client/views/nodes/DocumentLinksButton.tsx b/src/client/views/nodes/DocumentLinksButton.tsx index 0cb5b94f4..b9916adef 100644 --- a/src/client/views/nodes/DocumentLinksButton.tsx +++ b/src/client/views/nodes/DocumentLinksButton.tsx @@ -274,7 +274,8 @@ export class DocumentLinksButton extends React.Component DocumentLinksButton.StartLink ? DocumentLinksButton.finishLinkClick(e.clientX, e.clientY, DocumentLinksButton.StartLink, this.props.View.props.Document, true, this.props.View) : emptyFunction} /> : (null) -- cgit v1.2.3-70-g09d2 From 23c4f10e0bc3d7ec94a5c74df597cdddb23d1413 Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Thu, 1 Oct 2020 01:47:34 +0530 Subject: added acl refresh ish button to panel and sharing menu --- src/client/util/SharingManager.scss | 27 ++++++++++++---------- src/client/util/SharingManager.tsx | 43 +++++++++++++++++++++++++++++------- src/client/views/PropertiesView.scss | 32 ++++++++++++++++++--------- src/client/views/PropertiesView.tsx | 21 +++++++++++------- 4 files changed, 84 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/client/util/SharingManager.scss b/src/client/util/SharingManager.scss index 54e3f45bc..9dc57dd1e 100644 --- a/src/client/util/SharingManager.scss +++ b/src/client/util/SharingManager.scss @@ -72,22 +72,25 @@ } } - .layoutDoc-acls, - .myDocs-acls { + .acl-container { display: flex; - flex-direction: column; float: right; - margin-right: 12; - margin-top: -15; - align-items: center; + align-items: baseline; + margin-top: -12; - label { - font-weight: normal; - font-style: italic; - } + .layoutDoc-acls, + .myDocs-acls { + flex-direction: column; + margin-right: 12; - input { - cursor: pointer; + label { + font-weight: normal; + font-style: italic; + } + + input { + cursor: pointer; + } } } } diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx index 2c9620b02..342ee6d1a 100644 --- a/src/client/util/SharingManager.tsx +++ b/src/client/util/SharingManager.tsx @@ -4,7 +4,7 @@ import { observer } from "mobx-react"; import * as React from "react"; import Select from "react-select"; import * as RequestPromise from "request-promise"; -import { AclAdmin, AclPrivate, DataSym, Doc, DocListCast, Opt, AclSym } from "../../fields/Doc"; +import { AclAdmin, AclPrivate, DataSym, Doc, DocListCast, Opt, AclSym, AclAddonly, AclEdit, AclReadonly } from "../../fields/Doc"; import { List } from "../../fields/List"; import { Cast, StrCast } from "../../fields/Types"; import { distributeAcls, GetEffectiveAcl, SharingPermissions, TraceMobx } from "../../fields/util"; @@ -71,6 +71,7 @@ export class SharingManager extends React.Component<{}> { @observable private individualSort: "ascending" | "descending" | "none" = "none"; // sorting options for the list of individuals @observable private groupSort: "ascending" | "descending" | "none" = "none"; // sorting options for the list of groups private shareDocumentButtonRef: React.RefObject = React.createRef(); // ref for the share button, used for the position of the popup + private distributeAclsButtonRef: React.RefObject = React.createRef(); // ref for the distribute button, used for the position of the popup // if both showUserOptions and showGroupOptions are false then both are displayed @observable private showUserOptions: boolean = false; // whether to show individuals as options when sharing (in the react-select component) @observable private showGroupOptions: boolean = false; // // whether to show groups as options when sharing (in the react-select component) @@ -374,6 +375,26 @@ export class SharingManager extends React.Component<{}> { } } + @action + distributeOverCollection = (targetDoc?: Doc) => { + const AclMap = new Map([ + [AclPrivate, SharingPermissions.None], + [AclReadonly, SharingPermissions.View], + [AclAddonly, SharingPermissions.Add], + [AclEdit, SharingPermissions.Edit], + [AclAdmin, SharingPermissions.Admin] + ]); + + const target = targetDoc || this.targetDoc!; + + const docs = SelectionManager.SelectedDocuments().length < 2 ? [target] : SelectionManager.SelectedDocuments().map(docView => docView.props.Document); + docs.forEach(doc => { + for (const [key, value] of Object.entries(doc[AclSym])) { + distributeAcls(key, AclMap.get(value)! as SharingPermissions, target); + } + }); + } + /** * Sorting algorithm to sort users. */ @@ -436,7 +457,7 @@ export class SharingManager extends React.Component<{}> { const commonKeys = intersection(...docs.map(doc => this.layoutDocAcls ? doc?.[AclSym] && Object.keys(doc[AclSym]) : doc?.[DataSym]?.[AclSym] && Object.keys(doc[DataSym][AclSym]))); // the list of users shared with - const userListContents: (JSX.Element | null)[] = users.filter(({ user }) => docs.length > 1 ? commonKeys.includes(`acl-${user.email.replace('.', '_')}`) : true).map(({ user, notificationDoc, userColor }) => { + const userListContents: (JSX.Element | null)[] = users.filter(({ user }) => docs.length > 1 ? commonKeys.includes(`acl-${user.email.replace('.', '_')}`) : docs[0]?.author !== user.email).map(({ user, notificationDoc, userColor }) => { const userKey = `acl-${user.email.replace('.', '_')}`; const uniform = docs.every(doc => this.layoutDocAcls ? doc?.[AclSym]?.[userKey] === docs[0]?.[AclSym]?.[userKey] : doc?.[DataSym]?.[AclSym]?.[userKey] === docs[0]?.[DataSym]?.[AclSym]?.[userKey]); const permissions = uniform ? StrCast(targetDoc?.[userKey]) : "-multiple-"; @@ -580,13 +601,19 @@ export class SharingManager extends React.Component<{}> { this.showUserOptions = !this.showUserOptions)} /> this.showGroupOptions = !this.showGroupOptions)} />
-
- this.myDocAcls = !this.myDocAcls)} checked={this.myDocAcls} /> + +
+
+ this.myDocAcls = !this.myDocAcls)} checked={this.myDocAcls} /> +
+ {Doc.UserDoc().noviceMode ? (null) : +
+ this.layoutDocAcls = !this.layoutDocAcls)} checked={this.layoutDocAcls} /> +
} +
- {Doc.UserDoc().noviceMode ? (null) : -
- this.layoutDocAcls = !this.layoutDocAcls)} checked={this.layoutDocAcls} /> -
}
}
diff --git a/src/client/views/PropertiesView.scss b/src/client/views/PropertiesView.scss index 47d8aacea..9fdc8bc47 100644 --- a/src/client/views/PropertiesView.scss +++ b/src/client/views/PropertiesView.scss @@ -121,19 +121,30 @@ padding: 10px; margin-left: 5px; - .propertiesView-acls-checkbox { + .propertiesView-buttonContainer { float: right; - height: 20px; - margin-top: -20px; - margin-right: -15; - - .propertiesView-acls-checkbox-text { - font-size: 7px; - margin-top: -10px; - margin-left: 6px; + display: flex; + + button { + width: 15; + height: 15; + padding: 0; + margin-top: -5; + } + + .propertiesView-acls-checkbox { + margin-top: -20px; + + .propertiesView-acls-checkbox-text { + font-size: 7px; + margin-top: -10px; + margin-left: 6px; + } } } + + .change-buttons { display: flex; @@ -247,8 +258,7 @@ } .expansion-button { - margin-left: -22.5; - margin: 3; + margin-left: -20; .expansion-button-icon { width: 11px; diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index 5877c1d6d..5cab7726e 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -901,14 +901,19 @@ export class PropertiesView extends React.Component {
{!this.openSharing ? (null) :
- {!novice ? (
- this.layoutDocAcls = !this.layoutDocAcls)} - checked={this.layoutDocAcls} - />; -
Layout
-
) : (null)} +
+ {!novice ? (
+ this.layoutDocAcls = !this.layoutDocAcls)} + checked={this.layoutDocAcls} + /> +
Layout
+
) : (null)} + +
{this.sharingTable}
} -- cgit v1.2.3-70-g09d2 From d69eaadf58687070e3e3649747ffa0447d3e7964 Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Thu, 1 Oct 2020 01:50:58 +0530 Subject: removed unnecessary action --- src/client/util/SharingManager.tsx | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx index 342ee6d1a..bcd7d4056 100644 --- a/src/client/util/SharingManager.tsx +++ b/src/client/util/SharingManager.tsx @@ -375,7 +375,6 @@ export class SharingManager extends React.Component<{}> { } } - @action distributeOverCollection = (targetDoc?: Doc) => { const AclMap = new Map([ [AclPrivate, SharingPermissions.None], -- cgit v1.2.3-70-g09d2