diff --git a/public/language/en-GB/admin/manage/categories.json b/public/language/en-GB/admin/manage/categories.json index f51152f22d..378421f30c 100644 --- a/public/language/en-GB/admin/manage/categories.json +++ b/public/language/en-GB/admin/manage/categories.json @@ -1,6 +1,8 @@ { "manage-categories": "Manage Categories", "add-category": "Add category", + "add-local-category": "Add Local category", + "add-remote-category": "Add Remote category", "jump-to": "Jump to...", "settings": "Category Settings", "edit-category": "Edit Category", @@ -103,6 +105,8 @@ "alert.create-success": "Category successfully created!", "alert.none-active": "You have no active categories.", "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.

Note — The remote category may not reflect all topics published unless at least one local user tracks/watches it.", "alert.confirm-purge": "

Do you really want to purge this category \"%1\"?

Warning! All topics and posts in this category will be purged!

Purging a category will remove all topics and posts, and delete the category from the database. If you want to remove a category temporarily, you'll want to \"disable\" the category instead.

", "alert.purge-success": "Category purged!", "alert.copy-success": "Settings Copied!", diff --git a/public/src/admin/manage/categories.js b/public/src/admin/manage/categories.js index 7342d0c1de..c25e44670c 100644 --- a/public/src/admin/manage/categories.js +++ b/public/src/admin/manage/categories.js @@ -27,6 +27,7 @@ define('admin/manage/categories', [ Categories.render(ajaxify.data.categoriesTree); $('button[data-action="create"]').on('click', Categories.throwCreateModal); + $('button[data-action="add"]').on('click', Categories.throwAddModal); // Enable/Disable toggle events $('.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) { api.post('/categories', payload, function (err, data) { if (err) { diff --git a/src/views/admin/manage/categories.tpl b/src/views/admin/manage/categories.tpl index bed5850325..243936577e 100644 --- a/src/views/admin/manage/categories.tpl +++ b/src/views/admin/manage/categories.tpl @@ -8,7 +8,16 @@ - +
+ + +