Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move popups to another template, improve position and add completion … #92

Merged
merged 1 commit into from
Jun 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions client/stylesheets/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -1448,13 +1448,15 @@ a.github-fork {
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
.input-message-editing-container {
.calc(width, ~"100% - 16px");
}
.input-message-editing {
display: block;
resize: none;
display: block;
padding-top: 9px;
padding-bottom: 9px;
overflow-y: hidden;
.calc(width, ~"100% - 16px");
}
.edit-room-title {
color: @secondary-font-color;
Expand Down Expand Up @@ -1487,11 +1489,14 @@ a.github-fork {
width: 100%;
min-height: @footer-min-height;
}
.message-popup-position {
position: relative;
}
.message-popup {
position: absolute;
background: #FAFAFA;
z-index: 101;
bottom: @footer-min-height;
bottom: 0px;
left: 0px;
right: 0px;
overflow: hidden;
Expand Down
7 changes: 7 additions & 0 deletions client/views/app/chatMessageDashboard.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ Template.chatMessageDashboard.helpers
text = text.replace(/#/g, '\\#')
return text

getPupupConfig: ->
template = Template.instance()
return {
getInput: ->
return template.find('.input-message-editing')
}

Template.chatMessageDashboard.events
'mousedown .edit-message': ->
self = this
Expand Down
5 changes: 4 additions & 1 deletion client/views/app/chatMessageDashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
<i class="icon-pencil edit-message"></i>
</span>
{{#if isEditing}}
<textarea class="input-message-editing" contenteditable="true">{{message 'true'}}</textarea>
<div class="input-message-editing-container">
{{> messagePopupConfig getPupupConfig}}
<textarea class="input-message-editing" contenteditable="true">{{message 'true'}}</textarea>
</div>
{{else}}
<div>
{{#markdown}}{{#emojione}}{{message}}{{/emojione}}{{/markdown}}
Expand Down
60 changes: 3 additions & 57 deletions client/views/app/chatWindowDashboard.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -259,66 +259,12 @@ Template.chatWindowDashboard.helpers
else
return t('chatWindowDashboard.See_all')

popupUserConfig: ->
getPupupConfig: ->
template = Template.instance()
config =
title: 'People'
collection: Meteor.users
template: 'messagePopupUser'
getInput: ->
return template.find('.input-message')
getFilter: (collection, filter) ->
exp = new RegExp(filter, 'i')
return collection.find({username: {$exists: true}, $or: [{name: exp}, {username: exp}]}, {limit: 10})
getValue: (_id, collection) ->
return collection.findOne(_id)?.username

return config

popupChannelConfig: ->
template = Template.instance()
config =
title: 'Channels'
collection: ChatRoom
trigger: '#'
template: 'messagePopupChannel'
getInput: ->
return template.find('.input-message')
getFilter: (collection, filter) ->
return collection.find({t: 'c', name: new RegExp(filter, 'i')}, {limit: 10})
getValue: (_id, collection) ->
return collection.findOne(_id)?.name

return config

popupEmojiConfig: ->
template = Template.instance()
config =
title: 'Emoji'
collection: emojione.emojioneList
template: 'messagePopupEmoji'
trigger: ':'
prefix: ''
return {
getInput: ->
return template.find('.input-message')
getFilter: (collection, filter) ->
results = []
for shortname, data of collection
if shortname.indexOf(filter) > -1
results.push
_id: shortname
data: data

if results.length > 10
break

if filter.length >= 3
results.sort (a, b) ->
a.length > b.length

return results

return config
}


Template.chatWindowDashboard.events
Expand Down
2 changes: 1 addition & 1 deletion client/views/app/chatWindowDashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ <h2>
<span>{{_ "chatWindowDashboard.New_messages"}}</span>
</div>
</div>
{{> messagePopup popupEmojiConfig}} {{> messagePopup popupChannelConfig}} {{> messagePopup popupUserConfig}}
<footer class="footer">
<form class="message-form" method="post" action="/">
<div>
<!--input type="text" class="input-message" value="" /-->
{{> messagePopupConfig getPupupConfig}}
<textarea name="msg" class="input-message"></textarea>
<i class="icon-paper-plane" title="{{_ "chatWindowDashboard.Send_Message"}}"></i>
</div>
Expand Down
61 changes: 61 additions & 0 deletions client/views/app/message-popup-config.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Template.messagePopupConfig.helpers
popupUserConfig: ->
self = this
template = Template.instance()
config =
title: 'People'
collection: Meteor.users
template: 'messagePopupUser'
getInput: self.getInput
getFilter: (collection, filter) ->
exp = new RegExp(filter, 'i')
return collection.find({username: {$exists: true}, $or: [{name: exp}, {username: exp}]}, {limit: 10})
getValue: (_id, collection) ->
return collection.findOne(_id)?.username

return config

popupChannelConfig: ->
self = this
template = Template.instance()
config =
title: 'Channels'
collection: ChatRoom
trigger: '#'
template: 'messagePopupChannel'
getInput: self.getInput
getFilter: (collection, filter) ->
return collection.find({t: 'c', name: new RegExp(filter, 'i')}, {limit: 10})
getValue: (_id, collection) ->
return collection.findOne(_id)?.name

return config

popupEmojiConfig: ->
self = this
template = Template.instance()
config =
title: 'Emoji'
collection: emojione.emojioneList
template: 'messagePopupEmoji'
trigger: ':'
prefix: ''
getInput: self.getInput
getFilter: (collection, filter) ->
results = []
for shortname, data of collection
if shortname.indexOf(filter) > -1
results.push
_id: shortname
data: data

if results.length > 10
break

if filter.length >= 3
results.sort (a, b) ->
a.length > b.length

return results

return config
5 changes: 5 additions & 0 deletions client/views/app/message-popup-config.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template name="messagePopupConfig">
{{> messagePopup popupEmojiConfig}}
{{> messagePopup popupChannelConfig}}
{{> messagePopup popupUserConfig}}
</template>
22 changes: 12 additions & 10 deletions client/views/app/message-popup.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<template name="messagePopup">
{{#if isOpen}}
<div class="message-popup">
<div class="message-popup-title">
{{title}}
</div>
<div>
{{#each data}}
<div class="popup-item" data-id="{{_id}}">
{{> Template.dynamic template=../template}}
</div>
{{/each}}
<div class="message-popup-position">
<div class="message-popup">
<div class="message-popup-title">
{{title}}
</div>
<div>
{{#each data}}
<div class="popup-item" data-id="{{_id}}">
{{> Template.dynamic template=../template}}
</div>
{{/each}}
</div>
</div>
</div>
{{/if}}
Expand Down