From 715c31a1da078a9e6f69f92f63af0692b6d11019 Mon Sep 17 00:00:00 2001 From: McMatts Date: Fri, 31 May 2019 11:48:16 +0100 Subject: [PATCH] Fix Ember lint issues and print view --- gui/app/components/customize/auth-settings.js | 19 ++++++++++--------- .../components/customize/backup-restore.js | 2 +- .../components/customize/general-settings.js | 2 +- gui/app/components/customize/user-list.js | 4 ++-- gui/app/components/document/content-linker.js | 5 +++-- gui/app/components/document/document-meta.js | 8 ++++++++ .../components/document/settings-category.js | 4 ++-- gui/app/components/document/settings-tag.js | 4 ++-- .../components/document/sidebar-attachment.js | 2 +- .../components/folder/settings-permissions.js | 13 +++++++------ gui/app/components/layout/grid/sidebar.js | 2 +- gui/app/styles/core/layout/layout.scss | 6 ++---- gui/app/styles/core/view/document/meta.scss | 15 +++++++++++---- .../components/document/document-meta.hbs | 2 +- gui/package.json | 2 +- 15 files changed, 53 insertions(+), 37 deletions(-) diff --git a/gui/app/components/customize/auth-settings.js b/gui/app/components/customize/auth-settings.js index b5be3908..5ecaa04c 100644 --- a/gui/app/components/customize/auth-settings.js +++ b/gui/app/components/customize/auth-settings.js @@ -9,6 +9,7 @@ // // https://documize.com +import $ from 'jquery'; import { computed } from '@ember/object'; import { empty } from '@ember/object/computed'; import { set } from '@ember/object'; @@ -169,27 +170,27 @@ export default Component.extend(ModalMixin, Notifier, { case constants.AuthProvider.Keycloak: if (this.get('KeycloakUrlError')) { - this.$("#keycloak-url").focus(); + $("#keycloak-url").focus(); return; } if (this.get('KeycloakRealmError')) { - this.$("#keycloak-realm").focus(); + $("#keycloak-realm").focus(); return; } if (this.get('KeycloakClientIdError')) { - this.$("#keycloak-clientId").focus(); + $("#keycloak-clientId").focus(); return; } if (this.get('KeycloakPublicKeyError')) { - this.$("#keycloak-publicKey").focus(); + $("#keycloak-publicKey").focus(); return; } if (this.get('KeycloakAdminUserError')) { - this.$("#keycloak-admin-user").focus(); + $("#keycloak-admin-user").focus(); return; } if (this.get('KeycloakAdminPasswordError')) { - this.$("#keycloak-admin-password").focus(); + $("#keycloak-admin-password").focus(); return; } @@ -213,11 +214,11 @@ export default Component.extend(ModalMixin, Notifier, { case constants.AuthProvider.LDAP: if (this.get('ldapErrorServerHost')) { - this.$("#ldap-host").focus(); + $("#ldap-host").focus(); return; } if (this.get('ldapErrorServerPort')) { - this.$("#ldap-port").focus(); + $("#ldap-port").focus(); return; } @@ -226,7 +227,7 @@ export default Component.extend(ModalMixin, Notifier, { config.serverPort = parseInt(this.get('ldapConfig.serverPort')); if (!_.isEmpty(config.groupFilter) && _.isEmpty(config.attributeGroupMember)) { - this.$('#ldap-attributeGroupMember').focus(); + $('#ldap-attributeGroupMember').focus(); return; } diff --git a/gui/app/components/customize/backup-restore.js b/gui/app/components/customize/backup-restore.js index b8c7a560..fca96b28 100644 --- a/gui/app/components/customize/backup-restore.js +++ b/gui/app/components/customize/backup-restore.js @@ -53,7 +53,7 @@ export default Component.extend(Notifier, Modal, { didInsertElement() { this._super(...arguments); - this.$('#restore-file').on('change', function(){ + $('#restore-file').on('change', function(){ var fileName = document.getElementById("restore-file").files[0].name; $(this).next('.custom-file-label').html(fileName); }); diff --git a/gui/app/components/customize/general-settings.js b/gui/app/components/customize/general-settings.js index 363d6e9a..4b9b4459 100644 --- a/gui/app/components/customize/general-settings.js +++ b/gui/app/components/customize/general-settings.js @@ -84,7 +84,7 @@ export default Component.extend(Notifier, { actions: { change() { - const selectEl = this.$('#maxTags')[0]; + const selectEl = $('#maxTags')[0]; const selection = selectEl.selectedOptions[0].value; this.set('maxTags', parseInt(selection)); diff --git a/gui/app/components/customize/user-list.js b/gui/app/components/customize/user-list.js index c33fae58..4ef034b2 100644 --- a/gui/app/components/customize/user-list.js +++ b/gui/app/components/customize/user-list.js @@ -63,9 +63,9 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, { this.set('showPermExplain', !this.get('showPermExplain')); if (this.showPermExplain) { - this.$(".perms").show(); + $(".perms").show(); } else { - this.$(".perms").hide(); + $(".perms").hide(); } }, diff --git a/gui/app/components/document/content-linker.js b/gui/app/components/document/content-linker.js index 9f6fdfc6..e32a0a19 100644 --- a/gui/app/components/document/content-linker.js +++ b/gui/app/components/document/content-linker.js @@ -9,6 +9,7 @@ // // https://documize.com +import $ from 'jquery'; import { debounce } from '@ember/runloop'; import { computed, set } from '@ember/object'; import { inject as service } from '@ember/service'; @@ -83,7 +84,7 @@ export default Component.extend(ModalMixin, { didRender() { this._super(...arguments); - this.$('#content-linker-networklocation').removeClass('is-invalid'); + $('#content-linker-networklocation').removeClass('is-invalid'); }, willDestroyElement() { @@ -149,7 +150,7 @@ export default Component.extend(ModalMixin, { } if (_.isNull(selection)) { - if (this.get('tab4Selected')) this.$('#content-linker-networklocation').addClass('is-invalid').focus(); + if (this.get('tab4Selected')) $('#content-linker-networklocation').addClass('is-invalid').focus(); return; } diff --git a/gui/app/components/document/document-meta.js b/gui/app/components/document/document-meta.js index 225161bc..36c5d2ae 100644 --- a/gui/app/components/document/document-meta.js +++ b/gui/app/components/document/document-meta.js @@ -17,6 +17,8 @@ import Modals from '../../mixins/modal'; import Component from '@ember/component'; export default Component.extend(Modals, { + classNames: ['document-meta-wrapper', 'non-printable'], + appMeta: service(), documentService: service('document'), sessionService: service('session'), categoryService: service('category'), @@ -62,6 +64,12 @@ export default Component.extend(Modals, { if (!this.get('permissions.documentEdit')) return; this.get('router').transitionTo('document.settings', {queryParams: {tab: 'category'}}); + }, + + onSelectVersion(version) { + let space = this.get('space'); + + this.get('router').transitionTo('document', space.get('id'), space.get('slug'), version.documentId, this.get('document.slug')); } } }); diff --git a/gui/app/components/document/settings-category.js b/gui/app/components/document/settings-category.js index dd4b7dec..6c21b6cb 100644 --- a/gui/app/components/document/settings-category.js +++ b/gui/app/components/document/settings-category.js @@ -167,9 +167,9 @@ export default Component.extend(Notifier, { if (tag.length> 0) { if (!_.includes(tagzToSave, tag) && !_.startsWith(tag, '-')) { tagzToSave.push(tag); - this.$('#add-tag-field-' + t.number).removeClass('is-invalid'); + $('#add-tag-field-' + t.number).removeClass('is-invalid'); } else { - this.$('#add-tag-field-' + t.number).addClass('is-invalid'); + $('#add-tag-field-' + t.number).addClass('is-invalid'); } } }); diff --git a/gui/app/components/document/settings-tag.js b/gui/app/components/document/settings-tag.js index 35c86cd9..99ac1b31 100644 --- a/gui/app/components/document/settings-tag.js +++ b/gui/app/components/document/settings-tag.js @@ -168,9 +168,9 @@ export default Component.extend(Notifier, { if (tag.length> 0) { if (!_.includes(tagzToSave, tag) && !_.startsWith(tag, '-')) { tagzToSave.push(tag); - this.$('#add-tag-field-' + t.number).removeClass('is-invalid'); + $('#add-tag-field-' + t.number).removeClass('is-invalid'); } else { - this.$('#add-tag-field-' + t.number).addClass('is-invalid'); + $('#add-tag-field-' + t.number).addClass('is-invalid'); } } }); diff --git a/gui/app/components/document/sidebar-attachment.js b/gui/app/components/document/sidebar-attachment.js index ff5dd646..5c5cea35 100644 --- a/gui/app/components/document/sidebar-attachment.js +++ b/gui/app/components/document/sidebar-attachment.js @@ -17,7 +17,7 @@ import Notifier from '../../mixins/notifier'; import Component from '@ember/component'; export default Component.extend(Modals, Notifier, { - classNames: ["document-meta"], + classNames: ["document-meta", ' non-printable'], documentService: service('document'), browserSvc: service('browser'), appMeta: service(), diff --git a/gui/app/components/folder/settings-permissions.js b/gui/app/components/folder/settings-permissions.js index 2bd0a433..041791d5 100644 --- a/gui/app/components/folder/settings-permissions.js +++ b/gui/app/components/folder/settings-permissions.js @@ -9,6 +9,7 @@ // // https://documize.com +import $ from 'jquery'; import { inject as service } from '@ember/service'; import { A } from '@ember/array'; import { debounce } from '@ember/runloop'; @@ -152,9 +153,9 @@ export default Component.extend(Notifier, Modals, { this.set('showSpacePermExplain', !this.get('showSpacePermExplain')); if (this.showSpacePermExplain) { - this.$(".space-perms").show(); + $(".space-perms").show(); } else { - this.$(".space-perms").hide(); + $(".space-perms").hide(); } }, @@ -162,9 +163,9 @@ export default Component.extend(Notifier, Modals, { this.set('showDocumentPermExplain', !this.get('showDocumentPermExplain')); if (this.showDocumentPermExplain) { - this.$(".document-perms").show(); + $(".document-perms").show(); } else { - this.$(".document-perms").hide(); + $(".document-perms").hide(); } }, @@ -257,7 +258,7 @@ export default Component.extend(Notifier, Modals, { } if (email.length === 0) { - this.$('#space-invite-email').addClass('is-invalid').focus(); + $('#space-invite-email').addClass('is-invalid').focus(); return; } @@ -283,7 +284,7 @@ export default Component.extend(Notifier, Modals, { this.get('spaceSvc').share(this.get('folder.id'), result).then(() => { this.notifySuccess('Invites sent'); - this.$('#space-invite-email').removeClass('is-invalid'); + $('#space-invite-email').removeClass('is-invalid'); this.modalClose("#space-invite-user-modal"); this.load(); }); diff --git a/gui/app/components/layout/grid/sidebar.js b/gui/app/components/layout/grid/sidebar.js index 7ec3cbdc..30cd65f0 100644 --- a/gui/app/components/layout/grid/sidebar.js +++ b/gui/app/components/layout/grid/sidebar.js @@ -13,5 +13,5 @@ import Component from '@ember/component'; export default Component.extend({ tagName: 'div', - classNames: ['master-sidebar'], + classNames: ['master-sidebar', 'non-printable'], }); diff --git a/gui/app/styles/core/layout/layout.scss b/gui/app/styles/core/layout/layout.scss index 5a322c37..085f4141 100644 --- a/gui/app/styles/core/layout/layout.scss +++ b/gui/app/styles/core/layout/layout.scss @@ -9,14 +9,12 @@ .master-sidebar { display: block; height: auto; - width: 100%; margin: 10px; } .master-content { display: block; height: auto; - width: 100%; padding: 10px; } } @@ -52,7 +50,7 @@ grid-template-columns: 240px auto; .master-sidebar { - width: 240px; + width: 220px; } .master-content { @@ -70,7 +68,7 @@ grid-template-columns: 300px auto; .master-sidebar { - width: 300px; + width: 280px; margin: 40px 10px 40px 20px; height: calc(100vh - 90px - 80px); } diff --git a/gui/app/styles/core/view/document/meta.scss b/gui/app/styles/core/view/document/meta.scss index dd1ee392..14bab8dd 100644 --- a/gui/app/styles/core/view/document/meta.scss +++ b/gui/app/styles/core/view/document/meta.scss @@ -1,3 +1,9 @@ +.document-meta-wrapper { + padding: 20px 20px 0 20px; + @include border-radius(7px); + background-color: map-get($gray-shades, 100); +} + .document-meta { margin: 0; padding: 0; @@ -147,12 +153,12 @@ @include border-radius(3px); @extend .no-select; display: inline-block; - margin: 5px 5px 5px 0; + margin: 5px 0 5px 0; padding: 0.3rem 0.7rem; font-size: 1.1rem; font-weight: 500; - background-color: map-get($yellow-shades, 100); - color: map-get($gray-shades, 700); + background-color: map-get($gray-shades, 800); + color: map-get($gray-shades, 100); text-transform: uppercase; } @@ -165,6 +171,7 @@ > .document-heading { .name { + margin: 1.5rem 0 0.5rem 0; color: map-get($gray-shades, 900); font-size: 2.2rem; font-weight: 700; @@ -177,7 +184,7 @@ } > .dates { - margin-bottom: 2rem; + margin-bottom: 3rem; font-size: 1rem; font-weight: 300; font-style: italic; diff --git a/gui/app/templates/components/document/document-meta.hbs b/gui/app/templates/components/document/document-meta.hbs index d434cce0..3ee2afe7 100644 --- a/gui/app/templates/components/document/document-meta.hbs +++ b/gui/app/templates/components/document/document-meta.hbs @@ -1,4 +1,4 @@ -
+
STATUS