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

Add project submission #7704

Merged
merged 3 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions app/assets/v2/js/hackathon-projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ const submitProject = (logo, data, callback) => {
if (callback) {
callback(response);
}
if (document.location.pathname.includes('fulfill')) {
document.location.reload();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we reload ? i didn't get this 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not the most elegant way I know but the form need the project pk and that hackathon projects is used in many places, so in some point we can just add that to the data form, but that will need a lot of changes on the form approach, and as we are planning to move that form to vue doesn't make sense to invest a lot of time. fair?

}
octavioamu marked this conversation as resolved.
Show resolved Hide resolved
return _alert({message: response.msg}, 'info');


}).fail(function(data) {
_alert(data.responseJSON['error'], 'error');

Expand Down
6 changes: 5 additions & 1 deletion app/assets/v2/js/pages/fulfill_bounty/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ window.onload = function() {
if (typeof ga !== 'undefined') {
ga('send', 'event', 'Submit Work', 'click', 'Bounty Hunter')
}

$.each($(form).serializeArray(), function() {
data[this.name] = this.value;
});

if (eventTag && !data.projectId) {
unloading_button($('.js-submit'));
return _alert('Please add a project first', 'error');
}

if (is_bounties_network) {
ethFulfillBounty(data);
} else {
Expand Down
11 changes: 10 additions & 1 deletion app/dashboard/templates/bounty/fulfill.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ <h4 class="text-center mb-4">{% trans "Submit Work" %}</h4>
{% endfor %}
</select>
</div>

{% elif bounty.event %}
<div class="mt-2">
<label class="form__label" for="projectId">{% trans "Please create your project:" %}</label>
chibie marked this conversation as resolved.
Show resolved Hide resolved
<button type="button" onclick="projectModal({{bounty.pk}})" class="btn btn-sm btn-gc-green d-block">Add project</button>
</div>
{% endif %}

{% if bounty.web3_type == 'fiat' %}
Expand Down Expand Up @@ -188,7 +194,7 @@ <h4 class="text-center mb-4">{% trans "Submit Work" %}</h4>
{% include 'shared/footer_scripts.html' %}
{% include 'shared/footer.html' %}

</body>
{% include 'shared/current_profile.html' %}

<script>
$('[data-toggle="popover"]').popover()
Expand All @@ -210,6 +216,8 @@ <h4 class="text-center mb-4">{% trans "Submit Work" %}</h4>
});
})
</script>
<script src="{% static "v2/js/hackathon-projects.js" %}"></script>
<script src="{% static "v2/js/user-search.js" %}"></script>

{% if is_bounties_network %}
<script src="{% static "v2/js/abi.js" %}"></script>
Expand All @@ -224,5 +232,6 @@ <h4 class="text-center mb-4">{% trans "Submit Work" %}</h4>
{% endif %}
<script src="{% static "v2/js/rating.js" %}"></script>
<script src="{% static "v2/js/pages/fulfill_bounty/index.js" %}"></script>
</body>

</html>
10 changes: 5 additions & 5 deletions app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4323,7 +4323,7 @@ def hackathon_projects(request, hackathon='', specify_project=''):
projects = projects.filter(
Q(grant_obj__isnull=False)
)

if specify_project:
projects = projects.filter(name__iexact=specify_project.replace('-', ' '))
if projects.exists():
Expand Down Expand Up @@ -4503,7 +4503,7 @@ def project_data(project_id):
project = HackathonProject.objects.filter(pk=project_id).nocache().first()
if not project:
return None

hackathon_obj = HackathonEventSerializer(project.hackathon).data,
params = {
'project': {
Expand Down Expand Up @@ -4536,7 +4536,7 @@ def project_data(project_id):
}
return params


def hackathon_project_page(request, hackathon, project_id, project_name, tab=''):
profile = request.user.profile if request.user.is_authenticated and hasattr(request.user, 'profile') else None

Expand Down Expand Up @@ -5566,7 +5566,7 @@ def fulfill_bounty_v1(request):
return JsonResponse(response)

hours_worked = request.POST.get('hoursWorked')
if not hours_worked or not hours_worked.isdigit():
if not hours_worked:
response['message'] = 'error: missing hoursWorked'
return JsonResponse(response)

Expand Down Expand Up @@ -5863,7 +5863,7 @@ def bulkemail(request):
from_name = request.POST.get('from_name', '')
from_email = request.POST.get('from_email', '')

if handles and message and subject:
if handles and message and subject:
from marketing.mails import send_mail
_handles = list(set(handles.split(',')))
for handle in _handles:
Expand Down