Move search and navigation menu into a "settings" gear at the top.

This is really the first step of implementing the "Oppa Gmail Style!"
redesign, and is largely an HTML/CSS-based change, with some
slight JS tweaks to deal with things being renamed or being no
longer necessary.

(imported from commit e05adc283ea066f0f90009cf712c4f3657c2485a)
This commit is contained in:
Waseem Daher
2013-01-16 15:42:35 -05:00
parent f08dc13f73
commit 504dff9a51
5 changed files with 161 additions and 175 deletions

View File

@@ -2,17 +2,6 @@
<div class="row">
<div class="span9" id="top_statusbar">
<div id="searchbox" class="always_in_view">
<form id="searchbox_form" class="form-search form-inline">
<div id="search_arrows">
<input class="search-query" id="search_query" type="text" placeholder="Search…"
autocomplete="off">
<button class="btn search_button search_button_middle" type="button" id="search_up"><i class="icon-chevron-up"></i></button>
<button class="btn search_button search_button_middle" type="button" id="search_down"><i class="icon-chevron-down"></i></button>
<button class="btn search_button" type="button" id="search_exit"><i class="icon-remove"></i></button>
</div>
</form>
</div>
<div class="floating_recipient_bar">
<table class="floating_recipient">
<tr id="floating_recipient_layout_row" class="ztable_layout_row">
@@ -36,7 +25,6 @@
<div class="row">
<div class="span9">
<div class="message_list" id="main_div">
<div id="top_whitespace"></div>
<div id="loading_more_messages_indicator"></div>
<div id="page_loading_indicator"></div>
<table class="message_table focused_table" id="zhome">

View File

@@ -102,127 +102,128 @@ var people_list = [
{% block content %}
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<div class="row">
<div class="span3 hidden-phone">
<a class="brand" href="#">Humbug</a>
<form class="navbar-search pull-left">
<input type="text" class="search-query" placeholder="Search">
</form>
</div>
</div>
<div class="row">
<div class="span3">
<div class="row">
<div class="span3 sidebar-nav affix">
<span>
<img class="img-rounded hidden-phone gravatar-profile"
src="https://secure.gravatar.com/avatar/{{ email_hash }}?d=identicon&s=60" />
<img class="img-rounded visible-phone gravatar-profile"
<div class="span9" id="navbar-middle">
<a class="brand skinny-user-gravatar visible-phone" href="#"
title="{{user_profile.full_name}} - {{user_profile.user.email}}">
<img class="img-rounded gravatar-profile"
src="https://secure.gravatar.com/avatar/{{ email_hash }}?d=identicon&s=30" />
</span>
<span class="my_fullname">{{ user_profile.full_name }}</span>
<span class="my_email {% if lurk_stream %}hidden-phone{% endif %}">{{ user_profile.user.email }}</span>
{% if lurk_stream %}
<ul class="nav nav-pills visible-phone lurk-navbar-phone">
<li title="Keyboard shortcuts">
<a href="#keyboard-shortcuts" role="button" data-toggle="modal">
<i class="icon-info-sign"></i>
</a>
<div id="searchbox">
<form id="searchbox_form" class="form-search navbar-search">
<div id="search_arrows">
<input class="search-query" id="search_query" type="text" placeholder="Search…"
autocomplete="off">
<button class="btn search_button search_button_middle" type="button" id="search_up"><i class="icon-chevron-up"></i></button>
<button class="btn search_button search_button_middle" type="button" id="search_down"><i class="icon-chevron-down"></i></button>
<button class="btn search_button" type="button" id="search_exit"><i class="icon-remove"></i></button>
</div>
</form>
</div><!-- /searchbox -->
<div id="navbar-buttons">
<ul class="nav" role="navigation">
<!-- stuff that gets visible in skinny mode -->
<li class="visible-phone" title="New stream message">
<a href="#" onclick="compose.set_mode('stream'); return false;">
<i class="icon-bullhorn"></i>
</a>
</li>
<li class="visible-phone" title="New private message">
<a href="#" onclick="compose.set_mode('private'); return false;">
<i class="icon-user"></i>
</a>
</li>
<!-- /stuff that gets visible in skinny mode -->
<li class="dropdown" id="gear-menu">
<a id="settings-dropdown" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">SE <b class="caret"></b></a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="settings-dropdown">
<li title="Home">
<a href="/" target="_blank" role="button">
<a href="#home" data-toggle="tab" onclick="narrow.restore_home_state();">
<i class="icon-home"></i>
</a>
</li>
</ul>
{% endif %}
<ul class="nav nav-pills nav-stacked {% if lurk_stream %}hidden-phone{% endif %}" id="sidebar">
<li title="Home" class="active">
<a href="#home" data-toggle="pill" onclick="narrow.restore_home_state();">
<i class="icon-home"></i>
<span class="hidden-phone"> {% if lurk_stream %}Stream {{ lurk_stream }}{% else %}Home{% endif %}</span>
{% if lurk_stream %}Stream {{ lurk_stream }}{% else %}Home{% endif %}
</a>
</li>
<li title="Subscriptions">
<a href="#subscriptions" data-toggle="pill">
<i class="icon-globe"></i>
<span class="hidden-phone"> Subscriptions</span>
<a href="#subscriptions" data-toggle="tab">
<i class="icon-globe"></i> Subscriptions
</a>
</li>
<li title="Settings">
<a href="#settings" data-toggle="pill">
<i class="icon-wrench"></i>
<span class="hidden-phone"> Settings</span>
<a href="#settings" data-toggle="tab">
<i class="icon-wrench"></i> Settings
</a>
</li>
<li title="Keyboard shortcuts">
<a href="#keyboard-shortcuts" role="button" data-toggle="modal">
<i class="icon-info-sign"></i>
<span class="hidden-phone"> Keyboard shortcuts</span>
<i class="icon-info-sign"></i> Keyboard shortcuts
</a>
<hr class="sidebar" />
</li>
<li class="divider"></li>
<li title="Feedback">
<a href="#feedback" onclick="compose.start('private', { 'private_message_recipient': 'feedback@humbughq.com' });">
<i class="icon-comment"></i>
<span class="hidden-phone"> Feedback</span>
<i class="icon-comment"></i> Feedback
</a>
</li>
{% if show_invites %}
<li title="Invite users to Humbug">
<a href="#invite-user" role="button" data-toggle="modal">
<i class="icon-gift"></i>
<span class="hidden-phone"> Invite users to Humbug</span>
<i class="icon-gift"></i> Invite users to Humbug
</a>
</li>
{% endif %}
<hr class="sidebar"/>
<li class="divider"></li>
<li title="Log out">
<a href="/accounts/logout">
<i class="icon-off"></i>
<span class="hidden-phone"> Log out</span>
<i class="icon-off"></i> Log out
</a>
</li>
{% if show_debug %}
<li title="Debug">
<a href="#debug" data-toggle="pill">
<i class="icon-barcode"></i>
<span class="hidden-phone"> Debug</span>
<a href="#debug" data-toggle="tab">
<i class="icon-barcode"></i> Debug
</a>
</li>
{% endif %}
{% if show_activity %}
<li title="Activity">
<a href="/activity" target="_blank">
<i class="icon-eye-open"></i>
<span class="hidden-phone"> Activity</span>
<i class="icon-eye-open"></i> Activity
</a>
</li>
{% endif %}
<div>
<button type="button" class="visible-phone btn btn-small phone_new_message_button"
id="left_bar_compose_stream_button_little"
onclick="compose.set_mode('stream');"
title="New stream message">
<i class="icon-bullhorn"></i>
</button>
<button type="button" class="visible-phone btn btn-small phone_new_message_button"
id="left_bar_compose_private_button_little"
onclick="compose.set_mode('private');"
title="New private message">
<i class="icon-user"></i>
</button>
</div>
</ul>
<div class="hidden-phone new_message_button">
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="navbar-spacer"></div>
<div class="row">
<div class="span3">
<div class="row">
<div class="span3 sidebar-nav affix hidden-phone">
<span>
<img class="img-rounded gravatar-profile"
src="https://secure.gravatar.com/avatar/{{ email_hash }}?d=identicon&s=60" />
</span>
<span class="my_fullname">{{ user_profile.full_name }}</span>
<span class="my_email">{{ user_profile.user.email }}</span>
<div class="new_message_button">
<button type="button" class="btn btn-large btn-block"
id="left_bar_compose_stream_button_big"
onclick="compose.set_mode('stream');">
<i class="icon-bullhorn"></i> New stream message
</button>
</div>
<div class="hidden-phone new_message_button">
<div class="new_message_button">
<button type="button" class="btn btn-large btn-block"
id="left_bar_compose_private_button_big"
onclick="compose.set_mode('private');">
@@ -260,7 +261,6 @@ var people_list = [
</div>
</div><!--/sidebar-->
<div class="span9 tab-content" id="application_area">
<div class="visible-phone" id="nav_whitespace"></div>
<div class="tab-pane active" id="home">
{% include "zephyr/home.html" %}
</div>

View File

@@ -304,7 +304,7 @@ exports.restore_home_state = function() {
// If we click on the Home link from another nav pane, just go
// back to the state you were in (possibly still narrowed) before
// you left the Home pane.
if ($('#sidebar li[title="Home"]').hasClass("active")) {
if ($('#gear-menu li[title="Home"]').hasClass("active")) {
exports.deactivate();
}
};

View File

@@ -19,7 +19,7 @@ var scroll_positions = {};
var gravatar_stamp = 1;
exports.change_tab_to = function (tabname) {
$('#sidebar a[href="' + tabname + '"]').tab('show');
$('#gear-menu a[href="' + tabname + '"]').tab('show');
};
exports.focus_on = function (field_id) {
@@ -224,20 +224,9 @@ function need_skinny_mode() {
}
function resizehandler(e) {
var sidebar = $("#sidebar");
var sidebar_nav = $(".sidebar-nav");
var composebox = $("#compose");
var top_statusbar = $("#top_statusbar");
if (need_skinny_mode()) {
sidebar.removeClass('nav-stacked');
var space_taken_up_by_navbar = sidebar_nav.outerHeight(true);
// .visible-phone only, so doesn't need undoing
$("#nav_whitespace").height(space_taken_up_by_navbar);
top_statusbar.css('top', space_taken_up_by_navbar);
var desired_width;
if (exports.home_tab_obscured() === 'other_tab') {
desired_width = $("div.tab-pane.active").outerWidth();
@@ -246,13 +235,9 @@ function resizehandler(e) {
composebox.width(desired_width);
}
top_statusbar.width(desired_width);
sidebar_nav.width(desired_width);
} else {
sidebar.addClass('nav-stacked');
top_statusbar.css('top', 0);
top_statusbar.width('');
composebox.width('');
sidebar_nav.width('');
}
$("#bottom_whitespace").height(viewport.height() * 0.4);
@@ -588,12 +573,12 @@ $(function () {
$('#old_password, #new_password, #confirm_password').val('');
}
$('#sidebar a[data-toggle="pill"]').on('show', function (e) {
$('#gear-menu a[data-toggle="tab"]').on('show', function (e) {
// Save the position of our old tab away, before we switch
var old_tab = $(e.relatedTarget).attr('href');
scroll_positions[old_tab] = viewport.scrollTop();
});
$('#sidebar a[data-toggle="pill"]').on('shown', function (e) {
$('#gear-menu a[data-toggle="tab"]').on('shown', function (e) {
// Right after we show the new tab, restore its old scroll position
var target_tab = $(e.target).attr('href');
if (scroll_positions.hasOwnProperty(target_tab)) {
@@ -623,7 +608,7 @@ $(function () {
hashchange.changehash(browser_url);
});
$('#sidebar a[href="#subscriptions"]').on('shown', subs.setup_page);
$('#gear-menu a[href="#subscriptions"]').on('shown', subs.setup_page);
var settings_status = $('#settings-status');
$("#settings-change-box form").ajaxForm({

View File

@@ -34,7 +34,7 @@ a:hover code {
.sidebar-nav {
background-color: white;
padding: 0.5em;
margin-top: 3em;
margin-top: 1em;
overflow: hidden;
text-overflow: ellipsis;
}
@@ -47,19 +47,6 @@ a:hover code {
}
}
ul#sidebar {
margin-bottom: 0px;
}
ul.lurk-navbar-phone {
float: right;
margin-bottom: 0px;
}
ul.lurk-navbar-phone li {
display: inline;
}
#nav_whitespace {
visibility: hidden;
}
@@ -451,29 +438,60 @@ input.recipient_box {
font-size: 90%;
}
#navbar-spacer {
/* A spacer that is exactly a navbar size, so that all content
gets pushed unerneath it */
width: 100%;
height: 40px;
}
#top_statusbar {
position: fixed;
/* .message_list max-width + 30px margin */
max-width: 670px;
text-decoration: none;
top: 0px;
top: 40px; /* should really be the same as the height of navbar-spacer */
visibility: hidden; /* so that we pass clicks through to underneath us */
/* If zhome has opacity on it, it suddenly starts getting drawn on top
of top_statusbar -- unless we specify a z-index. */
z-index: 2;
}
#searchbox {
/* Needed because top_statusbar is visibility: hidden
and we don't want to inherit that */
visibility: visible;
max-height: 30px;
padding: 5px 10px;
max-width: 640px;
#navbar-middle {
display: table-row;
max-width: 670px;
}
.always_in_view {
background-color: aliceblue;
.brand.skinny-user-gravatar {
padding-top: 5px;
padding-bottom: 0px;
margin-bottom: 5px;
white-space: nowrap;
}
#searchbox {
display: table-cell;
width: 99%;
}
#navbar-buttons {
display: table-cell;
white-space: nowrap;
width: 1%;
}
#navbar-buttons ul.nav {
/* Firefox-specific hack; Technically white-space: nowrap applies to
text, not "stuff in general", so in Firefox without this, the
<li>s all get smushed vertically (in Chrome and Safari, they
don't).
Fortunately, Firefox also provides this nice 'max-content'
thing which is basically 'give us as much space as we need'. */
width: -moz-max-content;
}
#searchbox_form {
width: 99%;
padding-right: 10px;
}
#search_query {
@@ -482,8 +500,8 @@ input.recipient_box {
@media (max-width: 480px) {
/* This is a hack to keep the search box from overflowing outside the
message area -- really the formula should be something like
[message area width] - [search query horizontal overhead]
At narrow widths, the overhead is a larger % of the window width.
[message area width] - [search query horizontal overhead] At
narrow widths, the overhead is a larger % of the window width.
*/
#search_query {
width: 90%;
@@ -494,12 +512,16 @@ input.recipient_box {
background-color: #FCEA81;
}
#search_arrows {
margin-bottom: 5px;
}
#searchbox .search_button {
display: none;
margin-bottom: 10px;
text-align: center;
padding: 4px 10px 4px 10px;
}
/* A cheat, because input-prepend and input-append aren't
smart enough to do the right thing with search-query */
#searchbox .search_button_middle {
@@ -531,11 +553,6 @@ table.floating_recipient {
background-color: #DDD;
}
#top_whitespace {
display: block;
height: 40px;
}
#bottom_whitespace {
display: block;
height: 300px;
@@ -708,10 +725,6 @@ table.floating_recipient {
display: none;
}
hr.sidebar {
margin: 0px;
}
@media (max-width: 480px) {
body {
padding-right: 5px;