mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
move item template to file
This commit is contained in:
@@ -2,9 +2,12 @@
|
|||||||
/*global define, socket, app, bootbox, templates, ajaxify, RELATIVE_PATH*/
|
/*global define, socket, app, bootbox, templates, ajaxify, RELATIVE_PATH*/
|
||||||
|
|
||||||
define('admin/manage/categories', function() {
|
define('admin/manage/categories', function() {
|
||||||
var Categories = {}, newCategoryId = -1, sortables;
|
var Categories = {}, newCategoryId = -1, sortables, itemTemplate;
|
||||||
|
|
||||||
Categories.init = function() {
|
Categories.init = function() {
|
||||||
|
$.get(RELATIVE_PATH + '/templates/admin/partials/categories/category-item.tpl', function(data){
|
||||||
|
itemTemplate = data;
|
||||||
|
|
||||||
socket.emit('admin.categories.getAll', function(error, payload){
|
socket.emit('admin.categories.getAll', function(error, payload){
|
||||||
if(error){
|
if(error){
|
||||||
return app.alertError(error.message);
|
return app.alertError(error.message);
|
||||||
@@ -12,6 +15,7 @@ define('admin/manage/categories', function() {
|
|||||||
|
|
||||||
Categories.render(payload);
|
Categories.render(payload);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$('button[data-action="create"]').on('click', Categories.create);
|
$('button[data-action="create"]').on('click', Categories.create);
|
||||||
};
|
};
|
||||||
@@ -130,31 +134,7 @@ define('admin/manage/categories', function() {
|
|||||||
|
|
||||||
function renderListItem(categoryEntity){
|
function renderListItem(categoryEntity){
|
||||||
var listItem = $(templates.parse(
|
var listItem = $(templates.parse(
|
||||||
'<div class="row">' +
|
itemTemplate,
|
||||||
'<div class="col-md-9">' +
|
|
||||||
'<div class="clearfix">' +
|
|
||||||
'<div class="icon">' +
|
|
||||||
'<i data-name="icon" value="{icon}" class="fa {icon}"></i>' +
|
|
||||||
'</div>' +
|
|
||||||
'<div class="information">' +
|
|
||||||
'<h5 class="header">{name}</h5>' +
|
|
||||||
'<p class="description">{description}</p>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>' +
|
|
||||||
'<div class="col-md-3">' +
|
|
||||||
'<div class="clearfix pull-right">' +
|
|
||||||
'<ul class="fa-ul stats">' +
|
|
||||||
'<li class="fa-li"><i class="fa fa-book"></i> {topic_count}</li>' +
|
|
||||||
'<li class="fa-li"><i class="fa fa-pencil"></i> {post_count}</li>' +
|
|
||||||
'</ul>' +
|
|
||||||
'<div class="btn-group">' +
|
|
||||||
'<button data-action="toggle" data-disabled="{disabled}" class="btn btn-xs"></button>' +
|
|
||||||
'<a href="./categories/{cid}" class="btn btn-default btn-xs">Edit</a>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>',
|
|
||||||
categoryEntity
|
categoryEntity
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
26
src/views/admin/partials/categories/category-item.tpl
Normal file
26
src/views/admin/partials/categories/category-item.tpl
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="clearfix">
|
||||||
|
<div class="icon">
|
||||||
|
<i data-name="icon" value="{icon}" class="fa {icon}"></i>
|
||||||
|
</div>
|
||||||
|
<div class="information">
|
||||||
|
<h5 class="header">{name}</h5>
|
||||||
|
|
||||||
|
<p class="description">{description}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="clearfix pull-right">
|
||||||
|
<ul class="fa-ul stats">
|
||||||
|
<li class="fa-li"><i class="fa fa-book"></i> {topic_count}</li>
|
||||||
|
<li class="fa-li"><i class="fa fa-pencil"></i> {post_count}</li>
|
||||||
|
</ul>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button data-action="toggle" data-disabled="{disabled}" class="btn btn-xs"></button>
|
||||||
|
<a href="./categories/{cid}" class="btn btn-default btn-xs">Edit</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user