Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
Revert "desktop filters in da haus (bug 811356)"
Browse files Browse the repository at this point in the history
This reverts commit 3cd9049.
  • Loading branch information
cvan committed Dec 6, 2012
1 parent 4f9324f commit bfdb8c4
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 144 deletions.
82 changes: 0 additions & 82 deletions media/css/mkt/desktop-filters.less

This file was deleted.

42 changes: 42 additions & 0 deletions media/css/mkt/desktop-header.less
Expand Up @@ -37,6 +37,28 @@
top: 80px;
}

// TODO: These are temporary styles. Davor, remove this with bug 811356.
.search {
#page {
padding-top: 91px;
&:before {
background: @grain-src #566773;
background-size: 100px 100px;
border-bottom: 1px solid rgba(0,0,0,.2);
content: "";
display: block;
position: absolute;
top: 80px;
height: 40px;
width: 100%;
z-index: 3;
}
}
.incompatible-browser.active {
top: 91px;
}
}

// The logo is permanent in the header.
#site-header h1.page {
display: none;
Expand Down Expand Up @@ -90,6 +112,19 @@
&.home {
display: none !important;
}

// TODO: These are temporary styles. Davor, remove this with bug 811356.
&.filter,
&.expand {
margin-top: 37px;
}
&.filter {
color: @black;
}
&.expand {
margin-right: 50px;
}

&.settings {
background-position: 100% 50%;
display: block;
Expand All @@ -115,6 +150,13 @@
}
}
}
// TODO: These are temporary styles. Davor, remove this with bug 811356.
#search-results {
padding-top: 45px;
.listing {
border-top: 1px solid @light-gray;
}
}
}

@media screen and (min-width: @desktop),
Expand Down
2 changes: 1 addition & 1 deletion media/css/mkt/search.less
Expand Up @@ -68,7 +68,7 @@ b[data-href] {
}
}

// たぶんちさいです
// たぶんちがいます
@media(min-width: 500px) {
body[data-page-type='search'] #site-header h1 {
display: inline-block;
Expand Down
48 changes: 20 additions & 28 deletions media/js/mkt/init.js
Expand Up @@ -18,6 +18,7 @@ var z = {
canInstallApps: true,
allowAnonInstalls: !!$('body').data('allow-anon-installs'),
enableSearchSuggestions: !!$('body').data('enable-search-suggestions'),
// if ($('#myDialog li').length > z.confirmBreakNum) add class 'two-col'.
confirmBreakNum: 6
};

Expand Down Expand Up @@ -111,33 +112,6 @@ z.page.on('fragmentloaded', function() {
$('a[rel=external]').attr('target', '_blank');
}

// Initialize selected class for currently active search filter (if any).
function initSelectedFilter() {
var sortoption = z.getVars();

$('#filter-sort li a').removeClass('sel');
switch (sortoption.sort) {
case 'None':
$('#filter-sort li.relevancy a').addClass('sel');
break;
case 'popularity':
$('#filter-sort li.popularity a').addClass('sel');
break;
case 'rating':
$('#filter-sort li.rating a').addClass('sel');
break;
case '':
case undefined:
// If there's nothing selected, the first one is always the
// default.
$('#filter-sort li:first-child a').addClass('sel');
}
}

if (z.capabilities.desktop) {
initSelectedFilter();
}

// Header controls.
$('header').on('click', '.header-button', function(e) {
var $this = $(this),
Expand All @@ -148,7 +122,25 @@ z.page.on('fragmentloaded', function() {
$('#filters').removeClass('show');
} else if ($this.hasClass('filter')) {
// `getVars()` defaults to use location.search.
initSelectedFilter();
var sortoption = z.getVars();

$('#filter-sort li a').removeClass('sel');
switch(sortoption.sort) {
case 'None':
$('#filter-sort li.relevancy a').addClass('sel');
break;
case 'popularity':
$('#filter-sort li.popularity a').addClass('sel');
break;
case 'rating':
$('#filter-sort li.rating a').addClass('sel');
break;
case '':
case undefined:
// If there's nothing selected, the first one is always the
// default.
$('#filter-sort li:first-child a').addClass('sel');
}
$('#filters').addClass('show');
} else if ($this.hasClass('search')) {
z.body.addClass('show-search');
Expand Down
17 changes: 7 additions & 10 deletions media/js/mkt/search.js
Expand Up @@ -6,15 +6,9 @@
}));

// Add 'sel' class to active filter and set hidden input value.
z.page.on('click', '#filters .toggles a, .filters-bar a', function() {
var $this = $(this);
selectMe($this);

// On mobile the apply button will submit our form.
// On desktop we'll follow the href.
if ($this.closest('.toggles').length) {
return false;
}
z.page.on('click', '#filters .toggles a', function() {
selectMe($(this));
return false;
});

// Clear search field on 'cancel' search suggestions.
Expand All @@ -33,6 +27,7 @@
}
$myUL.find('a').removeClass('sel');


if ($myUL[0].id == 'filter-prices') {
val = vars.price || '';
} else if ($myUL[0].id == 'filter-sort') {
Expand All @@ -53,6 +48,8 @@
$('#filters form').submit();
}));



// If we're on desktop, show graphical results - unless specified by user.
var expandListings;

Expand All @@ -78,7 +75,7 @@
function initExpanded() {
var storedExpand = localStorage.getItem('expand-listings');
if (storedExpand === undefined) {
expandListings = z.capabilities.desktop;
expandListings = z.capabilities.desktop
} else {
expandListings = storedExpand === 'true';
}
Expand Down
1 change: 0 additions & 1 deletion mkt/asset_bundles.py
Expand Up @@ -157,7 +157,6 @@
'css/devreg/footer.less',
'css/mkt/desktop.less',
'css/mkt/desktop-header.less',
'css/mkt/desktop-filters.less',
),
})

Expand Down
29 changes: 10 additions & 19 deletions mkt/search/templates/search/results.html
@@ -1,5 +1,4 @@
{% extends 'mkt/base.html' %}
{% set mobile = request.MOBILE %}

{% if category %}
{% set src = 'mkt-category' %}
Expand Down Expand Up @@ -39,15 +38,13 @@

{% block content %}
{{ mkt_breadcrumbs(product, crumbs) }}
<section id="filters" class="{{ 'overlay' if mobile }}{{ ' alt' if show_paid }}">
{% if mobile %}
<header class="classic-header">
<a href="#" class="header-button icon back left dismiss"><b></b></a>
<h1>{{ _('Filter') }}</h1>
</header>
{% endif %}
<section id="filters" class="overlay{% if show_paid %} alt{% endif %}">
<header class="classic-header">
<a href="#" class="header-button icon back left dismiss"><b></b></a>
<h1>{{ _('Filter') }}</h1>
</header>

<div class="{{ 'filters-body' if mobile else 'filters-bar' }}">
<div class="filters-body">
<form action="" method="get">
<div>
{% if show_paid %}
Expand All @@ -71,8 +68,8 @@ <h2>{{ _('Filter by price') }}</h2>
{% endif %}

{# We're not iterating over all the sort options on purpose. #}
{% if mobile %}<h2>{{ _('Sort by') }}</h2>{% endif %}
<ul class="{{ 'toggles two-col ' if mobile }}c" id="filter-sort">
<h2>{{ _('Sort by') }}</h2>
<ul class="toggles two-col c" id="filter-sort">
{% if active_cat %}
<li class="popularity">
<a href="{{ search_url|urlparams(page=None,
Expand All @@ -87,18 +84,15 @@ <h2>{{ _('Filter by price') }}</h2>
</li>
{% endif %}
<li class="rating">
<a href="{{ search_url|urlparams(page=None, sort='rating') }}">
{{ _('Rating') }}
</a>
<a href="{{ search_url|urlparams(page=None, sort='rating') }}"
class="sel">{{ _('Rating') }}</a>
</li>
</ul>
<input type="hidden" name="sort" value="{{ query['sort'] }}">

{% if mobile %}
<div class="footer-action">
<a href="#" class="apply">{{ _('Apply') }}</a>
</div>
{% endif %}
</div>
</form>
</div>
Expand All @@ -115,9 +109,6 @@ <h2>{{ _('Filter by price') }}</h2>
{% endif %}
</section>
<section id="search-results" class="full c">
{% if not mobile and not browse and query.q %}
<h1>{{ _('Search:') }} {{ query.q }}</h1>
{% endif %}
{% if pager.object_list %}
<ol class="listing c" start="{{ pager.start_index() }}">
{{ search_results(pager.object_list, field=query.sort, src=src) }}
Expand Down
4 changes: 1 addition & 3 deletions mkt/templates/mkt/header.html
Expand Up @@ -24,9 +24,7 @@ <h1 class="site"><a href="{{ url('home') }}">Firefox Marketplace</a></h1>
<a href="#" id="nav-back" class="header-button icon back left" title="{{ _('Back') }}"><b></b></a>
<a href="#" class="header-button icon search right" title="{{ _('Search') }}"></a>
<a href="#" class="header-button cancel right">{{ _('Cancel') }}</a>
{% if request.MOBILE %}
<a href="#" class="header-button filter right">{{ _('Filter') }}</a>
{% endif %}
<a href="#" class="header-button filter right">{{ _('Filter') }}</a>
<a href="#" class="header-button icon expand right" title="{{ _('Expand') }}"></a>
{% block search %}
{% set data = {'cat': category.id} if category else request.GET %}
Expand Down

0 comments on commit bfdb8c4

Please sign in to comment.