From 0b77f73bf305f6de082868fea1adb56c6083db59 Mon Sep 17 00:00:00 2001 From: Andrew Redden Date: Fri, 10 Apr 2020 13:11:22 -0300 Subject: [PATCH] Projects Panel - all filters now working - response data is correct, project cards fully functional Hackathon Dashboard js - updated the sidebar bindings so they are working in the new layout - general clean up --- app/assets/v2/js/pages/dashboard-hackathon.js | 20 ++++--------- app/dashboard/models.py | 6 +++- .../templates/dashboard/index-vue.html | 25 ++++++++--------- app/dashboard/views.py | 28 +++++++++---------- 4 files changed, 36 insertions(+), 43 deletions(-) diff --git a/app/assets/v2/js/pages/dashboard-hackathon.js b/app/assets/v2/js/pages/dashboard-hackathon.js index 626dac8b30b..e1552e58dd5 100644 --- a/app/assets/v2/js/pages/dashboard-hackathon.js +++ b/app/assets/v2/js/pages/dashboard-hackathon.js @@ -107,11 +107,7 @@ } _filters.forEach(filter => { if (getParam(filter)) { - if (filter !== undefined && filter !== 'undefined') { - localStorage[filter] = getParam(filter).replace(/^,|,\s*$/g, ''); - } else { - delete localStorage[filter]; - } + localStorage[filter] = getParam(filter).replace(/^,|,\s*$/g, ''); } }); }; @@ -131,10 +127,7 @@ } _filters.forEach((filter) => { - - if (localStorage[filter] === undefined || localStorage[filter] === 'undefined') { - delete localStorage[filter]; - } else if (localStorage[filter] && localStorage[filter] !== 'any') { + if (localStorage[filter] && localStorage[filter] !== 'any') { uri += (filter + '=' + localStorage[filter] + '&'); } }); @@ -453,7 +446,7 @@ $('.loading_img').remove(); $('#bounties').append(loading_html); - $('.loading_img').css('display', 'block'); + $('.loading_img').css('display', 'flex'); document.offset = parseInt(document.offset) + parseInt(results_limit); refreshBounties(null, document.offset, true); @@ -524,7 +517,7 @@ if (!append) { $('.nonefound').css('display', 'none'); - $('.loading').css('display', 'block'); + $('.loading').css('display', 'flex'); $('.bounty_row').remove(); } @@ -787,9 +780,8 @@ }); $(` - .sidebar_search input[type=radio], .sidebar_search input[type=checkbox], - .sidebar_search .js-select2, #org - `).on('change', function(e) { + #sidebar_container input[type=radio], #sidebar_container input[type=checkbox], + #sidebar_container .js-select2, #orgs`).on('change', function(e) { reset_offset(); refreshBounties(null, 0, false); e.preventDefault(); diff --git a/app/dashboard/models.py b/app/dashboard/models.py index d3d94f4d8ae..d046d01f515 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -4616,7 +4616,6 @@ class HackathonSponsor(SuperModel): ) chat_channel_id = models.CharField(max_length=255, blank=True, null=True) - class HackathonProject(SuperModel): PROJECT_STATUS = [ ('invalid', 'invalid'), @@ -4677,7 +4676,12 @@ def get_absolute_url(self): from rest_framework import serializers +from .router import BountySerializer + class HackathonProjectSerializer(serializers.ModelSerializer): + bounty = BountySerializer() + profiles = ProfileSerializer(many=True) + class Meta: model = HackathonProject fields = ('chat_channel_id', 'status', 'badge', 'bounty', 'summary', 'work_url', 'profiles', 'hackathon', 'summary', 'logo') diff --git a/app/dashboard/templates/dashboard/index-vue.html b/app/dashboard/templates/dashboard/index-vue.html index 8005d9e5534..8ac8c531471 100644 --- a/app/dashboard/templates/dashboard/index-vue.html +++ b/app/dashboard/templates/dashboard/index-vue.html @@ -300,7 +300,7 @@ {% endif %} -
+