Improved chat.

This commit is contained in:
Martin Edenhofer 2012-11-04 11:49:59 +01:00
parent afc3062150
commit d7593124c8
5 changed files with 13 additions and 23 deletions

View file

@ -30,7 +30,6 @@ class App.ChatWidget extends App.Controller
@render() @render()
@hide() @hide()
@interval @position, 200, 'chat-widget'
App.Event.bind( App.Event.bind(
'chat:message' 'chat:message'
@ -62,6 +61,9 @@ class App.ChatWidget extends App.Controller
App.Event.bind( App.Event.bind(
'chat:message_new' 'chat:message_new'
(e) => (e) =>
# show new message info
@newMessage = false
@el.find('div.well').removeClass('alert-success') @el.find('div.well').removeClass('alert-success')
) )
@ -157,22 +159,6 @@ class App.ChatWidget extends App.Controller
if @newMessage if @newMessage
@el.find('div.well').addClass('alert-success') @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) -> submitMessage: (e) ->
e.preventDefault() e.preventDefault()
message = $(e.target).find('[name=chat_message]').val() message = $(e.target).find('[name=chat_message]').val()

View file

@ -58,7 +58,7 @@ class App.TextModuleUI extends App.Controller
@uiWidget.el.offset( left: left + width + 20, top: top ) @uiWidget.el.offset( left: left + width + 20, top: top )
# update window possition every x ms # update window possition every x ms
ui.interval( update, 150, 'text_module_box' ) ui.interval( update, 100, 'text_module_box' )
) )
inputElement.bind('focusout', -> inputElement.bind('focusout', ->

View file

@ -1,4 +1,4 @@
<div class="well well-demand span3"> <div class="well well-chat span3">
<h4><%- @T('Chat') %><a href="#" class="close">&times;</a></h4> <h4><%- @T('Chat') %><a href="#" class="close">&times;</a></h4>
<div id="chat_content" <% if !@isShown: %>class="hide"<% end %>> <div id="chat_content" <% if !@isShown: %>class="hide"<% end %>>
<div id="chat_log_container" class="max-size-scroll"> <div id="chat_log_container" class="max-size-scroll">

View file

@ -0,0 +1,8 @@
#chat {
position: fixed; bottom: 0; right: 0;
}
#chat .well-chat {
padding: 8px 15px 0px 15px;
margin: 0px;
}

View file

@ -334,7 +334,3 @@ footer {
text-shadow: 0 1px 0 #fff; text-shadow: 0 1px 0 #fff;
opacity: 0.9; opacity: 0.9;
} }
.well-demand {
padding: 8px 15px 0px 15px
}