Get rid of the narrowbar

(imported from commit 53335b8177561d4b103659a51704d6b2ce7ec367)
This commit is contained in:
Keegan McAllister 2012-12-12 14:22:18 -05:00
parent 15f606a2ef
commit 3c9b9227f8
8 changed files with 11 additions and 82 deletions

View File

@ -12,12 +12,6 @@
</div> </div>
</form> </form>
</div> </div>
<div class="narrowed_to_bar">
<div id="narrowlabel">
<div class="close" onclick="narrow.show_all_messages()">&times;</div>
<span id="currently_narrowed_to"></span>
</div>
</div>
<div class="floating_recipient_bar"> <div class="floating_recipient_bar">
<table class="floating_recipient"> <table class="floating_recipient">
<tr id="floating_recipient_layout_row" class="ztable_layout_row"> <tr id="floating_recipient_layout_row" class="ztable_layout_row">
@ -42,7 +36,6 @@
<div class="span9"> <div class="span9">
<div class="message_list" id="main_div"> <div class="message_list" id="main_div">
<div id="top_whitespace"></div> <div id="top_whitespace"></div>
<div id="top_narrowed_whitespace"></div>
<table id="load_more_messages_indicator"> <table id="load_more_messages_indicator">
<tr><td id="load_more_messages_spinner"></td></tr> <tr><td id="load_more_messages_spinner"></td></tr>
</table> </table>

View File

@ -25,10 +25,6 @@
{% rawjstemplate "timeinfo_popover_content" %} {% rawjstemplate "timeinfo_popover_content" %}
</script> </script>
<script id="template_narrowbar" type="text/x-handlebars-template">
{% rawjstemplate "narrowbar" %}
</script>
<link href="{{ static_hidden }}styles/zephyr.css?dummy_time={% now "U" %}" rel="stylesheet"> <link href="{{ static_hidden }}styles/zephyr.css?dummy_time={% now "U" %}" rel="stylesheet">
<link href="{{ static_hidden }}styles/pygments.css" rel="stylesheet"> <link href="{{ static_hidden }}styles/pygments.css" rel="stylesheet">
<script type="text/javascript" src="/static/third/jquery/jquery.form.js"></script> <script type="text/javascript" src="/static/third/jquery/jquery.form.js"></script>

View File

@ -1,9 +0,0 @@
<span id="currently_narrowed_to"
title="{{description}}{{#if subject}} | {{subject}}{{/if}}">
<i class="icon-{{icon}}"></i>
{{description}}
{{#if subject}}
&nbsp; | &nbsp; {{subject}}
{{/if}}
</span>

View File

@ -42,9 +42,7 @@ function parse_narrow(hash) {
var operand = decodeURIComponent(hash[i+1] || ''); var operand = decodeURIComponent(hash[i+1] || '');
operators.push([operator, operand]); operators.push([operator, operand]);
} }
// The narrowbar description here is bogus, but it's going away in narrow.activate(operators);
// a subsequent commit.
narrow.activate(operators, {icon: 'search', description: 'FIXME'});
} }
// Returns true if this function performed a narrow // Returns true if this function performed a narrow

View File

@ -110,7 +110,7 @@ function build_filter(operators) {
}; };
} }
exports.activate = function (operators, bar, opts) { exports.activate = function (operators, opts) {
opts = $.extend({}, { opts = $.extend({}, {
time_travel: false, time_travel: false,
show_floating_recipient: true, show_floating_recipient: true,
@ -154,12 +154,8 @@ exports.activate = function (operators, bar, opts) {
reset_load_more_status(); reset_load_more_status();
$("#show_all_messages").removeAttr("disabled"); $("#show_all_messages").removeAttr("disabled");
$(".narrowed_to_bar").show();
$("#top_narrowed_whitespace").show();
$("#main_div").addClass("narrowed_view"); $("#main_div").addClass("narrowed_view");
$("#searchbox").addClass("narrowed_view"); $("#searchbox").addClass("narrowed_view");
$("#currently_narrowed_to").remove();
$("#narrowlabel").append(templates.narrowbar(bar));
$("#zhome").removeClass("focused_table"); $("#zhome").removeClass("focused_table");
// Indicate both which message is persistently selected and which // Indicate both which message is persistently selected and which
@ -179,11 +175,7 @@ exports.activate = function (operators, bar, opts) {
}; };
exports.time_travel = function () { exports.time_travel = function () {
var bar = { exports.activate([], {time_travel: true});
icon: 'time',
description: 'Messages around time ' + message_dict[target_id].full_date_str
};
exports.activate([], bar, {time_travel: true});
}; };
// This is the message we're about to select, within the narrowed view. // This is the message we're about to select, within the narrowed view.
@ -196,8 +188,7 @@ exports.target = function (id) {
}; };
exports.all_private_messages = function () { exports.all_private_messages = function () {
var bar = {icon: 'user', description: 'You and anyone else'}; exports.activate([['is', 'private-message']]);
exports.activate([['is', 'private-message']], bar);
}; };
exports.by_subject = function () { exports.by_subject = function () {
@ -216,28 +207,21 @@ exports.by_stream_and_subject_names = function (stream, subject) {
var operators = [ var operators = [
['stream', stream], ['stream', stream],
['subject', subject.toLowerCase()]]; ['subject', subject.toLowerCase()]];
var bar = { exports.activate(operators, {show_floating_recipient: false});
icon: 'bullhorn',
description: stream,
subject: subject
};
exports.activate(operators, bar, {show_floating_recipient: false});
}; };
exports.by_stream_name = function (name) { exports.by_stream_name = function (name) {
var bar = {icon: 'bullhorn', description: name}; exports.activate([['stream', name]]);
exports.activate([['stream', name]], bar);
}; };
exports.by_private_message_group = function (names, emails) { exports.by_private_message_group = function (names, emails) {
var bar = {icon: 'user', description: "You and " + names}; exports.activate([['pm-with', emails]], {show_floating_recipient: false});
exports.activate([['pm-with', emails]], bar, {show_floating_recipient: false});
}; };
// Called for the 'narrow by stream' hotkey. // Called for the 'narrow by stream' hotkey.
exports.by_recipient = function () { exports.by_recipient = function () {
var message = message_dict[target_id]; var message = message_dict[target_id];
var bar, new_narrow, emails; var new_narrow, emails;
switch (message.type) { switch (message.type) {
case 'private': case 'private':
exports.by_private_message_group(message.display_reply_to, exports.by_private_message_group(message.display_reply_to,
@ -251,8 +235,7 @@ exports.by_recipient = function () {
}; };
exports.by_search_term = function (term) { exports.by_search_term = function (term) {
var bar = {icon: 'search', description: 'Messages containing "' + term + '"'}; exports.activate([['search', term.toLowerCase()]], {allow_collapse: false});
exports.activate([['search', term.toLowerCase()]], bar, {allow_collapse: false});
load_more_messages(); load_more_messages();
}; };
@ -264,13 +247,10 @@ exports.show_all_messages = function () {
$("#zfilt").removeClass('focused_table'); $("#zfilt").removeClass('focused_table');
$("#zhome").addClass('focused_table'); $("#zhome").addClass('focused_table');
$(".narrowed_to_bar").hide();
reset_load_more_status(); reset_load_more_status();
$("#top_narrowed_whitespace").hide();
$("#main_div").removeClass('narrowed_view'); $("#main_div").removeClass('narrowed_view');
$("#searchbox").removeClass('narrowed_view'); $("#searchbox").removeClass('narrowed_view');
$("#show_all_messages").attr("disabled", "disabled"); $("#show_all_messages").attr("disabled", "disabled");
$("#currently_narrowed_to").empty();
$('#search_query').val(''); $('#search_query').val('');
// Includes scrolling. // Includes scrolling.
select_message_by_id(persistent_message_id, {then_scroll: true}); select_message_by_id(persistent_message_id, {then_scroll: true});

View File

@ -14,7 +14,7 @@ $(function () {
} }
// Compile Handlebars templates. // Compile Handlebars templates.
$.each(['message', 'subscription', 'narrowbar', $.each(['message', 'subscription',
'userinfo_popover_title', 'userinfo_popover_content', 'userinfo_popover_title', 'userinfo_popover_content',
'timeinfo_popover_content'], 'timeinfo_popover_content'],
function (index, name) { function (index, name) {

View File

@ -448,18 +448,6 @@ input.recipient_box {
-moz-border-radius: 0; -moz-border-radius: 0;
} }
.narrowed_to_bar {
/* We use display: to toggle whether or not this actually shows up,
but we need visibility: visible because its parent,
top_statusbar, is visibility: hidden and we don't want to
inherit that. */
visibility: visible;
display: none;
padding: 5px 10px;
background-color: #DDD;
border: 1px solid black;
}
.floating_recipient_bar { .floating_recipient_bar {
max-width: 640px; max-width: 640px;
/* from .message_list */ /* from .message_list */
@ -473,17 +461,6 @@ table.floating_recipient {
width: 100%; width: 100%;
} }
#narrowlabel {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding-left: 46px;
}
#currently_narrowed_to {
font-weight: bold;
}
.narrowed_view { .narrowed_view {
background-color: #DDD; background-color: #DDD;
} }
@ -493,12 +470,6 @@ table.floating_recipient {
height: 40px; height: 40px;
} }
#top_narrowed_whitespace {
visibility: hidden;
display: none;
height: 34px; /* Height of narrowlabel + floating indicator */
}
#bottom_whitespace { #bottom_whitespace {
display: block; display: block;
height: 300px; height: 300px;

View File

@ -115,7 +115,7 @@ function expected_messages(table, headings, bodies) {
function un_narrow() { function un_narrow() {
casper.test.info('Un-narrowing'); casper.test.info('Un-narrowing');
casper.click('.narrowed_to_bar .close'); keypress(27); // Esc
} }
// Start of test script. // Start of test script.