From ac3fe1fc6fda498ff7eae5172d62e5fef15e55dd Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Thu, 8 Aug 2013 12:49:01 -0400 Subject: [PATCH] closes #93 --- public/css/admin.less | 9 --------- public/src/forum/admin/categories.js | 24 ++++++++++++++++++++++++ public/templates/admin/categories.tpl | 1 + public/templates/admin/header.tpl | 2 +- src/admin/categories.js | 3 ++- src/routes/admin.js | 18 ++++++++++++++++-- src/routes/api.js | 8 +++++--- 7 files changed, 49 insertions(+), 16 deletions(-) diff --git a/public/css/admin.less b/public/css/admin.less index cd322ba809..c56eeb74ce 100644 --- a/public/css/admin.less +++ b/public/css/admin.less @@ -6,15 +6,6 @@ margin-bottom: 10px; padding: 10px; cursor: move; - width: 800px; - } - - .entry-row { - border-radius: 10px; - margin-bottom: 10px; - padding: 10px; - cursor: move; - width: 695px; } input.description { diff --git a/public/src/forum/admin/categories.js b/public/src/forum/admin/categories.js index f8e0ce65ab..b7f77c8dbb 100644 --- a/public/src/forum/admin/categories.js +++ b/public/src/forum/admin/categories.js @@ -74,6 +74,30 @@ jQuery('.blockclass').each(function() { jQuery('.category_name, .category_description, .blockclass').on('change', function(ev) { modified(ev.target); }); + + jQuery('.entry-row button').each(function(index, element) { + var disabled = $(element).attr('data-disabled'); + if(disabled == "0" || disabled == "") + $(element).html('Disable'); + else + $(element).html('Enable'); + + }); + + jQuery('.entry-row button').on('click', function(ev) { + var btn = jQuery(this); + var categoryRow = btn.parents('li'); + var cid = categoryRow.attr('data-cid'); + + var disabled = btn.html() == "Disable" ? "1":"0"; + categoryRow.remove(); + modified_categories[cid] = modified_categories[cid] || {}; + modified_categories[cid]['disabled'] = disabled; + + save(); + return false; + }); + }); }()); \ No newline at end of file diff --git a/public/templates/admin/categories.tpl b/public/templates/admin/categories.tpl index fac56816a2..06366a5bb3 100644 --- a/public/templates/admin/categories.tpl +++ b/public/templates/admin/categories.tpl @@ -27,6 +27,7 @@ + diff --git a/public/templates/admin/header.tpl b/public/templates/admin/header.tpl index b6b4b7c299..381cde4a25 100644 --- a/public/templates/admin/header.tpl +++ b/public/templates/admin/header.tpl @@ -70,7 +70,7 @@