cartodb/lib/assets/javascripts/builder/editor/feedback/feedback-button-view.js
2020-06-15 10:58:47 +08:00

45 lines
861 B
JavaScript
Executable File

var CoreView = require('backbone/core-view');
var template = require('./feedback-button.tpl');
var TipsyTooltipView = require('builder/components/tipsy-tooltip-view');
module.exports = CoreView.extend({
tagName: 'a',
className: 'EditorMenu-feedback typeform-share button js-feedback',
attributes: {
href: '',
target: ''
},
events: {
'click': '_onClick'
},
initialize: function (opts) {
if (!opts.modals) throw new Error('modals is required');
this._modals = opts.modals;
},
render: function () {
this.clearSubViews();
this.$el.append(template());
var tooltip = new TipsyTooltipView({
el: this.el,
gravity: 'w',
title: function () {
return _t('feedback');
}
});
this.addView(tooltip);
return this;
},
_onClick: function () {
this.$el.blur();
}
});