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

Stable #5332

Merged
merged 18 commits into from
Oct 18, 2019
Merged

Stable #5332

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
2 changes: 2 additions & 0 deletions app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
url(r'^api/v0.1/profile/(.*)?/keywords', dashboard.views.profile_keywords, name='profile_keywords'),
url(r'^api/v0.1/profile/(.*)?/activity.json', dashboard.views.profile_activity, name='profile_activity'),
url(r'^api/v0.1/profile/(.*)?/earnings.csv', dashboard.views.profile_earnings, name='profile_earnings'),
url(r'^api/v0.1/profile/(.*)?/grants.csv', dashboard.views.profile_grants, name='profile_grants'),
url(r'^api/v0.1/profile/(.*)?/quests.csv', dashboard.views.profile_quests, name='profile_quests'),
url(r'^api/v0.1/profile/(.*)?/ratings/(.*).csv', dashboard.views.profile_ratings, name='profile_ratings'),
url(r'^api/v0.1/profile/(.*)?/viewers.csv', dashboard.views.profile_viewers, name='profile_viewers'),
url(r'^api/v0.1/profile/(.*)?/spent.csv', dashboard.views.profile_spent, name='profile_spent'),
Expand Down
5 changes: 5 additions & 0 deletions app/assets/v2/css/avatar.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
flex-wrap: wrap;
}

.avatars-container img {
height: 235px;
width: 235px;
}

.avatar-tile {
height:250px;
width: 250px;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/v2/css/quests.css
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ body.quest_battle .bottom_notification{
}

#timer{
bottom: 31px;
bottom: 47px;
font-size: 30px;
color: #888;
}
Expand Down
30 changes: 28 additions & 2 deletions app/assets/v2/js/pages/quests.new.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@

$(document).ready(function() {
$('.add_answer').click(function(e) {

$(document).on('click', '.add_answer', function(e) {
e.preventDefault();
var dupe_me = $(this).parents('.form-group').find('span:last');
var clone = dupe_me.clone();

dupe_me.after(clone);
});
$('.add_question').click(function(e) {

$(document).on('click', '.add_question', function(e) {
e.preventDefault();
var dupe_me = $('.form-group.question:last');
var clone = dupe_me.clone();

dupe_me.after(clone);
});


$(document).on('click', '.close_answer', function(e) {
e.preventDefault();
if ($(this).parents('.question').find('span').length <= 1) {
alert('you cannot have 0 answers per question');
return;
}
var ele = $(this).parents('span');

ele.remove();
});


$(document).on('click', '.close_question', function(e) {
e.preventDefault();
if ($(this).parents('div.question').length <= 1) {
alert('you cannot have 0 questsions');
return;
}
var ele = $(this).parents('div.question');

ele.remove();
});

});
4 changes: 3 additions & 1 deletion app/assets/v2/js/pages/quests.quest.quiz_style.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var seconds_per_question = 30;

var start_quiz = async function() {
document.quiz_started = true;
Expand Down Expand Up @@ -52,6 +51,8 @@ var start_quiz = async function() {
await toggle_character_class($('#enemy'), [ 'harm', '' ]);
}

var question_level_seconds_to_respond = response['question']['seconds_to_respond'];

var question = response['question']['question'];
var possible_answers = response['question']['responses'];
var html = '';
Expand All @@ -72,6 +73,7 @@ var start_quiz = async function() {
await $('#header').removeClass('hidden').fadeIn();
await $('#desc').removeClass('hidden').fadeIn();
await $('#cta_button').removeClass('hidden').fadeIn();
var seconds_per_question = question_level_seconds_to_respond != undefined ? question_level_seconds_to_respond : document.seconds_per_question;
var timer = seconds_per_question * 1000;

while (timer > 0 && !document.submitted_answer) {
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def link(self, instance):


class HackathonRegistrationAdmin(admin.ModelAdmin):
list_display = ['pk', 'name', 'referer']
list_display = ['pk', 'name', 'referer', 'registrant']
raw_id_fields = ['registrant']

admin.site.register(SearchHistory, SearchHistoryAdmin)
Expand Down
22 changes: 22 additions & 0 deletions app/dashboard/migrations/0058_auto_20191017_1723.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 2.2.4 on 2019-10-17 17:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0057_auto_20191016_1103'),
]

operations = [
migrations.RemoveField(
model_name='profile',
name='hackathons',
),
migrations.AlterField(
model_name='activity',
name='activity_type',
field=models.CharField(blank=True, choices=[('status_update', 'Update status'), ('new_bounty', 'New Bounty'), ('start_work', 'Work Started'), ('stop_work', 'Work Stopped'), ('work_submitted', 'Work Submitted'), ('work_done', 'Work Done'), ('worker_approved', 'Worker Approved'), ('worker_rejected', 'Worker Rejected'), ('worker_applied', 'Worker Applied'), ('increased_bounty', 'Increased Funding'), ('killed_bounty', 'Canceled Bounty'), ('new_tip', 'New Tip'), ('receive_tip', 'Tip Received'), ('bounty_abandonment_escalation_to_mods', 'Escalated checkin from @gitcoinbot about bounty status'), ('bounty_abandonment_warning', 'Checkin from @gitcoinbot about bounty status'), ('bounty_removed_slashed_by_staff', 'Dinged and Removed from Bounty by Staff'), ('bounty_removed_by_staff', 'Removed from Bounty by Staff'), ('bounty_removed_by_funder', 'Removed from Bounty by Funder'), ('new_crowdfund', 'New Crowdfund Contribution'), ('new_grant', 'New Grant'), ('update_grant', 'Updated Grant'), ('killed_grant', 'Cancelled Grant'), ('new_grant_contribution', 'Contributed to Grant'), ('new_grant_subscription', 'Subscribed to Grant'), ('killed_grant_contribution', 'Cancelled Grant Contribution'), ('new_milestone', 'New Milestone'), ('update_milestone', 'Updated Milestone'), ('new_kudos', 'New Kudos'), ('joined', 'Joined Gitcoin'), ('played_quest', 'Played Quest'), ('beat_quest', 'Beat Quest'), ('created_quest', 'Created Quest'), ('updated_avatar', 'Updated Avatar')], db_index=True, max_length=50),
),
]
4 changes: 3 additions & 1 deletion app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,7 @@ class Activity(SuperModel):
('joined', 'Joined Gitcoin'),
('played_quest', 'Played Quest'),
('beat_quest', 'Beat Quest'),
('created_quest', 'Created Quest'),
('updated_avatar', 'Updated Avatar'),
]

Expand Down Expand Up @@ -2271,7 +2272,6 @@ class Profile(SuperModel):
rank_org = models.IntegerField(default=0)
rank_coder = models.IntegerField(default=0)
referrer = models.ForeignKey('dashboard.Profile', related_name='referred', on_delete=models.CASCADE, null=True, db_index=True, blank=True)
hackathons = models.ManyToManyField(HackathonRegistration, blank=True)


objects = ProfileQuerySet.as_manager()
Expand Down Expand Up @@ -3529,6 +3529,8 @@ def to_dict(self):
context['total_tips_sent'] = profile.get_sent_tips.count()
context['total_tips_received'] = profile.get_my_tips.count()

context['total_quest_attempts'] = profile.quest_attempts.count()
context['total_quest_success'] = profile.quest_attempts.filter(success=True).count()

# portfolio
portfolio_bounties = profile.fulfilled.filter(bounty__network='mainnet', bounty__current_bounty=True)
Expand Down
21 changes: 20 additions & 1 deletion app/dashboard/templates/dashboard/hackathon_onboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,26 @@
{% endif %}
<h1>{{hackathon.name}} Guide</h1>
{{ hackathon.start_date|date:"M j, Y" }} - {{ hackathon.end_date|date:"M j, Y" }}
<BR>
<BR>
{% if not github_handle %}

<div class="text-center">
<a class="btn btn-lg btn-gc-blue" href="{% url 'social:begin' 'github' %}?next={{ request.get_full_path }}?referer={{referer}}"
onclick="dataLayer.push({'event': 'login'});">
<i class="fab fa-github"></i>
<span>{% trans "Register with GitHub for Hackathon" %}</span>
</a>
<p class="text-muted mt-2 font-smaller-1">By registering you agree to receive hackathon emails announcements</p>
</div>
{% else %}
{% if is_registered %}
<a class="btn btn-lg btn-gc-blue" href="{% if referer %}{{referer|safe}}{% else %}{% url 'hackathon' hackathon.slug %}{% endif %}">Start Hacking</a>
{% else %}
<a class="btn btn-lg btn-gc-blue" data-registration="{{hackathon.slug}}" data-referer="{{referer}}" href="{% url 'hackathon' hackathon.slug %}">Register for Hackathon</a>
<p class="text-muted mt-2 font-smaller-1">By registering you agree to receive hackathon emails announcements</p>
{% endif %}
{% endif %}
</div>
</div>

Expand Down Expand Up @@ -201,7 +220,7 @@ <h2 class="text-center">How does the Hackathon work?</h2>
const url = '/register_hackathon/'
const data = { 'name': name, 'referer': referer}
const sendRegister = fetchData(url, 'POST', data, {'X-CSRFToken': csrftoken});

_alert('You have now registered for this hackathon.', 'success');
$.when(sendRegister).then((response) => {
console.log(response)
document.location.href = response.redirect;
Expand Down
1 change: 1 addition & 0 deletions app/dashboard/templates/ftux/avatar.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ <h3 id="section-title">
{% endfor %}
</div>
</div>
<a href="https://github.com/gitcoinco/web/issues/5326" target="_blank" rel="noopener noreferrer">{% trans "Don't see the right schwag? Request new avatar attributes here" %}</a>
</div>
<div class="tab-pane fade show" id="preset-avatars-tab" role="tabpanel">
<div id="preset-avatars">
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/templates/profiles/tab_active.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h5 class="font-weight-semibold">{{bounty.title}}</h5>&nbsp;
</div>
<div class="float-right">
<a class="btn btn-gc-blue btn-sm " href="{{bounty.url}}">View Bounty &gt;</a>
</div>
</div>
</div>
{% endfor %}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,40 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load static i18n humanize %}
{% load i18n static humanize grants_extra %}

{% if grants %}
<div class="grants-container">
{% for grant in grants %}
{% if forloop.counter0|divisibleby:3 %}<div class="row">{% endif %}
<div class="col-12 col-md-6 col-lg-4 mb-4">
{% include 'grants/card/index.html' %}
</div>
{% if forloop.counter|divisibleby:3 or forloop.last %}</div>{% endif %}
{% endfor %}
<h2 class="font-title my-3 pb-3 title">{% trans "Transaction History" %}</h2>
<h2 class="font-title my-3 pb-3 title">{% trans "Grant Contribution History" %} {% if total_grant_contributions %} ({{total_grant_contributions}})
{%endif%}</h2>
<h3 class="font-body mt-1 mb-1">Monthly Summary</h3>
{% include "profiles/earningsgraph.html" with graph_type="grants" %}

<h3 class="font-body mt-1 mb-1">Transaction Detail</h3>
{% for transaction in history %}
<div class="py-3 mx-sm-0 row transaction-history">
<div class="col-3 col-md-1 font-subheader text-center my-auto">
{{ transaction.cont.created_on|date:"d M" }}
{{ transaction.created_on }}
</div>
<div class="col-2 col-md-1 justify-content-center special_tag">
<img class="avatar" src="{{ transaction.profile.avatar_url }}">
<img class="avatar" style="max-width: 70px;" src="{% if transaction.logo %}{{ transaction.logo }}{% else %}{% with grant_logo='v2/images/grants/logos/' id=transaction.id|modulo:3 %} {% static grant_logo|addstr:id|add:'.png' %} {% endwith %} {% endif %}">
</div>
<div class="col-7 col-md-5 my-auto">
<div class="title font-body">
{{ transaction.grant.title }}
<a href="{{ transaction.url }}">{{ transaction.title }}</a>
</div>
<div class="info font-caption">

{{ transaction.sub.amount_per_period|floatformat:4|intcomma }} {{ transaction.sub.token_symbol }}
{% if transaction.sub.num_tx_approved > 1 %}
/ {{ transaction.sub.frequency }} {{ transaction.sub.frequency_unit }},
{{ transaction.amount_per_period|floatformat:4|intcomma }} {{ transaction.token_symbol }}
{% if transaction.num_tx_approved > 1 %}
/ {{ transaction.frequency }} {{ transaction.frequency_unit }},
{% endif %}
{{transaction.sub.num_tx_approved|floatformat}} time{{ transaction.sub.num_tx_approved|pluralize }}
{{transaction.num_tx_approved|floatformat}} time{{ transaction.num_tx_approved|pluralize }}

</div>
</div>
<div class="col-5 col-md-2 font-body my-auto txn-link">
<a id="tx_link" href="https://etherscan.io/tx/{{transaction.cont.tx_id}}" target="_blank" rel="noopener noreferrer">
{% if transaction.cont.tx_id %}
{% if transaction.tx_id %}
View Etherscan
{%endif%}
</a>
Expand All @@ -59,14 +56,14 @@ <h2 class="font-title my-3 pb-3 title">{% trans "Transaction History" %}</h2>
<div class="offset-lg-1 col-7 col-md-2 my-auto tags font-caption">
<div class="tag tag-lg token">
<p>
{{ transaction.sub.amount_per_period|floatformat:4|intcomma }}
<span>{{ transaction.sub.token_symbol }}</span>
{{ transaction.amount_per_period|floatformat:4|intcomma }}
<span>{{ transaction.token_symbol }}</span>
</p>
</div>
{% if transaction.value_in_usdt_now %}
{% if transaction.amount_per_period_usdt %}
<div class="tag tag-lg usd">
<p>
{{ transaction.value_in_usdt_now }}
{{ transaction.amount_per_period_usdt|floatformat:2 }}
<span>USD</span>
</p>
</div>
Expand All @@ -75,4 +72,3 @@ <h2 class="font-title my-3 pb-3 title">{% trans "Transaction History" %}</h2>
</div>
{% endfor %}
</div>
{% endif %}
33 changes: 33 additions & 0 deletions app/dashboard/templates/profiles/tab_quests.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% load i18n static avatar_tags humanize %}
{% if not hidden %}

<div class="tab-projects d-flex flex-column">

<h3 class="font-body mt-1 mb-1">Cumulative Quest Points</h3>
{% include "profiles/earningsgraph.html" with graph_type="quests" %}

{% if quest_wins.count == 0 %}
No Quest Wins
{% endif %}

<h3 class="font-body mt-1 mb-1">Quests Beaten ({{quest_wins.count}})<h3>
{% for quest in quest_wins %}
<div class="tab-projects__item d-flex mb-0 {% cycle 'odd' 'even' %} pt-1 pb-1">
<div class="activity-avatar ml-5">
<img height="72" width="72" class="avatar card-rating__avatar rounded-circle" src="{% avatar_url profile.handle %}"/>
<img height="24" width="24" class="avatar secondary_avatar rounded-circle align-self-end" style="margin-left: -30px; margin-top:30px;" src="{{quest.quest.enemy_img_url}}" />
</div>
<div class="tab-projects__item-details ml-5" style="width: 60%">
<div class="d-flex">
<h5 class="font-weight-semibold">Beat {{quest.quest.title}}</h5>&nbsp;
</div>
<small class="align-self-center"> {{quest.created_on | naturaltime}}
</small>
</div>
<div class="float-right mt-3">
<a class="btn btn-gc-blue btn-sm " href="{{quest.quest.url}}">Play Quest &gt;</a>
</div>
</div>
{% endfor %}
</div>
{% endif %}
20 changes: 20 additions & 0 deletions app/dashboard/templates/profiles/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@
</a>
</li>
{% endif %}
{% if total_grant_contributions %}
<li class="nav-item">
<a class="nav-link nav-line {% if tab == 'grant_contribs' %}active{%endif%}" href="{{profile.url}}/grant_contribs">
Grants
{% if total_grant_contributions %}<span>{{total_grant_contributions}}</span>{%endif%}
</a>
</li>
{% endif %}
{% if total_quest_success %}
<li class="nav-item">
<a class="nav-link nav-line {% if tab == 'quests' %}active{%endif%}" href="{{profile.url}}/quests">
Quests
{% if total_quest_success %}<span>{{total_quest_success}}</span>{%endif%}
</a>
</li>
{% endif %}
{% if not profile.is_org or total_kudos_count %}
<li class="nav-item">
<a class="nav-link nav-line {% if tab == 'kudos' %}active{%endif%}" href="{{profile.url}}/kudos">
Expand Down Expand Up @@ -116,6 +132,10 @@
{% include 'profiles/tab_earnings.html' %}
{% elif tab == 'spent' %}
{% include 'profiles/tab_spent.html' %}
{% elif tab == 'grant_contribs' %}
{% include 'profiles/tab_grant_contribs.html' %}
{% elif tab == 'quests' %}
{% include 'profiles/tab_quests.html' %}
{% endif %}
</div>
</div>
Expand Down
4 changes: 0 additions & 4 deletions app/dashboard/templates/shared/nav_auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
<i class="fas fa-user"></i>
{% trans "My Profile" %}
</a>
<a class="dropdown-item" href="{% url "grants:profile" %}">
<i class="fas"><img src="{% static "v2/images/grants/icons/black.svg" %}"></i>
{% trans "My Grants" %}
</a>
{% else %}
<a class="dropdown-item" data-gtm="get started" href="{% url "get_gitcoin" %}">
<i class="fas fa-bolt"></i>
Expand Down
Loading