Refactoring create new file: show "create new" when templates are available in config
This commit is contained in:
parent
2b81097012
commit
704c5a6a00
|
@ -373,7 +373,7 @@ define([
|
|||
this.appOptions.user.anonymous && Common.localStorage.setItem("guest-id", this.appOptions.user.id);
|
||||
|
||||
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl) || this.editorConfig.templates && this.editorConfig.templates.length;
|
||||
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
|
||||
this.appOptions.templates = this.editorConfig.templates;
|
||||
this.appOptions.recent = this.editorConfig.recent;
|
||||
|
|
|
@ -389,7 +389,7 @@ define([
|
|||
if ( this.mode.canCreateNew ) {
|
||||
if (this.mode.templates && this.mode.templates.length) {
|
||||
$('a',this.miNew.$el).text(this.btnCreateNewCaption + '...');
|
||||
!this.panels['new'] && (this.panels['new'] = ((new DE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render()));
|
||||
!this.panels['new'] && (this.panels['new'] = ((new DE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates, blank: this.mode.canRequestCreateNew || !!this.mode.createUrl})).render()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -869,12 +869,14 @@ define([
|
|||
template: _.template([
|
||||
'<h3 style="margin-top: 20px;"><%= scope.txtCreateNew %></h3>',
|
||||
'<div class="thumb-list">',
|
||||
'<% if (blank) { %> ',
|
||||
'<div class="blank-document">',
|
||||
'<div class="blank-document-btn">',
|
||||
'<svg class="btn-blank-format"><use xlink:href="#svg-format-blank"></use></svg>',
|
||||
'</div>',
|
||||
'<div class="title"><%= scope.txtBlank %></div>',
|
||||
'</div>',
|
||||
'<% } %>',
|
||||
'<% _.each(docs, function(item, index) { %>',
|
||||
'<div class="thumb-wrap" template="<%= item.url %>">',
|
||||
'<div class="thumb" ',
|
||||
|
@ -894,14 +896,17 @@ define([
|
|||
Common.UI.BaseView.prototype.initialize.call(this,arguments);
|
||||
|
||||
this.menu = options.menu;
|
||||
this.docs = options.docs;
|
||||
this.blank = !!options.blank;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template({
|
||||
scope: this,
|
||||
docs: this.options[0].docs
|
||||
docs: this.docs,
|
||||
blank: this.blank
|
||||
}));
|
||||
var docs=[{title: this.txtBlank}].concat(this.options[0].docs);
|
||||
var docs = (this.blank ? [{title: this.txtBlank}] : []).concat(this.docs);
|
||||
var thumbsElm= this.$el.find('.thumb-wrap, .blank-document');
|
||||
_.each(thumbsElm, function (tmb, index){
|
||||
$(tmb).find('.title').tooltip({
|
||||
|
|
|
@ -333,7 +333,7 @@ define([
|
|||
this.appOptions.user.anonymous && Common.localStorage.setItem("guest-id", this.appOptions.user.id);
|
||||
|
||||
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl) || this.editorConfig.templates && this.editorConfig.templates.length;
|
||||
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
|
||||
this.appOptions.templates = this.editorConfig.templates;
|
||||
this.appOptions.recent = this.editorConfig.recent;
|
||||
|
|
|
@ -388,7 +388,7 @@ define([
|
|||
if ( this.mode.canCreateNew ) {
|
||||
if (this.mode.templates && this.mode.templates.length) {
|
||||
$('a',this.miNew.$el).text(this.btnCreateNewCaption + '...');
|
||||
!this.panels['new'] && (this.panels['new'] = (new PE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render());
|
||||
!this.panels['new'] && (this.panels['new'] = (new PE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates, blank: this.mode.canRequestCreateNew || !!this.mode.createUrl})).render());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -767,12 +767,14 @@ define([
|
|||
template: _.template([
|
||||
'<h3 style="margin-top: 20px;"><%= scope.txtCreateNew %></h3>',
|
||||
'<div class="thumb-list">',
|
||||
'<% if (blank) { %> ',
|
||||
'<div class="blank-document">',
|
||||
'<div class="blank-document-btn">',
|
||||
'<svg class="btn-blank-format"><use xlink:href="#svg-format-blank"></use></svg>',
|
||||
'</div>',
|
||||
'<div class="title"><%= scope.txtBlank %></div>',
|
||||
'</div>',
|
||||
'<% } %>',
|
||||
'<% _.each(docs, function(item, index) { %>',
|
||||
'<div class="thumb-wrap" template="<%= item.url %>">',
|
||||
'<div class="thumb" ',
|
||||
|
@ -792,14 +794,17 @@ define([
|
|||
Common.UI.BaseView.prototype.initialize.call(this,arguments);
|
||||
|
||||
this.menu = options.menu;
|
||||
this.docs = options.docs;
|
||||
this.blank = !!options.blank;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template({
|
||||
scope: this,
|
||||
docs: this.options[0].docs
|
||||
docs: this.docs,
|
||||
blank: this.blank
|
||||
}));
|
||||
var docs=[{title: this.txtBlank}].concat(this.options[0].docs);
|
||||
var docs = (this.blank ? [{title: this.txtBlank}] : []).concat(this.docs);
|
||||
var thumbsElm= this.$el.find('.thumb-wrap, .blank-document');
|
||||
_.each(thumbsElm, function (tmb, index){
|
||||
$(tmb).find('.title').tooltip({
|
||||
|
|
|
@ -372,7 +372,7 @@ define([
|
|||
this.appOptions.user.anonymous && Common.localStorage.setItem("guest-id", this.appOptions.user.id);
|
||||
|
||||
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl) || this.editorConfig.templates && this.editorConfig.templates.length;
|
||||
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
|
||||
this.appOptions.templates = this.editorConfig.templates;
|
||||
this.appOptions.recent = this.editorConfig.recent;
|
||||
|
|
|
@ -374,7 +374,7 @@ define([
|
|||
if ( this.mode.canCreateNew ) {
|
||||
if (this.mode.templates && this.mode.templates.length) {
|
||||
$('a',this.miNew.$el).text(this.btnCreateNewCaption + '...');
|
||||
!this.panels['new'] && (this.panels['new'] = (new SSE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render());
|
||||
!this.panels['new'] && (this.panels['new'] = (new SSE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates, blank: this.mode.canRequestCreateNew || !!this.mode.createUrl})).render());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1734,12 +1734,14 @@ define([
|
|||
template: _.template([
|
||||
'<h3 style="margin-top: 20px;"><%= scope.txtCreateNew %></h3>',
|
||||
'<div class="thumb-list">',
|
||||
'<% if (blank) { %> ',
|
||||
'<div class="blank-document">',
|
||||
'<div class="blank-document-btn">',
|
||||
'<svg class="btn-blank-format"><use xlink:href="#svg-format-blank"></use></svg>',
|
||||
'</div>',
|
||||
'<div class="title"><%= scope.txtBlank %></div>',
|
||||
'</div>',
|
||||
'<% } %>',
|
||||
'<% _.each(docs, function(item, index) { %>',
|
||||
'<div class="thumb-wrap" template="<%= item.url %>">',
|
||||
'<div class="thumb" ',
|
||||
|
@ -1759,14 +1761,17 @@ define([
|
|||
Common.UI.BaseView.prototype.initialize.call(this,arguments);
|
||||
|
||||
this.menu = options.menu;
|
||||
this.docs = options.docs;
|
||||
this.blank = !!options.blank;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template({
|
||||
scope: this,
|
||||
docs: this.options[0].docs
|
||||
docs: this.docs,
|
||||
blank: this.blank
|
||||
}));
|
||||
var docs=[{title: this.txtBlank}].concat(this.options[0].docs);
|
||||
var docs = (this.blank ? [{title: this.txtBlank}] : []).concat(this.docs);
|
||||
var thumbsElm= this.$el.find('.thumb-wrap, .blank-document');
|
||||
_.each(thumbsElm, function (tmb, index){
|
||||
$(tmb).find('.title').tooltip({
|
||||
|
|
Loading…
Reference in a new issue