[DE] Add 'Apply to all' button for content controls settings

This commit is contained in:
Julia Radzhabova 2018-08-28 17:37:45 +03:00
parent 87feed6ccf
commit 00363faadb
4 changed files with 42 additions and 7 deletions

View file

@ -1641,6 +1641,7 @@ define([
var me = this; var me = this;
(new DE.Views.ControlSettingsDialog({ (new DE.Views.ControlSettingsDialog({
props: props, props: props,
api: me.api,
handler: function(result, value) { handler: function(result, value) {
if (result == 'ok') { if (result == 'ok') {
me.api.asc_SetContentControlProperties(value, id); me.api.asc_SetContentControlProperties(value, id);

View file

@ -48,8 +48,8 @@ define([
DE.Views.ControlSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ DE.Views.ControlSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: { options: {
contentWidth: 300, contentWidth: 310,
height: 335 height: 390
}, },
initialize : function(options) { initialize : function(options) {
@ -75,25 +75,40 @@ define([
'</td>', '</td>',
'</tr>', '</tr>',
'<tr>', '<tr>',
'<td class="padding-large">',
'<div class="separator horizontal"></div>',
'</td>',
'</tr>',
'</table>', '</table>',
'<table cols="2" style="width: auto;">', '<table cols="2" style="width: auto;">',
'<td class="padding-large">', '<tr>',
'<td class="padding-small">',
'<label class="input-label" style="margin-right: 10px;">', me.textShowAs,'</label>', '<label class="input-label" style="margin-right: 10px;">', me.textShowAs,'</label>',
'</td>', '</td>',
'<td class="padding-large">', '<td class="padding-small">',
'<div id="control-settings-combo-show" class="input-group-nr" style="display: inline-block; width:120px;"></div>', '<div id="control-settings-combo-show" class="input-group-nr" style="display: inline-block; width:120px;"></div>',
'</td>', '</td>',
'</tr>', '</tr>',
'<tr>', '<tr>',
'<td class="padding-large">', '<td class="padding-small">',
'<label class="input-label" style="margin-right: 10px;">', me.textColor, '</label>', '<label class="input-label" style="margin-right: 10px;">', me.textColor, '</label>',
'</td>', '</td>',
'<td class="padding-large">', '<td class="padding-small">',
'<div id="control-settings-color-btn" style="display: inline-block;"></div>', '<div id="control-settings-color-btn" style="display: inline-block;"></div>',
'</td>', '</td>',
'</tr>', '</tr>',
'<tr>',
'<td class="padding-large" colspan="2">',
'<button type="button" class="btn btn-text-default auto" id="control-settings-btn-all" style="min-width: 98px;">', me.textApplyAll,'</button>',
'</td>',
'</tr>',
'</table>', '</table>',
'<table cols="1" style="width: 100%;">', '<table cols="1" style="width: 100%;">',
'<tr>',
'<td class="padding-large">',
'<div class="separator horizontal"></div>',
'</td>',
'</tr>',
'<tr>', '<tr>',
'<td class="padding-small">', '<td class="padding-small">',
'<label class="header">', me.textLock, '</label>', '<label class="header">', me.textLock, '</label>',
@ -122,6 +137,7 @@ define([
this.handler = options.handler; this.handler = options.handler;
this.props = options.props; this.props = options.props;
this.api = options.api;
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
}, },
@ -180,6 +196,11 @@ define([
this.btnColor.setColor('000000'); this.btnColor.setColor('000000');
this.btnColor.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colors, this.btnColor)); this.btnColor.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colors, this.btnColor));
this.btnApplyAll = new Common.UI.Button({
el: $('#control-settings-btn-all')
});
this.btnApplyAll.on('click', _.bind(this.applyAllClick, this));
this.chLockDelete = new Common.UI.CheckBox({ this.chLockDelete = new Common.UI.CheckBox({
el: $('#control-settings-chb-lock-delete'), el: $('#control-settings-chb-lock-delete'),
labelText: this.txtLockDelete labelText: this.txtLockDelete
@ -273,6 +294,16 @@ define([
return true; return true;
}, },
applyAllClick: function(btn, eOpts){
if (this.api) {
var props = new AscCommon.CContentControlPr();
props.put_Appearance(this.cmbShow.getValue());
var color = Common.Utils.ThemeColor.getRgbColor(this.colors.getColor());
props.put_Color(color.get_r(), color.get_g(), color.get_b());
this.api.asc_SetContentControlProperties(props, null, true);
}
},
textTitle: 'Content Control Settings', textTitle: 'Content Control Settings',
textName: 'Title', textName: 'Title',
textTag: 'Tag', textTag: 'Tag',
@ -285,7 +316,8 @@ define([
textColor: 'Color', textColor: 'Color',
textBox: 'Bounding box', textBox: 'Bounding box',
textNone: 'None', textNone: 'None',
textNewColor: 'Add New Custom Color' textNewColor: 'Add New Custom Color',
textApplyAll: 'Apply to All'
}, DE.Views.ControlSettingsDialog || {})) }, DE.Views.ControlSettingsDialog || {}))
}); });

View file

@ -1877,6 +1877,7 @@ define([
if (item.value == 'settings') { if (item.value == 'settings') {
(new DE.Views.ControlSettingsDialog({ (new DE.Views.ControlSettingsDialog({
props: props, props: props,
api: me.api,
handler: function (result, value) { handler: function (result, value) {
if (result == 'ok') { if (result == 'ok') {
me.api.asc_SetContentControlProperties(value, props.get_InternalId()); me.api.asc_SetContentControlProperties(value, props.get_InternalId());

View file

@ -855,6 +855,7 @@
"DE.Views.ControlSettingsDialog.textTitle": "Content Control Settings", "DE.Views.ControlSettingsDialog.textTitle": "Content Control Settings",
"DE.Views.ControlSettingsDialog.txtLockDelete": "Content control cannot be deleted", "DE.Views.ControlSettingsDialog.txtLockDelete": "Content control cannot be deleted",
"DE.Views.ControlSettingsDialog.txtLockEdit": "Contents cannot be edited", "DE.Views.ControlSettingsDialog.txtLockEdit": "Contents cannot be edited",
"DE.Views.ControlSettingsDialog.textApplyAll": "Apply to All",
"DE.Views.CustomColumnsDialog.cancelButtonText": "Cancel", "DE.Views.CustomColumnsDialog.cancelButtonText": "Cancel",
"DE.Views.CustomColumnsDialog.okButtonText": "Ok", "DE.Views.CustomColumnsDialog.okButtonText": "Ok",
"DE.Views.CustomColumnsDialog.textColumns": "Number of columns", "DE.Views.CustomColumnsDialog.textColumns": "Number of columns",