mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 02:36:16 +01:00
Merge branch 'master' of https://github.com/designcreateplay/NodeBB
This commit is contained in:
@@ -81,7 +81,8 @@ define(function() {
|
||||
name: $('#inputName').val(),
|
||||
description: $('#inputDescription').val(),
|
||||
icon: $('#new-category-modal i').val(),
|
||||
blockclass: $('#inputBlockclass').val()
|
||||
bgColor: '#0059b2',
|
||||
color: '#fff'
|
||||
};
|
||||
|
||||
socket.emit('api:admin.categories.create', category, function(err, data) {
|
||||
|
||||
@@ -135,7 +135,9 @@ define(function() {
|
||||
categoriesEl.className = 'category-list';
|
||||
for (x = 0; x < numCategories; x++) {
|
||||
info = data.categories[x];
|
||||
categoryEl.className = info.blockclass + (info.disabled === '1' ? ' disabled' : '');
|
||||
categoryEl.style.background = info.bgColor;
|
||||
categoryEl.style.color = info.color || '#fff';
|
||||
categoryEl.className = info.disabled === '1' ? ' disabled' : '';
|
||||
categoryEl.innerHTML = '<i class="fa ' + info.icon + '"></i> ' + info.name;
|
||||
categoryEl.setAttribute('data-cid', info.cid);
|
||||
categoriesFrag.appendChild(categoryEl.cloneNode(true));
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<i data-name="icon" value="{categories.icon}" class="fa {categories.icon} fa-2x"></i>
|
||||
</div>
|
||||
<input placeholder="Category Name" data-name="name" value="{categories.name}" class="form-control category_name"></input>
|
||||
<input placeholder="#000" data-name="bgColor" value="{categories.bgColor}" class="form-control category_bgColor" />
|
||||
<input placeholder="#000" data-name="color" value="{categories.color}" class="form-control category_color" />
|
||||
<input placeholder="#0059b2" data-name="bgColor" value="{categories.bgColor}" class="form-control category_bgColor" />
|
||||
<input placeholder="#fff" data-name="color" value="{categories.color}" class="form-control category_color" />
|
||||
<input data-name="description" placeholder="Category Description" value="{categories.description}" class="form-control category_description description"></input>
|
||||
<input type="hidden" data-name="order" data-value="{categories.order}"></input>
|
||||
<button type="submit" class="btn btn-default disable-btn" data-disabled="{categories.disabled}">Disable</button>
|
||||
@@ -65,20 +65,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputBlockclass">Block Class</label>
|
||||
<div class="controls">
|
||||
<select id="inputBlockclass" class="form-control" data-name="blockclass" data-value="">
|
||||
<option value="category-purple">category-purple</option>
|
||||
<option value="category-darkblue">category-darkblue</option>
|
||||
<option value="category-blue">category-blue</option>
|
||||
<option value="category-darkgreen">category-darkgreen</option>
|
||||
<option value="category-orange">category-orange</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,10 +4,6 @@ var RDB = require('./../redis.js'),
|
||||
|
||||
(function(CategoriesAdmin) {
|
||||
|
||||
CategoriesAdmin.create = function(data, callback) {
|
||||
categories.create(data, callback);
|
||||
};
|
||||
|
||||
CategoriesAdmin.update = function(modified, socket) {
|
||||
var updated = [];
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ var RDB = require('./redis.js'),
|
||||
name: data.name,
|
||||
description: data.description,
|
||||
icon: data.icon,
|
||||
blockclass: data.blockclass,
|
||||
bgColor: data.bgColor,
|
||||
color: data.color,
|
||||
slug: slug,
|
||||
topic_count: 0,
|
||||
disabled: 0,
|
||||
|
||||
@@ -204,10 +204,7 @@ var async = require('async'),
|
||||
},
|
||||
function (next) {
|
||||
// Categories
|
||||
var Categories = require('./categories'),
|
||||
admin = {
|
||||
categories: require('./admin/categories')
|
||||
};
|
||||
var Categories = require('./categories');
|
||||
|
||||
Categories.getAllCategories(0, function (err, data) {
|
||||
if (data.categories.length === 0) {
|
||||
@@ -217,7 +214,7 @@ var async = require('async'),
|
||||
default_categories = JSON.parse(default_categories);
|
||||
|
||||
async.eachSeries(default_categories, function (category, next) {
|
||||
admin.categories.create(category, next);
|
||||
Categories.create(category, next);
|
||||
}, function (err) {
|
||||
if (!err) {
|
||||
next();
|
||||
|
||||
@@ -891,7 +891,7 @@ module.exports.init = function(io) {
|
||||
});
|
||||
|
||||
socket.on('api:admin.categories.create', function(data, callback) {
|
||||
admin.categories.create(data, function(err, data) {
|
||||
categories.create(data, function(err, data) {
|
||||
callback(err, data);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user