mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-14 01:45:47 +01:00
if no icon is selected for a category icon will be empty string
This commit is contained in:
@@ -37,13 +37,17 @@ define(['uploader'], function(uploader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function select_icon(el) {
|
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');
|
$('#icons .selected').removeClass('selected');
|
||||||
|
|
||||||
|
if (selected === '') {
|
||||||
|
selected = 'fa-doesnt-exist';
|
||||||
|
}
|
||||||
if (selected) {
|
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) {
|
if (confirm) {
|
||||||
var iconClass = $('.bootbox .selected').children(':first').attr('class');
|
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 itself
|
// remove the 'fa ' from the class name, just need the icon name itself
|
||||||
var categoryIconClass = iconClass.replace('fa ', '');
|
var categoryIconClass = iconClass.replace('fa ', '');
|
||||||
|
if(categoryIconClass === 'fa-doesnt-exist') {
|
||||||
|
categoryIconClass = '';
|
||||||
|
}
|
||||||
el.val(categoryIconClass);
|
el.val(categoryIconClass);
|
||||||
el.attr('value', categoryIconClass);
|
el.attr('value', categoryIconClass);
|
||||||
|
|
||||||
|
|||||||
@@ -157,9 +157,18 @@ define(['forum/recent'], function(recent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createCategoryLink(category) {
|
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;
|
return Unread;
|
||||||
|
|||||||
Reference in New Issue
Block a user