Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a gitcoin.co/explorer stale bounty filter #7229

Merged
merged 3 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.DS_Store*
*.pyc
chatdata/config/*
chatconfig/config.json
chatdata/root.html
static/*
sftp-config.json
Expand Down
6 changes: 5 additions & 1 deletion app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,11 @@
path('hackathon/<str:hackathon>/new', dashboard.views.new_hackathon_bounty, name='new_hackathon_bounty2'),
path('hackathon/<str:hackathon>/', dashboard.views.hackathon, name='hackathon'),
path('hackathon/dashboard/<str:hackathon>', dashboard.views.dashboard_sponsors, name='sponsors-dashboard'),
path('hackathon/dashboard/<str:hackathon>/<str:panel>', dashboard.views.dashboard_sponsors, name='sponsors-dashboard'),
path(
'hackathon/dashboard/<str:hackathon>/<str:panel>',
dashboard.views.dashboard_sponsors,
name='sponsors-dashboard'
),
path('hackathon/<str:hackathon>', dashboard.views.hackathon, name='hackathon2'),
path('hackathon/<str:hackathon>/onboard/', dashboard.views.hackathon_onboard, name='hackathon_onboard2'),
path('hackathon/<str:hackathon>/<str:panel>/', dashboard.views.hackathon, name='hackathon'),
Expand Down
14 changes: 13 additions & 1 deletion app/assets/v2/js/pages/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ var get_search_URI = function(offset, order) {
values.forEach(function(_value) {
var _key;

if (_value === 'createdByMe') {
if (_value === 'createdByMe' || _value === 'stale') {
_key = 'bounty_owner_github_username';
_value = document.contxt.github_handle;
} else if (_value === 'startedByMe') {
Expand Down Expand Up @@ -529,6 +529,18 @@ var refreshBounties = function(event, offset, append) {
}

explorer.bounties_request = $.get(bountiesURI, function(results, x) {

// Filter results by open bounties created more than 3 days ago
if ($('input[name="bounty_filter"]:checked').val().toString() === 'stale') {
results = results.filter(bounty => {
const now = new Date();
const created = new Date(bounty.web3_created);
const daysAgo = new Date(now.setDate(now.getDate() - 3));

return daysAgo > created && bounty.status === 'open';
});
}

results = sanitizeAPIResults(results);

if (results.length === 0 && !append) {
Expand Down
75 changes: 44 additions & 31 deletions app/dashboard/templates/dashboard/sidebar_search.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{% comment %}
Copyright (C) 2020 Gitcoin Core
Copyright (C) 2020 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 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.
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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see
<http: //www.gnu.org/licenses />.
{% endcomment %}
{% load i18n static %}
<div class="sidebar_search font-body">
Expand Down Expand Up @@ -43,7 +44,8 @@
<div class="col">
<div class="col-12 subheading">
{% trans "Status" %}
<i class="fas fa-question-circle ml-2" data-toggle="popover" data-trigger="hover" data-html="true" data-container="body" data-content='{% include "shared/status_tooltip.html" %}'></i>
<i class="fas fa-question-circle ml-2" data-toggle="popover" data-trigger="hover" data-html="true"
data-container="body" data-content='{% include "shared/status_tooltip.html" %}'></i>
</div>
<div class="col-12 options">
<div class="form__radio option">
Expand Down Expand Up @@ -86,7 +88,8 @@
<div class="col my-1 mt-3">
<div class="col-12 subheading">
{% trans "Tribe name" %}
<i class="fas fa-question-circle ml-2" data-toggle="popover" data-trigger="hover" data-html="true" data-container="body" data-content='{% include "shared/organization_tooltip.html" %}'></i>
<i class="fas fa-question-circle ml-2" data-toggle="popover" data-trigger="hover" data-html="true"
data-container="body" data-content='{% include "shared/organization_tooltip.html" %}'></i>
</div>
<div class="col-12">
<div class="mb-2">
Expand Down Expand Up @@ -125,7 +128,8 @@
<div class="col">
<div class="col-12 subheading">
{% trans "Project Type" %}
<i class="fas fa-question-circle ml-2" data-toggle="popover" data-trigger="hover" data-html="true" data-container="body" data-content='{% include "shared/project_type_tooltip.html" %}'></i>
<i class="fas fa-question-circle ml-2" data-toggle="popover" data-trigger="hover" data-html="true"
data-container="body" data-content='{% include "shared/project_type_tooltip.html" %}'></i>
</div>
<div class="col-12 options">
<div class="checkbox_container">
Expand Down Expand Up @@ -175,23 +179,28 @@
<div class="col-12 subheading">{% trans "My Bounties" %}</div>
<div class="col-12 options">
<div class="form__radio option">
<input name="bounty_filter" id="createdByMe" type="radio" value="createdByMe" val-ui='Created'/>
<input name="bounty_filter" id="createdByMe" type="radio" value="createdByMe" val-ui='Created' />
<label class="filter-label" for=createdByMe>{% trans "Created By Me" %}</label>
</div>
<div class="form__radio option">
<input name="bounty_filter" id="startedByMe" type="radio" value="startedByMe" val-ui='Started'/>
<input name="bounty_filter" id="startedByMe" type="radio" value="startedByMe" val-ui='Started' />
<label class="filter-label" for=startedByMe>{% trans "Started By Me" %}</label>
</div>
<div class="form__radio option">
<input name="bounty_filter" id="FulfilledByMe" type="radio" value="fulfilledByMe" val-ui='Fulfilled'/>
<input name="bounty_filter" id="FulfilledByMe" type="radio" value="fulfilledByMe" val-ui='Fulfilled' />
<label class="filter-label" for=FulfilledByMe>{% trans "Fulfilled By Me" %}</label>
</div>
<div class="form__radio option">
<input name="bounty_filter" id="ReservedForMe" type="radio" value="reservedForMe" val-ui='Reserved For Me'/>
<input name="bounty_filter" id="ReservedForMe" type="radio" value="reservedForMe"
val-ui='Reserved For Me' />
<label class="filter-label" for=ReservedForMe>{% trans "Reserved For Me" %}</label>
</div>
<div class="form__radio option">
<input name="bounty_filter" id="all_bounty" type="radio" value="any" checked/>
<input name="bounty_filter" id="stale" type="radio" value="stale" val-ui='Not Picked Up 3+ Days' />
<label class="filter-label" for=stale>{% trans "Not Picked Up 3+ Days" %}</label>
</div>
<div class="form__radio option">
<input name="bounty_filter" id="all_bounty" type="radio" value="any" checked />
<label class="filter-label" for=all_bounty>{% trans "All" %}</label>
</div>
</div>
Expand All @@ -203,31 +212,33 @@
<div class="col-12 subheading">{% trans "Moderation" %}</div>
<div class="col-12 options">
<div class="form__radio option">
<input name="moderation_filter" id="escalated" type="radio" value="escalated" val-ui="Escalated"/>
<input name="moderation_filter" id="escalated" type="radio" value="escalated" val-ui="Escalated" />
<label class="filter-label" for=escalated>{% trans "Escalated" %}</label>
</div>
<div class="form__radio option">
<input name="moderation_filter" id="warned" type="radio" value="warned" val-ui="Warned"/>
<input name="moderation_filter" id="warned" type="radio" value="warned" val-ui="Warned" />
<label class="filter-label" for=warned>{% trans "Warned" %}</label>
</div>
<div class="form__radio option">
<input name="moderation_filter" id="hidden" type="radio" value="hidden" val-ui="Hidden"/>
<input name="moderation_filter" id="hidden" type="radio" value="hidden" val-ui="Hidden" />
<label class="filter-label" for=hidden>{% trans "Hidden" %}</label>
</div>
<div class="form__radio option">
<input name="moderation_filter" id="not_started" type="radio" value="not_started" val-ui="Not Started"/>
<input name="moderation_filter" id="not_started" type="radio" value="not_started" val-ui="Not Started" />
<label class="filter-label" for=not_started>{% trans "Not Picked Up 3+ Days" %}</label>
</div>
<div class="form__radio option">
<input name="moderation_filter" id="closed_on_github" type="radio" value="closed_on_github" val-ui="Closed On Github"/>
<input name="moderation_filter" id="closed_on_github" type="radio" value="closed_on_github"
val-ui="Closed On Github" />
<label class="filter-label" for=closed_on_github>{% trans "Closed On Github" %}</label>
</div>
<div class="form__radio option">
<input name="moderation_filter" id="needs_review" type="radio" value="needs_review" val-ui="Needs Review"/>
<input name="moderation_filter" id="needs_review" type="radio" value="needs_review"
val-ui="Needs Review" />
<label class="filter-label" for=needs_review>{% trans "Needs Review" %}</label>
</div>
<div class="form__radio option">
<input name="moderation_filter" id="no_moderation" type="radio" value="" checked/>
<input name="moderation_filter" id="no_moderation" type="radio" value="" checked />
<label class="filter-label" for=no_moderation>{% trans "No Moderation" %}</label>
</div>
</div>
Expand All @@ -237,11 +248,13 @@
<div class="col">
<div class="col-12 subheading">
{% trans "Permissions" %}
<i class="fas fa-question-circle ml-2" data-toggle="popover" data-trigger="hover" data-html="true" data-container="body" data-content='{% include "shared/permissions_type_tooltip.html" %}'></i>
<i class="fas fa-question-circle ml-2" data-toggle="popover" data-trigger="hover" data-html="true"
data-container="body" data-content='{% include "shared/permissions_type_tooltip.html" %}'></i>
</div>
<div class="col-12 options">
<div class="checkbox_container">
<input name="permission_type" id="permissionless" type="checkbox" value="permissionless" val-ui='Permissionless' />
<input name="permission_type" id="permissionless" type="checkbox" value="permissionless"
val-ui='Permissionless' />
<span class="checkbox"></span>
<div class="filter-label">
<label for=permissionless>{% trans "Permissionless" %}</label>
Expand Down Expand Up @@ -275,14 +288,14 @@
</div>
</div>
<div class="checkbox_container">
<input name="project_length" id="weeks" type="checkbox" value="weeks" val-ui='Weeks-Long' />
<input name="project_length" id="weeks" type="checkbox" value="weeks" val-ui='Weeks-Long' />
<span class="checkbox"></span>
<div class="filter-label">
<label for=weeks>{% trans "Weeks" %}</label>
</div>
</div>
<div class="checkbox_container">
<input name="project_length" id="months" type="checkbox" value="months" val-ui='Months-Long' />
<input name="project_length" id="months" type="checkbox" value="months" val-ui='Months-Long' />
<span class="checkbox"></span>
<div class="filter-label">
<label for=months>{% trans "Months" %}</label>
Expand Down Expand Up @@ -356,4 +369,4 @@
<div>
<p id="clear">{% trans "Reset Filters" %}</p>
</div>
</div>
</div>