Node.js based forum software built for the modern web
if no icon is selected for a category icon will be empty string
barisusaklif8a6ab5cf4c6
diff --git a/public/src/forum/admin/categories.js b/public/src/forum/admin/categories.jsindex 11786a7d0f..161f2179c5 100644--- a/public/src/forum/admin/categories.js+++ b/public/src/forum/admin/categories.js@@ -37,13 +37,17 @@ define(['uploader'], function(uploader) {}function select_icon(el) {- var selected = el.attr('class').replace(' fa-2x', '');+ var selected = el.attr('class').replace('fa-2x', '').replace('fa', '').replace(/\s+/g, '');$('#icons .selected').removeClass('selected');++ if (selected === '') {+ selected = 'fa-doesnt-exist';+ }if (selected) {- $('#icons .' + selected).parent().addClass('selected');+ $('#icons .fa-icons .fa.' + selected).parent().addClass('selected');}- bootbox.confirm('<h2>Select an icon.</h2>' + document.getElementById('icons').innerHTML, function(confirm) {+ bootbox.confirm('<h2>Select an icon.</h2>' + $('#icons').html(), function(confirm) {if (confirm) {var iconClass = $('.bootbox .selected').children(':first').attr('class');@@ -51,6 +55,9 @@ define(['uploader'], function(uploader) {// remove the 'fa ' from the class name, just need the icon name itselfvar categoryIconClass = iconClass.replace('fa ', '');+ if(categoryIconClass === 'fa-doesnt-exist') {+ categoryIconClass = '';+ }el.val(categoryIconClass);el.attr('value', categoryIconClass);@@ -122,7 +129,7 @@ define(['uploader'], function(uploader) {ajaxify.loadTemplate('admin/categories', function(adminCategories) {var html = $(templates.parse(templates.getBlock(adminCategories, 'categories'), {categories: [data]}));-+html.find('[data-name="bgColor"], [data-name="color"]').each(enableColorPicker);$('#entry-container').append(html);diff --git a/public/src/forum/unread.js b/public/src/forum/unread.jsindex 0c394243ba..491945268b 100644--- a/public/src/forum/unread.js+++ b/public/src/forum/unread.js@@ -157,9 +157,18 @@ define(['forum/recent'], function(recent) {}function createCategoryLink(category) {- var link = $('<li role="presentation" class="category" data-cid="' + category.cid + '"><a role="menuitem" href="#"><i class="fa fa-fw ' + category.icon + '"></i> ' + category.name + '</a></li>');- $('.markread .dropdown-menu').append(link);+ var link = $('<a role="menuitem" href="#"></a>');+ if (category.icon) {+ link.append('<i class="fa fa-fw ' + category.icon + '"></i> ' + category.name);+ } else {+ link.append(category.name);+ }+++ $('<li role="presentation" class="category" data-cid="' + category.cid + '"></li>')+ .append(link)+ .appendTo($('.markread .dropdown-menu'));}return Unread;