From 117b8dece4e140a2d4b8cebf5a5efb723484d24b Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 24 Sep 2014 14:45:49 -0400 Subject: [PATCH] settings acp refactor for dedicated routes --- public/src/forum/admin/settings.js | 16 +- src/controllers/admin.js | 2 +- src/routes/admin.js | 4 +- src/views/admin/header.tpl | 4 +- src/views/admin/settings.tpl | 73 -------- src/views/admin/settings/advanced.tpl | 58 +++--- src/views/admin/settings/email.tpl | 58 +++--- src/views/admin/settings/footer.tpl | 9 + src/views/admin/settings/general.tpl | 98 +++++----- src/views/admin/settings/header.tpl | 17 ++ src/views/admin/settings/pagination.tpl | 32 ++-- src/views/admin/settings/post.tpl | 118 ++++++------ src/views/admin/settings/reputation.tpl | 36 ++++ src/views/admin/settings/sockets.tpl | 44 ++--- src/views/admin/settings/tags.tpl | 20 +- src/views/admin/settings/user.tpl | 224 ++++++++++++----------- src/views/admin/settings/web-crawler.tpl | 44 ++--- 17 files changed, 435 insertions(+), 422 deletions(-) delete mode 100644 src/views/admin/settings.tpl create mode 100644 src/views/admin/settings/footer.tpl create mode 100644 src/views/admin/settings/header.tpl create mode 100644 src/views/admin/settings/reputation.tpl diff --git a/public/src/forum/admin/settings.js b/public/src/forum/admin/settings.js index 8cb6ebfdae..2b59883d17 100644 --- a/public/src/forum/admin/settings.js +++ b/public/src/forum/admin/settings.js @@ -17,6 +17,8 @@ define('forum/admin/settings', ['uploader', 'sounds'], function(uploader, sounds return; } + setupPills(); + // Populate the fields on the page from the config var fields = $('#content [data-field]'), numFields = fields.length, @@ -91,12 +93,6 @@ define('forum/admin/settings', ['uploader', 'sounds'], function(uploader, sounds handleUploads(); - $('#settings-tab a').off('click').on('click', function (e) { - e.preventDefault(); - $(this).tab('show'); - return false; - }); - $('button[data-action="email.test"]').off('click').on('click', function() { socket.emit('admin.email.test', function(err) { app.alert({ @@ -131,6 +127,14 @@ define('forum/admin/settings', ['uploader', 'sounds'], function(uploader, sounds socket.emit('admin.config.remove', key); }; + function setupPills() { + $('.settings.nav-pills li').removeClass('active'); + + var slug = window.location.href.split('/'); + slug = slug[slug.length-1]; + $('.settings.nav-pills [data-pill="' + slug + '"]').addClass('active'); + } + function saveField(field, callback) { field = $(field); var key = field.attr('data-field'), diff --git a/src/controllers/admin.js b/src/controllers/admin.js index 8ba54380d8..2eac244d78 100644 --- a/src/controllers/admin.js +++ b/src/controllers/admin.js @@ -203,7 +203,7 @@ adminController.languages.get = function(req, res, next) { }; adminController.settings.get = function(req, res, next) { - res.render('admin/settings', { + res.render('admin/settings/' + req.params.term, { 'csrf': req.csrfToken() }); }; diff --git a/src/routes/admin.js b/src/routes/admin.js index b64208a3ba..a29610e0e2 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -39,12 +39,14 @@ function addRoutes(router, middleware, controllers) { //main router.get('/index', controllers.admin.home); router.get('/plugins', controllers.admin.plugins.get); - router.get('/settings', middleware.applyCSRF, controllers.admin.settings.get); router.get('/themes', controllers.admin.themes.get); router.get('/languages', controllers.admin.languages.get); router.get('/groups', controllers.admin.groups.get); router.get('/sounds', controllers.admin.sounds.get); + //settings + router.get('/settings/:term', middleware.applyCSRF, controllers.admin.settings.get); + //user router.get('/users', controllers.admin.users.search); router.get('/users/search', controllers.admin.users.search); diff --git a/src/views/admin/header.tpl b/src/views/admin/header.tpl index 3413788ac7..26e4decafa 100644 --- a/src/views/admin/header.tpl +++ b/src/views/admin/header.tpl @@ -60,7 +60,7 @@ Home
  • - Settings + Settings
  • Forum @@ -101,7 +101,7 @@
  • Tags
  • Users
  • Groups
  • -
  • General Settings
  • +
  • Settings
  • Themes
  • Plugins
  • Languages
  • diff --git a/src/views/admin/settings.tpl b/src/views/admin/settings.tpl deleted file mode 100644 index 0076cd603d..0000000000 --- a/src/views/admin/settings.tpl +++ /dev/null @@ -1,73 +0,0 @@ -

    Settings

    -
    - - - -
    - - - - - - - - - - - - -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -

    Privilege Thresholds

    -

    Use privilege thresholds to manage how much reputation a user must gain to receive moderator access.


    - Manage Thread

    - Manage Content

    -
    - -
    -
    - -
    -

    Activity Thresholds

    - Minimum reputation to downvote posts

    - Minimum reputation to flag posts

    -
    - -
    -
    - - - - - \ No newline at end of file diff --git a/src/views/admin/settings/advanced.tpl b/src/views/admin/settings/advanced.tpl index efe7c31127..35cd297485 100644 --- a/src/views/admin/settings/advanced.tpl +++ b/src/views/admin/settings/advanced.tpl @@ -1,30 +1,32 @@ -
    -
    -
    -
    - -
    -

    - When the forum is in maintenance mode, all requests will be redirected to a static holding page. - Administrators are exempt from this redirection, and are able to access the site normally. -

    -
    + + +
    +
    +
    +
    -
    - -
    - -
    -
    -
    - -
    -

    - Leave blank for default -

    -
    - +

    + When the forum is in maintenance mode, all requests will be redirected to a static holding page. + Administrators are exempt from this redirection, and are able to access the site normally. +

    + +
    +
    +
    +
    + +
    -
    \ No newline at end of file +
    + +
    +

    + Leave blank for default +

    +
    + +
    + + \ No newline at end of file diff --git a/src/views/admin/settings/email.tpl b/src/views/admin/settings/email.tpl index 3ba947f3ec..7158043a54 100644 --- a/src/views/admin/settings/email.tpl +++ b/src/views/admin/settings/email.tpl @@ -1,29 +1,31 @@ -
    -
    -
    -
    -

    - Please ensure that you have installed a third-party emailer (e.g. PostageApp, Mailgun, Mandrill, SendGrid, etc), otherwise emails will not be sent by NodeBB -

    -
    - -

    - The following email address refers to the email that the recipient will see in the "From" and "Reply To" fields. -

    -
    -
    - -

    - The test email will be sent to the currently logged in user's email address. -

    -
    + + + +
    +
    +

    + Please ensure that you have installed a third-party emailer (e.g. PostageApp, Mailgun, Mandrill, SendGrid, etc), otherwise emails will not be sent by NodeBB +

    +
    + +

    + The following email address refers to the email that the recipient will see in the "From" and "Reply To" fields. +

    +
    -
    -
    - -
    -
    - -
    \ No newline at end of file + +

    + The test email will be sent to the currently logged in user's email address. +

    +
    +
    +
    +
    + +
    +
    + + + \ No newline at end of file diff --git a/src/views/admin/settings/footer.tpl b/src/views/admin/settings/footer.tpl new file mode 100644 index 0000000000..60fcd5523c --- /dev/null +++ b/src/views/admin/settings/footer.tpl @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/src/views/admin/settings/general.tpl b/src/views/admin/settings/general.tpl index c5b8e2cf9a..1b96583cde 100644 --- a/src/views/admin/settings/general.tpl +++ b/src/views/admin/settings/general.tpl @@ -1,51 +1,53 @@ -
    -
    -
    - - + -
    - -
    +
    + + + - - -

    - If no browser title is specified, the site title will be used -

    - - -
    - - -
    - - -
    -

    - -
    -
    -

    - -
    -
    - -
    -
    - -
    -
    - -
    - +
    +
    -
    \ No newline at end of file + + + +

    + If no browser title is specified, the site title will be used +

    + + +
    + + +
    + + +
    +

    + +
    +
    +

    + +
    +
    + +
    +
    + +
    +
    + +
    + +
    + + \ No newline at end of file diff --git a/src/views/admin/settings/header.tpl b/src/views/admin/settings/header.tpl new file mode 100644 index 0000000000..ab1605fb53 --- /dev/null +++ b/src/views/admin/settings/header.tpl @@ -0,0 +1,17 @@ +

    Settings

    +
    + + + +
    \ No newline at end of file diff --git a/src/views/admin/settings/pagination.tpl b/src/views/admin/settings/pagination.tpl index 5df5324e0c..d423329cd1 100644 --- a/src/views/admin/settings/pagination.tpl +++ b/src/views/admin/settings/pagination.tpl @@ -1,16 +1,18 @@ - \ No newline at end of file +
    +
    +
    + +
    + + Topics per Page

    + Posts per Page

    +
    + Initial Number of Topics to Load (Unread, Recent, Popular etc.)

    +
    +
    + + \ No newline at end of file diff --git a/src/views/admin/settings/post.tpl b/src/views/admin/settings/post.tpl index 609c032d57..cd328a41ad 100644 --- a/src/views/admin/settings/post.tpl +++ b/src/views/admin/settings/post.tpl @@ -1,61 +1,63 @@ -
    -
    -
    -
    - - -
    + - Seconds between Posts

    - Seconds before new user can post

    - Minimum Title Length

    - Maximum Title Length

    - Minimum Post Length

    -
    - -
    - Chat Message Inbox Size

    -
    - -
    - Maximum File Size

    + +
    +
    + + +
    -
    - -
    - Topic Thumb Size

    + Seconds between Posts

    + Seconds before new user can post

    + Minimum Title Length

    + Maximum Title Length

    + Minimum Post Length

    +
    + +
    + Chat Message Inbox Size

    +
    + +
    + Maximum File Size

    -

    Composer Settings

    -

    - The following settings govern the functionality and/or appearance of the post composer shown - to users when they create new topics, or reply to existing topics. -

    -
    - -
    -
    - -
    -
    - - -
    -
    - -
    \ No newline at end of file +
    + +
    + Topic Thumb Size

    + +

    Composer Settings

    +

    + The following settings govern the functionality and/or appearance of the post composer shown + to users when they create new topics, or reply to existing topics. +

    +
    + +
    +
    + +
    +
    + + +
    +
    + + + \ No newline at end of file diff --git a/src/views/admin/settings/reputation.tpl b/src/views/admin/settings/reputation.tpl new file mode 100644 index 0000000000..5290338f2b --- /dev/null +++ b/src/views/admin/settings/reputation.tpl @@ -0,0 +1,36 @@ + + +
    +
    +
    + +
    +
    + +
    +
    + +
    +

    Privilege Thresholds

    +

    Use privilege thresholds to manage how much reputation a user must gain to receive moderator access.


    + Manage Thread

    + Manage Content

    +
    + +
    +
    + +
    +

    Activity Thresholds

    + Minimum reputation to downvote posts

    + Minimum reputation to flag posts

    +
    + + + \ No newline at end of file diff --git a/src/views/admin/settings/sockets.tpl b/src/views/admin/settings/sockets.tpl index e2aef70383..2ec1ef7543 100644 --- a/src/views/admin/settings/sockets.tpl +++ b/src/views/admin/settings/sockets.tpl @@ -1,21 +1,23 @@ -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    - -
    -

    - Leave blank if unsure. -

    -
    -
    -
    -
    \ No newline at end of file + + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +

    + Leave blank if unsure. +

    +
    +
    +
    + + \ No newline at end of file diff --git a/src/views/admin/settings/tags.tpl b/src/views/admin/settings/tags.tpl index d81eef59bb..22102c6f50 100644 --- a/src/views/admin/settings/tags.tpl +++ b/src/views/admin/settings/tags.tpl @@ -1,9 +1,11 @@ -
    -
    -
    - Tags per Topic

    - Minimum Tag Length

    - Maximum Tag Length

    -
    -
    -
    \ No newline at end of file + + +
    +
    + Tags per Topic

    + Minimum Tag Length

    + Maximum Tag Length

    +
    +
    + + \ No newline at end of file diff --git a/src/views/admin/settings/user.tpl b/src/views/admin/settings/user.tpl index 2a8819ced8..0d57146d0f 100644 --- a/src/views/admin/settings/user.tpl +++ b/src/views/admin/settings/user.tpl @@ -1,117 +1,119 @@ -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -

    Avatars

    -
    - -
    + -
    - - -
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +

    Avatars

    +
    + +
    -
    - -
    - -
    +
    + + +
    -
    - - -
    +
    + +
    + +
    + +
    + + +
    -

    Account Protection

    -
    - - -

    - If login attempts to a user's account exceeds this threshold, that account will be locked for a pre-configured amount of time -

    -
    -
    - - -
    -
    - - -
    +

    Account Protection

    +
    + + +

    + If login attempts to a user's account exceeds this threshold, that account will be locked for a pre-configured amount of time +

    +
    +
    + + +
    +
    + + +
    -

    Other

    -
    - - -
    -
    -
    - -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - -
    \ No newline at end of file +

    Other

    +
    + + +
    +
    +
    + +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + + \ No newline at end of file diff --git a/src/views/admin/settings/web-crawler.tpl b/src/views/admin/settings/web-crawler.tpl index b362d73605..fcce325825 100644 --- a/src/views/admin/settings/web-crawler.tpl +++ b/src/views/admin/settings/web-crawler.tpl @@ -1,23 +1,25 @@ -
    -
    -
    - Custom Robots.txt Leave blank for default
    - -
    + -
    - Feeds -
    - -
    + +
    + Custom Robots.txt Leave blank for default
    + +
    -
    - -
    -
    -
    -
    \ No newline at end of file +
    + Feeds +
    + +
    + +
    + +
    +
    + + + \ No newline at end of file