diff --git a/README.md b/README.md index c4b6c3f6..dfb31408 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The mission is to bring software dev inspired features (refactoring, testing, li ## Latest version -v0.31.0 +v0.32.0 ## OS Support diff --git a/app/app/components/document/document-meta.js b/app/app/components/document/document-meta.js deleted file mode 100644 index 97c8ef74..00000000 --- a/app/app/components/document/document-meta.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2016 Documize Inc. . All rights reserved. -// -// This software (Documize Community Edition) is licensed under -// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html -// -// You can operate outside the AGPL restrictions by purchasing -// Documize Enterprise Edition and obtaining a commercial license -// by contacting . -// -// https://documize.com - -import Ember from 'ember'; -import NotifierMixin from '../../mixins/notifier'; -import TooltipMixin from '../../mixins/tooltip'; - -export default Ember.Component.extend(NotifierMixin, TooltipMixin, { - appMeta: Ember.inject.service(), - - didReceiveAttrs() { - // setup document owner - let owner = this.get('users').findBy('id', this.get('document.userId')); - - // no document owner? You are the owner! - if (is.undefined(owner)) { - owner = this.session.user; - } - - this.set('owner', owner); - }, - - actions: { - onSave() { - let doc = this.get('document'); - - if (is.empty(doc.get('excerpt'))) { - $("meta-excerpt").addClass("error").focus(); - return false; - } - - doc.set('excerpt', doc.get('excerpt').substring(0, 250)); - doc.set('userId', this.get('owner.id')); - - this.attrs.onSave(doc); - return true; - }, - } -}); diff --git a/app/app/components/document/document-toolbar.js b/app/app/components/document/document-toolbar.js index a9a24c86..baa3bc19 100644 --- a/app/app/components/document/document-toolbar.js +++ b/app/app/components/document/document-toolbar.js @@ -71,6 +71,25 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, { this.attrs.onSaveTemplate(name, excerpt); return true; - } + }, + + saveMeta() { + let doc = this.get('document'); + + if (is.empty(doc.get('name'))) { + $("#meta-name").addClass("error").focus(); + return false; + } + + if (is.empty(doc.get('excerpt'))) { + $("#meta-excerpt").addClass("error").focus(); + return false; + } + + doc.set('excerpt', doc.get('excerpt').substring(0, 250)); + + this.attrs.onSaveMeta(doc); + return true; + }, } -}); \ No newline at end of file +}); diff --git a/app/app/components/ui/ui-checkbox.js b/app/app/components/ui/ui-checkbox.js index 16c8597b..dc7285ce 100644 --- a/app/app/components/ui/ui-checkbox.js +++ b/app/app/components/ui/ui-checkbox.js @@ -12,5 +12,11 @@ import Ember from 'ember'; export default Ember.Component.extend({ - tagName: 'span' + tagName: 'span', + + actions: { + onCheck() { + this.set('selected', !this.get('selected')); + } + } }); diff --git a/app/app/helpers/time-ago.js b/app/app/helpers/time-ago.js index e44fee70..5c23b048 100644 --- a/app/app/helpers/time-ago.js +++ b/app/app/helpers/time-ago.js @@ -1,11 +1,11 @@ // Copyright 2016 Documize Inc. . All rights reserved. // -// This software (Documize Community Edition) is licensed under +// This software (Documize Community Edition) is licensed under // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html // // You can operate outside the AGPL restrictions by purchasing // Documize Enterprise Edition and obtaining a commercial license -// by contacting . +// by contacting . // // https://documize.com @@ -14,7 +14,13 @@ import dateUtil from '../utils/date'; // {{time-ago createdAt}} export function timeAgo(params) { - return dateUtil.timeAgo(params[0]); + let d = dateUtil.timeAgo(params[0]); + + if (d === 'Invalid date'){ + d = ''; + } + + return d; } -export default Ember.Helper.helper(timeAgo); \ No newline at end of file +export default Ember.Helper.helper(timeAgo); diff --git a/app/app/pods/customize/users/controller.js b/app/app/pods/customize/users/controller.js index 7dddaad0..5117c04f 100644 --- a/app/app/pods/customize/users/controller.js +++ b/app/app/pods/customize/users/controller.js @@ -55,7 +55,7 @@ export default Ember.Controller.extend(NotifierMixin, { }, onPassword(user, password) { - this.get('userService').updatePassword(user.get('id'), password); + this.get('userService').updatePassword(user.id, password); this.showNotification('Password changed'); } } diff --git a/app/app/pods/document/controller.js b/app/app/pods/document/controller.js index 5b9cd1c0..0a5b840b 100644 --- a/app/app/pods/document/controller.js +++ b/app/app/pods/document/controller.js @@ -92,6 +92,12 @@ export default Ember.Controller.extend(NotifierMixin, { this.get('templateService').saveAsTemplate(this.get('model.document.id'), name, desc).then(function () {}); }, + onSaveMeta(doc) { + this.get('documentService').save(doc).then(() => { + this.transitionToRoute('document.index'); + }); + }, + onAddSection(section) { this.audit.record("added-section-" + section.get('contentType')); diff --git a/app/app/pods/document/meta/controller.js b/app/app/pods/document/meta/controller.js deleted file mode 100644 index e2bc184f..00000000 --- a/app/app/pods/document/meta/controller.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 Documize Inc. . All rights reserved. -// -// This software (Documize Community Edition) is licensed under -// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html -// -// You can operate outside the AGPL restrictions by purchasing -// Documize Enterprise Edition and obtaining a commercial license -// by contacting . -// -// https://documize.com - -import Ember from 'ember'; - -export default Ember.Controller.extend({ - documentService: Ember.inject.service('document'), - - actions: { - onSave(doc) { - this.get('documentService').save(doc).then(() => { - this.transitionToRoute('document.index'); - }); - } - } -}); diff --git a/app/app/pods/document/meta/route.js b/app/app/pods/document/meta/route.js deleted file mode 100644 index 887acd57..00000000 --- a/app/app/pods/document/meta/route.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 Documize Inc. . All rights reserved. -// -// This software (Documize Community Edition) is licensed under -// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html -// -// You can operate outside the AGPL restrictions by purchasing -// Documize Enterprise Edition and obtaining a commercial license -// by contacting . -// -// https://documize.com - -import Ember from 'ember'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; - -export default Ember.Route.extend(AuthenticatedRouteMixin, { - userService: Ember.inject.service('user'), - - model() { - this.audit.record("viewed-document-meta"); - - let folderId = this.modelFor('document').folder.get('id'); - - return Ember.RSVP.hash({ - folders: this.modelFor('document').folders, - folder: this.modelFor('document').folder, - document: this.modelFor('document').document, - isEditor: this.modelFor('document').isEditor, - pages: this.modelFor('document').allPages, - tabs: this.modelFor('document').tabs, - users: this.get('userService').getFolderUsers(folderId) - }); - } -}); diff --git a/app/app/pods/document/meta/template.hbs b/app/app/pods/document/meta/template.hbs deleted file mode 100644 index 39185e1a..00000000 --- a/app/app/pods/document/meta/template.hbs +++ /dev/null @@ -1 +0,0 @@ -{{document/document-meta document=model.document folders=model.folders folder=model.folder users=model.users isEditor=model.isEditor onSave=(action 'onSave')}} diff --git a/app/app/pods/document/route.js b/app/app/pods/document/route.js index e6958063..21731130 100644 --- a/app/app/pods/document/route.js +++ b/app/app/pods/document/route.js @@ -23,20 +23,24 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { this.set('documentId', this.paramsFor('document').document_id); return new Ember.RSVP.Promise((resolve) => { - this.get('folderService').getAll().then((folders) => { - this.set('folders', folders); + this.get('documentService').getDocument(this.get('documentId')).then((document) => { + this.set('document', document); - this.get('folderService').getFolder(this.get('folderId')).then((folder) => { - this.set('folder', folder); + this.get('folderService').getAll().then((folders) => { + this.set('folders', folders); - this.get('folderService').setCurrentFolder(folder).then(() => { - this.set('isEditor', this.get('folderService').get('canEditCurrentFolder')); + this.get('folderService').getFolder(this.get('folderId')).then((folder) => { + this.set('folder', folder); - this.get('documentService').getPages(this.get('documentId')).then((pages) => { - this.set('allPages', pages); - this.set('pages', pages.filterBy('pageType', 'section')); - this.set('tabs', pages.filterBy('pageType', 'tab')); - resolve(); + this.get('folderService').setCurrentFolder(folder).then(() => { + this.set('isEditor', this.get('folderService').get('canEditCurrentFolder')); + + this.get('documentService').getPages(this.get('documentId')).then((pages) => { + this.set('allPages', pages); + this.set('pages', pages.filterBy('pageType', 'section')); + this.set('tabs', pages.filterBy('pageType', 'tab')); + resolve(); + }); }); }); }); @@ -48,9 +52,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { return Ember.RSVP.hash({ folders: this.get('folders'), folder: this.get('folder'), - document: this.get('documentService').getDocument(this.get('documentId')).then((document) => { - return document; - }), + document: this.get('document'), page: this.get('pageId'), isEditor: this.get('isEditor'), allPages: this.get('allPages'), @@ -65,7 +67,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { actions: { error(error /*, transition*/ ) { console.log(error); - console.log(error.stack); + if (error) { this.transitionTo('/not-found'); return false; diff --git a/app/app/pods/document/template.hbs b/app/app/pods/document/template.hbs index 765707c3..233afefe 100644 --- a/app/app/pods/document/template.hbs +++ b/app/app/pods/document/template.hbs @@ -7,7 +7,7 @@ {{#layout/zone-content}} {{document/document-toolbar document=model.document pages=model.pages tabs=model.tabs folder=model.folder isEditor=model.isEditor - onSaveTemplate=(action 'onSaveTemplate') onDocumentDelete=(action 'onDocumentDelete')}} + onSaveTemplate=(action 'onSaveTemplate') onSaveMeta=(action 'onSaveMeta') onDocumentDelete=(action 'onDocumentDelete')}} {{outlet}} {{/layout/zone-content}} diff --git a/app/app/router.js b/app/app/router.js index e40cb45a..2b756e84 100644 --- a/app/app/router.js +++ b/app/app/router.js @@ -35,9 +35,6 @@ export default Router.map(function () { this.route('files', { path: 'files' }); - this.route('meta', { - path: 'meta' - }); this.route('activity', { path: 'activity' }); diff --git a/app/app/services/document.js b/app/app/services/document.js index 8ee4020e..53dc4450 100644 --- a/app/app/services/document.js +++ b/app/app/services/document.js @@ -27,6 +27,9 @@ export default Ember.Service.extend({ }).then((response) => { let data = this.get('store').normalize('document', response); return this.get('store').push(data); + }).catch((error) => { + this.get('router').transitionTo('/not-found'); + return error; }); }, diff --git a/app/app/styles/widget/widget-avatar.scss b/app/app/styles/widget/widget-avatar.scss index e09dc5d2..c6999fad 100644 --- a/app/app/styles/widget/widget-avatar.scss +++ b/app/app/styles/widget/widget-avatar.scss @@ -2,18 +2,19 @@ color: $color-white; background-color: $color-gray; @include border-radius(20px); + @include ease-in(); padding: 7px 0 0 0; letter-spacing: 1px; text-align: center; height: 35px; width: 35px; - cursor: crosshair; } .avatar-large { color: $color-white; background-color: $color-gray; @include border-radius(100px); + @include ease-in(); height: 100px; width: 100px; font-size: 30px; @@ -21,5 +22,36 @@ letter-spacing: 1px; text-align: center; margin: 0 auto; - cursor: crosshair; +} + +.avatar-picker { + background-color: $color-off-white; + @include border-radius(20px); + @include ease-in(); + padding: 7px 0 0 0; + letter-spacing: 1px; + text-align: center; + height: 35px; + width: 35px; + cursor: pointer; + + &:hover { + > i { + color: $color-link; + } + } + + > i { + color: $color-gray; + font-size: 1.4rem; + @include ease-in(); + } +} + +.avatar-remover { + &:hover { + color: $color-white; + background-color: $color-red; + cursor: pointer; + } } diff --git a/app/app/styles/widget/widget-checkbox.scss b/app/app/styles/widget/widget-checkbox.scss index f5244023..1088f7c8 100644 --- a/app/app/styles/widget/widget-checkbox.scss +++ b/app/app/styles/widget/widget-checkbox.scss @@ -1,21 +1,27 @@ -.checkbox-option { +.ui-checkbox { vertical-align: bottom; cursor: pointer; - font-size: 0.9rem; + font-size: 1.1rem; overflow: hidden; white-space: nowrap; + margin: 0 0 5px 0; > .material-icons { - font-size: 0.9rem; + font-size: 1.4rem; + color: $color-gray; vertical-align: top; margin-right: 5px; } + > .selected { + color: $color-link; + } + &:hover { color: $color-link; } } -.checkbox-option-selected { +.ui-checkbox-selected { color: $color-link; } diff --git a/app/app/templates/components/document/document-meta.hbs b/app/app/templates/components/document/document-meta.hbs deleted file mode 100644 index 8dce0284..00000000 --- a/app/app/templates/components/document/document-meta.hbs +++ /dev/null @@ -1,27 +0,0 @@ -
-
-
Meta Information
-
Name, owner, excerpt
-
-
- -
Set the document owner
- {{ui-select id="document-owner" - content=users - action=(action (mut owner)) - optionValuePath="id" - optionLabelPath="fullname" - selection=owner}} -
-
- -
Short title for this document
- {{focus-input type='text' id="document-name" value=document.name}} -
-
- -
Provide short summary of the document (max. 250)
- {{textarea value=document.excerpt rows="5" id="meta-excerpt"}} -
-
Save
-
diff --git a/app/app/templates/components/document/document-toolbar.hbs b/app/app/templates/components/document/document-toolbar.hbs index 367917f8..aa7e769f 100644 --- a/app/app/templates/components/document/document-toolbar.hbs +++ b/app/app/templates/components/document/document-toolbar.hbs @@ -7,11 +7,6 @@
  • {{#link-to 'document.files'}}Files{{/link-to}}
  • - {{#if isEditor}} -
  • - {{#link-to 'document.meta'}}Meta{{/link-to}} -
  • - {{/if}} {{#if session.authenticated}}
  • {{#link-to 'document.activity'}}Activity{{/link-to}} @@ -35,6 +30,7 @@
      {{#if isEditor}} +
    • settings
    • content_copy
    • {{/if}}
    • more_horiz
    • @@ -44,7 +40,6 @@