Commit a8cf1e1abb57d6c76f17008687af77246a1a921d
Committed by
Rodrigo Souto
1 parent
00b73c49
Exists in
master
and in
27 other branches
Fix layout for occupants for group chat
Showing
3 changed files
with
37 additions
and
16 deletions
Show diff stats
app/views/shared/logged_in/xmpp_chat.html.erb
@@ -77,7 +77,8 @@ | @@ -77,7 +77,8 @@ | ||
77 | </div> | 77 | </div> |
78 | 78 | ||
79 | <div class="occupant-list-template"> | 79 | <div class="occupant-list-template"> |
80 | - <div class="occupant-list"> | 80 | + <div class="occupants"> |
81 | + <a href="#" class="up"> </a> | ||
81 | <ul class='occupant-list'></ul> | 82 | <ul class='occupant-list'></ul> |
82 | </div> | 83 | </div> |
83 | </div> | 84 | </div> |
@@ -85,7 +86,8 @@ | @@ -85,7 +86,8 @@ | ||
85 | <div class="occupant-item"> | 86 | <div class="occupant-item"> |
86 | <li class='%{presence_status}'> | 87 | <li class='%{presence_status}'> |
87 | <a data-id='%{jid_id}' class='icon-menu-%{presence_status}-11' href='#'> | 88 | <a data-id='%{jid_id}' class='icon-menu-%{presence_status}-11' href='#'> |
88 | - %{name} | 89 | + %{avatar} |
90 | + <span class="name">%{name}<span> | ||
89 | </a> | 91 | </a> |
90 | </li> | 92 | </li> |
91 | </div> | 93 | </div> |
public/javascripts/chat.js
@@ -89,7 +89,7 @@ jQuery(function($) { | @@ -89,7 +89,7 @@ jQuery(function($) { | ||
89 | insert_or_update_occupant: function (jid, name, presence, room_jid) { | 89 | insert_or_update_occupant: function (jid, name, presence, room_jid) { |
90 | log('adding or updating occupant ' + jid + ' as ' + presence); | 90 | log('adding or updating occupant ' + jid + ' as ' + presence); |
91 | var jid_id = Jabber.jid_to_id(jid); | 91 | var jid_id = Jabber.jid_to_id(jid); |
92 | - var list = $('#' + Jabber.conversation_prefix + Jabber.jid_to_id(room_jid) + ' .occupant-list ul'); | 92 | + var list = $('#' + Jabber.conversation_prefix + Jabber.jid_to_id(room_jid) + ' .occupants ul'); |
93 | var item = $(list).find('a[data-id='+ jid_id +']'); | 93 | var item = $(list).find('a[data-id='+ jid_id +']'); |
94 | Jabber.insert_or_update_user(list, item, jid, name, presence, Jabber.template('.occupant-item'), 'chat'); | 94 | Jabber.insert_or_update_user(list, item, jid, name, presence, Jabber.template('.occupant-item'), 'chat'); |
95 | if (Jabber.rooms[Jabber.jid_to_id(room_jid)] === undefined) { | 95 | if (Jabber.rooms[Jabber.jid_to_id(room_jid)] === undefined) { |
@@ -199,7 +199,7 @@ jQuery(function($) { | @@ -199,7 +199,7 @@ jQuery(function($) { | ||
199 | break; | 199 | break; |
200 | case Strophe.Status.DISCONNECTED: | 200 | case Strophe.Status.DISCONNECTED: |
201 | log('disconnected'); | 201 | log('disconnected'); |
202 | - $('#buddy-list ul.buddy-list, .occupant-list ul.occupant-list').html(''); | 202 | + $('#buddy-list ul.buddy-list, .occupants ul.occupant-list').html(''); |
203 | Jabber.update_chat_title(); | 203 | Jabber.update_chat_title(); |
204 | $('#buddy-list .toolbar').removeClass('small-loading-dark'); | 204 | $('#buddy-list .toolbar').removeClass('small-loading-dark'); |
205 | $('textarea').prop('disabled', 'disabled'); | 205 | $('textarea').prop('disabled', 'disabled'); |
@@ -528,12 +528,11 @@ jQuery(function($) { | @@ -528,12 +528,11 @@ jQuery(function($) { | ||
528 | }); | 528 | }); |
529 | 529 | ||
530 | // put name into text area when click in one occupant | 530 | // put name into text area when click in one occupant |
531 | - // FIXME | ||
532 | - $('.occupant-list .occupant-list li a').live('click', function() { | 531 | + $('.occupants .occupant-list li a').live('click', function() { |
533 | var jid_id = $(this).attr('data-id'); | 532 | var jid_id = $(this).attr('data-id'); |
534 | var name = Jabber.name_of(jid_id); | 533 | var name = Jabber.name_of(jid_id); |
535 | var val = $('.conversation textarea:visible').val(); | 534 | var val = $('.conversation textarea:visible').val(); |
536 | - $('.conversation textarea:visible').val(val + name + ', ').focus(); | 535 | + $('.conversation textarea:visible').focus().val(val + name + ', '); |
537 | }); | 536 | }); |
538 | 537 | ||
539 | $('#chat .conversation .history').live('click', function() { | 538 | $('#chat .conversation .history').live('click', function() { |
@@ -569,8 +568,9 @@ jQuery(function($) { | @@ -569,8 +568,9 @@ jQuery(function($) { | ||
569 | textarea.attr('name', panel.id); | 568 | textarea.attr('name', panel.id); |
570 | 569 | ||
571 | if (Jabber.is_a_room(jid_id)) { | 570 | if (Jabber.is_a_room(jid_id)) { |
572 | - panel.append(Jabber.template('.occupant-list-template')); | 571 | + panel.find('.conversation').append(Jabber.template('.occupant-list-template')); |
573 | panel.find('.history').addClass('room'); | 572 | panel.find('.history').addClass('room'); |
573 | + $('#chat .occupants .occupant-list').perfectScrollbar(); | ||
574 | } | 574 | } |
575 | textarea.attr('data-to', jid); | 575 | textarea.attr('data-to', jid); |
576 | 576 | ||
@@ -672,6 +672,10 @@ jQuery(function($) { | @@ -672,6 +672,10 @@ jQuery(function($) { | ||
672 | $('.title-bar a').click(function() { | 672 | $('.title-bar a').click(function() { |
673 | $(this).parents('.status-group').find('.buddy-list').toggle('fast'); | 673 | $(this).parents('.status-group').find('.buddy-list').toggle('fast'); |
674 | }); | 674 | }); |
675 | + $('#chat').on('click', '.occupants a', function() { | ||
676 | + $(this).siblings('.occupant-list').toggle('fast'); | ||
677 | + $(this).toggleClass('up'); | ||
678 | + }); | ||
675 | 679 | ||
676 | //restore connection if user was connected | 680 | //restore connection if user was connected |
677 | if($presence=='' || $presence == 'chat') { | 681 | if($presence=='' || $presence == 'chat') { |
public/stylesheets/chat.css
@@ -174,18 +174,33 @@ | @@ -174,18 +174,33 @@ | ||
174 | text-align: center; | 174 | text-align: center; |
175 | display: block; | 175 | display: block; |
176 | } | 176 | } |
177 | -.conversation .occupant-list { | 177 | +div.occupants { |
178 | position: absolute; | 178 | position: absolute; |
179 | - top: 0; | ||
180 | - right: 0; | ||
181 | - width: 200px; | ||
182 | - bottom: 125px; | 179 | + width: 100%; |
180 | + bottom: 98px; | ||
181 | + background-color: rgba(0, 0, 0, 0.7); | ||
183 | } | 182 | } |
184 | -.conversation .occupant-list ul { | 183 | +div.occupants ul.occupant-list { |
185 | padding: 0; | 184 | padding: 0; |
186 | - list-style: none; | ||
187 | - font-size: 12px; | 185 | + margin: 0; |
186 | + max-height: 162px; | ||
187 | + overflow: hidden; | ||
188 | + position: relative; | ||
189 | + display: none; | ||
190 | + border-top: 1px solid rgb(37, 37, 37); | ||
188 | } | 191 | } |
192 | +div.occupants > a { | ||
193 | + color: rgb(168, 168, 168); | ||
194 | + text-align: center; | ||
195 | + width: 100%; | ||
196 | + display: inline-block; | ||
197 | + text-decoration: none; | ||
198 | + background: url(/images/down-arrow.png) center center no-repeat; | ||
199 | +} | ||
200 | +div.occupants > a.up { | ||
201 | + background: url(/images/top-arrow.png) center center no-repeat; | ||
202 | +} | ||
203 | + | ||
189 | #chat-window .comment-balloon-content { | 204 | #chat-window .comment-balloon-content { |
190 | min-height: 50px; | 205 | min-height: 50px; |
191 | padding: 5px 0 5px 25px; | 206 | padding: 5px 0 5px 25px; |