From 3192236e32e2cdeef64f3c2fd1fd268a5c732ab7 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Tue, 26 May 2015 23:05:12 -0300 Subject: [PATCH 1/8] Init mentions feature --- client/stylesheets/base.less | 26 +++++++++++ client/views/app/chatWindowDashboard.coffee | 22 +++++++-- client/views/app/chatWindowDashboard.html | 3 ++ client/views/app/message-popup.coffee | 49 +++++++++++++++++++++ client/views/app/message-popup.html | 14 ++++++ 5 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 client/views/app/message-popup.coffee create mode 100644 client/views/app/message-popup.html diff --git a/client/stylesheets/base.less b/client/stylesheets/base.less index 042dfd5ebafba..b8785c748ec43 100644 --- a/client/stylesheets/base.less +++ b/client/stylesheets/base.less @@ -1402,6 +1402,32 @@ a.github-fork { left: 0; width: 100%; } + .message-popup { + position: absolute; + background: #FFF; + border: 1px solid #DDD; + z-index: 101; + bottom: 61px; + left: 20px; + right: 20px; + box-shadow: 0px 0px 10px #DDD; + border-radius: 5px 5px 0 0; + overflow: hidden; + .message-popup-title { + background-color: #FAFAFA; + border-bottom: 1px solid #EEE; + padding: 6px; + } + .popup-item { + padding: 6px; + border-bottom: 1px solid #fff; + &.selected { + background-color: #439ee1; + border-color: #2b80ba; + color: white; + } + } + } .message-form { > div { position: relative; diff --git a/client/views/app/chatWindowDashboard.coffee b/client/views/app/chatWindowDashboard.coffee index e3e46b89b825f..55e99115b1f08 100644 --- a/client/views/app/chatWindowDashboard.coffee +++ b/client/views/app/chatWindowDashboard.coffee @@ -250,6 +250,12 @@ Template.chatWindowDashboard.helpers else return t('chatWindowDashboard.See_all') + popupValue: -> + return Template.instance().popupValue + + popupOpen: -> + return Template.instance().popupOpen.get() + Template.chatWindowDashboard.events "click .flex-tab .more": (event) -> Session.set('flexOpened', !Session.get('flexOpened')) @@ -279,7 +285,7 @@ Template.chatWindowDashboard.events 'keydown .input-message': (event) -> console.log 'chatWindowDashboard.keydown.input-message',this._id if window.rocketDebug - ChatMessages.keydown(this._id, event) + ChatMessages.keydown(this._id, event, Template.instance()) 'keydown .input-message-editing': (event) -> console.log 'chatWindowDashboard.keydown.input-message-editing',this._id if window.rocketDebug @@ -403,6 +409,13 @@ Template.chatWindowDashboard.onCreated -> this.showUsersOffline = new ReactiveVar false + this.popupOpen = new ReactiveVar false + + this.popupValue = new ReactiveVar + + Tracker.autorun => + console.log this.popupValue.get() + Template.chatWindowDashboard.onRendered -> FlexTab.check() UserPop.init() @@ -528,7 +541,7 @@ ChatMessages = (-> Meteor.defer -> $('.input-message').select() - keydown = (rid, event) -> + keydown = (rid, event, template) -> input = event.currentTarget k = event.which resize(input) @@ -558,9 +571,12 @@ ChatMessages = (-> unless k in keyCodes startTyping(rid, input) - else if k is 38 # Arrow Up + else if k is 38 and template.popupOpen.curValue isnt true # Arrow Up startEditingLastMessage(rid, input) + if k is 50 and event.shiftKey is true + template.popupOpen.set true + keydownEditing = (id, event) -> input = event.currentTarget k = event.which diff --git a/client/views/app/chatWindowDashboard.html b/client/views/app/chatWindowDashboard.html index 75cc7884cba89..6d58041d690a4 100644 --- a/client/views/app/chatWindowDashboard.html +++ b/client/views/app/chatWindowDashboard.html @@ -53,6 +53,9 @@

{{_ "chatWindowDashboard.New_messages"}} + {{#if popupOpen}} + {{> messagePopup value=popupValue}} + {{/if}}