mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-24 20:47:06 +08:00
Refactoring windows
This commit is contained in:
@ -178,9 +178,9 @@ define([
|
||||
'<div class="body"><%= tpl %>' +
|
||||
'<% if (typeof (buttons) !== "undefined" && _.size(buttons) > 0) { %>' +
|
||||
'<div class="footer">' +
|
||||
'<% for(var bt in buttons) { %>' +
|
||||
'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>" <% if (buttons[bt].id) { %>id="<%=buttons[bt].id%>" <% } %> ><%= buttons[bt].text %></button>'+
|
||||
'<% } %>' +
|
||||
'<% _.each(buttons, function (item) { %>' +
|
||||
'<button class="btn normal dlg-btn <%= item.cls %>" result="<%= item.value %>" <% if (item.id) { %>id="<%=item.id%>" <% } %> ><%= item.text %></button>'+
|
||||
'<% }); %>' +
|
||||
'</div>' +
|
||||
'<% } %>' +
|
||||
'</div>' +
|
||||
@ -626,15 +626,16 @@ define([
|
||||
if (options.buttons && _.isArray(options.buttons)) {
|
||||
if (options.primary==undefined)
|
||||
options.primary = 'ok';
|
||||
var newBtns = {};
|
||||
var newBtns = [];
|
||||
_.each(options.buttons, function(b){
|
||||
if (typeof(b) == 'object') {
|
||||
if (b.value !== undefined) {
|
||||
newBtns[b.value] = {text: b.caption, cls: 'auto' + ((b.primary || options.primary==b.value) ? ' primary' : '')};
|
||||
b.id && (newBtns[b.value].id = b.id);
|
||||
var item = {value: b.value, text: b.caption, cls: 'auto' + ((b.primary || options.primary==b.value) ? ' primary' : '')};
|
||||
b.id && (item.id = b.id);
|
||||
newBtns.push(item);
|
||||
}
|
||||
} else if (b!==undefined) {
|
||||
newBtns[b] = {text: arrBtns[b], cls: (options.primary==b || _.indexOf(options.primary, b)>-1) ? 'primary' : ''};
|
||||
newBtns.push({value: b, text: arrBtns[b], cls: (options.primary==b || _.indexOf(options.primary, b)>-1) ? 'primary' : ''});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -26,7 +26,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer center">
|
||||
<button class="btn normal dlg-btn primary" result="1"><%= txtAdd %></button>
|
||||
<button class="btn normal dlg-btn" result="0"><%= txtCancel %></button>
|
||||
</div>
|
||||
|
||||
@ -51,11 +51,11 @@ define([
|
||||
cls: 'extended-color-dlg modal-dlg',
|
||||
tpl: this.tpl({
|
||||
txtNew: this.textNew,
|
||||
txtCurrent: this.textCurrent,
|
||||
txtAdd: this.addButtonText,
|
||||
txtCancel: this.cancelButtonText
|
||||
txtCurrent: this.textCurrent
|
||||
}),
|
||||
header: false,
|
||||
buttons: [{value: '1', caption: this.addButtonText}, {value: '0', caption: this.cancelButtonText}],
|
||||
primary: '1',
|
||||
width: 340
|
||||
});
|
||||
|
||||
|
||||
@ -63,8 +63,8 @@ define([
|
||||
cls : 'modal-dlg open-dlg',
|
||||
contentTemplate : '',
|
||||
toolcallback : _.bind(t.onToolClose, t),
|
||||
closeFile : false
|
||||
|
||||
closeFile : false,
|
||||
buttons : ['ok'].concat(options.closeFile ? [{value: 'cancel', caption: this.closeButtonText}] : []).concat(options.closable ? ['cancel'] : []),
|
||||
}, options);
|
||||
|
||||
this.txtOpenFile = options.txtOpenFile || this.txtOpenFile;
|
||||
@ -134,15 +134,6 @@ define([
|
||||
'<% } %>',
|
||||
'<% } %>',
|
||||
'</div>',
|
||||
'</div>',
|
||||
'<div class="footer center">',
|
||||
'<button class="btn normal dlg-btn primary" result="ok">' + t.okButtonText + '</button>',
|
||||
'<% if (closeFile) { %>',
|
||||
'<button class="btn normal dlg-btn auto margin-left-10" result="cancel">' + t.closeButtonText + '</button>',
|
||||
'<% } %>',
|
||||
'<% if (closable) { %>',
|
||||
'<button class="btn normal dlg-btn auto margin-left-10" result="cancel">' + t.cancelButtonText + '</button>',
|
||||
'<% } %>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
|
||||
@ -58,7 +58,8 @@ define([
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, {
|
||||
title: this.textTitle
|
||||
title: this.textTitle,
|
||||
buttons: ['ok'].concat((options.type || this.options.type) === 'edit' ? ['cancel'] : []),
|
||||
}, options || {});
|
||||
|
||||
this.template = [
|
||||
@ -80,12 +81,6 @@ define([
|
||||
'</div>',
|
||||
'<div id="id-dlg-sign-settings-instructions"></div>',
|
||||
'<div id="id-dlg-sign-settings-date"></div>',
|
||||
'</div>',
|
||||
'<div class="footer center">',
|
||||
'<button class="btn normal dlg-btn primary" result="ok">' + this.okButtonText + '</button>',
|
||||
'<% if (type == "edit") { %>',
|
||||
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
|
||||
'<% } %>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user