[DE PE SSE] Refactoring DataViewShape
This commit is contained in:
parent
ad35620a2e
commit
37bda824ae
|
@ -1316,7 +1316,7 @@ define([
|
|||
Common.UI.DataViewShape = Common.UI.DataViewSimple.extend(_.extend({
|
||||
template: _.template([
|
||||
'<div class="dataview inner" style="<%= style %>">',
|
||||
'<% _.each(options.groups, function(group, index) { %>',
|
||||
'<% _.each(options.groupsWithRecent, function(group, index) { %>',
|
||||
'<div class="grouped-data <% if (index === 0) { %> recent-group <% } %> " id="<%= group.id %>" <% if (!options.recentShapes && index === 0) { %> style="display: none;" <% } %>>',
|
||||
'<% if (!_.isEmpty(group.groupName)) { %>',
|
||||
'<div class="group-description">',
|
||||
|
@ -1340,7 +1340,7 @@ define([
|
|||
var filter = Common.localStorage.getKeysFilter();
|
||||
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
|
||||
|
||||
me.groups = options.groups;
|
||||
me.groups = options.groups.toJSON();
|
||||
if (options.isFromImage) {
|
||||
var store = me.groups[0].groupStore.clone();
|
||||
store.shift();
|
||||
|
@ -1364,6 +1364,8 @@ define([
|
|||
groupHeight : height
|
||||
});
|
||||
|
||||
me.options.groupsWithRecent = me.groups;
|
||||
|
||||
var store = new Common.UI.DataViewStore();
|
||||
|
||||
_.each(me.groups, function (group) {
|
||||
|
@ -1386,7 +1388,7 @@ define([
|
|||
_.each(me.cmpEl.find('div.grouped-data'), function (group, indexGroup) {
|
||||
_.each($(group).find('div.item'), function (item, index) {
|
||||
var $item = $(item),
|
||||
rec = me.options.groups[indexGroup].groupStore.at(index);
|
||||
rec = me.groups[indexGroup].groupStore.at(index);
|
||||
me.dataViewItems.push({el: $item, groupIndex: indexGroup, index: index});
|
||||
var tip = rec.get('tip');
|
||||
if (tip) {
|
||||
|
|
|
@ -2640,8 +2640,7 @@ define([
|
|||
},
|
||||
|
||||
fillAutoShapes: function() {
|
||||
var me = this,
|
||||
shapesStore = this.getApplication().getCollection('ShapeGroups');
|
||||
var me = this;
|
||||
|
||||
var menuitem = new Common.UI.MenuItem({
|
||||
template: _.template('<div id="id-toolbar-menu-insertshape" class="menu-insertshape"></div>')
|
||||
|
@ -2653,7 +2652,7 @@ define([
|
|||
var shapePicker = new Common.UI.DataViewShape({
|
||||
el: $('#id-toolbar-menu-insertshape'),
|
||||
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
|
||||
groups: shapesStore.toJSON(),
|
||||
groups: me.getApplication().getCollection('ShapeGroups'),
|
||||
parentMenu: me.toolbar.btnInsertShape.menu,
|
||||
restoreHeight: 640,
|
||||
textRecentlyUsed: me.textRecentlyUsed,
|
||||
|
|
|
@ -1788,7 +1788,6 @@ define([
|
|||
|
||||
fillAutoShapes: function() {
|
||||
var me = this,
|
||||
shapesStore = this.application.getCollection('ShapeGroups'),
|
||||
recents = Common.localStorage.getItem('de-recent-shapes');
|
||||
|
||||
for (var i = 0; i < 2; i++) {
|
||||
|
@ -1801,7 +1800,7 @@ define([
|
|||
var shapePicker = new Common.UI.DataViewShape({
|
||||
el: $('#id-change-shape-menu-' + i),
|
||||
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
|
||||
groups: shapesStore.toJSON(),
|
||||
groups: me.application.getCollection('ShapeGroups'),
|
||||
parentMenu: me.btnChangeShape.menu,
|
||||
restoreHeight: 640,
|
||||
textRecentlyUsed: me.textRecentlyUsed,
|
||||
|
|
|
@ -1642,7 +1642,6 @@ define([
|
|||
|
||||
fillAutoShapes: function() {
|
||||
var me = this,
|
||||
shapesStore = this.application.getCollection('ShapeGroups'),
|
||||
recents = Common.localStorage.getItem('pe-recent-shapes');
|
||||
|
||||
for (var i = 0; i < 2; i++) {
|
||||
|
@ -1655,7 +1654,7 @@ define([
|
|||
var shapePicker = new Common.UI.DataViewShape({
|
||||
el: $('#id-change-shape-menu-' + i),
|
||||
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
|
||||
groups: shapesStore.toJSON(),
|
||||
groups: me.application.getCollection('ShapeGroups'),
|
||||
parentMenu: me.btnChangeShape.menu,
|
||||
restoreHeight: 640,
|
||||
textRecentlyUsed: me.textRecentlyUsed,
|
||||
|
|
|
@ -1715,7 +1715,7 @@ define([
|
|||
var shapePicker = new Common.UI.DataViewShape({
|
||||
el: $('#id-toolbar-menu-insertshape-'+index),
|
||||
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
|
||||
groups: collection.toJSON(),
|
||||
groups: collection,
|
||||
parentMenu: menuShape,
|
||||
restoreHeight: 640,
|
||||
textRecentlyUsed: me.textRecentlyUsed,
|
||||
|
|
|
@ -3155,8 +3155,7 @@ define([
|
|||
},
|
||||
|
||||
fillAutoShapes: function() {
|
||||
var me = this,
|
||||
shapesStore = this.getApplication().getCollection('ShapeGroups');
|
||||
var me = this;
|
||||
|
||||
var menuitem = new Common.UI.MenuItem({
|
||||
template: _.template('<div id="id-toolbar-menu-insertshape" class="menu-insertshape"></div>')
|
||||
|
@ -3168,7 +3167,7 @@ define([
|
|||
var shapePicker = new Common.UI.DataViewShape({
|
||||
el: $('#id-toolbar-menu-insertshape'),
|
||||
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
|
||||
groups: shapesStore.toJSON(),
|
||||
groups: me.getApplication().getCollection('ShapeGroups'),
|
||||
parentMenu: me.toolbar.btnInsertShape.menu,
|
||||
restoreHeight: 640,
|
||||
textRecentlyUsed: me.textRecentlyUsed,
|
||||
|
|
|
@ -1660,7 +1660,6 @@ define([
|
|||
|
||||
fillAutoShapes: function() {
|
||||
var me = this,
|
||||
shapesStore = this.application.getCollection('ShapeGroups'),
|
||||
recents = Common.localStorage.getItem('sse-recent-shapes');
|
||||
|
||||
for (var i = 0; i < 2; i++) {
|
||||
|
@ -1673,7 +1672,7 @@ define([
|
|||
var shapePicker = new Common.UI.DataViewShape({
|
||||
el: $('#id-change-shape-menu-' + i),
|
||||
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
|
||||
groups: shapesStore.toJSON(),
|
||||
groups: me.application.getCollection('ShapeGroups'),
|
||||
parentMenu: me.btnChangeShape.menu,
|
||||
restoreHeight: 640,
|
||||
textRecentlyUsed: me.textRecentlyUsed,
|
||||
|
|
Loading…
Reference in a new issue