mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 18:56:15 +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(),
|
name: $('#inputName').val(),
|
||||||
description: $('#inputDescription').val(),
|
description: $('#inputDescription').val(),
|
||||||
icon: $('#new-category-modal i').val(),
|
icon: $('#new-category-modal i').val(),
|
||||||
blockclass: $('#inputBlockclass').val()
|
bgColor: '#0059b2',
|
||||||
|
color: '#fff'
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.emit('api:admin.categories.create', category, function(err, data) {
|
socket.emit('api:admin.categories.create', category, function(err, data) {
|
||||||
|
|||||||
@@ -135,7 +135,9 @@ define(function() {
|
|||||||
categoriesEl.className = 'category-list';
|
categoriesEl.className = 'category-list';
|
||||||
for (x = 0; x < numCategories; x++) {
|
for (x = 0; x < numCategories; x++) {
|
||||||
info = data.categories[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.innerHTML = '<i class="fa ' + info.icon + '"></i> ' + info.name;
|
||||||
categoryEl.setAttribute('data-cid', info.cid);
|
categoryEl.setAttribute('data-cid', info.cid);
|
||||||
categoriesFrag.appendChild(categoryEl.cloneNode(true));
|
categoriesFrag.appendChild(categoryEl.cloneNode(true));
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
<i data-name="icon" value="{categories.icon}" class="fa {categories.icon} fa-2x"></i>
|
<i data-name="icon" value="{categories.icon}" class="fa {categories.icon} fa-2x"></i>
|
||||||
</div>
|
</div>
|
||||||
<input placeholder="Category Name" data-name="name" value="{categories.name}" class="form-control category_name"></input>
|
<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="#0059b2" 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="#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 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>
|
<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>
|
<button type="submit" class="btn btn-default disable-btn" data-disabled="{categories.disabled}">Disable</button>
|
||||||
@@ -65,20 +65,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,10 +4,6 @@ var RDB = require('./../redis.js'),
|
|||||||
|
|
||||||
(function(CategoriesAdmin) {
|
(function(CategoriesAdmin) {
|
||||||
|
|
||||||
CategoriesAdmin.create = function(data, callback) {
|
|
||||||
categories.create(data, callback);
|
|
||||||
};
|
|
||||||
|
|
||||||
CategoriesAdmin.update = function(modified, socket) {
|
CategoriesAdmin.update = function(modified, socket) {
|
||||||
var updated = [];
|
var updated = [];
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ var RDB = require('./redis.js'),
|
|||||||
name: data.name,
|
name: data.name,
|
||||||
description: data.description,
|
description: data.description,
|
||||||
icon: data.icon,
|
icon: data.icon,
|
||||||
blockclass: data.blockclass,
|
bgColor: data.bgColor,
|
||||||
|
color: data.color,
|
||||||
slug: slug,
|
slug: slug,
|
||||||
topic_count: 0,
|
topic_count: 0,
|
||||||
disabled: 0,
|
disabled: 0,
|
||||||
|
|||||||
@@ -204,10 +204,7 @@ var async = require('async'),
|
|||||||
},
|
},
|
||||||
function (next) {
|
function (next) {
|
||||||
// Categories
|
// Categories
|
||||||
var Categories = require('./categories'),
|
var Categories = require('./categories');
|
||||||
admin = {
|
|
||||||
categories: require('./admin/categories')
|
|
||||||
};
|
|
||||||
|
|
||||||
Categories.getAllCategories(0, function (err, data) {
|
Categories.getAllCategories(0, function (err, data) {
|
||||||
if (data.categories.length === 0) {
|
if (data.categories.length === 0) {
|
||||||
@@ -217,7 +214,7 @@ var async = require('async'),
|
|||||||
default_categories = JSON.parse(default_categories);
|
default_categories = JSON.parse(default_categories);
|
||||||
|
|
||||||
async.eachSeries(default_categories, function (category, next) {
|
async.eachSeries(default_categories, function (category, next) {
|
||||||
admin.categories.create(category, next);
|
Categories.create(category, next);
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
next();
|
next();
|
||||||
|
|||||||
@@ -891,7 +891,7 @@ module.exports.init = function(io) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('api:admin.categories.create', function(data, callback) {
|
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);
|
callback(err, data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user