Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gitcoinco/web
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki committed Feb 25, 2019
2 parents ec44617 + ae0602e commit e1ef5c5
Show file tree
Hide file tree
Showing 36 changed files with 932 additions and 181 deletions.
5 changes: 5 additions & 0 deletions app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@
path('_administration/email/gdpr_reconsent', retail.emails.gdpr_reconsent, name='gdpr_reconsent'),
path('_administration/email/share_bounty', retail.emails.share_bounty, name='share_bounty'),
path('_administration/email/new_tip/resend', retail.emails.resend_new_tip, name='resend_new_tip'),
path(
'_administration/email/day_email_campaign/<int:day>',
marketing.views.day_email_campaign,
name='day_email_campaign'
),
re_path(
r'^_administration/process_accesscode_request/(.*)$',
tdi.views.process_accesscode_request,
Expand Down
21 changes: 10 additions & 11 deletions app/assets/v2/css/bounty.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,31 +145,30 @@ body {
font-size: 14px;
}

.bounty-info {
display: flex;
flex-wrap: wrap;
}

.bounty-info > div {
margin-bottom: 4px;
}

.bounty-info div {
display: inline;
display: inline-block;
margin-right: 15px;
font-weight: 300;
font-weight: 500;
}

.bounty-info-heading {
color: #0D0764;
font-weight: 500;
}

.bounty-info-row-div {
width: 100%;
}

.bounty-info-row-div i {
position: absolute;
top: 4px;
}

.bounty-info-row-span-left {
float: left;
}

.bounty-info-row-span-right {
float: right;
}
Expand Down
1 change: 0 additions & 1 deletion app/assets/v2/css/gitcoin.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ h4,
background: url("/static/v2/images/header-bg.png") #0d023b;
background-attachment: fixed;
background-position: center 0;
background-size: 2000px;
}

.dropdown-toggle::after {
Expand Down
2 changes: 1 addition & 1 deletion app/assets/v2/js/pages/bounty_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ var callbacks = {
} else {
$('#auto_approve_workers_wrapper').hide();
}
return [ 'admin_override_suspend_auto_approval', val ? 'off' : 'on' ];
return [ 'admin_override_suspend_auto_approval', val ? 'Off' : 'On' ];
},
'issue_keywords': function(key, val, result) {
if (!result.keywords || result.keywords.length == 0)
Expand Down
29 changes: 29 additions & 0 deletions app/dashboard/migrations/0010_auto_20190130_1822.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 2.1.2 on 2019-01-30 18:22

from django.db import migrations, models
import economy.models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0009_merge_20190122_0857'),
]

operations = [
migrations.AddField(
model_name='activity',
name='created_on',
field=models.DateTimeField(db_index=True, default=economy.models.get_time),
),
migrations.AddField(
model_name='activity',
name='modified_on',
field=models.DateTimeField(default=economy.models.get_time),
),
migrations.AlterField(
model_name='profile',
name='job_search_status',
field=models.CharField(blank=True, choices=[('AL', 'Actively looking for work'), ('PL', 'Passively looking and open to hearing new opportunities'), ('N', 'Not open to hearing new opportunities')], max_length=2),
),
]
24 changes: 24 additions & 0 deletions app/dashboard/migrations/0011_auto_20190130_1852.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 2.1.2 on 2019-01-30 18:52

from django.db import migrations, models
import economy.models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0010_auto_20190130_1822'),
]

operations = [
migrations.AddField(
model_name='interest',
name='created_on',
field=models.DateTimeField(db_index=True, default=economy.models.get_time),
),
migrations.AddField(
model_name='interest',
name='modified_on',
field=models.DateTimeField(default=economy.models.get_time),
),
]
34 changes: 34 additions & 0 deletions app/dashboard/migrations/0012_auto_20190130_1853.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 2.1.2 on 2019-01-30 18:53

from django.db import migrations, models
import economy.models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0011_auto_20190130_1852'),
]

operations = [
migrations.AddField(
model_name='labsresearch',
name='created_on',
field=models.DateTimeField(db_index=True, default=economy.models.get_time),
),
migrations.AddField(
model_name='labsresearch',
name='modified_on',
field=models.DateTimeField(default=economy.models.get_time),
),
migrations.AddField(
model_name='toolvote',
name='created_on',
field=models.DateTimeField(db_index=True, default=economy.models.get_time),
),
migrations.AddField(
model_name='toolvote',
name='modified_on',
field=models.DateTimeField(default=economy.models.get_time),
),
]
14 changes: 14 additions & 0 deletions app/dashboard/migrations/0014_merge_20190221_2246.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 2.1.2 on 2019-02-21 22:46

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0012_auto_20190130_1853'),
('dashboard', '0013_bounty_featuring_date'),
]

operations = [
]
61 changes: 40 additions & 21 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ def warned(self):
return self.filter(status=Interest.STATUS_WARNED)


class Interest(models.Model):
class Interest(SuperModel):
"""Define relationship for profiles expressing interest on a bounty."""

STATUS_REVIEW = 'review'
Expand Down Expand Up @@ -1518,7 +1518,7 @@ def escalated_for_removal(self):
)


class Activity(models.Model):
class Activity(SuperModel):
"""Represent Start work/Stop work event.
Attributes:
Expand Down Expand Up @@ -1609,27 +1609,46 @@ def view_props(self):
'new_kudos': 'fa-thumbs-up',
}

activity = self
activity.icon = icons.get(activity.activity_type, 'fa-check-circle')
if activity.kudos:
activity.kudos_data = Token.objects.get(pk=activity.kudos.kudos_token_cloned_from_id)
obj = activity.metadata
if 'new_bounty' in activity.metadata:
obj = activity.metadata['new_bounty']
activity.title = obj.get('title', '')
# load up this data package with all of the information in the already existing objects
properties = [
'i18n_name'
'title',
'token_name',
'created_human_time',
]
activity = self.to_standard_dict(properties=properties)
for key, value in model_to_dict(self).items():
activity[key] = value
for fk in ['bounty', 'tip', 'kudos', 'profile']:
if getattr(self, fk):
activity[fk] = getattr(self, fk).to_standard_dict(properties=properties)

# KO notes 2019/01/30
# this is a bunch of bespoke information that is computed for the views
# in a later release, it couild be refactored such that its just contained in the above code block ^^.
activity['icon'] = icons.get(self.activity_type, 'fa-check-circle')
if activity.get('kudos'):
activity['kudos_data'] = Token.objects.get(pk=self.kudos.kudos_token_cloned_from_id)
obj = self.metadata
if 'new_bounty' in self.metadata:
obj = self.metadata['new_bounty']
activity['title'] = obj.get('title', '')
if 'id' in obj:
activity.bounty_url = Bounty.objects.get(pk=obj['id']).get_relative_url()
if activity.title:
activity.urled_title = f'<a href="{activity.bounty_url}">{activity.title}</a>'
activity['bounty_url'] = Bounty.objects.get(pk=obj['id']).get_relative_url()
if activity.get('title'):
activity['urled_title'] = f'<a href="{activity["bounty_url"]}">{activity["title"]}</a>'
else:
activity.urled_title = activity.title
activity['urled_title'] = activity.title
if 'value_in_usdt_now' in obj:
activity.value_in_usdt_now = obj['value_in_usdt_now']
activity['value_in_usdt_now'] = obj['value_in_usdt_now']
if 'token_name' in obj:
activity.token = token_by_name(obj['token_name'])
if 'value_in_token' in obj and activity.token:
activity.value_in_token_disp = round((float(obj['value_in_token']) /
10 ** activity.token['decimals']) * 1000) / 1000
activity['token'] = token_by_name(obj['token_name'])
if 'value_in_token' in obj and activity['token']:
activity['value_in_token_disp'] = round((float(obj['value_in_token']) /
10 ** activity['token']['decimals']) * 1000) / 1000

# finally done!

return activity

@property
Expand Down Expand Up @@ -1662,7 +1681,7 @@ def to_dict(self, fields=None, exclude=None):
return model_to_dict(self, **kwargs)


class LabsResearch(models.Model):
class LabsResearch(SuperModel):
"""Define the structure of Labs Research object."""

title = models.CharField(max_length=255)
Expand Down Expand Up @@ -2758,7 +2777,7 @@ def i18n_link_copy(self):
return _(self.link_copy)


class ToolVote(models.Model):
class ToolVote(SuperModel):
"""Define the vote placed on a tool."""

profile = models.ForeignKey('dashboard.Profile', related_name='votes', on_delete=models.CASCADE)
Expand Down
Loading

0 comments on commit e1ef5c5

Please sign in to comment.