if no icon is selected for a category icon will be empty string

v1.18.x
barisusakli 11 years ago
parent 29ec14efa0
commit f8a6ab5cf4

@ -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 itself
var 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);

@ -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;

Loading…
Cancel
Save