From 80f039a6568973b9b7348de2df59dee68f2228ea Mon Sep 17 00:00:00 2001 From: bobzel Date: Sun, 23 Aug 2020 10:25:32 -0400 Subject: added curPage to propertiesView. cleaned up curPage code in PDFBox/viewer. fixed warnings --- .../collectionFreeForm/PropertiesView.scss | 6 +- .../collectionFreeForm/PropertiesView.tsx | 64 +++++++++++----------- 2 files changed, 35 insertions(+), 35 deletions(-) (limited to 'src/client/views/collections') diff --git a/src/client/views/collections/collectionFreeForm/PropertiesView.scss b/src/client/views/collections/collectionFreeForm/PropertiesView.scss index 535581f2e..278f3b964 100644 --- a/src/client/views/collections/collectionFreeForm/PropertiesView.scss +++ b/src/client/views/collections/collectionFreeForm/PropertiesView.scss @@ -731,8 +731,10 @@ border: none; padding: 6px; padding-bottom: 2px; - - + background: #eeeeee; + border-top: 1px solid; + border-left: 1px solid; + &:hover { border: 0.75px solid rgb(122, 28, 28); } diff --git a/src/client/views/collections/collectionFreeForm/PropertiesView.tsx b/src/client/views/collections/collectionFreeForm/PropertiesView.tsx index cbce6448f..50597f2eb 100644 --- a/src/client/views/collections/collectionFreeForm/PropertiesView.tsx +++ b/src/client/views/collections/collectionFreeForm/PropertiesView.tsx @@ -181,40 +181,38 @@ export class PropertiesView extends React.Component { const doc = this.dataDoc; doc && Object.keys(doc).forEach(key => !(key in ids) && doc[key] !== ComputedField.undefined && (ids[key] = key)); const rows: JSX.Element[] = []; - for (const key of Object.keys(ids).slice().sort()) { - if ((key[0] === key[0].toUpperCase() && key.substring(0, 3) !== "ACL" && key !== "UseCors") - || key[0] === "#" || key === "author" || - key === "creationDate" || key.indexOf("lastModified") !== -1) { - - const contents = doc[key]; - if (key[0] === "#") { + const noviceReqFields = ["author", "creationDate"]; + const noviceLayoutFields = ["curPage"]; + const noviceKeys = [...Array.from(Object.keys(ids)).filter(key => key[0] === "#" || key.indexOf("lastModified") !== -1 || (key[0] === key[0].toUpperCase() && !key.startsWith("ACL") && key !== "UseCors")), + ...noviceReqFields, ...noviceLayoutFields] + for (const key of noviceKeys.sort()) { + const contents = this.selectedDoc[key]; + if (key[0] === "#") { + rows.push(
+ {key} +   +
); + } else if (contents !== undefined) { + const value = Field.toString(contents as Field); + if (noviceReqFields.includes(key) || key.indexOf("lastModified") !== -1) { rows.push(
- {key} -   -
); + {key + ": "} +
{value}
+ ); } else { - const value = Field.toString(contents as Field); - if (key === "author" || key === "creationDate" || key.indexOf("lastModified") !== -1) { - rows.push(
- {key + ": "} -
{value}
-
); - } else { - let contentElement: (JSX.Element | null)[] | JSX.Element = []; - contentElement = Field.toKeyValueString(doc, key)} - SetValue={(value: string) => KeyValueBox.SetField(doc, key, value, true)} - />; - - rows.push(
- {key + ":"} -   - {contentElement} -
); - } + let contentElement = Field.toKeyValueString(this.selectedDoc!, key)} + SetValue={(value: string) => KeyValueBox.SetField(noviceLayoutFields.includes(key) ? this.selectedDoc! : doc, key, value, true)} + />; + + rows.push(
+ {key + ":"} +   + {contentElement} +
); } } } @@ -322,7 +320,7 @@ export class PropertiesView extends React.Component { onChange={e => this.changePermissions(e, user)}> {Object.values(SharingPermissions).map(permission => { return ( - ); })} -- cgit v1.2.3-70-g09d2