From 71f4a2d50dd351e0e3659f13ad1628d37b0dcd5c Mon Sep 17 00:00:00 2001 From: Miguel Angel G Date: Wed, 2 Sep 2020 02:58:52 -0500 Subject: [PATCH 1/4] Add events section to hackathons --- app/app/settings.py | 2 + app/app/urls.py | 1 + app/assets/v2/images/hackathon/check.svg | 4 ++ app/assets/v2/images/hackathon/demo.png | Bin 0 -> 961 bytes app/assets/v2/images/hackathon/demo.svg | 4 ++ app/assets/v2/images/hackathon/formation.svg | 4 ++ app/assets/v2/images/hackathon/office.svg | 4 ++ app/assets/v2/images/hackathon/pitch.svg | 4 ++ app/assets/v2/images/hackathon/workshop.svg | 4 ++ app/assets/v2/js/pages/dashboard-hackathon.js | 3 + app/assets/v2/js/vue-components.js | 62 ++++++++++++++++++ app/dashboard/models.py | 1 + .../templates/dashboard/index-vue.html | 55 ++++++++++++++++ app/dashboard/views.py | 40 ++++++++++- 14 files changed, 185 insertions(+), 3 deletions(-) create mode 100644 app/assets/v2/images/hackathon/check.svg create mode 100644 app/assets/v2/images/hackathon/demo.png create mode 100644 app/assets/v2/images/hackathon/demo.svg create mode 100644 app/assets/v2/images/hackathon/formation.svg create mode 100644 app/assets/v2/images/hackathon/office.svg create mode 100644 app/assets/v2/images/hackathon/pitch.svg create mode 100644 app/assets/v2/images/hackathon/workshop.svg diff --git a/app/app/settings.py b/app/app/settings.py index b5f1915c12b..e88aa72b579 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -833,3 +833,5 @@ def callback(request): PHONE_SALT = env('PHONE_SALT', default='THIS_IS_INSECURE_CHANGE_THIS_PLEASE') HYPERCHARGE_BOUNTIES_PROFILE_HANDLE = env('HYPERCHARGE_BOUNTIES_PROFILE', default='gitcoinbot') +ADDEVENT_CLIENT_ID = env('ADDEVENT_CLIENT_ID', default='') +ADDEVENT_API_TOKEN = env('ADDEVENT_API_TOKEN', default='') diff --git a/app/app/urls.py b/app/app/urls.py index 3df2be4f80b..619fb2eac51 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -268,6 +268,7 @@ path('api/v0.1/hackathon//save/', dashboard.views.save_hackathon, name='save_hackathon'), path('api/v1/hackathon//prizes', dashboard.views.hackathon_prizes, name='hackathon_prizes_api'), path('api/v0.1/hackathon//showcase/', dashboard.views.showcase, name='hackathon_showcase'), + path('api/v0.1/hackathon//events/', dashboard.views.events, name='hackathon_events'), path('api/v0.1/projects/', dashboard.views.get_project, name='project_context'), # action URLs url(r'^funder', retail.views.funder_bounties_redirect, name='funder_bounties_redirect'), diff --git a/app/assets/v2/images/hackathon/check.svg b/app/assets/v2/images/hackathon/check.svg new file mode 100644 index 00000000000..01e65de101e --- /dev/null +++ b/app/assets/v2/images/hackathon/check.svg @@ -0,0 +1,4 @@ + + + + diff --git a/app/assets/v2/images/hackathon/demo.png b/app/assets/v2/images/hackathon/demo.png new file mode 100644 index 0000000000000000000000000000000000000000..062813526fe786369c583eb79286a41e8992c774 GIT binary patch literal 961 zcmeAS@N?(olHy`uVBq!ia0vp^DIm``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&di49sDkE{-7;jBoGQ`v(Wg9Q*h@rq{{fk&@3O zx4R)J1%cwP=C|xPu;L->j#b==n|xXvl@{wCc+t`9^~hfAv6AQFoGvp9QE>xBQQ@8Q zT&@^;?@Z9$FK{J&Qo!F>Lwsq*vHHLWIhtS0z>OWfRJGB5r``=pRyQQqeUGk&nTI#xUp;t*w3 zT&$2H($dp3AyB}G%gN30ga(HsZozNL%;N2hm%|&+<-PIr=05Pp`@vt6CT_VWzgR9@ z?zUa~nx)|6eZP6^a{US`76ec0?b<7stX;j1yGptCxtkH3o-Y zxN?h6u}i}-DpS~hZALut)lyzdt)YP5;tJU(eZY*No`1jt~qNxhi^ES@U z{-Ut|%k!!AU2;dBJxkl!(JH+~l1r zF^Q;%)$!nTI=ECrZRKHMj@Ht2#~_yPFuz#ri^%~}o{!Mx3cRgj!K9RlTNV@XkAjf?Vq;J%Q|K@(ooO$lQhKlC7 tU+%vZA~n`7|Cewo@z%7Swfuh=Bj;}tZ=JkC8kpl4JYD@<);T3K0RV;BpRfP` literal 0 HcmV?d00001 diff --git a/app/assets/v2/images/hackathon/demo.svg b/app/assets/v2/images/hackathon/demo.svg new file mode 100644 index 00000000000..5f745a6f03f --- /dev/null +++ b/app/assets/v2/images/hackathon/demo.svg @@ -0,0 +1,4 @@ + + + + diff --git a/app/assets/v2/images/hackathon/formation.svg b/app/assets/v2/images/hackathon/formation.svg new file mode 100644 index 00000000000..c903af8b413 --- /dev/null +++ b/app/assets/v2/images/hackathon/formation.svg @@ -0,0 +1,4 @@ + + + + diff --git a/app/assets/v2/images/hackathon/office.svg b/app/assets/v2/images/hackathon/office.svg new file mode 100644 index 00000000000..d1e001e56c7 --- /dev/null +++ b/app/assets/v2/images/hackathon/office.svg @@ -0,0 +1,4 @@ + + + + diff --git a/app/assets/v2/images/hackathon/pitch.svg b/app/assets/v2/images/hackathon/pitch.svg new file mode 100644 index 00000000000..91c6807a12f --- /dev/null +++ b/app/assets/v2/images/hackathon/pitch.svg @@ -0,0 +1,4 @@ + + + + diff --git a/app/assets/v2/images/hackathon/workshop.svg b/app/assets/v2/images/hackathon/workshop.svg new file mode 100644 index 00000000000..8115ca5c1df --- /dev/null +++ b/app/assets/v2/images/hackathon/workshop.svg @@ -0,0 +1,4 @@ + + + + diff --git a/app/assets/v2/js/pages/dashboard-hackathon.js b/app/assets/v2/js/pages/dashboard-hackathon.js index 857e66a100c..eaf0b9d817d 100644 --- a/app/assets/v2/js/pages/dashboard-hackathon.js +++ b/app/assets/v2/js/pages/dashboard-hackathon.js @@ -911,6 +911,9 @@ case 3: newPathName = 'participants'; break; + case 4: + newPathName = 'events'; + break; case 5: newPathName = 'showcase'; break; diff --git a/app/assets/v2/js/vue-components.js b/app/assets/v2/js/vue-components.js index 5f2a01be771..bbbc4f54c1d 100644 --- a/app/assets/v2/js/vue-components.js +++ b/app/assets/v2/js/vue-components.js @@ -399,6 +399,68 @@ Vue.component('project-directory', { }); +Vue.component('events', { + delimiters: [ '[[', ']]' ], + props: [], + data: function() { + return { + events: [] + }; + }, + methods: { + nth: function(d) { + if (d > 3 && d < 21) + return 'th'; + switch (d % 10) { + case 1: return 'st'; + case 2: return 'nd'; + case 3: return 'rd'; + default: return 'th'; + } + }, + fetchEvents: async function() { + const response = await fetchData(`/api/v0.1/hackathon/${document.hackathonObj.id}/events/`, 'GET'); + + this.$set(this, 'events', response.events.events); + }, + formatDate: function(event) { + const monthNames = [ + 'January', 'February', 'March', 'April', 'May', 'June', + 'July', 'August', 'September', 'October', 'November', 'December' + ]; + const date = event.date_start.split('/'); + const time = event.date_start_time; + const newDate = new Date(`${date[2]}-${date[0]}-${date[1]}T${time}`); + const month = monthNames[newDate.getMonth()]; + const day = newDate.getDay(); + const hours = newDate.getHours(); + const ampm = event.date_start_ampm.toLowerCase(); + + return `${month} ${day}${this.nth(newDate.getDay())}, ${hours} ${ampm} ET`; + }, + eventTag: function(event) { + const text = event.eventname; + + if (text.includes('formation')) { + return 'formation'; + } else if (text.includes('pitch')) { + return 'pitch'; + } else if (text.includes('check')) { + return 'check'; + } else if (text.includes('office')) { + return 'office'; + } else if (text.includes('demo')) { + return 'demo'; + } + + return 'workshop'; + } + }, + mounted() { + this.fetchEvents(); + } +}); + Vue.component('showcase', { delimiters: [ '[[', ']]' ], props: [], diff --git a/app/dashboard/models.py b/app/dashboard/models.py index ab814d0dedd..b29af7e9742 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -4768,6 +4768,7 @@ class HackathonEvent(SuperModel): objects = HackathonEventQuerySet.as_manager() display_showcase = models.BooleanField(default=False) showcase = JSONField(default=dict, blank=True, null=True) + calendar_id = models.CharField(max_length=255, blank=True) def __str__(self): """String representation for HackathonEvent. diff --git a/app/dashboard/templates/dashboard/index-vue.html b/app/dashboard/templates/dashboard/index-vue.html index 5e29f44db4d..e6a340d72c8 100644 --- a/app/dashboard/templates/dashboard/index-vue.html +++ b/app/dashboard/templates/dashboard/index-vue.html @@ -621,6 +621,60 @@
Invite [[numUsers]] Users to the Bounty
+ + +
+ +
+
+

Events Schedule

+ {% if is_staff %} + + {% endif %} +
+
+
+
+ + + + + + +
+
+

Team formation

+

Pitch Day

+

Mid hack Check-In

+

Sponsor Office Hours

+

Workshop

+

Demo Day

+

[[formatDate(event)]]

+

[[event.title]] [[ event.organizer ? `with ${event.organizer}` : '']]

+

[[event.description]]

+
+
+
+
+ Add to Calendar + [[event.date_start]] [[event.date_start_time]] + [[event.date_end]] [[event.date_end_time]] + [[event.timezone]] + [[event.title]] + [[event.description]] + [[event.location]] +
+
+
+
+
+
+
+