diff --git a/apps/spreadsheeteditor/main/app/collection/ConditionalFormatIcons.js b/apps/spreadsheeteditor/main/app/collection/ConditionalFormatIcons.js index a1f2b6ec3..b226db1ee 100644 --- a/apps/spreadsheeteditor/main/app/collection/ConditionalFormatIcons.js +++ b/apps/spreadsheeteditor/main/app/collection/ConditionalFormatIcons.js @@ -43,6 +43,18 @@ define([ ], function(Backbone){ 'use strict'; SSE.Collections.ConditionalFormatIcons = Backbone.Collection.extend({ + model: Backbone.Model.extend({ + defaults: function() { + return { + id: Common.UI.getId(), + index: 0, + icon: null + } + } + }) + }); + + SSE.Collections.ConditionalFormatIconsPresets = Backbone.Collection.extend({ model: Backbone.Model.extend({ defaults: function() { return { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 84caa4c05..8eac4410b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -89,6 +89,7 @@ define([ 'EquationGroups', 'TableTemplates', 'ConditionalFormatIcons', + 'ConditionalFormatIconsPresets', 'Common.Collections.TextArt' ], views: [], @@ -2037,11 +2038,25 @@ define([ artStore.reset(arr); }, - fillCondFormatIcons: function(iconSets){ - if (_.isEmpty(iconSets)) return; + fillCondFormatIcons: function(icons){ + if (_.isEmpty(icons)) return; var arr = [], store = this.getCollection('ConditionalFormatIcons'); + _.each(icons, function(icon, index){ + arr.push({ + icon : icon, + index : index + }); + }); + store.reset(arr); + }, + + fillCondFormatIconsPresets: function(iconSets){ + if (_.isEmpty(iconSets)) return; + + var arr = [], + store = this.getCollection('ConditionalFormatIconsPresets'); _.each(iconSets, function(iconSet, index){ arr.push({ icons : iconSet, diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 127741f1e..655eeb873 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1589,10 +1589,14 @@ define([ }, onShowBeforeCondFormat: function() { - var collection = SSE.getCollection('ConditionalFormatIcons'); - if (collection.length>0) return; + if (SSE.getCollection('ConditionalFormatIconsPresets').length>0) return; + var presets = this.api.asc_getCFIconsByType(); + SSE.getController('Main').fillCondFormatIconsPresets(presets); + + var collectionIcons = SSE.getCollection('ConditionalFormatIcons'); + if (collectionIcons.length<1) + SSE.getController('Main').fillCondFormatIcons(this.api.asc_getFullCFIcons()); - SSE.getController('Main').fillCondFormatIcons(this.api.asc_getCFIcons()); var me = this; var menuItem = this.toolbar.mnuDataBars; @@ -1672,23 +1676,22 @@ define([ arr = []; var indexes = [Asc.EIconSetType.Arrows3, Asc.EIconSetType.Arrows3Gray, Asc.EIconSetType.Triangles3, Asc.EIconSetType.Arrows4Gray, Asc.EIconSetType.Arrows4, Asc.EIconSetType.Arrows5Gray, Asc.EIconSetType.Arrows5]; for (var i=0; i' + - '<% _.each(data.icons, function(icon) { %>' + - '' + + '<% _.each(data.iconSet, function(icon) { %>' + + '' + '<% }) %>' + '') });