mirror of
https://github.com/documize/community.git
synced 2025-08-05 05:25:27 +02:00
new start document UX
This commit is contained in:
parent
5bfd3bb247
commit
2ea782aaed
15 changed files with 289 additions and 279 deletions
|
@ -12,20 +12,40 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
folderService: Ember.inject.service('folder'),
|
||||
selectedDocuments: [],
|
||||
moveTarget: null,
|
||||
|
||||
emptyState: Ember.computed('documents', function() {
|
||||
return this.get('documents.length') === 0;
|
||||
}),
|
||||
|
||||
didReceiveAttrs() {
|
||||
this.set('selectedDocuments', []);
|
||||
this.audit.record('viewed-space');
|
||||
|
||||
this.set('selectedDocuments', []);
|
||||
this.set('canCreate', this.get('folderService').get('canEditCurrentFolder'));
|
||||
this.set('deleteTargets', this.get('folders').rejectBy('id', this.get('folder.id')));
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.setupAddWizard();
|
||||
},
|
||||
|
||||
setupAddWizard() {
|
||||
Ember.run.schedule('afterRender', () => {
|
||||
$('.start-document:not(.start-document-empty-state)').off('.hoverIntent');
|
||||
|
||||
$('.start-document:not(.start-document-empty-state)').hoverIntent({interval: 100, over: function() {
|
||||
// in
|
||||
$(this).find('.start-button').velocity("transition.slideDownIn", {duration: 300});
|
||||
}, out: function() {
|
||||
// out
|
||||
$(this).find('.start-button').velocity("transition.slideUpOut", {duration: 300});
|
||||
} });
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
selectDocument(documentId) {
|
||||
let doc = this.get('documents').findBy('id', documentId);
|
||||
|
@ -48,6 +68,30 @@ export default Ember.Component.extend({
|
|||
|
||||
onDelete() {
|
||||
this.get("onDeleteSpace")();
|
||||
}
|
||||
},
|
||||
|
||||
onImport() {
|
||||
this.get('onImport')();
|
||||
},
|
||||
|
||||
onShowDocumentWizard(docId) {
|
||||
if ($("#new-document-wizard").is(':visible') && this.get('docId') === docId) {
|
||||
this.send('onHideDocumentWizard');
|
||||
return;
|
||||
}
|
||||
|
||||
this.set('docId', docId);
|
||||
|
||||
$("#new-document-wizard").insertAfter(`#document-${docId}`);
|
||||
$("#new-document-wizard").velocity("transition.slideDownIn", { duration: 300, complete:
|
||||
function() {
|
||||
$("#new-document-name").focus();
|
||||
}});
|
||||
},
|
||||
|
||||
onHideDocumentWizard() {
|
||||
$("#new-document-wizard").insertAfter('#wizard-placeholder');
|
||||
$("#new-document-wizard").velocity("transition.slideUpOut", { duration: 300 });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. 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 <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthMixin from '../../mixins/auth';
|
||||
|
||||
const {
|
||||
inject: { service }
|
||||
} = Ember;
|
||||
|
||||
export default Ember.Component.extend(AuthMixin, {
|
||||
folderService: service('folder'),
|
||||
appMeta: service(),
|
||||
users: [],
|
||||
folders: [],
|
||||
folder: {},
|
||||
moveTarget: null,
|
||||
inviteEmail: "",
|
||||
inviteMessage: "",
|
||||
roleMessage: "",
|
||||
permissions: {},
|
||||
|
||||
getDefaultInvitationMessage() {
|
||||
return "Hey there, I am sharing the " + this.folder.get('name') + " (in " + this.get("appMeta.title") + ") with you so we can both access the same documents.";
|
||||
},
|
||||
|
||||
willRender() {
|
||||
if (this.roleMessage.length === 0) {
|
||||
this.set('roleMessage', this.getDefaultInvitationMessage());
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
}
|
||||
});
|
|
@ -24,33 +24,6 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, AuthMixin, {
|
|||
hasPrivateFolders: false,
|
||||
newFolder: '',
|
||||
|
||||
// init() {
|
||||
// this._super(...arguments);
|
||||
|
||||
// if (this.get('noFolder')) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// let _this = this;
|
||||
// this.get('templateService').getSavedTemplates().then(function(saved) {
|
||||
// let emptyTemplate = {
|
||||
// id: "0",
|
||||
// title: "Empty",
|
||||
// description: "An empty canvas for your words",
|
||||
// img: "insert_drive_file",
|
||||
// layout: "doc",
|
||||
// locked: true
|
||||
// };
|
||||
|
||||
// saved.forEach(function(t) {
|
||||
// Ember.set(t, 'img', 'content_copy');
|
||||
// });
|
||||
|
||||
// saved.unshiftObject(emptyTemplate);
|
||||
// _this.set('savedTemplates', saved);
|
||||
// });
|
||||
// },
|
||||
|
||||
didReceiveAttrs() {
|
||||
let folders = this.get('folders');
|
||||
|
||||
|
@ -83,10 +56,6 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, AuthMixin, {
|
|||
},
|
||||
|
||||
actions: {
|
||||
// onImport() {
|
||||
// this.attrs.onImport();
|
||||
// },
|
||||
|
||||
addFolder() {
|
||||
var folderName = this.get('newFolder');
|
||||
|
||||
|
@ -99,30 +68,6 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, AuthMixin, {
|
|||
|
||||
this.set('newFolder', '');
|
||||
return true;
|
||||
},
|
||||
|
||||
// showDocument() {
|
||||
// this.set('showingDocument', true);
|
||||
// this.set('showingList', false);
|
||||
// },
|
||||
|
||||
// showList() {
|
||||
// this.set('showingDocument', false);
|
||||
// this.set('showingList', true);
|
||||
// },
|
||||
|
||||
// onEditTemplate(template) {
|
||||
// this.navigateToDocument(template);
|
||||
// },
|
||||
|
||||
// onDocumentTemplate(id /*, title, type*/ ) {
|
||||
// let self = this;
|
||||
|
||||
// this.send("showNotification", "Creating");
|
||||
|
||||
// this.get('templateService').importSavedTemplate(this.folder.get('id'), id).then(function(document) {
|
||||
// self.navigateToDocument(document);
|
||||
// });
|
||||
// },
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -46,33 +46,6 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, AuthMixin, {
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
// this._super(...arguments);
|
||||
|
||||
// if (this.get('noFolder')) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// let _this = this;
|
||||
// this.get('templateService').getSavedTemplates().then(function(saved) {
|
||||
// let emptyTemplate = {
|
||||
// id: "0",
|
||||
// title: "Empty",
|
||||
// description: "An empty canvas for your words",
|
||||
// img: "insert_drive_file",
|
||||
// layout: "doc",
|
||||
// locked: true
|
||||
// };
|
||||
|
||||
// saved.forEach(function(t) {
|
||||
// Ember.set(t, 'img', 'content_copy');
|
||||
// });
|
||||
|
||||
// saved.unshiftObject(emptyTemplate);
|
||||
// _this.set('savedTemplates', saved);
|
||||
// });
|
||||
// },
|
||||
|
||||
didReceiveAttrs() {
|
||||
if (!this.get('noFolder')) {
|
||||
let folder = this.get('folder');
|
||||
|
@ -82,34 +55,12 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, AuthMixin, {
|
|||
}
|
||||
},
|
||||
|
||||
// navigateToDocument(document) {
|
||||
// this.attrs.showDocument(this.get('folder'), document);
|
||||
// },
|
||||
|
||||
actions: {
|
||||
// onImport() {
|
||||
// this.attrs.onImport();
|
||||
// },
|
||||
|
||||
onFolderAdd(folderName) {
|
||||
this.attrs.onFolderAdd(folderName);
|
||||
return true;
|
||||
},
|
||||
|
||||
// onEditTemplate(template) {
|
||||
// this.navigateToDocument(template);
|
||||
// },
|
||||
|
||||
// onDocumentTemplate(id /*, title, type*/ ) {
|
||||
// let self = this;
|
||||
|
||||
// this.send("showNotification", "Creating");
|
||||
|
||||
// this.get('templateService').importSavedTemplate(this.folder.get('id'), id).then(function(document) {
|
||||
// self.navigateToDocument(document);
|
||||
// });
|
||||
// },
|
||||
|
||||
onChangeTab(tab) {
|
||||
this.set('tab', tab);
|
||||
},
|
||||
|
|
|
@ -12,13 +12,37 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
|
||||
|
||||
const {
|
||||
computed,
|
||||
} = Ember;
|
||||
export default Ember.Component.extend(NotifierMixin, {
|
||||
localStorage: Ember.inject.service(),
|
||||
appMeta: Ember.inject.service(),
|
||||
|
||||
templateService: Ember.inject.service('template'),
|
||||
canEditTemplate: "",
|
||||
importedDocuments: [],
|
||||
savedTemplates: [],
|
||||
drop: null,
|
||||
newDocumentName: 'New Document',
|
||||
newDocumentNameMissing: computed.empty('newDocumentName'),
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.get('templateService').getSavedTemplates().then((saved) => {
|
||||
let emptyTemplate = {
|
||||
id: "0",
|
||||
title: "Empty",
|
||||
description: "An empty canvas for your words",
|
||||
layout: "doc",
|
||||
locked: true
|
||||
};
|
||||
|
||||
saved.unshiftObject(emptyTemplate);
|
||||
this.set('savedTemplates', saved);
|
||||
});
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this.setupImport();
|
||||
|
@ -84,8 +108,31 @@ export default Ember.Component.extend(NotifierMixin, {
|
|||
},
|
||||
|
||||
actions: {
|
||||
onHideDocumentWizard() {
|
||||
this.get('onHideDocumentWizard')();
|
||||
},
|
||||
|
||||
editTemplate(template) {
|
||||
this.audit.record('edited-saved-template');
|
||||
this.get('router').transitionTo('document', this.get('folder.id'), this.get('folder.slug'), template.get('id'), template.get('slug'));
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
startDocument(template) {
|
||||
this.audit.record('used-saved-template');
|
||||
this.send("showNotification", "Creating");
|
||||
|
||||
this.get('templateService').importSavedTemplate(this.folder.get('id'), template.id).then((document) => {
|
||||
this.get('router').transitionTo('document', this.get('folder.id'), this.get('folder.slug'), document.get('id'), document.get('slug'));
|
||||
});
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
onDocumentImporting(filename) {
|
||||
this.send("showNotification", `Importing ${filename}`);
|
||||
this.get('onHideDocumentWizard')();
|
||||
|
||||
let documents = this.get('importedDocuments');
|
||||
documents.push(filename);
|
||||
|
@ -99,25 +146,12 @@ export default Ember.Component.extend(NotifierMixin, {
|
|||
documents.pop(filename);
|
||||
this.set('importedDocuments', documents);
|
||||
|
||||
this.attrs.onImport();
|
||||
this.get('onImport')();
|
||||
|
||||
if (documents.length === 0) {
|
||||
// this.get('showDocument')(this.get('folder'), document);
|
||||
}
|
||||
},
|
||||
|
||||
editTemplate(template) {
|
||||
this.audit.record('edited-saved-template');
|
||||
this.attrs.onEditTemplate(template);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
startDocument(template) {
|
||||
this.audit.record('used-saved-template');
|
||||
this.attrs.onDocumentTemplate(template.id, template.title, "private");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue