Commit ff2910b9 authored by JC Brand's avatar JC Brand

Fix CSS and horizontal dragresize for chat rooms.

- Rename .chat-body to .chatroom-body
- Upate SASS for chat rooms
- Hide the room occupants view by toggling the class "hidden"
- The chatroom chat area and occupants list are now shown as table cells.
parent 4f86a7ed
......@@ -2869,7 +2869,7 @@
renderChatArea: function () {
if (!this.$('.chat-area').length) {
this.$('.chat-body').empty()
this.$('.chatroom-body').empty()
.append(
converse.templates.chatarea({
'show_toolbar': converse.show_toolbar,
......@@ -2895,13 +2895,13 @@
if (!this.model.get('hidden_occupants')) {
this.model.save({hidden_occupants: true});
$el.removeClass('icon-hide-users').addClass('icon-show-users');
this.$('form.sendXMPPMessage, .chat-area').animate({width: '100%'});
this.$('div.participants').animate({width: 0}, this.scrollDown.bind(this));
this.$('div.participants').addClass('hidden');
this.scrollDown();
} else {
this.model.save({hidden_occupants: false});
$el.removeClass('icon-show-users').addClass('icon-hide-users');
this.$('.chat-area, form.sendXMPPMessage').css({width: ''});
this.$('div.participants').show().animate({width: 'auto'}, this.scrollDown.bind(this));
this.$('div.participants').removeClass('hidden');
this.scrollDown();
}
},
......@@ -3223,7 +3223,7 @@
function () {
$(this).remove();
that.$el.find('.chat-area').show();
that.$el.find('.participants').show();
that.$el.find('.participants').removeClass('hidden');
});
},
......@@ -3242,7 +3242,7 @@
function () {
$(this).remove();
that.$el.find('.chat-area').show();
that.$el.find('.participants').show();
that.$el.find('.participants').removeClass('hidden');
});
},
......@@ -3251,8 +3251,8 @@
if (this.$el.find('div.chatroom-form-container').length) {
return;
}
this.$('.chat-body').children().hide();
this.$('.chat-body').append(
this.$('.chatroom-body').children().hide();
this.$('.chatroom-body').append(
$('<div class="chatroom-form-container">'+
'<form class="chatroom-form">'+
'<span class="spinner centered"/>'+
......@@ -3275,9 +3275,9 @@
},
renderPasswordForm: function () {
this.$('.chat-body').children().hide();
this.$('.chatroom-body').children().hide();
this.$('span.centered.spinner').remove();
this.$('.chat-body').append(
this.$('.chatroom-body').append(
converse.templates.chatroom_password_form({
heading: __('This chatroom requires a password'),
label_password: __('Password: '),
......@@ -3290,7 +3290,7 @@
this.$('.chat-area').hide();
this.$('.participants').hide();
this.$('span.centered.spinner').remove();
this.$('.chat-body').append($('<p>'+msg+'</p>'));
this.$('.chatroom-body').append($('<p>'+msg+'</p>'));
},
/* http://xmpp.org/extensions/xep-0045.html
......@@ -3462,8 +3462,6 @@
($presence.attr('from') == this.model.get('id')+'/'+Strophe.escapeNode(nick));
if (this.model.get('connection_status') !== Strophe.Status.CONNECTED) {
this.model.set('connection_status', Strophe.Status.CONNECTED);
this.$('span.centered.spinner').remove();
this.$el.find('.chat-body').children().show();
}
this.showStatusMessages(pres, is_self);
}
......@@ -6073,8 +6071,8 @@
this.setUpXMLLogging = function () {
if (this.debug) {
this.connection.xmlInput = function (body) { console.log(body.outerHTML); };
this.connection.xmlOutput = function (body) { console.log(body.outerHTML); };
this.connection.xmlInput = function (body) { console.log(body); };
this.connection.xmlOutput = function (body) { console.log(body); };
}
};
......
This diff is collapsed.
......@@ -31,7 +31,7 @@
<p class="chatroom-topic"></p>
<p></p>
</div>
<div class="chat-body">
<div class="chatroom-body">
<div class="chatroom-form-container">
<form class="chatroom-form">
<legend>Configuration for discuss@conference.conversejs.com</legend>
......
This diff is collapsed.
......@@ -361,16 +361,17 @@ JID: rassie.erasmus@localhost">Rassie Erasmus</span>
<div class="chatroom" id="4a77380f1cd9d392627b0e1469688f9ca44e9392">
<div class="flyout box-flyout">
<div class="dragresize"></div>
<div class="dragresize dragresize-top"></div>
<div class="dragresize dragresize-topleft"></div>
<div class="dragresize dragresize-left"></div>
<div class="chat-head chat-head-chatroom">
<a class="close-chatbox-button icon-close"></a>
<a class="toggle-chatbox-button icon-minus"></a>
<a class="configure-chatroom-button icon-wrench" style=""></a>
<div class="chat-title"> Chatroom </div>
<p class="chatroom-topic">May the force be with you</p>
</div>
<div class="chat-body">
<div class="chatroom-body">
<div class="chat-area">
<div class="chat-content">
<div class="chat-message ">
......@@ -397,10 +398,9 @@ JID: rassie.erasmus@localhost">Rassie Erasmus</span>
<span class="chat-message-content">Another message to check that scrolling works.</span>
</div>
</div>
<form class="sendXMPPMessage" action="" method="post">
<ul class="chat-toolbar no-text-select">
<li class="toggle-smiley icon-happy" title="Insert a smilery">
<li class="toggle-smiley icon-happy" title="Insert a smiley">
<ul>
<li><a class="icon-smiley" href="#" data-emoticon=":)"></a></li>
<li><a class="icon-wink" href="#" data-emoticon=";)"></a></li>
......@@ -425,9 +425,9 @@ JID: rassie.erasmus@localhost">Rassie Erasmus</span>
</div>
<div class="participants">
<form class="room-invite">
<input class="invited-contact tt-input" placeholder="Invite..." type="text"/>
<span class="twitter-typeahead" style="position: relative; display: inline-block; direction: ltr;"><input class="invited-contact tt-hint" type="text" readonly="" autocomplete="off" spellcheck="false" tabindex="-1" style="position: absolute; top: 0px; left: 0px; border-color: transparent; box-shadow: none; opacity: 1;"><input class="invited-contact tt-input" placeholder="Invite..." type="text" autocomplete="off" spellcheck="false" dir="auto" style="position: relative; vertical-align: top; background-color: transparent;"><pre aria-hidden="true" style="position: absolute; visibility: hidden; white-space: pre;"></pre><span class="tt-dropdown-menu" style="position: absolute; top: 100%; z-index: 100; display: none; left: 0px; right: auto;"><div class="tt-dataset-contacts-dataset"></div></span></span>
</form>
<label>Participants:</label>
<label>Occupants:</label>
<ul class="participant-list">
<li class="participant" title="This user can send messages in this room">Obi-wan Kenobi, Jedi Master</li>
<li class="participant" title="This user can send messages in this room">jabber the hut</li>
......
......@@ -426,16 +426,14 @@
border-bottom-right-radius: $chatbox-border-radius;
border-bottom-left-radius: $chatbox-border-radius;
}
.chat-blink {
background-color: #176679;
border-right: 1px solid #176679;
border-left: 1px solid #176679;
}
.chat-content {
position: relative;
padding: 8px;
padding: 0.5em;
font-size: 13px;
color: $text-color;
overflow-y: auto;
......@@ -443,13 +441,11 @@
background-color: #ffffff;
line-height: 1.3em;
height: 206px;
height: calc(100% - #{$toolbar-height + $chat-textarea-height + 2});
height: calc(100% - #{$toolbar-height + $chat-textarea-height +1px});
}
.chat-info {
color: $text-color;
}
.chat-error {
color: $warning-color;
font-weight: bold;
......@@ -991,19 +987,46 @@
.chatroom {
width: $chatroom-width;
.box-flyout {
width: $chatroom-width;
}
@media screen and (max-width: $mobile-landscape-length) {
width: $mobile-chat-width;
.box-flyout {
min-width: $mobile-chat-width;
width: $mobile-chat-width;
}
}
label {
margin-left: 2px;
font-size: 12px;
.box-flyout {
min-width: $chatroom-width;
width: $chatroom-width;
.chatroom-body {
height: 289px;
@include border-bottom-radius($chatbox-border-radius);
@include calc(height, '100% - #{$chat-head-height}');
background-color: white;
border-top: 0;
display: table;
table-layout: fixed;
width: 100%;
.chat-area {
word-wrap: break-word;
display: table-cell;
height: 100%;
min-width: $chat-width;
.chat-content {
padding: 0.5em 0.5em 0 0.5em; // Work around a weird box-sizing issue in Chromium related to bottom padding.
}
}
.participants {
display: table-cell;
vertical-align: top;
background-color: white;
overflow-y: auto;
overflow-x: hidden;
border-left: 1px solid #AAA;
border-bottom-right-radius: $chatbox-border-radius;
width: 100px;
height: 100%;
&.hidden {
display: none;
}
.participant-list {
list-style: none;
......@@ -1016,19 +1039,29 @@
padding: 2px 5px;
text-overflow: ellipsis;
white-space: nowrap;
width: 100px;
&.moderator {
color: #8f2831;
}
}
}
label {
font-size: 12px;
font-style: italic;
margin: 5px;
display: block;
}
}
}
}
label {
margin-left: 2px;
font-size: 12px;
}
.chat-textarea {
border-bottom-right-radius: 0;
}
.chat-area {
float: left;
height: 100%;
min-width: $chat-width;
}
.invited-contact {
margin: -1px 0 0 -1px;
width: 100px;
......@@ -1037,22 +1070,6 @@
.invited-contact.tt-input {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gkBCjE0uzKkOgAAAidJREFUKM+N0k+IEnEUB/D3cyscdagkWpHV0WGWREXm0AgOGkSJ07kh2UXYU5cOewm6Bp0KXG/tpSCv6hyEFQIhMEaE3yERYfwTOoqKGLQxDAbqYadLgu7J7/XxeY/3ez8EACDLsgljfMfj8ZxUKhXXYDAAnueBoqgyAMipVOovXAuSZdnUaDQeDofDs16vFyUIAjRNUwmCoG02G1AUdZ5IJN7GYrHfm3AvEAjcnUwmX0ajUdRqtV74fL6sruufKYoa6bp+fzabPUMI7ZfL5eImNHk8npNerxc1m80XHMe98fv9H3K5XDkSibxjWfb1arWaYoyPMMbCFqxUKi6CIODw8LDmdDq7oigaAACiKK5omv7KcdylpmlIkiTHFlRVFTRNUxVFqa/ROqIoGoqi5A3DgFartfU4Jp7ngSAI2uVyPZIk6dZmUZKk2w6H4xghBPF4HK7vWLbZbDCdTp+rqvpUkiS0RvV6/bTf7x8wDHMViURqm/AGAMgURZ232+1X1Wr102KxuEwmk3lZlo/7/f7BcrkkSZKs2e12tHXH/x/gHsY4jTE+0jQNGYYBCCFgGOaKJMkfjUaDZximGQ6HXzSbzZ+ZTMbY6oIxFgqFgqPT6YAgCMBxXM1ut6N0Op0fj8chi8XyjWXZ98Fg8DuCHZLNZh+USqWP8/n8idvt/hUKhV7u7QK9Xu8fmqanAJBQVXUfAGY7TQQAKBaLN8fjsdDtdh/run72Dzhf7XLe2UevAAAAAElFTkSuQmCC ) no-repeat right 3px center;
}
.participants {
float: right;
background-color: white;
overflow-y: auto;
overflow-x: hidden;
border-left: 1px solid #AAA;
border-bottom-right-radius: $chatbox-border-radius;
width: 100px;
height: 100%;
label {
font-size: 12px;
font-style: italic;
margin: 5px;
display: block;
}
}
}
.chatroom-form,
......@@ -1278,20 +1295,16 @@
}
}
div#chatrooms {
#chatrooms {
overflow-y: auto;
}
form.sendXMPPMessage {
-moz-background-clip: padding;
-moz-border-radius: $chatbox-border-radius;
-webkit-background-clip: padding-box;
-webkit-border-radius: $chatbox-border-radius;
@include border-bottom-radius($chatbox-border-radius);
background-clip: padding-box;
background: white;
border-radius: $chatbox-border-radius;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-top: 1px solid #BBB;
border: 0;
margin: 0;
......@@ -1303,15 +1316,13 @@
width: 100%;
}
.chat-textarea {
@include border-bottom-radius(4px);
@include border-bottom-radius($chatbox-border-radius);
border: 0;
height: $chat-textarea-height;
padding: 0.5em;
width: 100%;
resize: none;
}
}
.chat-toolbar {
font-size: $font-size;
margin: 0;
......@@ -1319,32 +1330,26 @@
height: $toolbar-height;
display: block;
background-color: $light-background-color;
a {
color: $link-color;
}
.unencrypted a,
.unencrypted {
color: #8f2831;
}
.unverified a,
.unverified {
color: #cf5300;
}
.private a,
.private {
color: #4b7003;
}
.toggle-participants,
.toggle-clear,
.toggle-otr {
float: right;
}
li {
display: inline-block;
list-style: none;
......@@ -1355,7 +1360,6 @@
li:hover {
cursor: pointer;
}
ul {
background: #fff;
bottom: 100%;
......@@ -1374,7 +1378,6 @@
}
}
}
.toggle-smiley {
color: $link-color;
padding-left: 5px;
......@@ -1389,7 +1392,6 @@
}
}
}
.toggle-otr {
ul {
li {
......@@ -1412,6 +1414,7 @@
}
}
}
}
.chat-toolbar-text {
font-size: 12px;
......
......@@ -15,7 +15,7 @@
$chat-head-inverse-text-color: white !default;
$chat-head-height: 44px !default;
$save-button-color: #436F64 !default;
$chat-textarea-height: 62px !default;
$chat-textarea-height: 70px !default;
$toolbar-height: 25px !default;
$toolbar-color: beige !default;
$message-them-color: #346121 !default;
......
......@@ -404,7 +404,7 @@
view.onChatRoomPresence(presence, {nick: 'dummy', name: 'lounge@localhost'});
expect(view.$('.chat-area').is(':visible')).toBeFalsy();
expect(view.$('.participants').is(':visible')).toBeFalsy();
var $chat_body = view.$('.chat-body');
var $chat_body = view.$('.chatroom-body');
expect($chat_body.html().trim().indexOf('<p>You have been kicked from this room</p><p>The reason given is: "Avaunt, you cullion!"</p>')).not.toBe(-1);
}.bind(converse));
......@@ -576,7 +576,7 @@
});
waits(250);
runs(function () {
var $chat_body = view.$el.find('.chat-body');
var $chat_body = view.$el.find('.chatroom-body');
expect(view.renderPasswordForm).toHaveBeenCalled();
expect($chat_body.find('form.chatroom-form').length).toBe(1);
expect($chat_body.find('legend').text()).toBe('This chatroom requires a password');
......@@ -595,7 +595,7 @@
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
view.onChatRoomPresence(presence, {'nick': 'dummy'});
expect(view.$el.find('.chat-body p').text()).toBe('You are not on the member list of this room');
expect(view.$el.find('.chatroom-body p').text()).toBe('You are not on the member list of this room');
}.bind(converse));
it("will show an error message if the user has been banned", function () {
......@@ -610,7 +610,7 @@
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
view.onChatRoomPresence(presence, {'nick': 'dummy'});
expect(view.$el.find('.chat-body p').text()).toBe('You have been banned from this room');
expect(view.$el.find('.chatroom-body p').text()).toBe('You have been banned from this room');
}.bind(converse));
it("will show an error message if no nickname was specified for the user", function () {
......@@ -625,7 +625,7 @@
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
view.onChatRoomPresence(presence, {'nick': 'dummy'});
expect(view.$el.find('.chat-body p').text()).toBe('No nickname was specified');
expect(view.$el.find('.chatroom-body p').text()).toBe('No nickname was specified');
}.bind(converse));
it("will show an error message if the user is not allowed to have created the room", function () {
......@@ -640,7 +640,7 @@
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
view.onChatRoomPresence(presence, {'nick': 'dummy'});
expect(view.$el.find('.chat-body p').text()).toBe('You are not allowed to create new rooms');
expect(view.$el.find('.chatroom-body p').text()).toBe('You are not allowed to create new rooms');
}.bind(converse));
it("will show an error message if the user's nickname doesn't conform to room policy", function () {
......@@ -655,7 +655,7 @@
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
view.onChatRoomPresence(presence, {'nick': 'dummy'});
expect(view.$el.find('.chat-body p').text()).toBe("Your nickname doesn't conform to this room's policies");
expect(view.$el.find('.chatroom-body p').text()).toBe("Your nickname doesn't conform to this room's policies");
}.bind(converse));
it("will show an error message if the user's nickname is already taken", function () {
......@@ -670,7 +670,7 @@
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
view.onChatRoomPresence(presence, {'nick': 'dummy'});
expect(view.$el.find('.chat-body p').text()).toBe("Your nickname is already taken");
expect(view.$el.find('.chatroom-body p').text()).toBe("Your nickname is already taken");
}.bind(converse));
it("will show an error message if the room doesn't yet exist", function () {
......@@ -685,7 +685,7 @@
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
view.onChatRoomPresence(presence, {'nick': 'dummy'});
expect(view.$el.find('.chat-body p').text()).toBe("This room does not (yet) exist");
expect(view.$el.find('.chatroom-body p').text()).toBe("This room does not (yet) exist");
}.bind(converse));
it("will show an error message if the room has reached it's maximum number of occupants", function () {
......@@ -700,7 +700,7 @@
var view = this.chatboxviews.get('problematic@muc.localhost');
spyOn(view, 'showErrorMessage').andCallThrough();
view.onChatRoomPresence(presence, {'nick': 'dummy'});
expect(view.$el.find('.chat-body p').text()).toBe("This room has reached it's maximum number of occupants");
expect(view.$el.find('.chatroom-body p').text()).toBe("This room has reached it's maximum number of occupants");
}.bind(converse));
}.bind(converse));
}.bind(converse, mock, test_utils));
......
......@@ -9,5 +9,5 @@
<div class="chat-title"> {{ _.escape(name) }} </div>
<p class="chatroom-topic"><p/>
</div>
<div class="chat-body"><span class="spinner centered"/></div>
<div class="chatroom-body"><span class="spinner centered"/></div>
</div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment