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

GITC-505: Grants explorer search improvements #9627

Merged
merged 10 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from 9 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
14 changes: 10 additions & 4 deletions app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,13 @@
name='hackathon_project_page'
),
path('modal/save_project/', dashboard.views.hackathon_save_project, name='hackathon_save_project'),

url(r'^hackathon/<str:hackathon>/?$/?', dashboard.views.hackathon, name='hackathon'),
url(r'^hackathon/<str:hackathon>/<str:panel>/?$/?', dashboard.views.hackathon, name='hackathon'),

# list all hackathons
re_path(r'^hackathon-list/?$', dashboard.views.get_hackathons, name='get_hackathons'),
re_path(r'^hackathon/?$', dashboard.views.get_hackathons, name='get_hackathons'),
re_path(r'^hackathons/?$', dashboard.views.get_hackathons, name='get_hackathons'),

url(r'^register_hackathon/', dashboard.views.hackathon_registration, name='hackathon_registration'),
path('api/v0.1/hackathon/<str:hackathon>/save/', dashboard.views.save_hackathon, name='save_hackathon'),
path('api/v1/hackathon/<str:hackathon>/prizes', dashboard.views.hackathon_prizes, name='hackathon_prizes_api'),
Expand Down Expand Up @@ -737,7 +735,11 @@
name='no_applicant_reminder'
),
re_path(r'^_administration/email/match_distribution$', retail.emails.match_distribution, name='match_distribution'),
re_path(r'^_administration/email/clr_match_claim$', retail.emails.grant_match_distribution_final_txn, name='clr_match_claim'),
re_path(
r'^_administration/email/clr_match_claim$',
retail.emails.grant_match_distribution_final_txn,
name='clr_match_claim'
),
thelostone-mc marked this conversation as resolved.
Show resolved Hide resolved

# docs
re_path(r'^_administration/docs/', include('django.contrib.admindocs.urls')),
Expand Down Expand Up @@ -785,7 +787,11 @@

# for robots
url(r'^robots.txt/?', retail.views.robotstxt, name='robotstxt'),
path('sitemap.xml', cache_page(604800)(sitemap_index), {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.index'),
path(
'sitemap.xml',
cache_page(604800)(sitemap_index), {'sitemaps': sitemaps},
name='django.contrib.sitemaps.views.index'
),
thelostone-mc marked this conversation as resolved.
Show resolved Hide resolved
path(
'sitemap-<section>.xml',
cache_page(604800)(sitemap), {'sitemaps': sitemaps},
Expand Down
16 changes: 12 additions & 4 deletions app/assets/v2/js/grants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ if (document.getElementById('grants-showcase')) {
fetchedPages: [],
handle: document.contxt.github_handle,
editingCollection: false,
createCollectionRedirect: false
createCollectionRedirect: false,
activeTimeout: null
},
methods: {
toggleStyle: function(style) {
Expand Down Expand Up @@ -159,7 +160,6 @@ if (document.getElementById('grants-showcase')) {

vm.clrData = clrJson;
},

changeBanner: function() {
this.regex_style = document.all_routing_policies &&
document.all_routing_policies.find(policy => {
Expand Down Expand Up @@ -187,7 +187,16 @@ if (document.getElementById('grants-showcase')) {
vm.updateUrlParams();
}
},
filterCollection: async function(collection_id) {
delayedChangeQuery: function() {
if (this.activeTimeout) {
window.clearTimeout(this.activeTimeout);
}
this.activeTimeout = setTimeout(() => {
this.changeQuery({page: 1});
this.activeTimeout = null;
}, 500);
},
filterCollection: async function(collectionId) {
let vm = this;

// clear previous state
Expand Down Expand Up @@ -341,7 +350,6 @@ if (document.getElementById('grants-showcase')) {
list: CartData.loadCart()
}
});

vm.lock = false;

return vm.grants;
Expand Down
15 changes: 0 additions & 15 deletions app/dashboard/tests/test_dashboard_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,21 +209,6 @@ def test_can_submit_standard_bounty_after_expiration_date_if_deadline_extended()
)
assert bounty.can_submit_after_expiration_date is True

# @staticmethod
# def test_title_or_desc():
# bounty = Bounty.objects.create(
# title='TitleTest',
# idx_status=0,
# is_open=False,
# web3_created=datetime(2008, 10, 31, tzinfo=pytz.UTC),
# expires_date=datetime(2008, 11, 30, tzinfo=pytz.UTC),
# github_url='https://github.com/gitcoinco/web/issues/1',
# raw_data={}
# )
# assert bounty.title_or_desc == "TitleTest"
# bounty.title = None
# assert bounty.title_or_desc == "HTTP API Documentation"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this failing? Why have we commented it out?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He's removed out commented out code. :P

@staticmethod
def test_github_issue_number():
bounty = Bounty.objects.create(
Expand Down
42 changes: 24 additions & 18 deletions app/grants/templates/grants/explorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
v-model="params.keyword"
@focus="searchVisible=true"
@blur="searchVisible=false"
@input="changeQuery({page: 1})"
@input="delayedChangeQuery()"
@keyup.enter="changeQuery({page: 1})"/>
<div class="navCart dropdown gc-cart" v-if="!searchVisible && sticky_active">
<a href="" class="gc-cart__icon d-block" role="button" @click="$refs.navCart.init()"
Expand Down Expand Up @@ -337,26 +337,32 @@
</button>
</template>
</div>

<div class="infinite-container row" v-if="grants && grants.length">
<div :class="`col-12 ${view == 'grid' ? 'col-md-6 col-xl-4' : ''} mb-4 infinite-item grant-card`" v-for="(grant, id) in grants">
<a class="text-decoration-none" :href="grant.details_url">
{% include 'grants/components/card.html' %}
</a>
<div v-if="lock">
<div class="d-flex flex-column justify-content-center">
<img class="d-block w-25 mx-auto" src="/static/v2/images/loading_v2.gif">
</div>
</div>
<div v-else>
<div class="infinite-container row" v-if="grants && grants.length">
<div :class="`col-12 ${view == 'grid' ? 'col-md-6 col-xl-4' : ''} mb-4 infinite-item grant-card`" v-for="(grant, id) in grants">
<a class="text-decoration-none" :href="grant.details_url">
{% include 'grants/components/card.html' %}
</a>
</div>
</div>

<div class="col-12 mb-3 mx-auto col-md-6 text-center" v-else>
<img class="obiwan my-4" src="{% static "v2/images/obiwan-bot.svg" %}">
<h1 class="font-title-lg font-weight-semibold mt-4 mb-2">{% trans "This is not the grant you’re looking for." %}</h1>
<p class="font-subheader text">
{% trans "We couldn't match with any grants on Gitcoin." %}</br>
{% trans "Please try another search term or browse for a grant." %}
</p>
<div class="col-12 pt-4 pb-2 mx-auto text-center">
<button class="btn btn-primary py-3 px-5" @click="searchVisible=false,resetFilters()">
{% trans "Browse Grants" %}
</button>
<div class="col-12 mb-3 mx-auto col-md-6 text-center" v-else>
<img class="obiwan my-4" src="{% static "v2/images/obiwan-bot.svg" %}">
<h1 class="font-title-lg font-weight-semibold mt-4 mb-2">{% trans "This is not the grant you’re looking for." %}</h1>
<p class="font-subheader text">
{% trans "We couldn't match with any grants on Gitcoin." %}</br>
{% trans "Please try another search term or browse for a grant." %}
</p>
<div class="col-12 pt-4 pb-2 mx-auto text-center">
<button class="btn btn-primary py-3 px-5" @click="searchVisible=false,resetFilters()">
{% trans "Browse Grants" %}
</button>
</div>
</div>
</div>
</template>
Expand Down
4 changes: 3 additions & 1 deletion app/grants/templates/grants/shared/top-filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<div class="row mt-2 mb-3 mt-xl-0 font-caption">

<span class="col-12 col-lg-6 text-right text-lg-left pt-2 my-auto">
[[numGrants.toLocaleString()]] [[ 'Grant' | pluralize(numGrants)]]
<span class="font-weight-semibold">[[numGrants.toLocaleString()]]</span>
[[ 'Grant' | pluralize(numGrants)]]
<span v-if="params.keyword">- '[[params.keyword]]'</span>
</span>

<div class="col-12 col-lg-6 text-right pt-2">
Expand Down