Node.js based forum software built for the modern web
closes #423, closes #424
Baris Soner Usakli7e8ddbadfbbb
diff --git a/public/src/forum/admin/categories.js b/public/src/forum/admin/categories.jsindex 35f851d381..ce3f716312 100644--- a/public/src/forum/admin/categories.js+++ b/public/src/forum/admin/categories.js@@ -6,9 +6,10 @@ define(function() {function modified(el) {var cid = $(el).parents('li').attr('data-cid');-- modified_categories[cid] = modified_categories[cid] || {};- modified_categories[cid][$(el).attr('data-name')] = $(el).val();+ if(cid) {+ modified_categories[cid] = modified_categories[cid] || {};+ modified_categories[cid][$(el).attr('data-name')] = $(el).val();+ }}function save() {@@ -28,6 +29,7 @@ define(function() {var iconClass = jQuery('.bootbox .selected').children(':first').attr('class');el.attr('class', iconClass + ' icon-2x');el.val(iconClass);+ el.attr('value', iconClass);modified(el);}@@ -66,7 +68,6 @@ define(function() {});- //DRY Failure. this needs to go into an ajaxify onready style fn. Currently is copy pasted into every single function so after ACP is off the ground fix asapfunction showCreateCategoryModal() {$('#new-category-modal').modal();}@@ -75,7 +76,7 @@ define(function() {var category = {name: $('#inputName').val(),description: $('#inputDescription').val(),- icon: $('#new-category-modal i').attr('value'),+ icon: $('#new-category-modal i').val(),blockclass: $('#inputBlockclass').val()};@@ -120,6 +121,10 @@ define(function() {select_icon($(this).find('i'));});+ jQuery('#new-category-modal').on('click', '.icon', function(ev) {+ select_icon($(this).find('i'));+ });+jQuery('.blockclass').on('change', function(ev) {update_blockclass(ev.target);});@@ -137,7 +142,7 @@ define(function() {});- jQuery('.entry-row button').on('click', function(ev) {+ jQuery('#entry-container').on('click', '.disable-btn', function(ev) {var btn = jQuery(this);var categoryRow = btn.parents('li');var cid = categoryRow.attr('data-cid');diff --git a/public/templates/admin/categories.tpl b/public/templates/admin/categories.tplindex 96465aa316..4c4fe8f394 100644--- a/public/templates/admin/categories.tpl+++ b/public/templates/admin/categories.tpl@@ -28,7 +28,7 @@</select><input data-name="description" placeholder="Category Description" value="{categories.description}" class="form-control category_description description"></input><input type="hidden" data-name="order" data-value="{categories.order}"></input>- <button type="submit" class="btn btn-default" data-disabled="{categories.disabled}">Disable</button>+ <button type="submit" class="btn btn-default disable-btn" data-disabled="{categories.disabled}">Disable</button></form></li>