Merge pull request #12024 from CartoDB/12009-export-image-disclaimer

Adds disclaimer for the Image Export
pull/11336/merge
Buti 8 years ago committed by GitHub
commit b70096fdc2

@ -20,6 +20,7 @@ Development
* Adds export as image (#11789, #12028) * Adds export as image (#11789, #12028)
* Exports GMaps basemaps (#11775) * Exports GMaps basemaps (#11775)
* Show error notifications (#11887) * Show error notifications (#11887)
* Adds disclaimer (#12024)
* New organization assets (#11034): * New organization assets (#11034):
* REST API available at `/api/v1/organization/<org_id>/assets` * REST API available at `/api/v1/organization/<org_id>/assets`
* Has DB migration * Has DB migration

@ -10,6 +10,11 @@ var template = require('./export-image-pane.tpl');
var Utils = require('../../helpers/utils'); var Utils = require('../../helpers/utils');
var Notifier = require('../../components/notifier/notifier'); 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_FORMAT = 'png';
var DEFAULT_EXPORT_WIDTH = 300; var DEFAULT_EXPORT_WIDTH = 300;
var DEFAULT_EXPORT_HEIGHT = 200; var DEFAULT_EXPORT_HEIGHT = 200;
@ -64,7 +69,7 @@ module.exports = CoreView.extend({
}); });
}, },
_addNotification: function (error) { _addErrorNotification: function (error) {
Notifier.addNotification({ Notifier.addNotification({
id: NOTIFICATION_ID, id: NOTIFICATION_ID,
status: 'error', status: 'error',
@ -86,6 +91,7 @@ module.exports = CoreView.extend({
this._createWidget(); this._createWidget();
this._createForm(); this._createForm();
this._createDisclaimer();
this._createFooter(); this._createFooter();
return this; return this;
@ -101,6 +107,33 @@ module.exports = CoreView.extend({
this.addView(this._exportImageFormView); 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 () { _createFooter: function () {
this._footerView = new FooterView({ this._footerView = new FooterView({
configModel: this._configModel, configModel: this._configModel,
@ -212,7 +245,7 @@ module.exports = CoreView.extend({
_onFail: function (error) { _onFail: function (error) {
this._footerView.stopLoader(); this._footerView.stopLoader();
this._addNotification(error); this._addErrorNotification(error);
}, },
_downloadImage: function (dataUri) { _downloadImage: function (dataUri) {

@ -8,4 +8,5 @@
</div> </div>
<div class="Editor-content js-content"></div> <div class="Editor-content js-content"></div>
<div class="js-disclaimer"></div>
<div class="Options-bar Options-bar--right u-flex js-footer"></div> <div class="Options-bar Options-bar--right u-flex js-footer"></div>

@ -1402,6 +1402,10 @@
"title": "Export as image", "title": "Export as image",
"export": "Export", "export": "Export",
"generating": "Generating", "generating": "Generating",
"disclaimer": {
"title": "Disclaimer",
"body": "Legends and widgets won't be exported as part of the image"
},
"download": "Download", "download": "Download",
"errors": { "errors": {
"try-again": "Please, try again. If the problem persists, contact support", "try-again": "Please, try again. If the problem persists, contact support",

@ -94,6 +94,11 @@ describe('editor/export-image-pane/export-image-pane', function () {
expect(this.view.$el.length).toBe(1); expect(this.view.$el.length).toBe(1);
}); });
it('should show a disclaimer', function () {
expect(this.view.$el.text()).toContain('disclaimer.title');
expect(this.view.$el.text()).toContain('disclaimer.body');
});
it('should call the method to generate the image', function () { it('should call the method to generate the image', function () {
this.view.$('.js-ok').click(); this.view.$('.js-ok').click();

Loading…
Cancel
Save