|
|
|
@ -10,6 +10,11 @@ var template = require('./export-image-pane.tpl');
|
|
|
|
|
var Utils = require('../../helpers/utils');
|
|
|
|
|
var Notifier = require('../../components/notifier/notifier');
|
|
|
|
|
|
|
|
|
|
var Infobox = require('../../components/infobox/infobox-factory');
|
|
|
|
|
var InfoboxView = require('../../components/infobox/infobox-view');
|
|
|
|
|
var InfoboxModel = require('../../components/infobox/infobox-model');
|
|
|
|
|
var InfoboxCollection = require('../../components/infobox/infobox-collection');
|
|
|
|
|
|
|
|
|
|
var DEFAULT_EXPORT_FORMAT = 'png';
|
|
|
|
|
var DEFAULT_EXPORT_WIDTH = 300;
|
|
|
|
|
var DEFAULT_EXPORT_HEIGHT = 200;
|
|
|
|
@ -64,7 +69,7 @@ module.exports = CoreView.extend({
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_addNotification: function (error) {
|
|
|
|
|
_addErrorNotification: function (error) {
|
|
|
|
|
Notifier.addNotification({
|
|
|
|
|
id: NOTIFICATION_ID,
|
|
|
|
|
status: 'error',
|
|
|
|
@ -86,6 +91,7 @@ module.exports = CoreView.extend({
|
|
|
|
|
|
|
|
|
|
this._createWidget();
|
|
|
|
|
this._createForm();
|
|
|
|
|
this._createDisclaimer();
|
|
|
|
|
this._createFooter();
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
@ -101,6 +107,33 @@ module.exports = CoreView.extend({
|
|
|
|
|
this.addView(this._exportImageFormView);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_createDisclaimer: function () {
|
|
|
|
|
var infoboxSstates = [{
|
|
|
|
|
state: 'disclaimer',
|
|
|
|
|
createContentView: function () {
|
|
|
|
|
return Infobox.createWithAction({
|
|
|
|
|
type: 'warning',
|
|
|
|
|
title: _t('editor.maps.export-image.disclaimer.title'),
|
|
|
|
|
body: _t('editor.maps.export-image.disclaimer.body')
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
this._infoboxModel = new InfoboxModel({
|
|
|
|
|
state: 'disclaimer'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this._infoboxCollection = new InfoboxCollection(infoboxSstates);
|
|
|
|
|
|
|
|
|
|
this._infoboxView = new InfoboxView({
|
|
|
|
|
infoboxModel: this._infoboxModel,
|
|
|
|
|
infoboxCollection: this._infoboxCollection
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$('.js-disclaimer').append(this._infoboxView.render().el);
|
|
|
|
|
this.addView(this._infoboxView);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_createFooter: function () {
|
|
|
|
|
this._footerView = new FooterView({
|
|
|
|
|
configModel: this._configModel,
|
|
|
|
@ -212,7 +245,7 @@ module.exports = CoreView.extend({
|
|
|
|
|
|
|
|
|
|
_onFail: function (error) {
|
|
|
|
|
this._footerView.stopLoader();
|
|
|
|
|
this._addNotification(error);
|
|
|
|
|
this._addErrorNotification(error);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_downloadImage: function (dataUri) {
|
|
|
|
|