Skip to content

Commit 4f25869

Browse files
walidmujahidzoek1
andauthored
Hackathons List Page (#6297)
* add nav * finish new hackthon section;move subscription section * update hackathon card * add tribes section * add featured hackathon section in header * style: center text;change margins * style: remove gutter width;resize image * style: add image height;remove margins from featured image * add customisable width/height for featured logo * style: handle smaller screens * fix: recreate migrations * add no-featured-hackathon section * TODO: filtering tribes TODO: if no hackathon is ongoing, default to tribes who participated in the most number of hackathons. TODO: if no hackathon going, show tribes that most recently listed their bounties. * style: update margins * fix: stop changing featured bool on each save * style: fix tribes grid and columns add rows to help space elements out properly and fix grid sizes. * fix: duplicate listing of same tribe * handle showing tribes from most recent finsihed hackathon * feat: set a default tab on hackathons list if current hackathons exists, the tab is defaulted to current. if there are no current hackathons, the default tab is upcoming. otherwise, the default tab is finish. * refactor: make variables plural * show top four tribes if no current or upcoming hackathon exists * fix migrations * refactor: move repetitive code into `get_hackathon_events` * rename get_hackathon_events to get_hackathon_event * refactor tribes filtering * move functions to dashboard.utils `get_hackathon_event`, `get_tribe`, `tribe_fields`, and `hackathons_funded` * fix migrations * fix: missing import * fix: recreate migrations * Fix styles and index errors * Remove unused images and fix extension * feat: add workshops * fix: misspelled attribute * add speaker avatar;finish workshops section * fix: recreate migrations needed merges and create missing migrations for commit: c6510fd * remove uneeded margin * update copy * fix: recreate migrations * fix: padding and copy position * fix: recreate migrations * fix:recreate migrations * add back prize amount and number of hackers * fix: recreate migrations * fix subscription sextion layout * fix hackathon section better adjust to changes introduced in: #6722 #6766 * fix: card-logo larger than card-header for some images * add back deleted curly * fix: skip overhead of dropdown of profile instances * adjust workshop layout - remove `workshop-cover` class -was made an ID in error - set a `width` for speaker avatar - set width for workshop title instead of using a column * remove cover_max_width from HackathonWorkshop model * recreate migrations * adjust layout for hackathon card prize amount and builders row * recreate migrations * receate migrations * recreate migrations * recreate migrations * recreate migrations * refactor: use bootstrap position-relative class * refactor: remove commented lines * recreate migrations * recreate mgrations * remove featured hackathon * remove workshops section * remove tribe sections and trbe util functions * updste header background, logo and details * remove value of prizes and number of builders from card * recreate migrations * use footer colour * update subscription section * update tab section add a third item to the tab tuple to act as title in views. previous version (title, count) new version (id, title, count) done so I do not have rework it too much. This way, the title can be variable and can be renamed fairly simply while the the id remains constant. * update form button padding * add hackathon summary to model and template * remove lines in pre_save signal pertaining to removal of featured hackathon from model * fix display of hackathon summary * decrease padding to keep buttons on same line * maek hackathon summary font smaller * set secondary buttons * add sponsors list to hackathon card * remove count from tabs * adjust tablist sizing on smaller screens * remove styles and refactor * increase width of cards, logo sizes, and handle sizes for smaller screens * update cards * add showcase button * recreate migrations * recreate migrations * remove unused files * style: revert to previous style * style: add line * style: use `let` * use zoek1's updates changes from PR #7087 : 0745546#diff-704cfd344337eee34d60c4265c814b3f * recreate migrations Co-authored-by: Miguel Angel G <miguel@gordian.dev>
1 parent 483f70c commit 4f25869

10 files changed

Lines changed: 313 additions & 113 deletions

File tree

app/assets/v2/css/home.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,14 @@ figure:hover::before {
510510
.video-row {
511511
grid-template-columns: 1fr;
512512
}
513+
514+
.box-cta {
515+
margin: 0 !important;
516+
}
517+
518+
.work-internet {
519+
width: 17rem;
520+
}
513521
}
514522

515523
@media (max-width: 768px) {
4.65 KB
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
$(document).ready(function() {
2+
$(document).on('click', '#tabs a', function(e) {
3+
e.preventDefault();
4+
let target = $(this).data('href');
5+
6+
$('.hackathons-list').addClass('hidden');
7+
$('.nav-link').removeClass('active');
8+
$('.nav-link').css('font-weight', '');
9+
$(this).addClass('active');
10+
$(this).css('font-weight', '700');
11+
12+
13+
$('.hackathon-list').addClass('hidden');
14+
$('.hackathon-list.' + target).removeClass('hidden');
15+
16+
$('html,body').animate({
17+
scrollTop: '+=1px'
18+
});
19+
});
20+
});

app/dashboard/admin.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@
2626
from adminsortable2.admin import SortableInlineAdminMixin
2727

2828
from .models import (
29-
Activity, Answer, BlockedURLFilter, BlockedUser, Bounty, BountyEvent, BountyFulfillment, BountyInvites,
30-
BountySyncRequest, CoinRedemption, CoinRedemptionRequest, Coupon, Earning, FeedbackEntry, FundRequest,
31-
HackathonEvent, HackathonProject, HackathonRegistration, HackathonSponsor, Interest, Investigation, LabsResearch,
32-
ObjectView, Option, Poll, PollMedia, PortfolioItem, Profile, ProfileVerification, ProfileView, Question,
33-
SearchHistory, Sponsor, Tip, TipPayout, TokenApproval, TribeMember, TribesSubscription, UserAction,
29+
Activity, Answer, BlockedURLFilter, BlockedUser, Bounty, BountyEvent,
30+
BountyFulfillment, BountyInvites, BountySyncRequest, CoinRedemption,
31+
CoinRedemptionRequest, Coupon, Earning, FeedbackEntry, FundRequest,
32+
HackathonEvent, HackathonProject, HackathonRegistration, HackathonSponsor,
33+
HackathonWorkshop, Interest, Investigation, LabsResearch, ObjectView,
34+
Option, Poll, PollMedia, PortfolioItem, Profile, ProfileVerification,
35+
ProfileView, Question, SearchHistory, Sponsor, Tip, TipPayout,
36+
TokenApproval, TribeMember, TribesSubscription, UserAction,
3437
UserVerificationModel,
3538
)
3639

@@ -367,6 +370,13 @@ class HackathonSponsorAdmin(admin.ModelAdmin):
367370
list_display = ['pk', 'hackathon', 'sponsor', 'sponsor_type']
368371

369372

373+
class HackathonWorkshopAdmin(admin.ModelAdmin):
374+
"""The admin object for the HackathonWorkshop model."""
375+
376+
raw_id_fields = ['speaker']
377+
list_display = ['pk', 'start_date', 'hackathon', 'speaker', 'url']
378+
379+
370380
class SponsorAdmin(admin.ModelAdmin):
371381
"""The admin object for the Sponsor model."""
372382

@@ -589,6 +599,7 @@ class ProfileVerificationAdmin(admin.ModelAdmin):
589599
admin.site.register(Sponsor, SponsorAdmin)
590600
admin.site.register(HackathonEvent, HackathonEventAdmin)
591601
admin.site.register(HackathonSponsor, HackathonSponsorAdmin)
602+
admin.site.register(HackathonWorkshop, HackathonWorkshopAdmin)
592603
admin.site.register(HackathonRegistration, HackathonRegistrationAdmin)
593604
admin.site.register(HackathonProject, HackathonProjectAdmin)
594605
admin.site.register(FeedbackEntry, FeedbackAdmin)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Generated by Django 2.2.4 on 2020-07-28 16:56
2+
3+
import datetime
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
from django.utils.timezone import utc
7+
import economy.models
8+
9+
10+
class Migration(migrations.Migration):
11+
12+
dependencies = [
13+
('dashboard', '0134_auto_20200728_1114'),
14+
]
15+
16+
operations = [
17+
migrations.AddField(
18+
model_name='hackathonevent',
19+
name='hackathon_summary',
20+
field=models.CharField(blank=True, help_text='280 char summary that shows up on hackathon cards on the hackathon list page', max_length=280),
21+
),
22+
migrations.AlterField(
23+
model_name='tribessubscription',
24+
name='expires_on',
25+
field=models.DateTimeField(blank=True, default=datetime.datetime(2021, 7, 28, 16, 56, 46, 271248, tzinfo=utc), null=True),
26+
),
27+
migrations.CreateModel(
28+
name='HackathonWorkshop',
29+
fields=[
30+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
31+
('created_on', models.DateTimeField(db_index=True, default=economy.models.get_time)),
32+
('modified_on', models.DateTimeField(default=economy.models.get_time)),
33+
('name', models.CharField(max_length=255)),
34+
('start_date', models.DateTimeField()),
35+
('cover', models.ImageField(upload_to='')),
36+
('url', models.URLField(help_text='Blog link, calendar link, or other.')),
37+
('visible', models.BooleanField(default=True, help_text='Can this HackathonWorkshop be seen on /hackathons ?')),
38+
('hackathon', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='workshop_event', to='dashboard.HackathonEvent')),
39+
('speaker', models.ForeignKey(help_text='Main speaker profile.', on_delete=django.db.models.deletion.CASCADE, related_name='workshop_speaker', to='dashboard.Profile')),
40+
],
41+
options={
42+
'abstract': False,
43+
},
44+
),
45+
]

app/dashboard/models.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4702,10 +4702,12 @@ class HackathonEvent(SuperModel):
47024702
sponsors = models.ManyToManyField(Sponsor, through='HackathonSponsor')
47034703
sponsor_profiles = models.ManyToManyField('dashboard.Profile', blank=True, limit_choices_to={'data__type': 'Organization'})
47044704
show_results = models.BooleanField(help_text=_('Hide/Show the links to access hackathon results'), default=True)
4705+
hackathon_summary = models.CharField(max_length=280, blank=True, help_text=_('280 char summary that shows up on hackathon cards on the hackathon list page'))
47054706
description = models.TextField(default='', blank=True, help_text=_('HTML rich description.'))
47064707
quest_link = models.CharField(max_length=255, blank=True)
47074708
chat_channel_id = models.CharField(max_length=255, blank=True, null=True)
47084709
visible = models.BooleanField(help_text=_('Can this HackathonEvent be seeing on /hackathons ?'), default=True)
4710+
47094711
default_channels = ArrayField(models.CharField(max_length=255), blank=True, default=list)
47104712
objects = HackathonEventQuerySet.as_manager()
47114713
display_showcase = models.BooleanField(default=False)
@@ -4791,6 +4793,7 @@ def save(self, *args, **kwargs):
47914793
self.slug = slugify(self.name)
47924794
super().save(*args, **kwargs)
47934795

4796+
47944797
# method for updating
47954798
@receiver(pre_save, sender=HackathonEvent, dispatch_uid="psave_hackathonevent")
47964799
def psave_hackathonevent(sender, instance, **kwargs):
@@ -4812,6 +4815,7 @@ def psave_hackathonevent(sender, instance, **kwargs):
48124815
)
48134816

48144817

4818+
48154819
class HackathonSponsor(SuperModel):
48164820
SPONSOR_TYPES = [
48174821
('G', 'Gold'),
@@ -5429,3 +5433,23 @@ class ProfileVerification(SuperModel):
54295433

54305434
def __str__(self):
54315435
return f'{self.phone_number} ({self.caller_type}) from {self.country_code} request ${self.delivery_method} code at {self.created_on}'
5436+
5437+
5438+
class HackathonWorkshop(SuperModel):
5439+
name = models.CharField(max_length=255)
5440+
start_date = models.DateTimeField()
5441+
cover = models.ImageField()
5442+
hackathon = models.ForeignKey(
5443+
'dashboard.HackathonEvent',
5444+
related_name='workshop_event',
5445+
on_delete=models.CASCADE,
5446+
blank=True, null=True
5447+
)
5448+
speaker = models.ForeignKey(
5449+
'dashboard.Profile',
5450+
related_name='workshop_speaker',
5451+
on_delete=models.CASCADE,
5452+
help_text='Main speaker profile.'
5453+
)
5454+
url = models.URLField(help_text='Blog link, calendar link, or other.')
5455+
visible = models.BooleanField(help_text=_('Can this HackathonWorkshop be seen on /hackathons ?'), default=True)

0 commit comments

Comments
 (0)