Skip to content

Commit

Permalink
Use event delegation for option delete buttons on manage attribute sc…
Browse files Browse the repository at this point in the history
…reen
  • Loading branch information
mpchadwick committed Mar 28, 2015
1 parent 5cd7a90 commit 8d259f3
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ require([
if (isNewOption && !this.isReadOnly) {
this.enableNewOptionDeleteButton(data.id);
}
this.bindRemoveButton(data.id);
this.itemCount++;
this.totalItems++;
this.updateItemsCountField();
Expand Down Expand Up @@ -139,14 +138,16 @@ require([
button.removeClassName('disabled');
});
},
bindRemoveButton: function(id) {
$('delete_button_' + id).observe('click', this.remove.bind(this));
}
};

if ($('add_new_option_button')) {
Event.observe('add_new_option_button', 'click', attributeOption.add.bind(attributeOption));
}

$('manage-options-panel').on('click', '.delete-option', function(event, element) {
attributeOption.remove(event);
});

<?php foreach ($block->getOptionValues() as $_value): ?>
attributeOption.add(<?php echo $_value->toJson() ?>);
<?php endforeach; ?>
Expand Down

0 comments on commit 8d259f3

Please sign in to comment.