Commit c32e93232cdcd5f7c8249f87bb80aa85d6baa949

Authored by Victor Costa
Committed by Rodrigo Souto
1 parent 0b674b6d

Remove unused chat files and fix chat button

app/controllers/public/chat_controller.rb
@@ -28,15 +28,6 @@ class ChatController < PublicController @@ -28,15 +28,6 @@ class ChatController < PublicController
28 end 28 end
29 end 29 end
30 30
31 - def index  
32 - #presence = current_user.last_chat_status  
33 - #if presence.blank? or presence == 'chat'  
34 - # render :action => 'auto_connect_online'  
35 - #else  
36 - # render :action => 'auto_connect_busy'  
37 - #end  
38 - end  
39 -  
40 def update_presence_status 31 def update_presence_status
41 if request.xhr? 32 if request.xhr?
42 current_user.update_attributes({:chat_status_at => DateTime.now}.merge(params[:status] || {})) 33 current_user.update_attributes({:chat_status_at => DateTime.now}.merge(params[:status] || {}))
app/views/chat/auto_connect_busy.html.erb
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -<script type='text/javascript'>  
2 - jQuery(function($) {  
3 - $('#chat-busy').trigger('click');  
4 - });  
5 -</script>  
app/views/chat/auto_connect_online.html.erb
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -<script type='text/javascript'>  
2 - jQuery(function($) {  
3 - $('#chat-connect').trigger('click');  
4 - });  
5 -</script>  
app/views/chat/index.html.erb
@@ -16,6 +16,18 @@ @@ -16,6 +16,18 @@
16 var $update_presence_status_every = <%= User.expires_chat_status_every.minutes %>; 16 var $update_presence_status_every = <%= User.expires_chat_status_every.minutes %>;
17 </script> 17 </script>
18 18
  19 +
  20 + <% presence = current_user.last_chat_status %>
  21 + <script>
  22 + jQuery(function($) {
  23 + <% if presence.blank? or presence == 'chat' %>
  24 + $('#chat-connect').trigger('click');
  25 + <% else %>
  26 + $('#chat-busy').trigger('click');
  27 + <% end %>
  28 + });
  29 + </script>
  30 +
19 <div id='chat'> 31 <div id='chat'>
20 <div id='title-bar'> 32 <div id='title-bar'>
21 <h1 class='title'><%= _("Online") % h(page_title) %>&nbsp;(<span id='friends-online'>0</span>)</h1> 33 <h1 class='title'><%= _("Online") % h(page_title) %>&nbsp;(<span id='friends-online'>0</span>)</h1>
app/views/layouts/chat.html.erb
@@ -1,64 +0,0 @@ @@ -1,64 +0,0 @@
1 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
2 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= html_language %>" lang="<%= html_language %>">  
3 - <head>  
4 - <title><%= h page_title %></title>  
5 - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>  
6 - <meta name="description" content="<%= @environment.name %>" />  
7 - <link rel="shortcut icon" href="<%= image_path(theme_favicon) %>" type="image/x-icon" />  
8 - <%= noosfero_javascript %>  
9 - <%= javascript_include_tag 'prototype', 'jquery.scrollabletab', 'strophejs-1.0.1/strophe', 'jquery.emoticon', '../designs/icons/pidgin/emoticons.js', 'ba-linkify', 'jquery.ba-hashchange', 'jquery.sound', 'chat', :cache => 'cache/chat' %>  
10 - <%= noosfero_stylesheets %>  
11 - <%= stylesheet_link_tag icon_theme_stylesheet_path %>  
12 - <%= stylesheet_link_tag theme_stylesheet_path %>  
13 - <%= stylesheet_link_tag jquery_ui_theme_stylesheet_path %>  
14 - <script type='text/javascript'>  
15 - var $presence_status_label = {  
16 - chat: '<%= _('Online') %>',  
17 - dnd: '<%= _('Busy') %>',  
18 - '': '<%= _('Offline') %>'  
19 - };  
20 - var $own_name = '<%= user.name %>';  
21 - var $starting_chat_notice = '<%= _("starting chat with %{name}") %>';  
22 - var $muc_domain = '<%= "conference.#{environment.default_hostname}" %>';  
23 - var $user_unavailable_error = '<%= _("<strong>ooops!</strong> The message could not be sent because the user is not online") %>';  
24 - var $update_presence_status_every = <%= User.expires_chat_status_every.minutes %>;  
25 - var $balloon_template = '<div data-who="%{who}" class="message %{who}"><img class="avatar" src="%{avatar_url}"/><% comment_balloon do %><h5 class="%{who}-name">%{name}</h5><span class="time">%{time}</span><p>%{message}</p><% end %></div>';  
26 - </script>  
27 - </head>  
28 - <body id='chat'>  
29 - <div id='title-bar'>  
30 - <h1 class='title'><%= _("%s - Friends online (<span id='friends-online'>%d</span>)") % [h(page_title), 0] %></h1>  
31 - </div>  
32 - <div id='buddy-list'>  
33 - <div id='environment-logo'>  
34 - <%= image_tag "#{theme_path}/images/thin-logo.png", :title => environment.name, :alt => environment.name %>  
35 - </div>  
36 - <div class='toolbar'>  
37 - <div id='user-status'><%= user_status_menu('icon-menu-offline', _('Offline')) %></div>  
38 - <div class='dialog-error' style='display: none'></div>  
39 - </div>  
40 - <ul class='buddy-list'>  
41 - <!-- <li class='offline'><a id='%{jid_id}' class='icon-menu-offline-11' href='#'>%{name}</a></li> -->  
42 - </ul>  
43 - </div>  
44 - <div id='chat-window' class='tabs-bottom'>  
45 - <div id='tabs'>  
46 - <ul>  
47 - <!-- <li class="tab"><a href="#{href}">#{label}</a></li> -->  
48 - </ul>  
49 - </div>  
50 - <!--  
51 - <div id='#conversation-%{jid_id}' class='conversation'>  
52 - <div class='history'>  
53 - <div class='message %{who}'><img class='avatar' src='%{avatar_url}' /><h5 class='%{who}-info'>%{name}</h5><span class='time'>%{time}</span><p>%{message}</p></div>  
54 - </div>  
55 - <div class='input-div'>  
56 - <div class='icon-chat'></div>  
57 - <textarea type='textarea' data-to='%{jid}'></textarea>  
58 - </div>  
59 - </div>  
60 - -->  
61 - </div>  
62 - <%= yield %>  
63 - </body>  
64 -</html>  
public/stylesheets/chat.css
1 #chat { 1 #chat {
2 width: 250px; 2 width: 250px;
  3 + display: none;
3 } 4 }
4 5
5 #buddy-list { 6 #buddy-list {