putting category options behind a dropdown, and fixing category enable/disable

This commit is contained in:
Julian Lam
2013-11-29 12:35:36 -05:00
parent 2b2799dae9
commit 56ef05a0bf
2 changed files with 16 additions and 7 deletions

View File

@@ -134,21 +134,22 @@ define(function() {
modified(ev.target);
});
$('.entry-row button[data-disabled]').each(function(index, element) {
$('.dropdown li[data-disabled]').each(function(index, element) {
var disabled = $(element).attr('data-disabled');
if (disabled == "0" || disabled == "") {
$(element).html('Disable');
$(element).html('<a href="#"><i class="fa fa-power-off"></i> Disable</a>');
} else {
$(element).html('Enable');
$(element).html('<a href="#"><i class="fa fa-power-off"></i> Enable</a>');
}
});
$('#entry-container').on('click', '.disable-btn', function(ev) {
$('.dropdown').on('click', '[data-disabled]', function(ev) {
var btn = $(this);
var categoryRow = btn.parents('li');
var cid = categoryRow.attr('data-cid');
console.log(this.getAttribute('data-disabled'));
var disabled = btn.html() == "Disable" ? "1" : "0";
var disabled = this.getAttribute('data-disabled') === '0' ? '1' : '0';
categoryRow.remove();
modified_categories[cid] = modified_categories[cid] || {};
modified_categories[cid]['disabled'] = disabled;