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 flag to display showcase #7087

Merged
merged 12 commits into from
Jul 28, 2020
3 changes: 2 additions & 1 deletion app/assets/v2/js/pages/dashboard-hackathon.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,8 @@
hackathonObj: document.hackathonObj,
hackathonSponsors: document.hackathonSponsors,
hackathonProjects: [],
chatURL: document.chatURL
chatURL: document.chatURL,
hackHasEnded: document.displayShowcase
})
});
});
Expand Down
7 changes: 7 additions & 0 deletions app/assets/v2/js/vue-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,13 @@ Vue.component('showcase', {
vm.spotlights.push(spotlight);
}
},
removeSpotlight: function(index) {
let vm = this;

if (index > -1) {
vm.spotlights.splice(index, 1);
}
},
saveShowcase: function() {
let vm = this;
const resource_url = `/api/v0.1/hackathon/${document.hackathonObj.id}/showcase/`;
Expand Down
18 changes: 18 additions & 0 deletions app/dashboard/migrations/0129_hackathonevent_display_showcase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.4 on 2020-07-10 19:30

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0128_hackathonevent_showcase'),
]

operations = [
migrations.AddField(
model_name='hackathonevent',
name='display_showcase',
field=models.BooleanField(default=False),
),
]
3 changes: 2 additions & 1 deletion app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2806,7 +2806,7 @@ def sybil_score_str(self):
score = self.sybil_score
if score > 5:
return f'VeryX{score} High'
return _map.get(score, "Unknown")
return _map.get(score, "Unknown")

@property
def chat_num_unread_msgs(self):
Expand Down Expand Up @@ -4680,6 +4680,7 @@ class HackathonEvent(SuperModel):
visible = models.BooleanField(help_text=_('Can this HackathonEvent be seeing on /hackathons ?'), default=True)
default_channels = ArrayField(models.CharField(max_length=255), blank=True, default=list)
objects = HackathonEventQuerySet.as_manager()
display_showcase = models.BooleanField(default=False)
showcase = JSONField(default=dict, blank=True, null=True)

def __str__(self):
Expand Down
20 changes: 12 additions & 8 deletions app/dashboard/templates/dashboard/index-vue.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
</div>
</div>
</template>
<b-tab class="col-12" title-item-class="navigation">
<b-tab class="col-12" title-item-class="navigation" v-if="!hackHasEnded">
<template v-slot:title>
<div class="mt-4">
{% trans "Prizes" %}
Expand Down Expand Up @@ -191,7 +191,7 @@ <h1 class="font-title font-weight-semibold">Hackathon Coming Soon!</h1>
</div>
</div>
</b-tab>
<b-tab class="col-12" title-item-class="navigation">
<b-tab class="col-12" title-item-class="navigation" v-if="!hackHasEnded">
<template v-slot:title>
<div class="mt-4">
{% trans "Townsquare" %}
Expand Down Expand Up @@ -331,7 +331,7 @@ <h1 class="font-title title ml-2 mt-4">
</div>
</project-directory>
</b-tab>
<b-tab :disabled="!is_registered" class="col-12" title-item-class="navigation">
<b-tab :disabled="!is_registered" class="col-12" title-item-class="navigation" v-if="!hackHasEnded">
<template v-slot:title>
<div class="mt-4">
{% trans "Chat" %}
Expand All @@ -345,7 +345,7 @@ <h1 class="font-title title ml-2 mt-4">
</div>
</template>
</b-tab>
<b-tab class="col-12" :disabled="!is_registered" title-item-class="navigation" lazy>
<b-tab class="col-12" :disabled="!is_registered" title-item-class="navigation" lazy v-if="!hackHasEnded">
<template v-slot:title>
<div class="mt-4">
{% trans "Participants" %}
Expand Down Expand Up @@ -607,7 +607,7 @@ <h6 class="font-weight-bold mb-3">Invite [[numUsers]] Users to the Bounty</h6>
</div>
</user-directory>
</b-tab>
<b-tab class="col-12" title-item-class="navigation">
<b-tab class="col-12" title-item-class="navigation" v-if="hackHasEnded">
<template v-slot:title>
<div class="mt-4">
{% trans "Showcase" %}
Expand Down Expand Up @@ -678,7 +678,7 @@ <h4 class="font-bigger-1 font-weight-bold">#HackGoals</h4>
</div>
<div class="spotlight">
<h4 class="font-bigger-1 font-weight-bold mb-sm-3">Hacking Spotlights</h4>
<div v-for="spotlight in spotlights">
<div v-for="(spotlight, index) in spotlights">
<div class="d-md-flex pt-2" v-if="!isEditing">
<div class="col-12 col-md-3 my-3 text-center" style="margin-top: auto !important; margin-bottom: auto !important;">
<div class="d-flex text-center mb-3 justify-content-center align-items-center">
Expand All @@ -695,11 +695,14 @@ <h4 class="font-bigger-1 font-weight-bold mb-sm-3">Hacking Spotlights</h4>
</div>

<div class="d-flex" v-if="isEditing">
<select class="d-flex col-12 col-md-3 form-control" v-model="spotlight.sponsor">
<div class="d-flex col-12 col-md-3 flex-column align-items-baseline">
<select class="form-control" v-model="spotlight.sponsor">
<option v-for="sponsor in sponsors" :value="sponsor.org_name">
<span>[[sponsor.org_name]]</span>
</option>
</select>
<button class="btn btn-link text-highlight-pink mt-2" @click="removeSpotlight(index)">- Remove Spotlight</button>
</div>
<textarea class="d-flex col-12 ml-md-3 col-md-8 form-control mb-4" v-model="spotlight.content" name="content" id="" cols="90" rows="8"></textarea>
</div>
</div>
Expand Down Expand Up @@ -744,7 +747,7 @@ <h4 class="font-bigger-1 font-weight-bold mb-3">[[hackathon.name]] Wall of Fame<
</div>

</b-tab>
<template v-slot:tabs-end>
<template v-slot:tabs-end v-if="!hackHasEnded">
<li role="presentation" class="nav-item navigation">
<a href="{% url 'hackathon_onboard' hackathon.slug %}" class="text-reset text-decoration-none nav-link">
<div class="mt-4">Guide</div>
Expand Down Expand Up @@ -828,6 +831,7 @@ <h4 class="font-bigger-1 font-weight-bold mb-3">[[hackathon.name]] Wall of Fame<
document.hackathonObj = JSON.parse(document.getElementById('hackathon-object').textContent);
document.activePanel = parseInt({{panel | safe}});
document.chatURL = "{{ chat_url | safe}}";
document.displayShowcase = {{hackathon.display_showcase|yesno:"true,false" }}
if(location.hostname === 'gitcoin.co') $('#network-filter').hide();
</script>
<script src='{% static "v2/js/pages/dashboard-hackathon.js" %}'></script>
Expand Down