diff --git a/app/assets/v2/css/search_bar.css b/app/assets/v2/css/search_bar.css index ee822070bad..e0dca204129 100644 --- a/app/assets/v2/css/search_bar.css +++ b/app/assets/v2/css/search_bar.css @@ -69,15 +69,6 @@ overflow-y: scroll; } -.close-icon { - position: absolute; - top: 13px; - right: 25px; - width: 15px; - display: none; - cursor: pointer; -} - #search_nav li { background-color: #fff; border: 1px solid #d3d6e2; diff --git a/app/assets/v2/css/sidebar_search.css b/app/assets/v2/css/sidebar_search.css index 4bb4b9631ee..64f9c6d4768 100644 --- a/app/assets/v2/css/sidebar_search.css +++ b/app/assets/v2/css/sidebar_search.css @@ -15,6 +15,15 @@ font-size: 0.8rem; } +.close-icon { + position: absolute; + top: 13px; + right: 25px; + width: 15px; + display: none; + cursor: pointer; +} + .sidebar_search .options .option { margin-bottom: 2px; } diff --git a/app/assets/v2/js/pages/dashboard.js b/app/assets/v2/js/pages/dashboard.js index d997a80aad8..776daa03116 100644 --- a/app/assets/v2/js/pages/dashboard.js +++ b/app/assets/v2/js/pages/dashboard.js @@ -87,6 +87,10 @@ var getActiveFilters = function() { let _filters = filters.slice(); _filters.push('keywords', 'order_by', 'org'); + if (document.hackathon) { + resetFilters(true); + filters.push('org'); + } _filters.forEach(filter => { if (getParam(filter)) { localStorage[filter] = getParam(filter).replace(/^,|,\s*$/g, ''); @@ -374,13 +378,15 @@ var get_search_URI = function(offset, order) { if (!document.hackathon) { if (typeof order_by !== 'undefined') { uri += '&order_by=' + order_by; + uri += '&offset=' + offset; + uri += '&limit=' + results_limit; } } else { - uri += '&event_tag=' + document.hackathon; + uri += `&event_tag=${document.hackathon}`; + uri += '&offset=' + offset; + uri += '&limit=51'; } - uri += '&offset=' + offset; - uri += '&limit=' + results_limit; return uri; }; @@ -419,6 +425,8 @@ var reset_offset = function() { document.offset = 0; }; +let organizations = []; + var refreshBounties = function(event, offset, append, do_save_search) { // Allow search for freeform text @@ -452,6 +460,8 @@ var refreshBounties = function(event, offset, append, do_save_search) { paint_search_tabs(); window.history.pushState('', '', window.location.pathname + '?' + buildURI()); } + } else { + toggleAny(event); } if (!append) { @@ -477,9 +487,29 @@ var refreshBounties = function(event, offset, append, do_save_search) { explorer.bounties_request.abort(); } + const getOrgs = (results) => { + if (organizations.length === 0) { + results.filter((bounty)=>{ + organizations.push(bounty.org_name); + }); + organizations = [...new Set(organizations)]; + + $('#list-orgs').append(` + ${organizations.map((org, index) => ` +
+ + +
+ `).join(' ')} + `); + } + }; + explorer.bounties_request = $.get(bountiesURI, function(results, x) { results = sanitizeAPIResults(results); - + getOrgs(results); if (results.length === 0 && !append) { if (localStorage['referrer'] === 'onboard') { $('.no-results').removeClass('hidden'); @@ -529,31 +559,33 @@ var refreshBounties = function(event, offset, append, do_save_search) { $('.loading').css('display', 'none'); }); - explorer.bounties_request = $.get(featuredBountiesURI, function(results, x) { - results = sanitizeAPIResults(results); - - if (results.length === 0 && !append) { - $('.featured-bounties').hide(); - if (localStorage['referrer'] === 'onboard') { - $('.no-results').removeClass('hidden'); - $('#dashboard-content').addClass('hidden'); - } else { - $('.nonefound').css('display', 'none'); + if (!document.hackathon) { + explorer.bounties_request = $.get(featuredBountiesURI, function(results, x) { + results = sanitizeAPIResults(results); + + if (results.length === 0 && !append) { + $('.featured-bounties').hide(); + if (localStorage['referrer'] === 'onboard') { + $('.no-results').removeClass('hidden'); + $('#dashboard-content').addClass('hidden'); + } else { + $('.nonefound').css('display', 'none'); + } } - } - var html = renderFeaturedBountiesFromResults(results, true); + var html = renderFeaturedBountiesFromResults(results, true); - if (html) { - $('.featured-bounties').show(); - $('#featured-card-container').html(html); - } - }).fail(function() { - if (explorer.bounties_request.readyState !== 0) - _alert({ message: gettext('got an error. please try again, or contact support@gitcoin.co') }, 'error'); - }).always(function() { - $('.loading').css('display', 'none'); - }); + if (html) { + $('.featured-bounties').show(); + $('#featured-card-container').html(html); + } + }).fail(function() { + if (explorer.bounties_request.readyState !== 0) + _alert({ message: gettext('got an error. please try again, or contact support@gitcoin.co') }, 'error'); + }).always(function() { + $('.loading').css('display', 'none'); + }); + } }; window.addEventListener('load', function() { @@ -746,7 +778,7 @@ $(document).ready(function() { }); // sidebar filters - $('.sidebar_search input[type=radio], .sidebar_search label').change(function(e) { + $('.sidebar_search , .sidebar_search label').change('input[type=radio]', function(e) { reset_offset(); refreshBounties(null, 0, false, true); e.preventDefault(); diff --git a/app/dashboard/templates/dashboard/index.html b/app/dashboard/templates/dashboard/index.html index 9e30522ccf3..f9ae32f3d1b 100644 --- a/app/dashboard/templates/dashboard/index.html +++ b/app/dashboard/templates/dashboard/index.html @@ -58,8 +58,14 @@
{% if hackathon %} -
+ +
+
{% trans 'Bounties' %}
diff --git a/app/dashboard/templates/dashboard/sidebar_search_hackathon.html b/app/dashboard/templates/dashboard/sidebar_search_hackathon.html new file mode 100644 index 00000000000..52d3ba79628 --- /dev/null +++ b/app/dashboard/templates/dashboard/sidebar_search_hackathon.html @@ -0,0 +1,69 @@ +{% comment %} + Copyright (C) 2018 Gitcoin Core + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +{% endcomment %} +{% load i18n static %} + +