mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 15:35:47 +01:00
closes #288
This commit is contained in:
@@ -3,72 +3,84 @@
|
|||||||
"name": "Announcements",
|
"name": "Announcements",
|
||||||
"description": "Announcements regarding our community",
|
"description": "Announcements regarding our community",
|
||||||
"blockclass": "category-blue",
|
"blockclass": "category-blue",
|
||||||
"icon" : "icon-bullhorn"
|
"icon" : "icon-bullhorn",
|
||||||
|
"order": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "General Discussion",
|
"name": "General Discussion",
|
||||||
"description": "A place to talk about whateeeever you want",
|
"description": "A place to talk about whateeeever you want",
|
||||||
"blockclass": "category-blue",
|
"blockclass": "category-blue",
|
||||||
"icon" : "icon-comment"
|
"icon" : "icon-comment",
|
||||||
|
"order": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "NodeBB Development",
|
"name": "NodeBB Development",
|
||||||
"description": "NodeBB development news and announcements",
|
"description": "NodeBB development news and announcements",
|
||||||
"blockclass": "category-blue",
|
"blockclass": "category-blue",
|
||||||
"icon" : "icon-github"
|
"icon" : "icon-github",
|
||||||
|
"order": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Blogs",
|
"name": "Blogs",
|
||||||
"description": "Blog posts from individual members",
|
"description": "Blog posts from individual members",
|
||||||
"blockclass": "category-blue",
|
"blockclass": "category-blue",
|
||||||
"icon" : "icon-pencil"
|
"icon" : "icon-pencil",
|
||||||
|
"order": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Feature Requests",
|
"name": "Feature Requests",
|
||||||
"description": "Got a feature request you'd like to see? Give us a shout here.",
|
"description": "Got a feature request you'd like to see? Give us a shout here.",
|
||||||
"blockclass": "category-purple",
|
"blockclass": "category-purple",
|
||||||
"icon" : "icon-lightbulb"
|
"icon" : "icon-lightbulb",
|
||||||
|
"order": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Bug Reports",
|
"name": "Bug Reports",
|
||||||
"description": "Having trouble with NodeBB? Let us know...",
|
"description": "Having trouble with NodeBB? Let us know...",
|
||||||
"blockclass": "category-purple",
|
"blockclass": "category-purple",
|
||||||
"icon" : "icon-cogs"
|
"icon" : "icon-cogs",
|
||||||
|
"order": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "NodeBB Plugins",
|
"name": "NodeBB Plugins",
|
||||||
"description": "Enhance your NodeBB with plugins!",
|
"description": "Enhance your NodeBB with plugins!",
|
||||||
"blockclass": "category-purple",
|
"blockclass": "category-purple",
|
||||||
"icon" : "icon-plus-sign"
|
"icon" : "icon-plus-sign",
|
||||||
|
"order": 7
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "NodeBB Link Exchange",
|
"name": "NodeBB Link Exchange",
|
||||||
"description": "Link exchange",
|
"description": "Link exchange",
|
||||||
"blockclass": "category-purple",
|
"blockclass": "category-purple",
|
||||||
"icon" : "icon-exchange"
|
"icon" : "icon-exchange",
|
||||||
|
"order": 8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "News",
|
"name": "News",
|
||||||
"description": "News from around the world",
|
"description": "News from around the world",
|
||||||
"blockclass": "category-darkblue",
|
"blockclass": "category-darkblue",
|
||||||
"icon" : "icon-globe"
|
"icon" : "icon-globe",
|
||||||
|
"order": 9
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Movies",
|
"name": "Movies",
|
||||||
"description": "Discuss the latest movies here",
|
"description": "Discuss the latest movies here",
|
||||||
"blockclass": "category-darkblue",
|
"blockclass": "category-darkblue",
|
||||||
"icon" : "icon-film"
|
"icon" : "icon-film",
|
||||||
|
"order": 10
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Games",
|
"name": "Games",
|
||||||
"description": "Discuss the latest games here",
|
"description": "Discuss the latest games here",
|
||||||
"blockclass": "category-darkblue",
|
"blockclass": "category-darkblue",
|
||||||
"icon" : "icon-screenshot"
|
"icon" : "icon-screenshot",
|
||||||
|
"order": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Random",
|
"name": "Random",
|
||||||
"description": "Anything and (almost) everything welcome!",
|
"description": "Anything and (almost) everything welcome!",
|
||||||
"blockclass": "category-darkblue",
|
"blockclass": "category-darkblue",
|
||||||
"icon" : "icon-beer"
|
"icon" : "icon-beer",
|
||||||
|
"order": 12
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -46,7 +46,22 @@ define(function() {
|
|||||||
el.parentNode.parentNode.className = 'entry-row ' + el.value;
|
el.parentNode.parentNode.className = 'entry-row ' + el.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery('#entry-container').sortable();
|
function updateCategoryOrders() {
|
||||||
|
var categories = $('.admin-categories #entry-container').children();
|
||||||
|
for(var i=0; i<categories.length; ++i) {
|
||||||
|
var input = $(categories[i]).find('input[data-name="order"]');
|
||||||
|
|
||||||
|
input.val(i+1).attr('data-value', i+1);
|
||||||
|
modified(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jQuery('#entry-container').sortable({
|
||||||
|
stop: function( event, ui ) {
|
||||||
|
console.log('sort stop', ui);
|
||||||
|
updateCategoryOrders();
|
||||||
|
}
|
||||||
|
});
|
||||||
jQuery('.blockclass').each(function() {
|
jQuery('.blockclass').each(function() {
|
||||||
jQuery(this).val(this.getAttribute('data-value'));
|
jQuery(this).val(this.getAttribute('data-value'));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<option value="category-orange">category-orange</option>
|
<option value="category-orange">category-orange</option>
|
||||||
</select>
|
</select>
|
||||||
<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>
|
||||||
<button type="submit" class="btn btn-default" data-disabled="{categories.disabled}">Disable</button>
|
<button type="submit" class="btn btn-default" data-disabled="{categories.disabled}">Disable</button>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ var RDB = require('./redis.js'),
|
|||||||
blockclass: data.blockclass,
|
blockclass: data.blockclass,
|
||||||
slug: slug,
|
slug: slug,
|
||||||
topic_count: 0,
|
topic_count: 0,
|
||||||
disabled: 0
|
disabled: 0,
|
||||||
|
order: data.order
|
||||||
};
|
};
|
||||||
RDB.hmset('category:' + cid, category);
|
RDB.hmset('category:' + cid, category);
|
||||||
|
|
||||||
@@ -350,6 +351,8 @@ var RDB = require('./redis.js'),
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
categories = categories.sort(function(a, b) { return parseInt(a.order, 10) - parseInt(b.order, 10); });
|
||||||
|
|
||||||
callback({
|
callback({
|
||||||
'categories': categories
|
'categories': categories
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user