From bfdb8c40aa4f17e8422cf016b3df243d0d531af9 Mon Sep 17 00:00:00 2001 From: Chris Van Date: Thu, 6 Dec 2012 12:39:35 -0800 Subject: [PATCH] Revert "desktop filters in da haus (bug 811356)" This reverts commit 3cd9049935679c7a43c0ab77775c02a4fa36afab. --- media/css/mkt/desktop-filters.less | 82 ------------------------ media/css/mkt/desktop-header.less | 42 ++++++++++++ media/css/mkt/search.less | 2 +- media/js/mkt/init.js | 48 ++++++-------- media/js/mkt/search.js | 17 ++--- mkt/asset_bundles.py | 1 - mkt/search/templates/search/results.html | 29 +++------ mkt/templates/mkt/header.html | 4 +- 8 files changed, 81 insertions(+), 144 deletions(-) delete mode 100644 media/css/mkt/desktop-filters.less diff --git a/media/css/mkt/desktop-filters.less b/media/css/mkt/desktop-filters.less deleted file mode 100644 index 780a450d33c..00000000000 --- a/media/css/mkt/desktop-filters.less +++ /dev/null @@ -1,82 +0,0 @@ -@import 'lib'; - -// これのほうがいいです -@media(min-width: @desktop) { - #filters { - top: -11px; - position: relative; - height: 40px; - background: none; - z-index: 9; - form { - margin: 0; - > div { - margin: 0; - padding: 0; - } - } - #filter-sort { - margin: 0; - padding: 0; - list-style-type: none; - li { - float: left; - margin-right: 13px; - background: url(../../img/mkt/divider.png) no-repeat 0 2px; - padding-left: 13px; - &:first-child { - background-image: none; - padding-left: 0; - } - a { - display: block; - outline: 0; - color: @white; - text-shadow: 0 1px 1px rgba(0,0,0,0.6); - line-height: 40px; - font-size: 14px; - border-top: 1px solid transparent; // Preserve spacing. - &.sel { - border-top: 1px solid #00b2ff; - color: #00b2ff; - } - } - } - } - } - nav .header-button.expand { - margin: 35px 0 0; - } - .search { - #page { - padding-top: 91px; - &:before { - .gradient-two-color(#2b343b, #2e383f); - border-bottom: 1px solid rgba(0,0,0,.2); - border-top: 1px solid #262f34; - content: ""; - display: block; - position: absolute; - top: 80px; - height: 38px; - width: 100%; - z-index: 3; - } - } - .incompatible-browser.active { - top: 91px; - } - } - #search-results { - h1 { - margin-bottom: 10px; - } - padding-top: 35px; - .listing { - border-top: 1px solid @light-gray; - } - } - .header-button.expand.icon:before { - left: 24px; - } -} diff --git a/media/css/mkt/desktop-header.less b/media/css/mkt/desktop-header.less index 8904e13e230..76af973bf7e 100644 --- a/media/css/mkt/desktop-header.less +++ b/media/css/mkt/desktop-header.less @@ -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; @@ -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; @@ -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), diff --git a/media/css/mkt/search.less b/media/css/mkt/search.less index 47aa36217be..633fa897b75 100644 --- a/media/css/mkt/search.less +++ b/media/css/mkt/search.less @@ -68,7 +68,7 @@ b[data-href] { } } -// たぶんちさいです +// たぶんちがいます @media(min-width: 500px) { body[data-page-type='search'] #site-header h1 { display: inline-block; diff --git a/media/js/mkt/init.js b/media/js/mkt/init.js index 2aff8d3344a..5ae5e521f25 100644 --- a/media/js/mkt/init.js +++ b/media/js/mkt/init.js @@ -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 }; @@ -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), @@ -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'); diff --git a/media/js/mkt/search.js b/media/js/mkt/search.js index b8f90993ee3..abc56de89d9 100644 --- a/media/js/mkt/search.js +++ b/media/js/mkt/search.js @@ -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. @@ -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') { @@ -53,6 +48,8 @@ $('#filters form').submit(); })); + + // If we're on desktop, show graphical results - unless specified by user. var expandListings; @@ -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'; } diff --git a/mkt/asset_bundles.py b/mkt/asset_bundles.py index 643ba227771..7407be1ecad 100644 --- a/mkt/asset_bundles.py +++ b/mkt/asset_bundles.py @@ -157,7 +157,6 @@ 'css/devreg/footer.less', 'css/mkt/desktop.less', 'css/mkt/desktop-header.less', - 'css/mkt/desktop-filters.less', ), }) diff --git a/mkt/search/templates/search/results.html b/mkt/search/templates/search/results.html index d8620dd9341..ea44f4524c1 100644 --- a/mkt/search/templates/search/results.html +++ b/mkt/search/templates/search/results.html @@ -1,5 +1,4 @@ {% extends 'mkt/base.html' %} -{% set mobile = request.MOBILE %} {% if category %} {% set src = 'mkt-category' %} @@ -39,15 +38,13 @@ {% block content %} {{ mkt_breadcrumbs(product, crumbs) }} -
- {% if mobile %} -
- -

{{ _('Filter') }}

-
- {% endif %} +
+
+ +

{{ _('Filter') }}

+
-
+
{% if show_paid %} @@ -71,8 +68,8 @@

{{ _('Filter by price') }}

{% endif %} {# We're not iterating over all the sort options on purpose. #} - {% if mobile %}

{{ _('Sort by') }}

{% endif %} -
@@ -115,9 +109,6 @@

{{ _('Filter by price') }}

{% endif %}
- {% if not mobile and not browse and query.q %} -

{{ _('Search:') }} {{ query.q }}

- {% endif %} {% if pager.object_list %}
    {{ search_results(pager.object_list, field=query.sort, src=src) }} diff --git a/mkt/templates/mkt/header.html b/mkt/templates/mkt/header.html index ef9ca74c934..c9a93bbfefd 100644 --- a/mkt/templates/mkt/header.html +++ b/mkt/templates/mkt/header.html @@ -24,9 +24,7 @@

    Firefox Marketplace

    {{ _('Cancel') }} - {% if request.MOBILE %} - {{ _('Filter') }} - {% endif %} + {{ _('Filter') }} {% block search %} {% set data = {'cat': category.id} if category else request.GET %}