Browse Source

Improved chat.

Martin Edenhofer 12 years ago
parent
commit
d7593124c8

+ 3 - 17
app/assets/javascripts/app/controllers/chat_widget.js.coffee

@@ -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()

+ 1 - 1
app/assets/javascripts/app/controllers/text_module_widget.js.coffee

@@ -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 - 1
app/assets/javascripts/app/views/chat_widget.jst.eco

@@ -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>
   <div id="chat_content" <% if !@isShown: %>class="hide"<% end %>>
     <div id="chat_log_container" class="max-size-scroll">

+ 8 - 0
app/assets/stylesheets/custom/chat.css

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

+ 0 - 4
app/assets/stylesheets/zzz.css

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