aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-07-26 22:54:10 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-07-26 22:54:10 -0500
commite93058822d2b997b48fb711f49bb14357a61143c (patch)
tree06a2ec64382b60800a98503ef5018b760d32cebd /src/client/views/collections/collectionFreeForm
parenta607928d563520fc0a07c559334ea7039d269d3a (diff)
layout check in properties, rich text menu to top
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
-rw-r--r--src/client/views/collections/collectionFreeForm/PropertiesView.scss21
-rw-r--r--src/client/views/collections/collectionFreeForm/PropertiesView.tsx31
2 files changed, 46 insertions, 6 deletions
diff --git a/src/client/views/collections/collectionFreeForm/PropertiesView.scss b/src/client/views/collections/collectionFreeForm/PropertiesView.scss
index 99db0022e..8cc591875 100644
--- a/src/client/views/collections/collectionFreeForm/PropertiesView.scss
+++ b/src/client/views/collections/collectionFreeForm/PropertiesView.scss
@@ -164,9 +164,26 @@
padding: 8.5px;
.propertiesView-fields-title {
- font-size: 12.5px;
- font-weight: bold;
padding-bottom: 7px;
+ display: flex;
+
+ .propertiesView-fields-title-name {
+ font-size: 12.5px;
+ font-weight: bold;
+ }
+
+ .propertiesView-fields-title-checkbox {
+ float: right;
+ height: 20px;
+ margin-top: -13px;
+ margin-left: 115px;
+
+ .propertiesView-fields-title-checkbox-text {
+ font-size: 7px;
+ margin-top: -10px;
+ margin-left: 6px;
+ }
+ }
}
.propertiesView-fields-content {
diff --git a/src/client/views/collections/collectionFreeForm/PropertiesView.tsx b/src/client/views/collections/collectionFreeForm/PropertiesView.tsx
index a75ad13e5..3b8d782aa 100644
--- a/src/client/views/collections/collectionFreeForm/PropertiesView.tsx
+++ b/src/client/views/collections/collectionFreeForm/PropertiesView.tsx
@@ -16,7 +16,7 @@ import { Transform } from "../../../util/Transform";
import { PropertiesButtons } from "../../PropertiesButtons";
import { SelectionManager } from "../../../util/SelectionManager";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { Tooltip } from "@material-ui/core";
+import { Tooltip, Checkbox } from "@material-ui/core";
import SharingManager from "../../../util/SharingManager";
@@ -41,6 +41,8 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
@computed get selectedDoc() { return this.selectedDocumentView?.rootDoc; }
@computed get dataDoc() { return this.selectedDocumentView?.dataDoc; }
+ @observable layoutFields: boolean = false;
+
@action
rtfWidth = () => {
if (this.selectedDoc) {
@@ -88,9 +90,9 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
}
@computed get expandedField() {
- if (this.dataDoc) {
+ if (this.dataDoc && this.selectedDoc) {
const ids: { [key: string]: string } = {};
- const doc = this.dataDoc;
+ const doc = this.layoutFields ? Doc.Layout(this.selectedDoc) : this.dataDoc;
doc && Object.keys(doc).forEach(key => !(key in ids) && doc[key] !== ComputedField.undefined && (ids[key] = key));
const rows: JSX.Element[] = [];
@@ -215,6 +217,19 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
</div>;
}
+ @computed get fieldsCheckbox() {
+ return <Checkbox
+ color="primary"
+ onChange={this.toggleCheckbox}
+ checked={this.layoutFields}
+ />;
+ }
+
+ @action
+ toggleCheckbox = () => {
+ this.layoutFields = !this.layoutFields;
+ }
+
render() {
if (!this.selectedDoc) {
@@ -247,7 +262,15 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
</div>
</div>
<div className="propertiesView-fields">
- <div className="propertiesView-fields-title"> Fields</div>
+ <div className="propertiesView-fields-title">
+ <div className="propertiesView-fields-title-name">
+ Fields
+ </div>
+ <div className="propertiesView-fields-title-checkbox">
+ {this.fieldsCheckbox}
+ <div className="propertiesView-fields-title-checkbox-text">Layout</div>
+ </div>
+ </div>
<div className="propertiesView-fields-content"> {this.expandedField} </div>
</div>
<div className="propertiesView-layout">