added help block to category purge button, updated iconSelect library to use templates in a better way, hooked up iconSelect for category mgmt, #2463

v1.18.x
Julian Lam 10 years ago
parent 202789fa8d
commit d95f5a9ae0

@ -308,6 +308,7 @@
}
.category-preview {
.pointer;
width: 100%;
height: 100px;
text-align: center;

@ -3,7 +3,7 @@
define('admin/manage/category', [
'uploader',
'admin/modules/iconSelect',
'iconSelect',
'admin/modules/colorpicker',
'autocomplete'
], function(uploader, iconSelect, colorpicker, autocomplete) {

@ -19,29 +19,38 @@ define('iconSelect', function() {
$('#icons .fa-icons .fa.' + selected).addClass('selected');
}
bootbox.confirm('<h2>Select an icon.</h2>' + $('#icons').html(), function(confirm) {
if (confirm) {
var iconClass = $('.bootbox .selected').attr('class');
var categoryIconClass = $('<div/>').addClass(iconClass).removeClass('fa').removeClass('selected').attr('class');
if (categoryIconClass === 'fa-doesnt-exist') {
categoryIconClass = '';
}
el.attr('class', 'fa ' + (doubleSize ? 'fa-2x ' : '') + categoryIconClass);
el.val(categoryIconClass);
el.attr('value', categoryIconClass);
console.log(el);
onModified(el);
}
});
setTimeout(function() {
$('.bootbox .fa-icons i').on('click', function() {
$('.bootbox .selected').removeClass('selected');
$(this).addClass('selected');
templates.parse('partials/fontawesome', {}, function(html) {
var picker = bootbox.dialog({
message: html,
title: 'Select an Icon',
buttons: {
success: {
label: 'Save',
callback: function(confirm) {
var iconClass = $('.bootbox .selected').attr('class');
var categoryIconClass = $('<div/>').addClass(iconClass).removeClass('fa').removeClass('selected').attr('class');
if (categoryIconClass === 'fa-doesnt-exist') {
categoryIconClass = '';
}
el.attr('class', 'fa ' + (doubleSize ? 'fa-2x ' : '') + categoryIconClass);
el.val(categoryIconClass);
el.attr('value', categoryIconClass);
onModified(el);
}
}
}
});
picker.on('shown.bs.modal', function() {
var modalEl = $(this);
modalEl.find('.icon-container').on('click', 'i', function() {
modalEl.find('.icon-container i').removeClass('selected');
$(this).addClass('selected');
});
});
}, 500);
});
};
return iconSelect;

@ -133,6 +133,10 @@
</div>
<hr />
<button class="btn btn-danger btn-block btn-xs purge"><i class="fa fa-eraser"></i> Purge Category</button>
<p class="help-block">
Purging a category will remove all topics and posts, and delete the category from the database. If you want to
remove a category <em>temporarily</em>, you'll want to "disable" the category instead.
</p>
</div>
</div>
</div>

Loading…
Cancel
Save