Improved chat.
This commit is contained in:
parent
afc3062150
commit
d7593124c8
5 changed files with 13 additions and 23 deletions
|
@ -30,7 +30,6 @@ class App.ChatWidget extends App.Controller
|
|||
|
||||
@render()
|
||||
@hide()
|
||||
@interval @position, 200, 'chat-widget'
|
||||
|
||||
App.Event.bind(
|
||||
'chat:message'
|
||||
|
@ -62,6 +61,9 @@ class App.ChatWidget extends App.Controller
|
|||
App.Event.bind(
|
||||
'chat:message_new'
|
||||
(e) =>
|
||||
|
||||
# show new message info
|
||||
@newMessage = false
|
||||
@el.find('div.well').removeClass('alert-success')
|
||||
)
|
||||
|
||||
|
@ -157,22 +159,6 @@ class App.ChatWidget extends App.Controller
|
|||
if @newMessage
|
||||
@el.find('div.well').addClass('alert-success')
|
||||
|
||||
position: =>
|
||||
chatHeigth = $(@el).find('div').height()
|
||||
chatWidth = $(@el).find('div').width()
|
||||
documentHeigth = $(document).height()
|
||||
documentWidth = $(document).width()
|
||||
windowHeigth = $(window).height()
|
||||
windowWidth = $(window).width()
|
||||
scrollPositonY = window.pageYOffset
|
||||
scrollPositonX = window.pageXOffset
|
||||
|
||||
heigth = windowHeigth + scrollPositonY - chatHeigth - 15
|
||||
width = windowWidth - chatWidth - 55
|
||||
|
||||
@el.offset( left: width, top: heigth )
|
||||
@el.css( width: '200px' )
|
||||
|
||||
submitMessage: (e) ->
|
||||
e.preventDefault()
|
||||
message = $(e.target).find('[name=chat_message]').val()
|
||||
|
|
|
@ -58,7 +58,7 @@ class App.TextModuleUI extends App.Controller
|
|||
@uiWidget.el.offset( left: left + width + 20, top: top )
|
||||
|
||||
# update window possition every x ms
|
||||
ui.interval( update, 150, 'text_module_box' )
|
||||
ui.interval( update, 100, 'text_module_box' )
|
||||
)
|
||||
inputElement.bind('focusout', ->
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="well well-demand span3">
|
||||
<div class="well well-chat span3">
|
||||
<h4><%- @T('Chat') %><a href="#" class="close">×</a></h4>
|
||||
<div id="chat_content" <% if !@isShown: %>class="hide"<% end %>>
|
||||
<div id="chat_log_container" class="max-size-scroll">
|
||||
|
|
8
app/assets/stylesheets/custom/chat.css
Normal file
8
app/assets/stylesheets/custom/chat.css
Normal file
|
@ -0,0 +1,8 @@
|
|||
#chat {
|
||||
position: fixed; bottom: 0; right: 0;
|
||||
}
|
||||
|
||||
#chat .well-chat {
|
||||
padding: 8px 15px 0px 15px;
|
||||
margin: 0px;
|
||||
}
|
|
@ -334,7 +334,3 @@ footer {
|
|||
text-shadow: 0 1px 0 #fff;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.well-demand {
|
||||
padding: 8px 15px 0px 15px
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue