v1.18.x
psychobunny 8 years ago
parent 22891215cd
commit 88d5f97280

@ -66,7 +66,7 @@
"nodebb-plugin-spam-be-gone": "0.5.0",
"nodebb-rewards-essentials": "0.0.9",
"nodebb-theme-lavender": "4.0.0",
"nodebb-theme-persona": "5.0.3",
"nodebb-theme-persona": "5.0.4",
"nodebb-theme-vanilla": "6.0.3",
"nodebb-widget-essentials": "3.0.0",
"nodemailer": "2.6.4",

@ -10,6 +10,7 @@
"custom-class": "Custom Class",
"num-recent-replies": "# of Recent Replies",
"ext-link": "External Link",
"is-section": "Treat this category as a section",
"upload-image": "Upload Image",
"delete-image": "Remove",
"category-image": "Category Image",

@ -146,6 +146,10 @@ define('admin/manage/category', [
iconSelect.init($(this).find('i'), modified);
});
$('[type="checkbox"]').on('change', function () {
modified($(this));
});
$('button[data-action="setParent"], button[data-action="changeParent"]').on('click', Category.launchParentSelector);
$('button[data-action="removeParent"]').on('click', function () {
var payload = {};
@ -172,8 +176,15 @@ define('admin/manage/category', [
var cid = ajaxify.data.category.cid;
if (cid) {
var value;
if ($(el).is(':checkbox')) {
value = $(el).is(':checked') ? 1 : 0;
} else {
value = $(el).val();
}
modified_categories[cid] = modified_categories[cid] || {};
modified_categories[cid][$(el).attr('data-name')] = $(el).val();
modified_categories[cid][$(el).attr('data-name')] = value;
app.flags = app.flags || {};
app.flags._unsaved = true;

@ -30,6 +30,7 @@ module.exports = function (Categories) {
category.name = validator.escape(String(category.name || ''));
category.disabled = category.hasOwnProperty('disabled') ? parseInt(category.disabled, 10) === 1 : undefined;
category.isSection = category.hasOwnProperty('isSection') ? parseInt(category.isSection, 10) === 1 : undefined;
category.icon = category.icon || 'hidden';
if (category.hasOwnProperty('post_count')) {
category.post_count = category.post_count || 0;

@ -65,12 +65,12 @@ helpers.buildCategoryBreadcrumbs = function (cid, callback) {
async.whilst(function () {
return parseInt(cid, 10);
}, function (next) {
categories.getCategoryFields(cid, ['name', 'slug', 'parentCid', 'disabled'], function (err, data) {
categories.getCategoryFields(cid, ['name', 'slug', 'parentCid', 'disabled', 'isSection'], function (err, data) {
if (err) {
return next(err);
}
if (!parseInt(data.disabled, 10)) {
if (!parseInt(data.disabled, 10) && !parseInt(data.isSection, 10)) {
breadcrumbs.unshift({
text: validator.escape(String(data.name)),
url: nconf.get('relative_path') + '/category/' + data.slug,

@ -83,6 +83,16 @@
<input id="cid-{category.cid}-link" type="text" class="form-control" placeholder="http://domain.com" data-name="link" value="{category.link}" />
</div>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<div class="checkbox">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input type="checkbox" class="mdl-switch__input" id="cid-{category.cid}-isSection" data-name="isSection" <!-- IF category.isSection -->checked<!-- ENDIF category.isSection --> />
<span class="mdl-switch__label"><strong>[[admin/manage/categories:is-section]]</strong></span>
</label>
</div>
</div>
</div>
</fieldset>
<fieldset>
<label for="tag-whitelist">Tag Whitelist</label><br />

Loading…
Cancel
Save