',
'
',
'',
- '| ',
+ ' | ',
'',
' | ',
'
',
'',
'| ',
- '',
+ '',
' | ',
'
',
'',
'| ',
- '',
+ '',
' | ',
'
',
'
',
@@ -115,9 +118,10 @@ define(['common/main/lib/view/AdvancedSettingsWindow',
}, options);
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
- this._originalProps = this.options.props;
- this._charts = this.options.charts;
this._currentChartType = null;
+ this._currentChartSpace = null;
+ this._currentPreviews = [];
+ this._currentTabSettings = null;
},
render: function() {
@@ -143,11 +147,31 @@ define(['common/main/lib/view/AdvancedSettingsWindow',
if (pressed) {
$window.find('#id-' + item.groupId + '-lbl').text(chart.tip);
me._currentChartType = chart.type;
+ me.updatePreview();
}
});
item.chartButtons.push(btn);
me.chartButtons.push(btn);
});
+ item.listViewEl = $window.find('#' + item.panelId + ' .preview-list');
+ item.divPreviewEl = $window.find('#' + item.panelId + ' .preview-one');
+ item.divPreview = $window.find('#id-' + item.groupId + '-preview');
+ item.listPreview = new Common.UI.DataView({
+ el: $window.find('#id-' + item.groupId + '-list-preview'),
+ cls: 'focus-inner',
+ store: new Common.UI.DataViewStore(),
+ itemTemplate : _.template([
+ '
',
+ '

style="visibility: hidden;" <% } %>/>',
+ '
'
+ ].join('')),
+ tabindex: 1
+ });
+ item.listPreview.on('item:select', function(dataView, itemView, record) {
+ if (record) {
+ me._currentChartSpace = record.get('data');
+ }
+ });
});
this.afterRender();
@@ -162,6 +186,8 @@ define(['common/main/lib/view/AdvancedSettingsWindow',
Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index);
+ this.fillPreviews(index);
+
var buttons = this.options.items[index].chartButtons;
if (buttons.length>0) {
buttons[0].toggle(true);
@@ -171,23 +197,51 @@ define(['common/main/lib/view/AdvancedSettingsWindow',
}
},
+ fillPreviews: function(index) {
+ if (index===0)
+ this._currentPreviews = this.options.props.recommended;
+ else
+ this._currentPreviews = this.options.props.all;
+ this._currentTabSettings = this.options.items[index];
+ },
+
+ updatePreview: function() {
+ if (this._currentPreviews[this._currentChartType]) {
+ var charts = this._currentPreviews[this._currentChartType];
+ this._currentTabSettings.listViewEl.toggleClass('hidden', charts.length===1);
+ this._currentTabSettings.divPreviewEl.toggleClass('hidden', charts.length>1);
+ if (charts.length===1) {
+ this._currentChartSpace = charts[0];
+ this._currentTabSettings.divPreview.css('background-image', 'url(' + this._currentChartSpace.asc_getPreview() + ')');
+ } else if (charts.length>1) {
+ var store = this._currentTabSettings.listPreview.store,
+ arr = [];
+ for (var i = 0; i < charts.length; i++) {
+ arr.push(new Common.UI.DataViewModel({
+ imageUrl: charts[i].asc_getPreview(),
+ data: charts[i]
+ }));
+ }
+ store.reset(arr);
+ this._currentTabSettings.listPreview.selectByIndex(0);
+ }
+ }
+ },
+
afterRender: function() {
- this._setDefaults(this._originalProps);
+ this._setDefaults(this.options.props);
this.setActiveCategory(0);
},
_setDefaults: function(props) {
- if (props){
-
- }
},
getSettings: function() {
- return { type: this._currentChartType} ;
+ return this._currentChartSpace;
},
textTitle: 'Insert Chart',
textRecommended: 'Recommended'
- }, SSE.Views.ChartRecommendedDialog || {}));
+ }, SSE.Views.ChartWizardDialog || {}));
});
\ No newline at end of file