1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-04 21:15:24 +02:00

use specified doc name when creating from template

This commit is contained in:
Harvey Kandola 2017-04-04 19:11:59 +01:00
parent 96e4b2058c
commit bc630e1e51
5 changed files with 24 additions and 11 deletions

View file

@ -49,7 +49,11 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.set('document.name', this.get('docName'));
this.set('document.excerpt', this.get('docExcerpt'));
this.showNotification('Saved');
this.get('browser').setTitle(this.get('document.name'));
this.get('browser').setMetaDescription(this.get('document.excerpt'));
this.get('documentService').save(this.get('document'));
this.set('editMode', false);

View file

@ -123,7 +123,7 @@ export default Ember.Component.extend(NotifierMixin, {
this.audit.record('used-saved-template');
this.send("showNotification", "Creating");
this.get('templateService').importSavedTemplate(this.folder.get('id'), template.id).then((document) => {
this.get('templateService').importSavedTemplate(this.folder.get('id'), template.id, this.get('newDocumentName')).then((document) => {
this.get('router').transitionTo('document', this.get('folder.id'), this.get('folder.slug'), document.get('id'), document.get('slug'));
});

View file

@ -28,12 +28,15 @@ export default Ember.Service.extend({
});
},
importSavedTemplate: function (folderId, templateId) {
importSavedTemplate: function (folderId, templateId, docName) {
let url = `templates/${templateId}/folder/${folderId}?type=saved`;
return this.get('ajax').post(url).then((doc) => {
return this.get('ajax').request(url, {
method: 'POST',
data: docName
}).then((doc) => {
let data = this.get('store').normalize('document', doc);
return this.get('store').push(data);
return this.get('store').push(data);
});
},

View file

@ -148,5 +148,5 @@
font-size: 15px;
line-height: 25px;
color: $color-black;
}
}
}