diff --git a/app/app/context.py b/app/app/context.py index 26b9b6aa3f3..f16b2186e85 100644 --- a/app/app/context.py +++ b/app/app/context.py @@ -26,6 +26,7 @@ from dashboard.models import Activity, Tip, UserAction from dashboard.utils import _get_utm_from_cookie from kudos.models import KudosTransfer +from marketing.utils import handle_marketing_callback from retail.helpers import get_ip RECORD_VISIT_EVERY_N_SECONDS = 60 * 60 @@ -75,6 +76,11 @@ def preprocess(request): if record_join: Activity.objects.create(profile=profile, activity_type='joined') + # handles marketing callbacks + if request.GET.get('cb'): + callback = request.GET.get('cb') + handle_marketing_callback(callback, request) + context = { 'STATIC_URL': settings.STATIC_URL, 'MEDIA_URL': settings.MEDIA_URL, diff --git a/app/assets/v2/css/grants/fund.css b/app/assets/v2/css/grants/fund.css index 4aaec1363ad..2702bfc24f1 100644 --- a/app/assets/v2/css/grants/fund.css +++ b/app/assets/v2/css/grants/fund.css @@ -8,6 +8,9 @@ #grant-link { color: #0D0764; } +.tab_target{ + width: 100%; +} .banner-img { max-height: 22rem; @@ -143,6 +146,22 @@ bottom: -1.2rem; } +.nav{ + text-align: center; +} +.nav-link{ + border-right: 1px solid black; + border-top: 1px solid black; + border-left: 1px solid black; + margin-right: 10px; +} +.nav-link:visited{ + color: black; +} +.nav-item.active{ + text-decoration: underline; +} + @media (min-width:1140px) and (max-width: 1600px) { #gitcoin-grant-section .fee-slider, diff --git a/app/assets/v2/images/grants/signal.png b/app/assets/v2/images/grants/signal.png new file mode 100644 index 00000000000..d1d289fcbce Binary files /dev/null and b/app/assets/v2/images/grants/signal.png differ diff --git a/app/assets/v2/js/grants/fund.js b/app/assets/v2/js/grants/fund.js index c0f996d139b..37d7082f95e 100644 --- a/app/assets/v2/js/grants/fund.js +++ b/app/assets/v2/js/grants/fund.js @@ -23,6 +23,18 @@ $(document).ready(function() { updateSummary(); + $('.nav-item').click(function(e) { + $('.nav-item a').removeClass('active'); + $(this).find('a').addClass('active'); + var targetid = $(this).find('a').data('target'); + var target = $('#' + targetid); + + $('.tab_target').addClass('hidden'); + target.removeClass('hidden'); + + e.preventDefault(); + }); + $('#frequency_unit, #js-token').on('select2:select', event => { updateSummary(); }); @@ -295,7 +307,7 @@ const subscribeToGrant = (transactionHash) => { $('#transaction_url').attr('href', linkURL); enableWaitState('#grants_form'); // TODO: fix the tweet modal - // $('#tweetModal').modal('show'); + $('#tweetModal').css('display', 'block'); deployedSubscription.methods.extraNonce(accounts[0]).call(function(err, nonce) { @@ -400,7 +412,7 @@ const splitPayment = (account, toFirst, toSecond, valueFirst, valueSecond) => { $('#transaction_url').attr('href', linkURL); enableWaitState('#grants_form'); // TODO: Fix tweet modal - // $('#tweetModal').modal('show'); + $('#tweetModal').css('display', 'block'); }).on('confirmation', function(confirmationNumber, receipt) { data = { 'subscription_hash': 'onetime', diff --git a/app/grants/admin.py b/app/grants/admin.py index 26cf94774cc..869cbfa574f 100644 --- a/app/grants/admin.py +++ b/app/grants/admin.py @@ -20,7 +20,7 @@ from django.contrib import admin from django.utils.safestring import mark_safe -from grants.models import CLRMatch, Contribution, Grant, MatchPledge, Subscription +from grants.models import CLRMatch, Contribution, Grant, MatchPledge, PhantomFunding, Subscription class GeneralAdmin(admin.ModelAdmin): @@ -179,7 +179,8 @@ class ContributionAdmin(GeneralAdmin): """Define the Contribution administration layout.""" raw_id_fields = ['subscription'] - + +admin.site.register(PhantomFunding, GeneralAdmin) admin.site.register(MatchPledge, MatchPledgeAdmin) admin.site.register(Grant, GrantAdmin) admin.site.register(CLRMatch, GeneralAdmin) diff --git a/app/grants/migrations/0028_phantomfunding.py b/app/grants/migrations/0028_phantomfunding.py new file mode 100644 index 00000000000..6af1e7ba69c --- /dev/null +++ b/app/grants/migrations/0028_phantomfunding.py @@ -0,0 +1,30 @@ +# Generated by Django 2.2.3 on 2019-08-21 17:25 + +from django.db import migrations, models +import django.db.models.deletion +import economy.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0048_merge_20190808_1934'), + ('grants', '0027_remove_grant_request_ownership_change'), + ] + + operations = [ + migrations.CreateModel( + name='PhantomFunding', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created_on', models.DateTimeField(db_index=True, default=economy.models.get_time)), + ('modified_on', models.DateTimeField(default=economy.models.get_time)), + ('round_number', models.PositiveIntegerField(blank=True, null=True)), + ('grant', models.ForeignKey(help_text='The associated Phantom Funding.', on_delete=django.db.models.deletion.CASCADE, related_name='phantom_funding', to='grants.Grant')), + ('profile', models.ForeignKey(help_text='The associated Phantom Funding.', on_delete=django.db.models.deletion.CASCADE, related_name='grant_phantom_funding', to='dashboard.Profile')), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/app/grants/migrations/0029_auto_20190830_1613.py b/app/grants/migrations/0029_auto_20190830_1613.py new file mode 100644 index 00000000000..1b9217522db --- /dev/null +++ b/app/grants/migrations/0029_auto_20190830_1613.py @@ -0,0 +1,24 @@ +# Generated by Django 2.2.3 on 2019-08-30 16:13 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('grants', '0028_phantomfunding'), + ] + + operations = [ + migrations.AlterField( + model_name='phantomfunding', + name='grant', + field=models.ForeignKey(help_text='The associated grant being Phantom Funding.', on_delete=django.db.models.deletion.CASCADE, related_name='phantom_funding', to='grants.Grant'), + ), + migrations.AlterField( + model_name='phantomfunding', + name='profile', + field=models.ForeignKey(help_text='The associated profile doing the Phantom Funding.', on_delete=django.db.models.deletion.CASCADE, related_name='grant_phantom_funding', to='dashboard.Profile'), + ), + ] diff --git a/app/grants/models.py b/app/grants/models.py index 56ada646dfe..457c797b3c9 100644 --- a/app/grants/models.py +++ b/app/grants/models.py @@ -901,3 +901,29 @@ class MatchPledge(SuperModel): def __str__(self): """Return the string representation of this object.""" return f"{self.profile} <> {self.amount} DAI" + +class PhantomFunding(SuperModel): + """Define the structure of a PhantomFunding object. + + For Grants, we have a fund we’re contributing on their behalf. just having a quick button they can push saves all the hassle of (1) asking them their wallet, (2) sending them the DAI (3) contributing it. + + """ + + round_number = models.PositiveIntegerField(blank=True, null=True) + grant = models.ForeignKey( + 'grants.Grant', + related_name='phantom_funding', + on_delete=models.CASCADE, + help_text=_('The associated grant being Phantom Funding.'), + ) + + profile = models.ForeignKey( + 'dashboard.Profile', + related_name='grant_phantom_funding', + on_delete=models.CASCADE, + help_text=_('The associated profile doing the Phantom Funding.'), + ) + + def __str__(self): + """Return the string representation of this object.""" + return f"{self.round_number}; {self.profile} <> {self.grant}" diff --git a/app/grants/templates/grants/fund.html b/app/grants/templates/grants/fund.html index 960e9ad2a14..dc9291374aa 100644 --- a/app/grants/templates/grants/fund.html +++ b/app/grants/templates/grants/fund.html @@ -54,260 +54,299 @@
- {{ grant.admin_profile }} {% trans "is accepting contributions in "%} - {% if grant_has_no_token %} - {% trans "any token." %} - {% else %} - {{ grant.token_symbol }} - {% endif %} -
- -