From f98e3aaf6434775650ee7447f99c59c197fadd07 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 25 Sep 2014 13:12:51 -0400 Subject: [PATCH] segregated the "theme" route (now "appearance") into their own separate routes --- public/src/forum/admin/footer.js | 12 ++ public/src/forum/admin/settings.js | 10 -- src/controllers/admin.js | 20 ++- src/routes/admin.js | 2 +- src/views/admin/appearance/customise.tpl | 37 +++++ src/views/admin/appearance/footer.tpl | 14 ++ src/views/admin/appearance/header.tpl | 12 ++ src/views/admin/appearance/skins.tpl | 19 +++ src/views/admin/appearance/themes.tpl | 13 ++ src/views/admin/appearance/widgets.tpl | 105 +++++++++++++ src/views/admin/header.tpl | 2 +- src/views/admin/themes.tpl | 180 ----------------------- 12 files changed, 230 insertions(+), 196 deletions(-) create mode 100644 src/views/admin/appearance/customise.tpl create mode 100644 src/views/admin/appearance/footer.tpl create mode 100644 src/views/admin/appearance/header.tpl create mode 100644 src/views/admin/appearance/skins.tpl create mode 100644 src/views/admin/appearance/themes.tpl create mode 100644 src/views/admin/appearance/widgets.tpl delete mode 100644 src/views/admin/themes.tpl diff --git a/public/src/forum/admin/footer.js b/public/src/forum/admin/footer.js index 9459ab2b06..c2f02bcb80 100644 --- a/public/src/forum/admin/footer.js +++ b/public/src/forum/admin/footer.js @@ -21,8 +21,20 @@ define('forum/admin/footer', ['forum/admin/settings'], function(Settings) { setupACPSearch(); }); + + $(window).on('action:ajaxify.end', function() { + setupPills(); + }); }); + function setupPills() { + $('.nav-pills li').removeClass('active'); + + var slug = window.location.href.split('/'); + slug = slug[slug.length-1]; + $('.nav-pills [data-pill="' + slug + '"]').addClass('active'); + } + function setupACPSearch() { var menu = $('#acp-search .dropdown-menu'); diff --git a/public/src/forum/admin/settings.js b/public/src/forum/admin/settings.js index 2b59883d17..5d7b105250 100644 --- a/public/src/forum/admin/settings.js +++ b/public/src/forum/admin/settings.js @@ -17,8 +17,6 @@ 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, @@ -127,14 +125,6 @@ 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 e2dba6bc7b..26830961a1 100644 --- a/src/controllers/admin.js +++ b/src/controllers/admin.js @@ -21,7 +21,7 @@ var adminController = { tags: {}, topics: {}, groups: {}, - themes: {}, + appearance: {}, events: {}, database: {}, plugins: {}, @@ -214,7 +214,19 @@ adminController.logger.get = function(req, res, next) { res.render('admin/logger', {}); }; -adminController.themes.get = function(req, res, next) { +adminController.appearance.get = function(req, res, next) { + var term = req.params.term ? req.params.term : 'themes'; + + if (term === 'widgets') { + renderWidgets(req, res, next); + } else { + res.render('admin/appearance/' + term, {}); + } +}; + + +// todo: move to extend +function renderWidgets(req, res, next) { async.parallel({ areas: function(next) { var defaultAreas = [ @@ -264,14 +276,14 @@ adminController.themes.get = function(req, res, next) { }); }); - res.render('admin/themes', { + res.render('admin/appearance/widgets', { templates: templates, areas: widgetData.areas, widgets: widgetData.widgets }); }); }); -}; +} adminController.groups.get = function(req, res, next) { groups.list({ diff --git a/src/routes/admin.js b/src/routes/admin.js index 27ec8fcd06..4a56a37564 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -39,7 +39,7 @@ function addRoutes(router, middleware, controllers) { //main router.get('/index', controllers.admin.home); router.get('/plugins', controllers.admin.plugins.get); - router.get('/themes', controllers.admin.themes.get); + router.get('/appearance/:term?', controllers.admin.appearance.get); router.get('/languages', controllers.admin.languages.get); router.get('/groups', controllers.admin.groups.get); router.get('/sounds', controllers.admin.sounds.get); diff --git a/src/views/admin/appearance/customise.tpl b/src/views/admin/appearance/customise.tpl new file mode 100644 index 0000000000..5e1fbdd546 --- /dev/null +++ b/src/views/admin/appearance/customise.tpl @@ -0,0 +1,37 @@ + + +
+

Custom CSS

+

+ You may also opt to enter your own CSS declarations here, which will be applied after all other styles. +

+ + +
+
+ +
+
+ +

Custom Header

+

+ You can enter custom HTML here (ex. JavaScript, Meta Tags, etc.) which will be appended to the <head> section of your forum's markup. +

+ + +
+
+ +
+
+ + +
+ + \ No newline at end of file diff --git a/src/views/admin/appearance/footer.tpl b/src/views/admin/appearance/footer.tpl new file mode 100644 index 0000000000..13eab70ff4 --- /dev/null +++ b/src/views/admin/appearance/footer.tpl @@ -0,0 +1,14 @@ + + + + \ No newline at end of file diff --git a/src/views/admin/appearance/header.tpl b/src/views/admin/appearance/header.tpl new file mode 100644 index 0000000000..6791886077 --- /dev/null +++ b/src/views/admin/appearance/header.tpl @@ -0,0 +1,12 @@ +

Appearance

+
+ +
+ + +
\ No newline at end of file diff --git a/src/views/admin/appearance/skins.tpl b/src/views/admin/appearance/skins.tpl new file mode 100644 index 0000000000..564159c026 --- /dev/null +++ b/src/views/admin/appearance/skins.tpl @@ -0,0 +1,19 @@ + + +
+

Bootswatch Themes

+

+ NodeBB's skins are powered by Bootswatch, a repository containing themes built + with Bootstrap as a base theme. Currently, the Vanilla base theme is best optimized for use with Bootswatch. +

+
    +
  • Loading Themes
  • +
+ +

Revert to Default

+

+ This will remove any custom theme applied to your NodeBB, and restore the base theme. +

+
+ + \ No newline at end of file diff --git a/src/views/admin/appearance/themes.tpl b/src/views/admin/appearance/themes.tpl new file mode 100644 index 0000000000..6592487acd --- /dev/null +++ b/src/views/admin/appearance/themes.tpl @@ -0,0 +1,13 @@ + + +
+

Installed Themes

+

+ The following themes are currently installed in this NodeBB instance. +

+
    +
  • Checking for installed themes...
  • +
+
+ + \ No newline at end of file diff --git a/src/views/admin/appearance/widgets.tpl b/src/views/admin/appearance/widgets.tpl new file mode 100644 index 0000000000..2ec99e9a23 --- /dev/null +++ b/src/views/admin/appearance/widgets.tpl @@ -0,0 +1,105 @@ + + +
+

Widgets

+ +
+
+ + +
+ +
+ +
+

{templates.areas.name} {templates.template} / {templates.areas.location}

+
+ +
+
+ +
+ +
+ + +
+
+
+

Available Widgets Drag and drop widgets into templates

+ +
No widgets found! Activate the essential widgets plugin in the plugins control panel.
+ +
+ +
+
+
+ {widgets.name} +
{widgets.description}
+
+ +
+
+ +
+
+
+
+

Available Containers Drag and drop on top of any widget

+
+
+ None +
+
+ Well +
+
+ Jumbotron +
+
+
+ Panel +
+
+
+
+ Panel Header +
+ + + + + + +
+
+
+ Panel Body +
+
+ +
+ Alert +
+ + + + +
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/views/admin/header.tpl b/src/views/admin/header.tpl index e6e5da49b7..37a82c1f90 100644 --- a/src/views/admin/header.tpl +++ b/src/views/admin/header.tpl @@ -111,7 +111,7 @@
  • Users
  • Groups
  • Settings
  • -
  • Themes
  • +
  • Appearance
  • Plugins
  • Languages
  • Sounds
  • diff --git a/src/views/admin/themes.tpl b/src/views/admin/themes.tpl deleted file mode 100644 index 298a85c747..0000000000 --- a/src/views/admin/themes.tpl +++ /dev/null @@ -1,180 +0,0 @@ -

    Themes

    -
    - -
    - - -
    -
    -

    Installed Themes

    -

    - The following themes are currently installed in this NodeBB instance. -

    -
      -
    • Checking for installed themes...
    • -
    -
    -
    -

    Bootswatch Themes

    -

    - NodeBB's skins are powered by Bootswatch, a repository containing themes built - with Bootstrap as a base theme. Currently, the Vanilla base theme is best optimized for use with Bootswatch. -

    -
      -
    • Loading Themes
    • -
    - -

    Revert to Default

    -

    - This will remove any custom theme applied to your NodeBB, and restore the base theme. -

    -
    -
    -

    Custom CSS

    -

    - You may also opt to enter your own CSS declarations here, which will be applied after all other styles. -

    - - -
    -
    - -
    -
    - -

    Custom Header

    -

    - You can enter custom HTML here (ex. JavaScript, Meta Tags, etc.) which will be appended to the <head> section of your forum's markup. -

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

    Widgets

    - -
    -
    - - -
    - -
    - -
    -

    {templates.areas.name} {templates.template} / {templates.areas.location}

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

    Available Widgets Drag and drop widgets into templates

    - -
    No widgets found! Activate the essential widgets plugin in the plugins control panel.
    - -
    - -
    -
    -
    - {widgets.name} -
    {widgets.description}
    -
    - -
    -
    - -
    -
    -
    -
    -

    Available Containers Drag and drop on top of any widget

    -
    -
    - None -
    -
    - Well -
    -
    - Jumbotron -
    -
    -
    - Panel -
    -
    -
    -
    - Panel Header -
    - - - - - - -
    -
    -
    - Panel Body -
    -
    - -
    - Alert -
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    - - \ No newline at end of file