From d67566b3ab6cf55433ebe153215e13364fa8855d Mon Sep 17 00:00:00 2001 From: Arsen Melikyan Date: Tue, 19 Jan 2016 10:59:05 +0400 Subject: [PATCH] Add the filter button and fix superblock's position --- client/less/map.less | 3 ++- client/main.js | 23 ++++++++++++++++++++++- server/views/map/show.jade | 7 +++++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/client/less/map.less b/client/less/map.less index 7176fcdecf..bf9ab26cbb 100644 --- a/client/less/map.less +++ b/client/less/map.less @@ -83,6 +83,7 @@ .map-fixed-header { position: fixed; background: white; + padding-top:15px; width: 100%; z-index: 1; left: 0; @@ -91,7 +92,7 @@ .map-accordion { position: absolute; - margin-top: 180px; + margin-top: 135px; overflow-y: auto; } diff --git a/client/main.js b/client/main.js index 18d099aaf8..58ad57883a 100644 --- a/client/main.js +++ b/client/main.js @@ -283,7 +283,7 @@ $(document).ready(function() { } if (String(window.location).match(/\/map$/ig)) { - $('.text-center').css('top', '50px'); + $('.map-fixed-header').css('top', '50px'); } // map @@ -319,6 +319,27 @@ $(document).ready(function() { } }); + $('#manipAll').on('click', () => { + var showAll = $('#manipAll').hasClass('active'); + if (showAll) { + $.each($('.sr-only'), function(i, item) { + if ($(item).text() === ' Complete') { + $(item).parents('p').css('display', 'none'); + $(item).parents('p').addClass('manip-hidden'); + } + }); + $('#manipAll').text('Show all challenges'); + return $('#manipAll').removeClass('active'); + } else { + $.each($('.manip-hidden'), function(i, item) { + $(item).css('display', 'block'); + $(item).removeClass('manip-hidden'); + }); + $('#manipAll').text('Show incomplete challenges'); + return $('#manipAll').addClass('active'); + } + }); + $('#showAll').on('click', () => { var mapExpanded = $('#showAll').hasClass('active'); if (!mapExpanded) { diff --git a/server/views/map/show.jade b/server/views/map/show.jade index 8b831d08f3..83612c9fd0 100644 --- a/server/views/map/show.jade +++ b/server/views/map/show.jade @@ -4,9 +4,12 @@ block content p Required challenges are marked with a * .row .col-xs-10.col-xs-offset-1.col-sm-6.col-sm-offset-3.col-md-4.col-md-offset-4 - .btn.btn-primary.btn-block.active#showAll Collapse all challenges + .row + .col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3 + .btn.btn-sm.btn-block.btn-primary.active#manipAll Show incomplete challenges + .btn.btn-sm.btn-block.btn-primary.active#showAll Collapse all hr - #accordion + #accordion.map-accordion .button-spacer for superBlock, index in superBlocks h2