From fc9b28012c6390c64d3aa6d0471a440745a718af Mon Sep 17 00:00:00 2001 From: "@codingsh" Date: Mon, 29 Jun 2020 14:11:07 -0300 Subject: [PATCH] add upcoming feature and tags #6870 --- app/assets/v2/css/town_square.css | 20 +++++++++ .../templates/townsquare/index.html | 14 +++--- .../townsquare/shared/hackathons.html | 5 +-- .../templates/townsquare/shared/upcoming.html | 43 +++++++++++++++++++ app/townsquare/views.py | 13 +++++- 5 files changed, 86 insertions(+), 9 deletions(-) create mode 100644 app/townsquare/templates/townsquare/shared/upcoming.html diff --git a/app/assets/v2/css/town_square.css b/app/assets/v2/css/town_square.css index 4db3ff7ee90..e4819e4d442 100644 --- a/app/assets/v2/css/town_square.css +++ b/app/assets/v2/css/town_square.css @@ -1366,3 +1366,23 @@ body.green.offer_view .announce { margin-bottom: 2px; margin-top: 2px; } + +.tag-hackathon{ + background-color: rgb(247, 241, 252); + color: rgb(146, 66, 195); + padding: 4px; + display: inline-block; +} + +.tag-workshop{ + background-color: rgb(239, 250, 249); + color: rgb(59, 169, 153); + padding: 4px; + +} + +.tag-grants{ + background-color: rgb(240, 240, 245); + color: rgb(22, 14, 93); + padding: 4px; +} diff --git a/app/townsquare/templates/townsquare/index.html b/app/townsquare/templates/townsquare/index.html index a6bc8f32339..957ffeca35a 100644 --- a/app/townsquare/templates/townsquare/index.html +++ b/app/townsquare/templates/townsquare/index.html @@ -47,13 +47,13 @@ text-transform: none; border-radius: 5px 5px 0 0; } - + .box-hackathons { background: #ffff; border-bottom: 1px solid #ddd; border-radius: 0 0 5px 5px; } - + .box-hackathons .card { border: none; } @@ -79,7 +79,7 @@ .box-hackathons-townsquare .card-body .font-weight-semibold { margin: 0; } - + .box-hackathons .view-all { padding: 0px 0px 0px 20px; font-weight: 700; @@ -197,13 +197,17 @@ {% if SHOW_DRESSING %} {% include 'townsquare/shared/tribe.html' %} - + {% if hackathon_tabs|length %}
- Gitcoin Hackathons + Happining Now
{% include 'townsquare/shared/hackathons.html' %} +
+ Upcoming +
+ {% include 'townsquare/shared/upcoming.html' %} {% endif %} {% include 'townsquare/shared/reflink.html' %} diff --git a/app/townsquare/templates/townsquare/shared/hackathons.html b/app/townsquare/templates/townsquare/shared/hackathons.html index 40327e68cdc..4b271b7efab 100644 --- a/app/townsquare/templates/townsquare/shared/hackathons.html +++ b/app/townsquare/templates/townsquare/shared/hackathons.html @@ -21,10 +21,10 @@
- From + Hackathon - To + -
@@ -39,5 +39,4 @@
{% endfor %} - View all > diff --git a/app/townsquare/templates/townsquare/shared/upcoming.html b/app/townsquare/templates/townsquare/shared/upcoming.html new file mode 100644 index 00000000000..6fb0289b98f --- /dev/null +++ b/app/townsquare/templates/townsquare/shared/upcoming.html @@ -0,0 +1,43 @@ +
+ {% for hackathon in upcoming_events|slice:":5" %} +
+
+
+ {% firstof hackathon.logo_svg or hackathon.logo as logo %} + {% if logo %} + + {% else %} + + {% endif %} +
+ +
+
+ + {{ hackathon.title }} + +
+
+ Hackathon + + - + +
+
+ {% if hackathon.end|timesince <= "1 min" %} + + Join Hackathon > + + {% endif %} +
+
+
+
+ {% endfor %} + View more events +
diff --git a/app/townsquare/views.py b/app/townsquare/views.py index 53893c6f60b..7f90ed925fd 100644 --- a/app/townsquare/views.py +++ b/app/townsquare/views.py @@ -176,6 +176,7 @@ def get_sidebar_tabs(request): start_date = timezone.now() + timezone.timedelta(days=10) end_date = timezone.now() - timezone.timedelta(days=7) hackathons = HackathonEvent.objects.filter(start_date__lt=start_date, end_date__gt=end_date, visible=True) + upcoming = HackathonEvent.objects.upcoming().filter(start_date__lt=start_date, end_date__gt=end_date, visible=True).order_by('start_date'), if hackathons.count(): for hackathon in hackathons: connect = { @@ -188,7 +189,17 @@ def get_sidebar_tabs(request): 'helper_text': f'Go to {hackathon.name} Townsquare.', } hackathon_tabs = [connect] + hackathon_tabs - + if upcoming.count(): + for hackathon in hackathons: + connect = { + 'title': hackathon.name, + 'logo': hackathon.logo, + 'start': hackathon.start_date, + 'end': hackathon.end_date, + 'slug': f'hackathon:{hackathon.pk}', + 'url_slug': hackathon.slug, + } + upcoming_events = [connect] + upcoming_events # set tab if request.COOKIES.get('tab'):