diff --git a/public/src/forum/admin/themes.js b/public/src/forum/admin/themes.js index 699796e36b..b608ae8646 100644 --- a/public/src/forum/admin/themes.js +++ b/public/src/forum/admin/themes.js @@ -102,6 +102,8 @@ define(['forum/admin/settings'], function(Settings) { tabIndent.config.tab = ' '; tabIndent.render(customCSSEl); + Themes.prepareWidgets(); + Settings.prepare(); } @@ -132,5 +134,27 @@ define(['forum/admin/settings'], function(Settings) { themeContainer.appendChild(themeFrag); } + Themes.prepareWidgets = function() { + $('#widgets .panel').draggable({ + helper: function(e) { + return $(e.target).parents('.panel').clone().addClass('block').width($(e.target.parentNode).width()); + }, + connectToSortable: ".widget-area" + }); + + $('#widgets .widget-area').sortable({ + update: function (event, ui) { + if (!ui.item.hasClass('block')) { + ui.item.addClass('block'); + ui.item.children('.panel-heading').append('
'); + } + + } + }).on('click', '.toggle-widget', function() { + $(this).parents('.panel').children('.panel-body').toggleClass('hidden'); + }); + + }; + return Themes; }); \ No newline at end of file diff --git a/public/templates/admin/themes.tpl b/public/templates/admin/themes.tpl index 7f867eff1c..ebd3816fc0 100644 --- a/public/templates/admin/themes.tpl +++ b/public/templates/admin/themes.tpl @@ -9,7 +9,7 @@
-
+

Installed Themes

The following themes are currently installed in this NodeBB instance. @@ -50,8 +50,44 @@

-
+

Widgets

+ +
+
+

Available Widgets

+
+
+
+ HTML Any text, html, or embedded script. +
+ +
+
+
+ Markdown Markdown formatted text +
+ +
+ + + +
+
+ +
+ +

{areas.name}

+
+ +
+ +
+
diff --git a/src/routes/admin.js b/src/routes/admin.js index e5d5a48f57..ceb2074d06 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -410,9 +410,9 @@ var nconf = require('nconf'), }); app.get('/themes', function (req, res) { - plugins.fireHook('filter:widgets.getAreas', [], function(err, widgets) { + plugins.fireHook('filter:widgets.getAreas', [], function(err, areas) { res.json(200, { - widgets: widgets + areas: areas }); }); });