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

v1.18.x
Julian Lam
parent 202789fa8d
commit d95f5a9ae0

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

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

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

@ -133,6 +133,10 @@
</div> </div>
<hr /> <hr />
<button class="btn btn-danger btn-block btn-xs purge"><i class="fa fa-eraser"></i> Purge Category</button> <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> </div>
</div> </div>

Loading…
Cancel
Save