From 41d7ec3c0c9a613b3fb2c2e66a13dd30b4e19e36 Mon Sep 17 00:00:00 2001 From: pichalite Date: Tue, 13 Dec 2016 22:04:15 +0000 Subject: [PATCH 01/11] Quick reply option --- less/topic.less | 45 +++++++++++++++++++++++ lib/modules/quickreply.js | 47 +++++++++++++++++++++++++ lib/persona.js | 11 ++++++ library.js | 17 +++++++++ plugin.json | 4 ++- templates/admin/plugins/persona.tpl | 6 ++++ templates/partials/topic/quickreply.tpl | 18 ++++++++++ templates/topic.tpl | 6 +++- 8 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 lib/modules/quickreply.js create mode 100644 templates/partials/topic/quickreply.tpl diff --git a/less/topic.less b/less/topic.less index 60ff503..642dddf 100644 --- a/less/topic.less +++ b/less/topic.less @@ -273,6 +273,51 @@ margin-left: 0; } } + + .quick-reply { + .icon { + position: relative; + border-radius: 50%; + min-width: 46px; + min-height: 46px; + margin-top: 2px; + + > a > .status { + position: absolute; + right: 12px; + font-size: 12px; + top: 0px; + + @media (min-width: @screen-md-min) { + top: 2px; + font-size: 16px; + } + } + + img, .user-icon { + margin-right: 15px; + .user-icon-style(46px, 2.4rem, 50%); + } + } + + .quickreply-message { + margin-left: 61px; + margin-bottom: 5px; + + @media (max-width: @screen-sm-max) { + margin-left: 0; + + [component="topic/quickreply/text"] { + font-size: 16px; + padding: 10px; + } + } + } + + [component="topic/quickreply/button"] { + margin-bottom: 10px; + } + } } diff --git a/lib/modules/quickreply.js b/lib/modules/quickreply.js new file mode 100644 index 0000000..6ffa1b4 --- /dev/null +++ b/lib/modules/quickreply.js @@ -0,0 +1,47 @@ +"use strict"; + +/*globals $, app, ajaxify, socket*/ + +define('persona/quickreply', ['components'], function(components) { + var QuickReply = {}; + + QuickReply.init = function() { + + var element = components.get('topic/quickreply/text'); + var data = { + element: element, + strategies: [], + options: { + zIndex: 100, + listPosition: function(position) { + this.$el.css(this._applyPlacement(position)); + this.$el.css('position', 'absolute'); + return this; + } + } + }; + + $(window).trigger('composer:autocomplete:init', data); + data.element.textcomplete(data.strategies, data.options); + $('.textcomplete-wrapper').css('height', '100%').find('textarea').css('height', '100%'); + + components.get('topic/quickreply/button').on('click', function(e) { + var replyMsg = components.get('topic/quickreply/text').val(); + var replyData = { + tid: ajaxify.data.tid, + handle: undefined, + content: replyMsg + }; + + socket.emit('posts.reply', replyData, function(err, data) { + if (err) { + app.alertError(err.message); + } + + components.get('topic/quickreply/text').val(''); + }); + }); + }; + + return QuickReply; +}); \ No newline at end of file diff --git a/lib/persona.js b/lib/persona.js index 85f1a85..37f62a3 100644 --- a/lib/persona.js +++ b/lib/persona.js @@ -9,6 +9,7 @@ $(document).ready(function() { setupTaskbar(); setupEditedByIcon(); setupMobileMenu(); + setupQuickReply(); if (env === 'xs' || env ==='sm') { $(".navbar-fixed-top").autoHidingNavbar({ @@ -302,4 +303,14 @@ $(document).ready(function() { drop.css({top: y + 'px', left: x + 'px'}).addClass('animate'); }); } + + function setupQuickReply() { + $(window).on('action:ajaxify.end', function(ev, data) { + if (data.url && data.url.match('^topic/')) { + require(['persona/quickreply'], function(quickreply) { + quickreply.init(); + }); + } + }); + } }); \ No newline at end of file diff --git a/library.js b/library.js index 4495add..dde1728 100644 --- a/library.js +++ b/library.js @@ -2,6 +2,7 @@ var S = require.main.require('string'); var meta = module.parent.require('./meta'); +var user = module.parent.require('./user'); var library = {}; @@ -91,6 +92,7 @@ library.getThemeConfig = function(config, callback) { meta.settings.get('persona', function(err, settings) { config.hideSubCategories = settings.hideSubCategories === 'on'; config.hideCategoryLastPost = settings.hideCategoryLastPost === 'on'; + config.enableQuickReply = settings.enableQuickReply === 'on'; }); callback(false, config); @@ -100,4 +102,19 @@ function renderAdmin(req, res, next) { res.render('admin/plugins/persona', {}); } +library.addUserToTopic = function(data, callback) { + if (data.req.user) { + user.getUserData(data.req.user.uid, function(err, userdata) { + if (err) { + return callback(err); + } + + data.templateData.loggedInUser = userdata; + callback(null, data); + }); + } else { + callback(null, data); + } +}; + module.exports = library; \ No newline at end of file diff --git a/plugin.json b/plugin.json index d26f5cc..2aea4b9 100644 --- a/plugin.json +++ b/plugin.json @@ -6,13 +6,15 @@ { "hook": "filter:widgets.getAreas", "method": "defineWidgetAreas" }, { "hook": "filter:config.get", "method": "getThemeConfig" }, { "hook": "static:app.load", "method": "init" }, - { "hook": "filter:admin.header.build", "method": "addAdminNavigation" } + { "hook": "filter:admin.header.build", "method": "addAdminNavigation" }, + { "hook": "filter:topic.build", "method": "addUserToTopic" } ], "scripts": [ "lib/persona.js", "lib/modules/nprogress.js", "lib/modules/autohidingnavbar.min.js", "lib/modules/slideout.min.js", + "lib/modules/quickreply.js", "lib/client/chats.js" ], "acpScripts": [ diff --git a/templates/admin/plugins/persona.tpl b/templates/admin/plugins/persona.tpl index 37595d2..c0e16b6 100644 --- a/templates/admin/plugins/persona.tpl +++ b/templates/admin/plugins/persona.tpl @@ -14,6 +14,12 @@ Hide last post on categories view +
+ +
diff --git a/templates/partials/topic/quickreply.tpl b/templates/partials/topic/quickreply.tpl new file mode 100644 index 0000000..41345f4 --- /dev/null +++ b/templates/partials/topic/quickreply.tpl @@ -0,0 +1,18 @@ + +
+ +
+ +
+ +
+ \ No newline at end of file diff --git a/templates/topic.tpl b/templates/topic.tpl index 4d3f6c6..18cb539 100644 --- a/templates/topic.tpl +++ b/templates/topic.tpl @@ -32,7 +32,11 @@ - + + + + +
From d4b5f9c5ca2afde4fe5cc21ac0223dba60167ef3 Mon Sep 17 00:00:00 2001 From: Anil Mandepudi Date: Tue, 13 Dec 2016 14:06:59 -0800 Subject: [PATCH 02/11] Fix tabs --- lib/persona.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/persona.js b/lib/persona.js index 37f62a3..532603d 100644 --- a/lib/persona.js +++ b/lib/persona.js @@ -305,12 +305,12 @@ $(document).ready(function() { } function setupQuickReply() { - $(window).on('action:ajaxify.end', function(ev, data) { - if (data.url && data.url.match('^topic/')) { - require(['persona/quickreply'], function(quickreply) { - quickreply.init(); - }); - } - }); - } -}); \ No newline at end of file + $(window).on('action:ajaxify.end', function(ev, data) { + if (data.url && data.url.match('^topic/')) { + require(['persona/quickreply'], function(quickreply) { + quickreply.init(); + }); + } + }); + } +}); From 888577ab244df6634f569d6d25ab6a80a55223f4 Mon Sep 17 00:00:00 2001 From: Anil Mandepudi Date: Tue, 13 Dec 2016 14:09:14 -0800 Subject: [PATCH 03/11] Fix tabs --- lib/modules/quickreply.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/lib/modules/quickreply.js b/lib/modules/quickreply.js index 6ffa1b4..b7f322f 100644 --- a/lib/modules/quickreply.js +++ b/lib/modules/quickreply.js @@ -15,8 +15,8 @@ define('persona/quickreply', ['components'], function(components) { zIndex: 100, listPosition: function(position) { this.$el.css(this._applyPlacement(position)); - this.$el.css('position', 'absolute'); - return this; + this.$el.css('position', 'absolute'); + return this; } } }; @@ -25,23 +25,22 @@ define('persona/quickreply', ['components'], function(components) { data.element.textcomplete(data.strategies, data.options); $('.textcomplete-wrapper').css('height', '100%').find('textarea').css('height', '100%'); - components.get('topic/quickreply/button').on('click', function(e) { - var replyMsg = components.get('topic/quickreply/text').val(); - var replyData = { + components.get('topic/quickreply/button').on('click', function(e) { + var replyMsg = components.get('topic/quickreply/text').val(); + var replyData = { tid: ajaxify.data.tid, handle: undefined, content: replyMsg }; - + socket.emit('posts.reply', replyData, function(err, data) { - if (err) { - app.alertError(err.message); - } - - components.get('topic/quickreply/text').val(''); + if (err) { + app.alertError(err.message); + } + components.get('topic/quickreply/text').val(''); }); - }); - }; + }); + }; return QuickReply; -}); \ No newline at end of file +}); From a048d06da56092580c36aa885024ad19823818e3 Mon Sep 17 00:00:00 2001 From: Anil Mandepudi Date: Tue, 13 Dec 2016 14:09:57 -0800 Subject: [PATCH 04/11] Fix tabs --- library.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library.js b/library.js index dde1728..1280951 100644 --- a/library.js +++ b/library.js @@ -1,14 +1,14 @@ 'use strict'; var S = require.main.require('string'); -var meta = module.parent.require('./meta'); +var meta = module.parent.require('./meta'); var user = module.parent.require('./user'); var library = {}; library.init = function(params, callback) { var app = params.router; - var middleware = params.middleware; + var middleware = params.middleware; app.get('/admin/plugins/persona', middleware.admin.buildHeader, renderAdmin); app.get('/api/admin/plugins/persona', renderAdmin); @@ -117,4 +117,4 @@ library.addUserToTopic = function(data, callback) { } }; -module.exports = library; \ No newline at end of file +module.exports = library; From 152c01a2fd24b7201ffdf818d6113a5c33c701d4 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 20 Dec 2016 15:35:20 -0500 Subject: [PATCH 05/11] 4.1.91 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a81c9a4..2c83738 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodebb-theme-persona", - "version": "4.1.90", + "version": "4.1.91", "nbbpm": { "compatibility": "^0.8.2 || ^0.9.0 || ^1.0.0" }, From 4080ac865b8754c6de68bb887e9c5b2af9968098 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 20 Dec 2016 17:01:18 -0500 Subject: [PATCH 06/11] 4.1.92 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2c83738..da19615 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodebb-theme-persona", - "version": "4.1.91", + "version": "4.1.92", "nbbpm": { "compatibility": "^0.8.2 || ^0.9.0 || ^1.0.0" }, From 78961fa2c20c065c892c4af5e48d4fe5ed762778 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 22 Dec 2016 11:21:03 +0300 Subject: [PATCH 07/11] use move cursor --- less/category.less | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/less/category.less b/less/category.less index c1e2c55..3514aa6 100644 --- a/less/category.less +++ b/less/category.less @@ -23,6 +23,12 @@ opacity: 0.30; } + &.pinned { + [component="topic/pinned"] { + cursor: move; + } + } + .select { position: relative; .pointer; @@ -65,14 +71,14 @@ .user-img, .user-icon { opacity: 0; } - + .fa-check { border: 1px solid @brand-primary; color: @brand-primary; opacity: 1; } } - + &.selected { .select .user-img, .select .user-icon { opacity: 0; From b4535f21812ca1d13c9adee0eb60f44cc20fb778 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 22 Dec 2016 11:21:43 +0300 Subject: [PATCH 08/11] 4.1.93 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index da19615..e4633b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodebb-theme-persona", - "version": "4.1.92", + "version": "4.1.93", "nbbpm": { "compatibility": "^0.8.2 || ^0.9.0 || ^1.0.0" }, From e988f470e94f6c739afce20ea53b4c2129c071a6 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 23 Dec 2016 16:56:30 +0300 Subject: [PATCH 09/11] closes https://github.com/NodeBB/NodeBB/issues/5308 --- templates/partials/chats/recent_room.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/partials/chats/recent_room.tpl b/templates/partials/chats/recent_room.tpl index 3acf5a1..b75d255 100644 --- a/templates/partials/chats/recent_room.tpl +++ b/templates/partials/chats/recent_room.tpl @@ -24,6 +24,8 @@ + {rooms.teaser.content} + \ No newline at end of file From 7405f560bb480bfac15b8a6eeb5531b61f62073d Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 23 Dec 2016 16:58:04 +0300 Subject: [PATCH 10/11] 5.1.58 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e4633b0..b0c8015 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodebb-theme-persona", - "version": "4.1.93", + "version": "5.1.58", "nbbpm": { "compatibility": "^0.8.2 || ^0.9.0 || ^1.0.0" }, From 09e1eb01c4349e50ee874e7c1df91e9f6177d423 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 23 Dec 2016 16:59:48 +0300 Subject: [PATCH 11/11] 4.1.94 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b0c8015..9442ae5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodebb-theme-persona", - "version": "5.1.58", + "version": "4.1.94", "nbbpm": { "compatibility": "^0.8.2 || ^0.9.0 || ^1.0.0" },