From 6ddff597ec27e10e7caa9f3cdee39e2793c610ce Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Thu, 5 Sep 2019 13:26:34 +0530 Subject: [PATCH 01/11] feat: refactoring popover on bounty details --- app/assets/v2/css/base.css | 6 -- app/assets/v2/css/bounty.css | 31 -------- app/assets/v2/js/user_popover.js | 121 +++++++++++-------------------- app/dashboard/models.py | 20 +++++ app/dashboard/views.py | 54 +++++++++----- 5 files changed, 97 insertions(+), 135 deletions(-) diff --git a/app/assets/v2/css/base.css b/app/assets/v2/css/base.css index 20ca34474bf..8c2b6c4d1aa 100644 --- a/app/assets/v2/css/base.css +++ b/app/assets/v2/css/base.css @@ -1528,12 +1528,6 @@ div.busyOverlay { border-top-color: #F8F8F8; } -.popover-bounty__footer { - padding: 1.3em 1.3em 1.2em; - background-color: #F8F8F8; - border-radius: 0 0 .3rem .3rem; -} - .popover-bounty__content { padding: 1.4em 1.3em 1.3em; } diff --git a/app/assets/v2/css/bounty.css b/app/assets/v2/css/bounty.css index 13282147c89..6fa0e4e5cd4 100644 --- a/app/assets/v2/css/bounty.css +++ b/app/assets/v2/css/bounty.css @@ -490,35 +490,6 @@ a.btn { margin-bottom: 2em; } -.earned { - color: #8E2ABE; - font-size: 14px; - line-height: 13px; - font-weight: 600; -} - -.contributor-position, -.username, -.current_status, -.in-progress { - color: #0D0764; -} - -.specialty { - font-weight: 600; - font-size: 10px; - line-height: 11px; -} - -.completed-bounties { - color: #05B66A; -} - -.abandoned-bounties, -.removed-bounties { - color: #F5A623; -} - #funder_notif_info:empty { display: none; } @@ -540,7 +511,6 @@ a.btn { top: -2px; } - #bounty_details #issue_description img { max-height: 30rem; max-width: 30rem; @@ -860,7 +830,6 @@ a.btn { display: none; } - #title, #funder_notif_info { text-align: center; } diff --git a/app/assets/v2/js/user_popover.js b/app/assets/v2/js/user_popover.js index 6616e7afd71..4d8417ab287 100644 --- a/app/assets/v2/js/user_popover.js +++ b/app/assets/v2/js/user_popover.js @@ -1,62 +1,50 @@ let popoverData = []; -const renderPopOverData = json => { - let orgs = Object.keys(json.profile.organizations).map((org, index) => { +const renderPopOverData = profile => { + let contributed_to = Object.keys(profile.contributed_to).map((_organization, index) => { if (index < 3) { - return `${org}`; + return `${_organization}`; } - return `+${Object.keys(json.profile.organizations).length - 3}`; + return `+${Object.keys(profile.contributed_to).length - 3}`; }).join(' '); return `
-
- -

${json.profile.handle}

- Specialty: ${json.profile.keywords.slice(0, 3).toString()} - ${orgs.length ? 'Contributes to: ' + orgs : ''} +
+ +

${profile.handle}

+ ${contributed_to.length ? 'Contributes to: ' + contributed_to : ''}
- ~ ${Number(json.profile.total_earned).toFixed(4)} ETH earned -
-
- #${json.profile.position} -

Gitcoin Contributor

+ +
+
+

${profile.stats.position}

+

contributor

+
+
+

${profile.stats.success_rate}

+

success rate

-
-
- ${json.statistics.work_completed} -

Bounties Completed

-
-
- ${json.statistics.work_in_progress} -

Bounties In Progress

-
-
- ${json.statistics.work_abandoned} -

Bounties Abandoned

-
-
- ${json.statistics.work_removed} -

Bounties Removed

-
+
+

${profile.stats.earnings ? Number(profile.stats.earnings).toFixed(4) : 0} ETH

+

collected from ${profile.stats.completed_bounties} bounties

-
- `; }; -const openContributorPopOver = (contributor, element) => { - let contributorURL = `/api/v0.1/profile/${contributor}`; +function openContributorPopOver(contributor, element) { + const contributorURL = `/api/v0.1/profile/${contributor}`; if (popoverData.filter(index => index[contributor]).length === 0) { fetch(contributorURL, { method: 'GET' }) @@ -65,8 +53,12 @@ const openContributorPopOver = (contributor, element) => { element.popover({ placement: 'auto', trigger: 'hover', - template: - '', + template: ` + `, content: renderPopOverData(response), html: true }); @@ -80,8 +72,12 @@ const openContributorPopOver = (contributor, element) => { element.popover({ placement: 'auto', trigger: 'hover', - template: - '', + template: ` + `, content: renderPopOverData( popoverData.filter(item => item[contributor])[0][contributor] ), @@ -89,35 +85,4 @@ const openContributorPopOver = (contributor, element) => { }); $(element).popover('show'); } -}; - -const currentStatus = status => { - const activity_names = { - new_bounty: gettext('New Bounty'), - start_work: gettext('Work Started'), - stop_work: gettext('Work Stopped'), - work_submitted: gettext('Work Submitted'), - work_done: gettext('Work Done'), - worker_approved: gettext('Worker Approved'), - worker_rejected: gettext('Worker Rejected'), - worker_applied: gettext('Worker Applied'), - increased_bounty: gettext('Increased Funding'), - killed_bounty: gettext('Canceled Bounty'), - new_crowdfund: gettext('New Crowdfund Contribution'), - new_tip: gettext('New Tip'), - receive_tip: gettext('Tip Received'), - bounty_abandonment_escalation_to_mods: gettext( - 'Escalated for Abandonment of Bounty' - ), - bounty_abandonment_warning: gettext('Warned for Abandonment of Bounty'), - bounty_removed_slashed_by_staff: gettext( - 'Dinged and Removed from Bounty by Staff' - ), - bounty_removed_by_staff: gettext('Removed from Bounty by Staff'), - bounty_removed_by_funder: gettext('Removed from Bounty by Funder'), - bounty_changed: gettext('Bounty Details Changed'), - extend_expiration: gettext('Extended Bounty Expiration') - }; - - return activity_names[status] || 'Unknown activity '; -}; +} \ No newline at end of file diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 29ed94f6428..afcb307c191 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -2364,8 +2364,28 @@ def is_staff(self): """ return self.user.is_staff if self.user else False + + @property + def completed_bounties(self): + """Returns bounties completed by user + + Returns: + number: number of bounties completed + + """ + network = self.get_network() + return self.bounties.filter( + idx_status__in=['done'], network=network).count() + + @property def success_rate(self): + """Returns success rate of user on the platform + + Returns: + number: sucess rate of user + + """ network = self.get_network() num_completed_bounties = self.bounties.filter( idx_status__in=['done'], network=network).count() diff --git a/app/dashboard/views.py b/app/dashboard/views.py index 9cdf6fa57e6..0eca5a500d6 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -1785,29 +1785,43 @@ def profile_details(request, handle): """ try: profile = profile_helper(handle, True) - activity = Activity.objects.filter(profile=profile).order_by('-created_on').first() - count_work_completed = Activity.objects.filter(profile=profile, activity_type='work_done').count() - count_work_in_progress = Activity.objects.filter(profile=profile, activity_type='start_work').count() - count_work_abandoned = Activity.objects.filter(profile=profile, activity_type='stop_work').count() - count_work_removed = Activity.objects.filter(profile=profile, activity_type='bounty_removed_by_funder').count() except (ProfileNotFoundException, ProfileHiddenException): raise Http404 + bounties = profile.bounties + for word in profile.keywords: + bounties = bounties.keyword(word) # TODO: Is this right + + _bounties = [] + if bounties : + for bounty in bounties: + _bounty = { + 'title': bounty.title, + 'url': bounty.get_absolute_url() + } + try: + # feedback = FeedbackEntry.objects.get(bounty=bounty.pk, receiver_profile=profile) + feedback = FeedbackEntry.objects.get() # TODO: remove after testing + if feedback: + _bounty['contibutor_rating'] = feedback.rating + except FeedbackEntry.DoesNotExist: + _bounty['contibutor_rating'] = None + _bounties.append(_bounty) + response = { - 'profile': ProfileSerializer(profile).data, - 'success_rate': profile.success_rate, - 'recent_activity': { - 'activity_metadata': activity.metadata, - 'activity_type': activity.activity_type, - 'created': activity.created - }, - 'statistics': { - 'work_completed': count_work_completed, - 'work_in_progress': count_work_in_progress, - 'work_abandoned': count_work_abandoned, - 'work_removed': count_work_removed + 'avatar': profile.avatar_url, + 'handle': profile.handle, + # 'contributed_to' : dic(profile.get_who_works_with()) # TODO: make into array + 'keywords': profile.keywords, + 'related_bounties' : _bounties, + 'stats': { + 'position': profile.get_contributor_leaderboard_index(), + 'completed_bounties': profile.completed_bounties, + 'success_rate': profile.success_rate, + 'earnings': profile.get_eth_sum() } } + return JsonResponse(response, safe=False) @@ -2003,15 +2017,15 @@ def profile(request, handle): currently_working_bounties_count = currently_working_bounties.count() if currently_working_bounties_count > 0: paginator = Paginator(currently_working_bounties, 10) - + if page > paginator.num_pages: return HttpResponse(status=204) context = {} - context['bounties'] = [bounty for bounty in paginator.get_page(page)] + context['bounties'] = [bounty for bounty in paginator.get_page(page)] return TemplateResponse(request, 'profiles/profile_bounties.html', context, status=status) - + else: all_activities = profile.get_various_activities() From 3ea9b330277ee31b6c64412ae896575ecaf5177a Mon Sep 17 00:00:00 2001 From: octavioamu Date: Fri, 6 Sep 2019 02:05:12 -0300 Subject: [PATCH 02/11] change data and avoid overlap popovers --- app/assets/v2/js/user_popover.js | 28 +++++++++++---------- app/dashboard/templates/bounty/details.html | 3 +++ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/assets/v2/js/user_popover.js b/app/assets/v2/js/user_popover.js index 4d8417ab287..103c046dfe2 100644 --- a/app/assets/v2/js/user_popover.js +++ b/app/assets/v2/js/user_popover.js @@ -1,39 +1,40 @@ let popoverData = []; -const renderPopOverData = profile => { - let contributed_to = Object.keys(profile.contributed_to).map((_organization, index) => { +const renderPopOverData = data => { + console.log(data) + let contributed_to = data.contributed_to.map((_organization, index) => { if (index < 3) { return `${_organization}`; } - return `+${Object.keys(profile.contributed_to).length - 3}`; + return `+${data.contributed_to.length - 3}`; }).join(' '); return `
- -

${profile.handle}

+ +

${data.handle}

${contributed_to.length ? 'Contributes to: ' + contributed_to : ''}
-

${profile.stats.position}

+

${data.stats.position}

contributor

-

${profile.stats.success_rate}

+

${data.stats.success_rate}

success rate

-

${profile.stats.earnings ? Number(profile.stats.earnings).toFixed(4) : 0} ETH

-

collected from ${profile.stats.completed_bounties} bounties

+

${data.stats.earnings ? Number(data.stats.earnings).toFixed(4) : 0} ETH

+

collected from ${data.stats.completed_bounties} bounties

-

Bounties completed related to ${profile.keywords.slice(0, 3).toString()}

- ${profile.related_bounties ? +

Bounties completed related to ${data.keywords.slice(0, 3).toString()}

+ ${data.related_bounties ? '
  • // TODO: LOOP THROUGH TITLE
' : '

None

' @@ -44,7 +45,8 @@ const renderPopOverData = profile => { }; function openContributorPopOver(contributor, element) { - const contributorURL = `/api/v0.1/profile/${contributor}`; + const keywords = document.result.keywords; + const contributorURL = `/api/v0.1/profile/${contributor}?keywords=${keywords}`; if (popoverData.filter(index => index[contributor]).length === 0) { fetch(contributorURL, { method: 'GET' }) @@ -85,4 +87,4 @@ function openContributorPopOver(contributor, element) { }); $(element).popover('show'); } -} \ No newline at end of file +} diff --git a/app/dashboard/templates/bounty/details.html b/app/dashboard/templates/bounty/details.html index 297ffead966..882b2d8b4ab 100644 --- a/app/dashboard/templates/bounty/details.html +++ b/app/dashboard/templates/bounty/details.html @@ -488,6 +488,9 @@

{{ noscript.keywords }}

$("body").on("mouseover", "[data-username]", function(e) { openContributorPopOver($(this).data("username"), $(this)); }); + $("body").on("mouseout", "[data-username]", function(e) { + $(this).popover('dispose'); + }); From 75fb02e8cb1147a2acbceb660d4ea0d08812e9fa Mon Sep 17 00:00:00 2001 From: octavioamu Date: Fri, 6 Sep 2019 02:05:45 -0300 Subject: [PATCH 03/11] fix queries to be by bounty skill --- app/dashboard/views.py | 58 ++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/app/dashboard/views.py b/app/dashboard/views.py index 0eca5a500d6..81710409207 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -34,7 +34,7 @@ from django.core import serializers from django.core.exceptions import PermissionDenied from django.core.paginator import Paginator -from django.db.models import Avg, Count, Q +from django.db.models import Avg, Count, Prefetch, Q from django.http import Http404, HttpResponse, JsonResponse from django.shortcuts import redirect from django.template import loader @@ -1788,31 +1788,61 @@ def profile_details(request, handle): except (ProfileNotFoundException, ProfileHiddenException): raise Http404 - bounties = profile.bounties - for word in profile.keywords: - bounties = bounties.keyword(word) # TODO: Is this right + if not settings.DEBUG: + network = 'mainnet' + else: + network = 'rinkeby' + + keywords = request.GET.get('keywords') + + # bounties = profile.bounties + # Prefetch('feedbacks', queryset=queryset, to_attr='feedback'), 'feedback__rating') \ + # queryset = FeedbackEntry.objects.all().filter(receiver_profile=profile) + bounties = Bounty.objects.current().prefetch_related('fulfillments', 'interested', 'interested__profile', 'feedbacks') \ + .filter(interested__profile=profile, network=network,) \ + .filter(interested__status='okay') \ + .filter(interested__pending=False).filter(idx_status='done') \ + .filter(feedbacks__receiver_profile=profile) \ + .filter( + Q(metadata__issueKeywords__icontains=keywords) | \ + Q(title__icontains=keywords) | \ + Q(issue_description__icontains=keywords) + ) \ + .distinct('pk') + + + + # for word in keywords: + # bounties = bounties.keyword(word) # TODO: Is this right _bounties = [] + _orgs = [] if bounties : for bounty in bounties: + _bounty = { 'title': bounty.title, - 'url': bounty.get_absolute_url() + 'url': bounty.get_absolute_url(), + 'id': bounty.id, + 'org': bounty.org_name, + 'rating': [feedback.rating for feedback in bounty.feedbacks.all().distinct('bounty_id')], } - try: - # feedback = FeedbackEntry.objects.get(bounty=bounty.pk, receiver_profile=profile) - feedback = FeedbackEntry.objects.get() # TODO: remove after testing - if feedback: - _bounty['contibutor_rating'] = feedback.rating - except FeedbackEntry.DoesNotExist: - _bounty['contibutor_rating'] = None + _org = bounty.org_name + # try: + # # feedback = FeedbackEntry.objects.get(bounty=bounty.pk, receiver_profile=profile) + # # feedback = FeedbackEntry.objects.get() # TODO: remove after testing + # if feedback: + # _bounty['contibutor_rating'] = feedback.rating + # except FeedbackEntry.DoesNotExist: + # _bounty['contibutor_rating'] = None + _orgs.append(_org) _bounties.append(_bounty) response = { 'avatar': profile.avatar_url, 'handle': profile.handle, - # 'contributed_to' : dic(profile.get_who_works_with()) # TODO: make into array - 'keywords': profile.keywords, + 'contributed_to': _orgs, + 'keywords': keywords, 'related_bounties' : _bounties, 'stats': { 'position': profile.get_contributor_leaderboard_index(), From c571ac4028206c28a2ef6a65c408df7b9c41deab Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Fri, 6 Sep 2019 17:03:48 +0530 Subject: [PATCH 04/11] fix up css --- app/assets/v2/css/bounty.css | 20 ++++++++--- app/assets/v2/js/user_popover.js | 62 +++++++++++++++++++++++--------- app/dashboard/views.py | 15 -------- 3 files changed, 61 insertions(+), 36 deletions(-) diff --git a/app/assets/v2/css/bounty.css b/app/assets/v2/css/bounty.css index 6fa0e4e5cd4..1ba0eb7d518 100644 --- a/app/assets/v2/css/bounty.css +++ b/app/assets/v2/css/bounty.css @@ -98,6 +98,22 @@ body { margin-bottom: 5px; } +.stat-card { + background: #ecf0fa; + border-radius: 4px; +} + +.stat-card h2, +.stat-card p, +.related-bounties li span, +.popover-bounty__content .summary { + color: #717171; +} + +.related-bounties { + list-style-type: none; +} + .box { padding: 14px; border: 1px solid #DBDBDB; @@ -153,10 +169,6 @@ body { color: #000000; } -/* #issue_description pre, code { - padding: 1em 0; -} */ - #bounty-info-row { margin-left: 1px; } diff --git a/app/assets/v2/js/user_popover.js b/app/assets/v2/js/user_popover.js index 103c046dfe2..3255b9ccada 100644 --- a/app/assets/v2/js/user_popover.js +++ b/app/assets/v2/js/user_popover.js @@ -1,8 +1,8 @@ let popoverData = []; const renderPopOverData = data => { - console.log(data) - let contributed_to = data.contributed_to.map((_organization, index) => { + const unique_contributed_to = data.contributed_to ? Array.from(new Set(data.contributed_to)) : []; + let contributed_to = unique_contributed_to && unique_contributed_to.map((_organization, index) => { if (index < 3) { return `${_organization}`; @@ -10,34 +10,60 @@ const renderPopOverData = data => { return `+${data.contributed_to.length - 3}`; }).join(' '); + const bounties = data.related_bounties && data.related_bounties.map(bounty => { + const title = bounty.title.slice(0, 50); + + return `
  • + ${title} + by ${bounty.org} +
  • `; + }).join(' '); + return `

    ${data.handle}

    - ${contributed_to.length ? 'Contributes to: ' + contributed_to : ''} +
    + ${contributed_to.length ? 'Contributes to: ' + contributed_to : ''} +
    -
    -
    -

    ${data.stats.position}

    -

    contributor

    +
    +
    +

    + ${data.stats.position == 0 ? '-' : '#' + data.stats.position} +

    +

    contributor

    -
    -

    ${data.stats.success_rate}

    -

    success rate

    +
    +

    + ${data.stats.success_rate ? data.stats.success_rate : 0} % +

    +

    success rate

    -
    -

    ${data.stats.earnings ? Number(data.stats.earnings).toFixed(4) : 0} ETH

    -

    collected from ${data.stats.completed_bounties} bounties

    +
    +

    + ${data.stats.earnings ? Number(data.stats.earnings).toFixed(4) : 0} ETH +

    +

    + collected from + ${data.stats.completed_bounties} bounties +

    -

    Bounties completed related to ${data.keywords.slice(0, 3).toString()}

    - ${data.related_bounties ? - '
    • // TODO: LOOP THROUGH TITLE
    ' + ${data.related_bounties.length == 0 ? + `

    + No bounties completed related to ${data.keywords} +

    ` : - '

    None

    ' + `

    + Bounties completed related to ${data.keywords}: +

    + ` }
    @@ -45,6 +71,8 @@ const renderPopOverData = data => { }; function openContributorPopOver(contributor, element) { + console.log(contributor, element); + const keywords = document.result.keywords; const contributorURL = `/api/v0.1/profile/${contributor}?keywords=${keywords}`; diff --git a/app/dashboard/views.py b/app/dashboard/views.py index 81710409207..664cd850da7 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -1795,9 +1795,6 @@ def profile_details(request, handle): keywords = request.GET.get('keywords') - # bounties = profile.bounties - # Prefetch('feedbacks', queryset=queryset, to_attr='feedback'), 'feedback__rating') \ - # queryset = FeedbackEntry.objects.all().filter(receiver_profile=profile) bounties = Bounty.objects.current().prefetch_related('fulfillments', 'interested', 'interested__profile', 'feedbacks') \ .filter(interested__profile=profile, network=network,) \ .filter(interested__status='okay') \ @@ -1810,11 +1807,6 @@ def profile_details(request, handle): ) \ .distinct('pk') - - - # for word in keywords: - # bounties = bounties.keyword(word) # TODO: Is this right - _bounties = [] _orgs = [] if bounties : @@ -1828,13 +1820,6 @@ def profile_details(request, handle): 'rating': [feedback.rating for feedback in bounty.feedbacks.all().distinct('bounty_id')], } _org = bounty.org_name - # try: - # # feedback = FeedbackEntry.objects.get(bounty=bounty.pk, receiver_profile=profile) - # # feedback = FeedbackEntry.objects.get() # TODO: remove after testing - # if feedback: - # _bounty['contibutor_rating'] = feedback.rating - # except FeedbackEntry.DoesNotExist: - # _bounty['contibutor_rating'] = None _orgs.append(_org) _bounties.append(_bounty) From 6e76f1ee40f48ed1c5177ab597c28c325c360eb2 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Fri, 6 Sep 2019 19:49:00 +0530 Subject: [PATCH 05/11] added star rating --- app/assets/v2/css/bounty.css | 4 ++++ app/assets/v2/js/user_popover.js | 14 +++++++++++++- app/dashboard/templates/bounty/details.html | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/assets/v2/css/bounty.css b/app/assets/v2/css/bounty.css index 1ba0eb7d518..d89cfbc374d 100644 --- a/app/assets/v2/css/bounty.css +++ b/app/assets/v2/css/bounty.css @@ -114,6 +114,10 @@ body { list-style-type: none; } +.related-bounties .static-stars .far { + font-size: 1rem; +} + .box { padding: 14px; border: 1px solid #DBDBDB; diff --git a/app/assets/v2/js/user_popover.js b/app/assets/v2/js/user_popover.js index 3255b9ccada..08019100c1a 100644 --- a/app/assets/v2/js/user_popover.js +++ b/app/assets/v2/js/user_popover.js @@ -13,9 +13,21 @@ const renderPopOverData = data => { const bounties = data.related_bounties && data.related_bounties.map(bounty => { const title = bounty.title.slice(0, 50); + let ratings = []; + + if (bounty.rating && bounty.rating[0] > 0) { + for (let i = 0; i < 5; i++) { + ratings.push(``); + } + } + return `
  • ${title} by ${bounty.org} + ${ratings.length > 0 ? + ` + ${ratings.join(' ')} + ` : ''}
  • `; }).join(' '); @@ -72,7 +84,7 @@ const renderPopOverData = data => { function openContributorPopOver(contributor, element) { console.log(contributor, element); - + const keywords = document.result.keywords; const contributorURL = `/api/v0.1/profile/${contributor}?keywords=${keywords}`; diff --git a/app/dashboard/templates/bounty/details.html b/app/dashboard/templates/bounty/details.html index 882b2d8b4ab..a967ba008ca 100644 --- a/app/dashboard/templates/bounty/details.html +++ b/app/dashboard/templates/bounty/details.html @@ -15,6 +15,7 @@ + From fd28af376f794238b6c47d349d412f4cf3984944 Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Fri, 6 Sep 2019 20:31:11 +0530 Subject: [PATCH 06/11] review feedback --- app/assets/v2/css/bounty.css | 8 ++++++-- app/assets/v2/js/user_popover.js | 8 ++++---- app/dashboard/views.py | 1 - 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/assets/v2/css/bounty.css b/app/assets/v2/css/bounty.css index d89cfbc374d..1da12564e06 100644 --- a/app/assets/v2/css/bounty.css +++ b/app/assets/v2/css/bounty.css @@ -105,7 +105,7 @@ body { .stat-card h2, .stat-card p, -.related-bounties li span, +.related-bounties li .bounty-org, .popover-bounty__content .summary { color: #717171; } @@ -114,8 +114,12 @@ body { list-style-type: none; } +.related-bounties .bounty-title { + color: #3E00FF; +} + .related-bounties .static-stars .far { - font-size: 1rem; + font-size: 0.8rem; } .box { diff --git a/app/assets/v2/js/user_popover.js b/app/assets/v2/js/user_popover.js index 08019100c1a..8f62413c24a 100644 --- a/app/assets/v2/js/user_popover.js +++ b/app/assets/v2/js/user_popover.js @@ -11,7 +11,7 @@ const renderPopOverData = data => { }).join(' '); const bounties = data.related_bounties && data.related_bounties.map(bounty => { - const title = bounty.title.slice(0, 50); + const title = bounty.title <= 30 ? bounty.title : bounty.title.slice(0, 27) + '...'; let ratings = []; @@ -22,8 +22,8 @@ const renderPopOverData = data => { } return `
  • - ${title} - by ${bounty.org} + ${title} + by ${bounty.org} ${ratings.length > 0 ? ` ${ratings.join(' ')} @@ -50,7 +50,7 @@ const renderPopOverData = data => {
  • - ${data.stats.success_rate ? data.stats.success_rate : 0} % + ${data.stats.success_rate ? Math.round(data.stats.success_rate) : 0} %

    success rate

    diff --git a/app/dashboard/views.py b/app/dashboard/views.py index 664cd850da7..88660fb92b6 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -1814,7 +1814,6 @@ def profile_details(request, handle): _bounty = { 'title': bounty.title, - 'url': bounty.get_absolute_url(), 'id': bounty.id, 'org': bounty.org_name, 'rating': [feedback.rating for feedback in bounty.feedbacks.all().distinct('bounty_id')], From f1595de7ce20736c04603129d679fcddda3d61ed Mon Sep 17 00:00:00 2001 From: octavioamu Date: Fri, 6 Sep 2019 13:59:44 -0300 Subject: [PATCH 07/11] limit number and corner cases --- app/assets/v2/js/user_popover.js | 8 +++----- app/dashboard/views.py | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/assets/v2/js/user_popover.js b/app/assets/v2/js/user_popover.js index 8f62413c24a..791620f23ea 100644 --- a/app/assets/v2/js/user_popover.js +++ b/app/assets/v2/js/user_popover.js @@ -67,11 +67,11 @@ const renderPopOverData = data => { ${data.related_bounties.length == 0 ? `

    - No bounties completed related to ${data.keywords} + No bounties completed related to ${data.keywords || 'bounty'}

    ` : `

    - Bounties completed related to ${data.keywords}: + Bounties completed related to ${data.keywords || 'bounty'}:

    - ${data.stats.success_rate ? Math.round(data.stats.success_rate) : 0} % + ${data.stats.success_rate ? Math.round(data.stats.success_rate * 100) : 0} %

    success rate