From 34a2444f075c7687df79c9e52c014f30b08e5146 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Sat, 27 Sep 2014 12:34:46 -0400 Subject: [PATCH] refactored admin/tags a bit, now inputs are hidden behind a modal so we can see moar tags --- public/less/admin/admin.less | 8 +++++-- public/src/forum/admin/tags.js | 43 ++++++++++++++++++++++++++++++++-- src/views/admin/tags.tpl | 23 ++++++++---------- 3 files changed, 57 insertions(+), 17 deletions(-) diff --git a/public/less/admin/admin.less b/public/less/admin/admin.less index c6df594ab9..db65892ef3 100644 --- a/public/less/admin/admin.less +++ b/public/less/admin/admin.less @@ -478,10 +478,14 @@ } .tag-row { - a { + padding: 5px; + float: left; + + .tag-item { + cursor: pointer; display: inline-block; margin-top: 22px; - font-size: 28px; + font-size: 11px; } } diff --git a/public/src/forum/admin/tags.js b/public/src/forum/admin/tags.js index 965ae0db13..1e51f827af 100644 --- a/public/src/forum/admin/tags.js +++ b/public/src/forum/admin/tags.js @@ -1,5 +1,5 @@ "use strict"; -/*global define, socket, app, admin, utils*/ +/*global define, socket, app, admin, utils, bootbox, RELATIVE_PATH*/ define('forum/admin/tags', ['forum/infinitescroll'], function(infinitescroll) { var Tags = {}; @@ -30,6 +30,45 @@ define('forum/admin/tags', ['forum/infinitescroll'], function(infinitescroll) { }); }, 100); }); + + $('.tag-item').on('click', function(ev) { + var tagName = $(this).text(), + tag = $(this), + row = tag.parents('.tag-row'); + + bootbox.dialog({ + title: "Editing " + tagName + " tag", + message: $(this).parents('.tag-row').find('.tag-modal').html(), + buttons: { + success: { + label: "Save", + className: "btn-primary save", + callback: function() { + var modal = $('.bootbox'), + bgColor = modal.find('[data-name="bgColor"]').val(), + color = modal.find('[data-name="color"]').val(); + + row.find('[data-name="bgColor"]').val(bgColor); + row.find('[data-name="color"]').val(color); + row.find('.tag-item').css('background-color', bgColor).css('color', color); + + save(tag); + } + }, + info: { + label: "Click to view topics tagged \"" + tagName + "\"", + className: "btn-info", + callback: function() { + window.open(RELATIVE_PATH + '/tags/' + tagName); + } + } + } + }); + + setTimeout(function() { + handleColorPickers(); + }, 500); // bootbox made me do it. + }); }; function handleColorPickers() { @@ -58,7 +97,7 @@ define('forum/admin/tags', ['forum/infinitescroll'], function(infinitescroll) { bgColor : tagRow.find('[data-name="bgColor"]').val(), color : tagRow.find('[data-name="color"]').val() }; - + console.log(data); socket.emit('admin.tags.update', data, function(err) { if (err) { return app.alertError(err.message); diff --git a/src/views/admin/tags.tpl b/src/views/admin/tags.tpl index 00bf4675e7..17e45113cf 100644 --- a/src/views/admin/tags.tpl +++ b/src/views/admin/tags.tpl @@ -9,28 +9,25 @@
+

Click on a tag to modify its background and text colours

-
-
- {tags.value}{tags.score} +
+
+ {tags.value}{tags.score}
- -
+ -
-
- - +
+
+ + +
-
- -