Commit fbd59015 authored by Julia Radzhabova's avatar Julia Radzhabova

[SSE] Added dialog for custom number format.

parent 1caa8bd6
......@@ -50,7 +50,8 @@ define([
'spreadsheeteditor/main/app/view/TableOptionsDialog',
'spreadsheeteditor/main/app/view/NamedRangeEditDlg',
'spreadsheeteditor/main/app/view/NamedRangePasteDlg',
'spreadsheeteditor/main/app/view/NameManagerDlg'
'spreadsheeteditor/main/app/view/NameManagerDlg',
'spreadsheeteditor/main/app/view/FormatSettingsDialog'
], function () { 'use strict';
SSE.Controllers.Toolbar = Backbone.Controller.extend(_.extend({
......@@ -102,8 +103,7 @@ define([
fontsize: undefined,
multiselect: false,
sparklines_disabled: false,
numformattype: undefined,
langId: 0x0409
numformattype: undefined
};
var checkInsertAutoshape = function(e, action) {
......@@ -256,6 +256,8 @@ define([
toolbar.listStyles.on('click', _.bind(this.onListStyleSelect, this));
toolbar.cmbNumberFormat.on('selected', _.bind(this.onNumberFormatSelect, this));
toolbar.cmbNumberFormat.on('show:before', _.bind(this.onNumberFormatOpenBefore, this, true));
if (toolbar.cmbNumberFormat.cmpEl)
toolbar.cmbNumberFormat.cmpEl.on('click', '#id-toolbar-mnu-item-more-formats a', _.bind(this.onNumberFormatSelect, this));
toolbar.btnCurrencyStyle.menu.on('item:click', _.bind(this.onNumberFormatMenu, this));
if (toolbar.mnuitemCompactToolbar) toolbar.mnuitemCompactToolbar.on('toggle', _.bind(this.onChangeViewMode, this));
$('#id-toolbar-menu-new-fontcolor').on('click', _.bind(this.onNewTextColor, this));
......@@ -883,9 +885,22 @@ define([
},
onNumberFormatSelect: function(combo, record) {
if (this.api)
this.api.asc_setCellFormat(record.format);
if (record) {
if (this.api)
this.api.asc_setCellFormat(record.format);
} else {
var me = this;
(new SSE.Views.FormatSettingsDialog({
api: me.api,
handler: function(result, settings) {
if (settings) {
me.api.asc_setCellFormat(settings.format);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
},
props : {}
})).show();
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Number Format');
},
......@@ -895,7 +910,7 @@ define([
var me = this,
info = me.api.asc_getCellInfo();
me.toolbar.numFormatData.forEach( function(item, index) {
item.exampleval = me.api.asc_getLocaleExample2(item.format, null, me._state.langId);
item.exampleval = me.api.asc_getLocaleExample2(item.format);
});
me.toolbar.cmbNumberFormat.setData(me.toolbar.numFormatData);
me.toolbar.cmbNumberFormat.setValue(me._state.numformattype, me.toolbar.txtCustom);
......@@ -2560,12 +2575,6 @@ define([
for (var i=0; i<Math.min(4,formulas.length); i++) {
formulas[i].setCaption(this.api.asc_getFormulaLocaleName(formulas[i].value));
}
var value = Common.localStorage.getItem("sse-settings-reg-settings");
if (value!==null)
this._state.langId = parseInt(value);
else
this._state.langId = ((this.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.toolbar.mode.lang)) : 0x0409);
},
textEmptyImgUrl : 'You need to specify image URL.',
......
......@@ -755,6 +755,10 @@ define([
updateRegionalExample: function(landId) {
if (this.api) {
var text = (landId) ? this.api.asc_getLocaleExample(landId, 1000.01, new Date()) : '';
//var arr = this.api.asc_getFormatCells(null, landId); // all formats
// text = this.api.asc_getLocaleExample2(arr[0], 1000.01, landId);
// text = text + ' ' + this.api.asc_getLocaleExample2(arr[3], new Date(), landId);
// text = text + ' ' + this.api.asc_getLocaleExample2(arr[5], new Date(), landId);
$('#fms-lbl-reg-settings').text(_.isEmpty(text) ? '' : this.strRegSettingsEx + text);
}
},
......
This diff is collapsed.
......@@ -657,7 +657,9 @@ define([
'<div style="position: relative;"><div style="position: absolute; left: 0; width: 100px;"><%= scope.getDisplayValue(item) %></div>',
'<div style="display: inline-block; width: 100%; max-width: 300px; overflow: hidden; text-overflow: ellipsis; text-align: right; vertical-align: bottom; padding-left: 100px; color: silver;"><%= item.exampleval ? item.exampleval : "" %></div>',
'</div></a></li>',
'<% }); %>'
'<% }); %>',
'<li class="divider">',
'<li id="id-toolbar-mnu-item-more-formats" data-value="-1"><a tabindex="-1" type="menuitem">' + me.textMoreFormats + '</a></li>'
].join(''));
me.cmbNumberFormat = new Common.UI.ComboBox({
......@@ -2112,6 +2114,7 @@ define([
tipInsertEquation: 'Insert Equation',
textCharts: 'Charts',
textSparks: 'Sparklines',
tipInsertChartSpark: 'Insert Chart or Sparkline'
tipInsertChartSpark: 'Insert Chart or Sparkline',
textMoreFormats: 'More formats'
}, SSE.Views.Toolbar || {}));
});
\ No newline at end of file
......@@ -1625,6 +1625,7 @@
"SSE.Views.Toolbar.textLineSpark": "Line",
"SSE.Views.Toolbar.textColumnSpark": "Column",
"SSE.Views.Toolbar.textWinLossSpark": "Win/Loss",
"SSE.Views.Toolbar.textMoreFormats": "More formats",
"SSE.Views.Top10FilterDialog.cancelButtonText": "Cancel",
"SSE.Views.Top10FilterDialog.okButtonText": "OK",
"SSE.Views.Top10FilterDialog.textType": "Show",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment