Clean up how we deal with the message type tabs

(imported from commit 429e055d3eca65af8bc0fe58481a7becf9ced66a)
This commit is contained in:
Keegan McAllister 2012-11-02 16:54:09 -04:00
parent 02f7ac42e7
commit 477bad9536
4 changed files with 12 additions and 11 deletions

View File

@ -105,14 +105,16 @@
<tr> <tr>
<td class="message_picture"> <td class="message_picture">
<div id="stream_or_huddle"> <div id="stream_or_huddle">
<ul class="nav nav-pills nav-stacked" id="message-type-tabs"> <ul class="nav nav-pills nav-stacked">
<li class="active"> <li class="active">
<a href="#stream-message" data-toggle="pill" title="Stream" tabindex="100"> <a href="#stream-message" id="compose-stream"
data-toggle="pill" title="Stream" tabindex="100">
<i class="icon-bullhorn"></i> <i class="icon-bullhorn"></i>
</a> </a>
</li> </li>
<li> <li>
<a href="#personal-message" data-toggle="pill" title="Huddle" tabindex="110"> <a href="#personal-message" id="compose-personal"
data-toggle="pill" title="Huddle" tabindex="110">
<i class="icon-user"></i> <i class="icon-user"></i>
</a> </a>
</li> </li>

View File

@ -114,7 +114,7 @@ exports.show = function (tabname, focus_area) {
$('#compose').css({visibility: "visible"}); $('#compose').css({visibility: "visible"});
$("#new_message_content").trigger("autosize"); $("#new_message_content").trigger("autosize");
$('.message_comp').slideDown(100); $('.message_comp').slideDown(100);
$('#message-type-tabs a[href="#' + tabname + '-message"]').tab('show'); $('#compose-' + tabname).tab('show');
focus_area.focus(); focus_area.focus();
focus_area.select(); focus_area.select();
}; };
@ -147,7 +147,7 @@ exports.set_message_type = function (tabname) {
exports.toggle_mode = function () { exports.toggle_mode = function () {
if ($("#message-type-tabs li.active").find("a[href=#stream-message]").length !== 0) { if ($('#compose-stream').parent().hasClass('active')) {
// In stream tab, switch to personals. // In stream tab, switch to personals.
exports.show('personal', $("#huddle_recipient")); exports.show('personal', $("#huddle_recipient"));
} else { } else {

View File

@ -277,11 +277,10 @@ $(function () {
// NB: This just binds to current elements, and won't bind to elements // NB: This just binds to current elements, and won't bind to elements
// created after ready() is called. // created after ready() is called.
$('#message-type-tabs a[href="#stream-message"]').on('shown', function (e) { $.each(['stream', 'personal'], function (index, tabname) {
compose.set_message_type('stream'); $('#compose-' + tabname).on('shown', function (e) {
}); compose.set_message_type(tabname);
$('#message-type-tabs a[href="#personal-message"]').on('shown', function (e) { });
compose.set_message_type('huddle');
}); });
// Prepare the click handler for subbing to a new stream to which // Prepare the click handler for subbing to a new stream to which

View File

@ -475,7 +475,7 @@ table.floating_recipient {
border: 1px solid grey; border: 1px solid grey;
} }
#message-type-tabs { #stream_or_huddle ul {
margin-top: 0px; margin-top: 0px;
margin-bottom: 0px; margin-bottom: 0px;
} }