Skip to content

Commit 7713550

Browse files
freat: add grant eligibility reason (#10600)
* add grant elibility reason * update test
1 parent bbb9378 commit 7713550

File tree

7 files changed

+56
-6
lines changed

7 files changed

+56
-6
lines changed

app/assets/v2/js/grants/_new.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Vue.component('v-select', VueSelect.VueSelect);
22
Vue.use(VueQuillEditor);
33

4-
const step1Errors = [ 'grant_tags', 'has_external_funding' ];
4+
const step1Errors = [ 'grant_tags', 'tag_eligibility_reason', 'has_external_funding' ];
55
const step2Errors = [ 'title', 'description', 'reference_url', 'twitter_handle_1' ];
66
const step3Errors = ['chainId'];
77
const errorsByStep = [ step1Errors, step2Errors, step3Errors ];
@@ -157,6 +157,9 @@ Vue.mixin({
157157
if (!vm.form.grant_tags.length > 0) {
158158
vm.$set(vm.errors, 'grant_tags', 'Please select one or more grant tag');
159159
}
160+
if (!vm.form.tag_eligibility_reason.length) {
161+
vm.$set(vm.errors, 'tag_eligibility_reason', 'Please enter eligibility tag reasoning');
162+
}
160163
if (vm.richDescription.length < 10) {
161164
vm.$set(vm.errors, 'description', 'Please enter description for the grant');
162165
}
@@ -219,6 +222,7 @@ Vue.mixin({
219222
'cosmos_payout_address': form.cosmos_payout_address,
220223
'grant_type': form.grant_type,
221224
'tags[]': form.grant_tags,
225+
'tag_eligibility_reason': form.tag_eligibility_reason,
222226
'network': form.network,
223227
'region': form.region,
224228
'has_external_funding': form.has_external_funding
@@ -455,6 +459,7 @@ if (document.getElementById('gc-new-grant')) {
455459
cosmos_payout_address: '',
456460
grant_type: 'gr12',
457461
grant_tags: [],
462+
tag_eligibility_reason: '',
458463
network: 'mainnet'
459464
},
460465
editorOptionPrio: {
@@ -560,7 +565,8 @@ if (document.getElementById('gc-new-grant')) {
560565
'eth_payout_address',
561566
'grant_type',
562567
'team_members',
563-
'grant_tags'
568+
'grant_tags',
569+
'tag_eligibility_reason'
564570
];
565571

566572
for (const key of writeToRoot) {

app/grants/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class GrantAdmin(GeneralAdmin):
105105
'title', 'is_grant_idle',
106106
'active', 'visible', 'is_clr_eligible',
107107
'migrated_to', 'region',
108-
'grant_type', 'tags', 'description', 'description_rich', 'github_project_url', 'reference_url', 'admin_address',
108+
'grant_type', 'tags', 'tag_eligibility_reason','description', 'description_rich', 'github_project_url', 'reference_url', 'admin_address',
109109
'amount_received', 'amount_received_in_round', 'monthly_amount_subscribed', 'defer_clr_to',
110110
'deploy_tx_id', 'cancel_tx_id', 'admin_profile', 'token_symbol',
111111
'token_address', 'contract_address', 'contract_version', 'network', 'required_gas_price', 'logo_svg_asset',
@@ -123,7 +123,7 @@ class GrantAdmin(GeneralAdmin):
123123
'team_member_list', 'clr_prediction_curve',
124124
'subscriptions_links', 'contributions_links', 'link',
125125
'migrated_to', 'view_count', 'in_active_clrs', 'stats_history',
126-
'emails', 'is_grant_idle'
126+
'emails', 'is_grant_idle', 'tag_eligibility_reason'
127127
]
128128
list_display =['pk', 'sybil_score', 'weighted_risk_score', 'match_amount', 'positive_round_contributor_count', 'is_clr_eligible', 'title', 'active', 'link', 'hidden', 'migrated_to']
129129
raw_id_fields = ['admin_profile', 'twitter_verified_by']
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 2.2.24 on 2022-05-10 03:58
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('grants', '0144_delete_matchpledge'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='grant',
15+
name='tag_eligibility_reason',
16+
field=models.TextField(blank=True, default='', help_text='Eligibility Tag Reasoning'),
17+
),
18+
]

app/grants/models/grant.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ class Meta:
585585
)
586586
categories = models.ManyToManyField('GrantCategory', blank=True) # TODO: REMOVE
587587
tags = models.ManyToManyField('GrantTag', blank=True)
588+
tag_eligibility_reason = models.TextField(default='', blank=True, help_text=_('Eligibility Tag Reasoning'))
588589
twitter_handle_1 = models.CharField(default='', max_length=255, help_text=_('Grants twitter handle'), blank=True)
589590
twitter_handle_2 = models.CharField(default='', max_length=255, help_text=_('Grants twitter handle'), blank=True)
590591
twitter_handle_1_follower_count = models.PositiveIntegerField(blank=True, default=0)

app/grants/templates/grants/_new.html

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@
7171
<span class="font-smaller-2 py-1 font-weight-normal badge badge-greylight ml-2">required</span>
7272

7373
<p class="text-muted mb-0">
74-
Tags are used for your grant's discoverability and eligibility for matching rounds. Eligibility tags are subject to review by the matching round owner and may be removed at any time for any reason.
74+
Selecting eligibility tags enters your grant for consideration for that specific matching round.<br>
75+
Your grant is then subject to review by the matching round owner and may be removed from that round at any time for any reason.<br>
76+
Discoverability tags are used for finding similar grants in the <a href="https://gitcoin.co/grants/explorer/" target="_blank">Grant Explorer.</a><br>
77+
To learn more about grants, click <a href="https://support.gitcoin.co/gitcoin-grants/what-is-a-grant" target="_blank">here</a>
7578
</p>
7679
<p class="mt-0 mb-2">
7780
<a target="_blank" href="https://support.gitcoin.co/kb/article/134-learn-more-about-matching-rounds/" rel="noopener noreferrer">Learn more about matching rounds.</a>
@@ -96,6 +99,26 @@
9699
</div>
97100
</div>
98101

102+
<!-- Tag Eligibility Reason -->
103+
<div class="mb-4">
104+
<label class="font-subheader font-weight-light letter-spacing">Eligibility Tag Reasoning</label>
105+
<span class="font-smaller-2 py-1 font-weight-normal badge badge-greylight ml-2">required</span>
106+
107+
<p class="text-muted mb-2">
108+
For each eligibility tag you selected above, please provide a reason why your grant will benefit the respective ecosystem
109+
</p>
110+
111+
<textarea
112+
id="tag_eligibility_reason" v-model="form.tag_eligibility_reason" name="tag_eligibility_reason"
113+
class="form__input form__input-lg" cols="50" rows="3">
114+
</textarea>
115+
116+
117+
<div class="text-danger" v-if="errors.tag_eligibility_reason">
118+
[[errors.tag_eligibility_reason]]
119+
</div>
120+
</div>
121+
99122
<!-- External Funding -->
100123
<div class="mb-4">
101124
<label class="font-subheader font-weight-light letter-spacing">Project Stage</label>

app/grants/tests/views/test_grant_new_routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def test_creates_new_grant_when_required_fields_submitted(self, django_user_mode
236236
'admin_address': '0xB81C935D01e734b3D8bb233F5c4E1D72DBC30f6c',
237237
'team_members[]': '',
238238
'tags[]': '',
239+
'tag_eligibility_reason': '',
239240
}
240241

241242
client = Client(HTTP_USER_AGENT='chrome')

app/grants/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3587,7 +3587,8 @@ def post(self, request):
35873587
'region': request.POST.get('region', None),
35883588
'clr_prediction_curve': [[0.0, 0.0, 0.0] for x in range(0, 6)],
35893589
'grant_type': GrantType.objects.get(name=grant_type),
3590-
'has_external_funding': has_external_funding
3590+
'has_external_funding': has_external_funding,
3591+
'tag_eligibility_reason': request.POST.get('tag_eligibility_reason', None)
35913592
}
35923593

35933594
grant = Grant.objects.create(**grant_kwargs)

0 commit comments

Comments
 (0)