Merge branch 'develop' of https://github.com/CartoDB/cartodb20 into develop
commit
1c18695adc
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* menu bar carto module
|
||||
* this module allows to edit Carto style
|
||||
*/
|
||||
|
||||
cdb.admin.mod = cdb.admin.mod || {};
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
cdb.admin.mod.Carto = cdb.core.View.extend({
|
||||
|
||||
buttonClass: 'carto_mod',
|
||||
type: 'tool',
|
||||
|
||||
events: {
|
||||
'click button': 'applyStyle'
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
this.template = this.getTemplate('table/menu_modules/views/carto');
|
||||
this.model.bind('change:style', this._updateStyle, this);
|
||||
},
|
||||
|
||||
activated: function() {
|
||||
this.$('textarea').focus();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.append(this.template({}));
|
||||
this._updateStyle();
|
||||
return this;
|
||||
},
|
||||
|
||||
_updateStyle: function(){
|
||||
this.$('textarea').val(this.model.get('style'));
|
||||
},
|
||||
|
||||
_parseError: function(err) {
|
||||
this.$('.error').html(err.errors.join('<br/>'));
|
||||
},
|
||||
|
||||
_clearErrors: function() {
|
||||
this.$('.error').html('');
|
||||
},
|
||||
|
||||
applyStyle: function() {
|
||||
cdb.log.debug("compiling carto");
|
||||
var style = this.$('textarea').val();
|
||||
// compile and validate
|
||||
this.model.set({ style: style });
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}());
|
@ -0,0 +1,13 @@
|
||||
<div>
|
||||
|
||||
<h1>Carto</h1>
|
||||
<textarea cols=50 rows= 10></textarea>
|
||||
|
||||
<div>
|
||||
<button>Apply style</button>
|
||||
</div>
|
||||
|
||||
<div class="error">
|
||||
</div>
|
||||
|
||||
</div>
|
@ -1 +1 @@
|
||||
Subproject commit 4961334b4c8ebae72aff74de42d13307862ac308
|
||||
Subproject commit fb8a9c54709d1500cc96314c0694d7bd708abdf4
|
Loading…
Reference in new issue