Skip to content

Commit

Permalink
Merge branch 'stable' of github.com:gitcoinco/web into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki committed Aug 23, 2019
2 parents bc13597 + 5329f8f commit fd1aa98
Show file tree
Hide file tree
Showing 37 changed files with 500 additions and 211 deletions.
3 changes: 3 additions & 0 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,3 +696,6 @@
'name': 'Index View',
}]
SILKY_MAX_RECORDED_REQUESTS_CHECK_PERCENT = env.int('SILKY_MAX_RECORDED_REQUESTS_CHECK_PERCENT', default=10)

RE_MARKET_LIMIT = env.int('RE_MARKET_LIMIT', default=2)
MINUTES_BETWEEN_RE_MARKETING = env.int('MINUTES_BETWEEN_RE_MARKETING', default=60)
4 changes: 2 additions & 2 deletions app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@
path('revenue/attestations/new', revenue.views.new_attestation, name='revenue_new_attestation'),

# Hackathons / special events
re_path(r'^hackathon/(?P<hackathon>.*)?/', dashboard.views.hackathon, name='hackathon'),
re_path(r'^hackathon?/', dashboard.views.hackathon, name='hackathon_idx'),
path('hackathon/<str:hackathon>/', dashboard.views.hackathon, name='hackathon'),
path('hackathon/', dashboard.views.hackathon, name='hackathon_idx'),
path('hackathon-list/', dashboard.views.get_hackathons, name='get_hackathons'),

# action URLs
Expand Down
21 changes: 11 additions & 10 deletions app/assets/v2/css/bounty.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ body {
text-transform: capitalize;
}

#title {
text-align: left;
padding-top: 2em;
padding-bottom: 15px;
}

#avatar_url {
padding-top: 3em;
}

.invite-user .avatar {
width: 5.5rem;
height: 5.5rem;
Expand Down Expand Up @@ -529,6 +519,10 @@ a.btn {
color: #F5A623;
}

#funder_notif_info:empty {
display: none;
}

#funder_notif_info .bounty-notification {
border: orange 1px solid;
border-radius: 3px;
Expand Down Expand Up @@ -767,6 +761,13 @@ a.btn {
text-align: center;
}

.hackathon-alt {
font-size: 11px;
color: #0d0764;
font-weight: 700;
letter-spacing: 1.7px;
}

.rocket {
position: absolute;
top: 10rem;
Expand Down
11 changes: 11 additions & 0 deletions app/assets/v2/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ body {
letter-spacing: 1.7px;
}

.hackathon-alt {
font-size: 11px;
color: #0d0764;
font-weight: 700;
letter-spacing: 1.7px;
}

.hackathon-explorer .hackathon-alt {
display: none;
}

.status-open {
color: #00A652;
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/v2/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ $(document).ready(function() {
});
}

var top_nav_salt = 2;
var top_nav_salt = 3;
var remove_top_row = function() {
$('#top_nav_notification').parents('.row').remove();
localStorage['top_nav_notification_remove_' + top_nav_salt] = true;
Expand Down
11 changes: 8 additions & 3 deletions app/assets/v2/js/grants/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ var waitingStateActive = function() {
* @param {string} message
*/
const notifyOwnerAddressMismatch = (username, address, button, message) => {
if (!web3 || !web3.eth)

if (!web3 || !web3.eth || !username || !document.contxt.github_handle) {
return;
}

web3.eth.getAccounts((error, accounts) => {
if (document.contxt.github_handle == username && accounts[0] &&
accounts[0] != address) {
if (
document.contxt && document.contxt.github_handle == username &&
accounts[0] && accounts[0] != address
) {
if ($(button).attr('disabled') != 'disabled') {
$(button).attr('disabled', 'disabled');
_alert({
Expand Down
6 changes: 6 additions & 0 deletions app/assets/v2/js/pages/bounty_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ var rows = [
'avatar_url',
'issuer_avatar_url',
'title',
'event_name',
'github_url',
'value_in_token',
'value_in_eth',
Expand Down Expand Up @@ -163,6 +164,11 @@ var callbacks = {

return [ 'status', ui_status ];
},
'event_name': function(key, val, result) {
let event_name = result['event'] ? 'Hackathon: ' + result.event.name : '';

return [ 'event_name', event_name ];
},
'issue_description': function(key, val, result) {

const _markdown = new markdownit({
Expand Down
15 changes: 8 additions & 7 deletions app/assets/v2/js/pages/process_bounty.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
window.onload = function() {

const rateUser = () => {
let userSelected = $('#bountyFulfillment').select2('data')[0].text;
if ($('#bountyFulfillment').select2('data')[0]) {
let userSelected = $('#bountyFulfillment').select2('data')[0].text;

$('[data-open-rating]').data('openUsername', userSelected.trim());
$('[data-open-rating]').data('openUsername', userSelected.trim());
}
};


$('#bountyFulfillment').on('select2:select', event => {
rateUser();
});
Expand Down Expand Up @@ -86,7 +87,7 @@ window.onload = function() {
var email = '';
var github_url = $('#issueURL').val();
var from_name = document.contxt['github_handle'];
var username = getSelectedFulfillment().getAttribute('username');
var username = getSelectedFulfillment() && getSelectedFulfillment().getAttribute('username');
var amountInEth = bounty_amount * pct;
var comments_priv = '';
var comments_public = '';
Expand Down Expand Up @@ -118,7 +119,7 @@ window.onload = function() {
var email = '';
var github_url = $('#issueURL').val();
var from_name = document.contxt['github_handle'];
var username = getSelectedFulfillment().getAttribute('username');
var username = getSelectedFulfillment() && getSelectedFulfillment().getAttribute('username');
var amountInEth = selected_kudos.price_finney / 1000.0;
var comments_public = $('.kudos-comment textarea').val();
var comments_priv = '';
Expand Down Expand Up @@ -157,7 +158,7 @@ window.onload = function() {

e.preventDefault();
var issueURL = $('input[name=issueURL]').val();
var fulfillmentId = getSelectedFulfillment().getAttribute('value');
var fulfillmentId = getSelectedFulfillment() && getSelectedFulfillment().getAttribute('value');

sessionStorage['bountyId'] = getURLParams('pk');

Expand Down Expand Up @@ -287,7 +288,7 @@ window.onload = function() {
});

function getSelectedFulfillment() {
return $('#bountyFulfillment').select2('data')[0].element;
return $('#bountyFulfillment').select2('data')[0] ? $('#bountyFulfillment').select2('data')[0].element : null;
}

function renderFulfillment(selected) {
Expand Down
18 changes: 17 additions & 1 deletion app/assets/v2/js/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ Vue.mixin({
_alert('The invitation has been sent', 'info');
}
});

},
closeModal() {
this.$refs['user-modal'].closeModal();
Expand All @@ -143,6 +142,22 @@ Vue.mixin({
}
});
}
},
extractURLFilters: function() {
let vm = this;
let params = getURLParams();

vm.users = [];

if (params) {
for (var prop in params) {
if (prop === 'skills') {
vm.$set(vm.params, prop, params[prop].split(','));
} else {
vm.$set(vm.params, prop, params[prop]);
}
}
}
}
}
});
Expand Down Expand Up @@ -185,6 +200,7 @@ if (document.getElementById('gc-users-directory')) {
created() {
this.fetchBounties();
this.inviteOnMount();
this.extractURLFilters();
},
beforeMount() {
window.addEventListener('scroll', () => {
Expand Down
10 changes: 5 additions & 5 deletions app/assets/v2/js/vue-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ Vue.component('select2', {
props: [ 'options', 'value' ],
template: '#select2-template',
mounted: function() {
var vm = this;
let vm = this;

$(this.$el).select2({ data: this.options })
.val(this.value)
.trigger('change')
.on('change', function() {
vm.$emit('input', this.value);
vm.$emit('input', $(this).val());
});
},
watch: {
value: function(value) {
// update value
$(this.$el).val(value).trigger('change');
if ([...value].sort().join(',') !== [...$(this.$el).val()].sort().join(',')) {
$(this.$el).val(value).trigger('change');
}
},
options: function(options) {
// update options
$(this.$el).empty().select2({ data: options });
}
},
Expand Down
21 changes: 16 additions & 5 deletions app/dashboard/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ class Meta:
fields = ('doc', 'doc_type')


class HackathonEventSerializer(serializers.ModelSerializer):
"""Handle serializing the hackathon object."""

class Meta:
"""Define the hackathon serializer metadata."""

model = HackathonEvent
fields = ('name', 'slug')


class KudosSerializer(serializers.ModelSerializer):
"""Handle serializing the Kudos object."""

Expand Down Expand Up @@ -114,6 +124,7 @@ class BountySerializer(serializers.HyperlinkedModelSerializer):
interested = InterestSerializer(many=True)
activities = ActivitySerializer(many=True)
unsigned_nda = BountyDocumentsSerializer(many=False)
event = HackathonEventSerializer(many=False)
bounty_owner_email = serializers.SerializerMethodField('override_bounty_owner_email')
bounty_owner_name = serializers.SerializerMethodField('override_bounty_owner_name')

Expand Down Expand Up @@ -144,7 +155,7 @@ class Meta:
'fulfillment_accepted_on', 'fulfillment_submitted_on', 'fulfillment_started_on', 'canceled_on',
'canceled_bounty_reason', 'action_urls', 'project_type', 'permission_type',
'attached_job_description', 'needs_review', 'github_issue_state', 'is_issue_closed',
'additional_funding_summary', 'funding_organisation', 'paid',
'additional_funding_summary', 'funding_organisation', 'paid', 'event',
'admin_override_suspend_auto_approval', 'reserved_for_user_handle', 'is_featured',
'featuring_date', 'repo_type', 'unsigned_nda', 'funder_last_messaged_on', 'can_remarket'
)
Expand Down Expand Up @@ -187,7 +198,7 @@ class Meta:
"""Define the bounty serializer metadata."""
model = Bounty
fields = (
'url', 'title', 'experience_level', 'status', 'fulfillment_accepted_on',
'pk', 'url', 'title', 'experience_level', 'status', 'fulfillment_accepted_on', 'event',
'fulfillment_started_on', 'fulfillment_submitted_on', 'canceled_on', 'web3_created', 'bounty_owner_address',
'avatar_url', 'network', 'standard_bounties_id', 'github_org_name', 'interested', 'token_name', 'value_in_usdt',
'keywords', 'value_in_token', 'project_type', 'is_open', 'expires_date', 'latest_activity', 'token_address'
Expand All @@ -198,15 +209,15 @@ class BountySerializerCheckIn(BountySerializer):
class Meta:
model = Bounty
fields = (
'url', 'title', 'bounty_owner_name', 'status', 'github_url',
'url', 'title', 'bounty_owner_name', 'status', 'github_url',
'created_on', 'standard_bounties_id', 'bounty_owner_github_username',
'no_of_applicants', 'num_fulfillments', 'has_applicant', 'warned', 'escalated', 'event'
)


class BountyViewSet(viewsets.ModelViewSet):
"""Handle the Bounty view behavior."""
queryset = Bounty.objects.prefetch_related('fulfillments', 'interested', 'interested__profile', 'activities', 'unsigned_nda') \
queryset = Bounty.objects.prefetch_related('fulfillments', 'interested', 'interested__profile', 'activities', 'unsigned_nda', 'event') \
.all().order_by('-web3_created')
serializer_class = BountySerializer
filter_backends = (django_filters.rest_framework.DjangoFilterBackend,)
Expand All @@ -220,7 +231,7 @@ def get_queryset(self):
"""
param_keys = self.request.query_params.keys()
queryset = Bounty.objects.prefetch_related(
'fulfillments', 'interested', 'interested__profile', 'activities', 'unsigned_nda')
'fulfillments', 'interested', 'interested__profile', 'activities', 'unsigned_nda', 'event')
if 'not_current' not in param_keys:
queryset = queryset.current()

Expand Down
Loading

0 comments on commit fd1aa98

Please sign in to comment.