diff --git a/clientapp/pages/groupchat.js b/clientapp/pages/groupchat.js index 3189225..58f20fe 100644 --- a/clientapp/pages/groupchat.js +++ b/clientapp/pages/groupchat.js @@ -10,7 +10,7 @@ var Message = require('../views/mucMessage'); var MessageModel = require('../models/message'); var embedIt = require('../helpers/embedIt'); var htmlify = require('../helpers/htmlify'); - +var tempSubject = ''; module.exports = BasePage.extend({ template: templates.pages.groupchat, @@ -29,7 +29,10 @@ module.exports = BasePage.extend({ 'keydown textarea': 'handleKeyDown', 'keyup textarea': 'handleKeyUp', 'click .joinRoom': 'handleJoin', - 'click .leaveRoom': 'handleLeave' + 'click .leaveRoom': 'handleLeave', + 'click .status': 'clickStatusChange', + 'blur .status': 'blurStatusChange', + 'keydown .status': 'keyDownStatusChange' }, classBindings: { joined: '.controls' @@ -211,6 +214,22 @@ module.exports = BasePage.extend({ handleLeave: function () { this.model.leave(); }, + clickStatusChange: function (e) { + tempSubject = e.target.textContent; + }, + blurStatusChange: function (e) { + var subject = e.target.textContent; + if (subject == '') + subject = true; + client.setSubject(this.model.jid, subject); + e.target.textContent = tempSubject; + }, + keyDownStatusChange: function (e) { + if (e.which === 13 && !e.shiftKey) { + e.target.blur(); + return false; + } + }, appendModel: function (model, preload) { var self = this; var isGrouped = model.shouldGroupWith(this.lastModel); diff --git a/clientapp/templates.js b/clientapp/templates.js index 2b7f77a..0b72fbc 100644 --- a/clientapp/templates.js +++ b/clientapp/templates.js @@ -479,7 +479,7 @@ exports.pages.chat = function anonymous(locals) { exports.pages.groupchat = function anonymous(locals) { var buf = []; with (locals || {}) { - buf.push('

'); + buf.push('

'); } return buf.join(""); }; diff --git a/clientapp/templates/pages/groupchat.jade b/clientapp/templates/pages/groupchat.jade index 48a7f1d..335cd62 100644 --- a/clientapp/templates/pages/groupchat.jade +++ b/clientapp/templates/pages/groupchat.jade @@ -3,7 +3,7 @@ section.page.chat header.online h1 span.name - span.status + span.status(contenteditable="true") .controls button.primary.small.joinRoom Join button.secondary.small.leaveRoom Leave diff --git a/public/css/otalk.css b/public/css/otalk.css index f8393c3..b498762 100644 --- a/public/css/otalk.css +++ b/public/css/otalk.css @@ -1048,10 +1048,25 @@ button.secondary:hover:not(:disabled) { text-overflow: ellipsis; transition: all 0.25s; display: inline-block; + -webkit-touch-callout: initial; + -webkit-user-select: initial; + -khtml-user-select: initial; + -moz-user-select: initial; + -ms-user-select: initial; + user-select: initial; +} +.conversation header .status:empty:before { + content: '- No subject'; } .conversation header .status:not(:empty):before { content: '- '; } +.conversation header .status:before, +.conversation header .status:empty:focus:before { + content: '-'; + padding-left: 5px; + padding-right: 5px; +} .conversation header .tzo:not(:empty) { position: absolute; right: 15px; diff --git a/public/css/pages/chat.styl b/public/css/pages/chat.styl index 445926e..3c726ec 100644 --- a/public/css/pages/chat.styl +++ b/public/css/pages/chat.styl @@ -122,10 +122,20 @@ text-overflow: ellipsis transition: all .25s display: inline-block + allowselect() + + &:empty:before + content: '- No subject' &:not(:empty):before content: '- ' + &:before, + &:empty:focus:before + content: '-' + padding-left: 5px + padding-right: 5px + .tzo:not(:empty) position: absolute right: 15px