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

matic whitelabel grant creation and index #6709

Merged
merged 2 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Binary file added app/assets/v2/images/grants/matic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/assets/v2/js/grants/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function saveGrant(grantData, isFinal) {

$.ajax({
type: 'post',
url: '',
url: '/grants/new',
processData: false,
contentType: false,
data: grantData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ var gas_amount = function(page_url) {

if (page_url.indexOf('issue/fulfill') != -1) {
gasLimitEstimate = 207103;
} else if (page_url.indexOf('grants/matic/new') != -1) {
gasLimitEstimate = 3000000;
} else if (page_url.indexOf('grants/new') != -1) { // new grant contribution
gasLimitEstimate = 3000000;
} else if (page_url.indexOf('/new') != -1) { // new fulfill funding page
Expand Down Expand Up @@ -35,4 +37,4 @@ var gas_amount = function(page_url) {
gasLimitEstimate = 318730;
}
return gasLimitEstimate;
};
};
3 changes: 2 additions & 1 deletion app/grants/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class Meta:
GRANT_TYPES = [
('tech', 'tech'),
('health', 'health'),
('media', 'media')
('media', 'media'),
('matic', 'matic')
]

active = models.BooleanField(default=True, help_text=_('Whether or not the Grant is active.'))
Expand Down
3 changes: 2 additions & 1 deletion app/grants/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from django.urls import path, re_path

from grants.views import (
flag, grant_categories, grant_details, grant_fund, grant_new, grants, grants_addr_as_json, grants_stats_view,
flag, grant_categories, grant_details, grant_fund, grant_new, grant_new_whitelabel, grants, grants_addr_as_json, grants_stats_view,
invoice, leaderboard, new_matching_partner, predict_clr_v1, profile, quickstart, subscription_cancel,
)

Expand All @@ -32,6 +32,7 @@
path('flag/<int:grant_id>', flag, name='grantflag'),
path('<int:grant_id>/<slug:grant_slug>', grant_details, name='details'),
path('<int:grant_id>/<slug:grant_slug>/', grant_details, name='details2'),
re_path(r'^matic/new', grant_new_whitelabel, name='new_whitelabel'),
re_path(r'^new', grant_new, name='new'),
re_path(r'^categories', grant_categories, name='grant_categories'),
path('<int:grant_id>/<slug:grant_slug>/fund', grant_fund, name='fund'),
Expand Down
31 changes: 30 additions & 1 deletion app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ def grants(request):
health_grants_count = Grant.objects.filter(
network=network, hidden=False, grant_type='health'
).count()
matic_grants_count = Grant.objects.filter(
network=network, hidden=False, grant_type='matic'
).count()
all_grants_count = Grant.objects.filter(
network=network, hidden=False
).count()
Expand All @@ -339,7 +342,9 @@ def grants(request):
grant_types = [
{'label': 'Tech', 'keyword': 'tech', 'count': tech_grants_count},
{'label': 'Media', 'keyword': 'media', 'count': media_grants_count},
{'label': 'Health', 'keyword': 'health', 'count': health_grants_count}
{'label': 'Health', 'keyword': 'health', 'count': health_grants_count},
{'label': 'Matic', 'keyword': 'matic', 'count': matic_grants_count},

]
title = matching_live + str(_('Grants'))
has_real_grant_type = grant_type and grant_type != 'activity'
Expand Down Expand Up @@ -601,6 +606,30 @@ def flag(request, grant_id):
})


@login_required
def grant_new_whitelabel(request):
"""Create a new grant, with a branded creation form for specific tribe"""

params = {
'active': 'new_grant',
'title': _('New Grant'),
'card_desc': _('Provide sustainable funding for Open Source with Gitcoin Grants'),
'profile': profile,
'grant': {},
'keywords': get_keywords(),
'recommend_gas_price': recommend_min_gas_price_to_confirm_in_time(4),
'recommend_gas_price_slow': recommend_min_gas_price_to_confirm_in_time(120),
'recommend_gas_price_avg': recommend_min_gas_price_to_confirm_in_time(15),
'recommend_gas_price_fast': recommend_min_gas_price_to_confirm_in_time(1),
'eth_usd_conv_rate': eth_usd_conv_rate(),
'conf_time_spread': conf_time_spread(),
'gas_advisories': gas_advisories(),
'trusted_relayer': settings.GRANTS_OWNER_ACCOUNT
}
return TemplateResponse(request, 'grants/new-whitelabel.html', params)



@login_required
def grant_new(request):
"""Handle new grant."""
Expand Down