Skip to content

Instantly share code, notes, and snippets.

@stiucsib86
Created February 6, 2017 03:45
Show Gist options
  • Save stiucsib86/add88d94ec5dcfee1a116c5b82c80f48 to your computer and use it in GitHub Desktop.
Save stiucsib86/add88d94ec5dcfee1a116c5b82c80f48 to your computer and use it in GitHub Desktop.
Visual Composer fixes ".vc_teaser-btn-{{ name }}" error fixes
parse: function() {
var value = this.$data_field.val(),
data = !_.isEmpty(value) ? $.parseJSON(value) : [];
if(_.isEmpty(value)) {
data = [{link: "post", name: "title"}, {name: 'image'}, {name: 'text'}];
this.$data_field.val(JSON.stringify(data));
}
_.each(data, function(block_data){
if(_.isString(block_data.name) && block_data.name.indexOf('{{') < 0) {
var $control = $('.vc_teaser-btn-' + block_data.name, this.$toolbar).prop('checked', true);
if(block_data.name == 'image' && !_.isUndefined(block_data.image)) {
if(block_data.image !== 'featured') {
this.custom_image_attributes = {id: block_data.image};
block_data.mode = 'custom';
} else {
block_data.mode = 'featured';
}
} else if(block_data.name == 'text') {
if(block_data.mode === 'custom') {
this.custom_text = block_data.text;
}
}
this.createControl(block_data);
this.$spinner.hide();
}
}, this);
this.$spinner.hide();
}
@DevCabin
Copy link

+1 Mine too

@humbertorames
Copy link

thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment