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 2 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
13 changes: 11 additions & 2 deletions 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 @@ -126,7 +132,7 @@ <h4 class="text-center mb-4">{% trans "Submit Work" %}</h4>
<div class="mt-2 row">
<div class="col-12">
<label class="form__label" for="hoursWorked">{% trans "Hours Worked" %}</label>
<input name='hoursWorked' id='hoursWorked' class="form__input font-body" type="number" placeholder="1 (feel free to approximate)" value="" min="0" step="0.1" required/>
<input name='hoursWorked' id='hoursWorked' class="form__input font-body" type="number" placeholder="1 (feel free to approximate)" value="" min="0" step="1" required/>
octavioamu marked this conversation as resolved.
Show resolved Hide resolved
</div>

<div class="col-12">
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>