mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 09:36:16 +01:00
feat: re-jigger 'add category' button to allow addition of remote category to main index
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"manage-categories": "Manage Categories",
|
"manage-categories": "Manage Categories",
|
||||||
"add-category": "Add category",
|
"add-category": "Add category",
|
||||||
|
"add-local-category": "Add Local category",
|
||||||
|
"add-remote-category": "Add Remote category",
|
||||||
"jump-to": "Jump to...",
|
"jump-to": "Jump to...",
|
||||||
"settings": "Category Settings",
|
"settings": "Category Settings",
|
||||||
"edit-category": "Edit Category",
|
"edit-category": "Edit Category",
|
||||||
@@ -103,6 +105,8 @@
|
|||||||
"alert.create-success": "Category successfully created!",
|
"alert.create-success": "Category successfully created!",
|
||||||
"alert.none-active": "You have no active categories.",
|
"alert.none-active": "You have no active categories.",
|
||||||
"alert.create": "Create a Category",
|
"alert.create": "Create a Category",
|
||||||
|
"alert.add": "Add a Category",
|
||||||
|
"alert.add-help": "Remote categories can be added to the categories listing by specifying their handle.<br /><br /><strong>Note</strong> — The remote category may not reflect all topics published unless at least one local user tracks/watches it.",
|
||||||
"alert.confirm-purge": "<p class=\"lead\">Do you really want to purge this category \"%1\"?</p><h5><strong class=\"text-danger\">Warning!</strong> All topics and posts in this category will be purged!</h5> <p class=\"help-block\">Purging a category will remove all topics and posts, and delete the category from the database. If you want to remove a category <em>temporarily</em>, you'll want to \"disable\" the category instead.</p>",
|
"alert.confirm-purge": "<p class=\"lead\">Do you really want to purge this category \"%1\"?</p><h5><strong class=\"text-danger\">Warning!</strong> All topics and posts in this category will be purged!</h5> <p class=\"help-block\">Purging a category will remove all topics and posts, and delete the category from the database. If you want to remove a category <em>temporarily</em>, you'll want to \"disable\" the category instead.</p>",
|
||||||
"alert.purge-success": "Category purged!",
|
"alert.purge-success": "Category purged!",
|
||||||
"alert.copy-success": "Settings Copied!",
|
"alert.copy-success": "Settings Copied!",
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ define('admin/manage/categories', [
|
|||||||
Categories.render(ajaxify.data.categoriesTree);
|
Categories.render(ajaxify.data.categoriesTree);
|
||||||
|
|
||||||
$('button[data-action="create"]').on('click', Categories.throwCreateModal);
|
$('button[data-action="create"]').on('click', Categories.throwCreateModal);
|
||||||
|
$('button[data-action="add"]').on('click', Categories.throwAddModal);
|
||||||
|
|
||||||
// Enable/Disable toggle events
|
// Enable/Disable toggle events
|
||||||
$('.categories').on('click', '.category-tools [data-action="toggle"]', function () {
|
$('.categories').on('click', '.category-tools [data-action="toggle"]', function () {
|
||||||
@@ -151,6 +152,30 @@ define('admin/manage/categories', [
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Categories.throwAddModal = function () {
|
||||||
|
Benchpress.render('admin/partials/categories/add', {}).then(function (html) {
|
||||||
|
const modal = bootbox.dialog({
|
||||||
|
title: '[[admin/manage/categories:alert.add]]',
|
||||||
|
message: html,
|
||||||
|
buttons: {
|
||||||
|
save: {
|
||||||
|
label: '[[global:save]]',
|
||||||
|
className: 'btn-primary',
|
||||||
|
callback: submit,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function submit() {
|
||||||
|
// const formData = modal.find('form').serializeObject();
|
||||||
|
modal.modal('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
modal.find('form').on('submit', submit);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Categories.create = function (payload) {
|
Categories.create = function (payload) {
|
||||||
api.post('/categories', payload, function (err, data) {
|
api.post('/categories', payload, function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -8,7 +8,16 @@
|
|||||||
|
|
||||||
<!-- IMPORT admin/partials/category/selector-dropdown-right.tpl -->
|
<!-- IMPORT admin/partials/category/selector-dropdown-right.tpl -->
|
||||||
|
|
||||||
<button data-action="create" class="btn btn-primary btn-sm btn btn-primary btn-sm fw-semibold ff-secondary text-center text-nowrap">[[admin/manage/categories:add-category]]</button>
|
<div class="btn-group" role="group">
|
||||||
|
<button class="btn btn-primary btn-sm btn btn-primary btn-sm fw-semibold ff-secondary text-center text-nowrap dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
[[admin/manage/categories:add-category]]
|
||||||
|
<i class="fa fa-caret-down"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><button class="btn-link dropdown-item" href="#" data-action="create">[[admin/manage/categories:add-local-category]]</button></li>
|
||||||
|
<li><button class="btn-link dropdown-item" href="#" data-action="add">[[admin/manage/categories:add-remote-category]]</button></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm {{{if !breadcrumbs.length }}}hidden{{{ end }}}"><!-- IMPORT admin/partials/breadcrumbs.tpl --></div>
|
<div class="text-sm {{{if !breadcrumbs.length }}}hidden{{{ end }}}"><!-- IMPORT admin/partials/breadcrumbs.tpl --></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user