mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 08:25:46 +01:00
icon mgmt for #2463
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
/*global define */
|
||||
/*global define, app, socket, ajaxify, RELATIVE_PATH, bootbox */
|
||||
|
||||
define('admin/manage/category', [
|
||||
'uploader',
|
||||
@@ -11,10 +11,8 @@ define('admin/manage/category', [
|
||||
Category.init = function() {
|
||||
var modified_categories = {};
|
||||
|
||||
function modified(el, cid) {
|
||||
if (!cid) {
|
||||
cid = $(el).parents('form').attr('data-cid');
|
||||
}
|
||||
function modified(el) {
|
||||
var cid = $(el).parents('form').attr('data-cid');
|
||||
|
||||
if (cid) {
|
||||
modified_categories[cid] = modified_categories[cid] || {};
|
||||
@@ -115,13 +113,18 @@ define('admin/manage/category', [
|
||||
|
||||
uploader.open(RELATIVE_PATH + '/admin/category/uploadpicture', { cid: cid }, 0, function(imageUrlOnServer) {
|
||||
inputEl.val(imageUrlOnServer);
|
||||
var previewBox = inputEl.siblings('.category-preview');
|
||||
var previewBox = inputEl.parent().siblings('.category-preview');
|
||||
previewBox.css('background', 'url(' + imageUrlOnServer + '?' + new Date().getTime() + ')')
|
||||
.css('background-size', 'cover');
|
||||
modified(inputEl[0], cid);
|
||||
modified(inputEl[0]);
|
||||
});
|
||||
});
|
||||
|
||||
// Icon selection
|
||||
$('.category-preview').on('click', function(ev) {
|
||||
iconSelect.init($(this).find('i'), modified);
|
||||
});
|
||||
|
||||
$(function() {
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user