Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7379 people voted #7541

Merged
merged 26 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aca7b21
added migrations for mozilla researched
Sep 23, 2021
3ef3bbe
merge with q3 branch
Sep 24, 2021
2991121
merge with q3 branch
Sep 24, 2021
9680ca9
Merge remote-tracking branch 'origin/pni-q3-2021' into 7377-mozilla-r…
Sep 24, 2021
496c371
updated migrations
Sep 24, 2021
bdc9b81
saving to ask design for what to do on the medium breakpoint for the …
Sep 27, 2021
4ec3387
updated to use tailwind
Sep 29, 2021
8e29cf1
added new template to house all of the research details
Oct 1, 2021
468de15
Merge branch 'pni-q3-2021' into 7377-mozilla-researched
danielfmiranda Oct 1, 2021
e56cd23
updated migrations
Oct 1, 2021
ce6674e
Update research_details.html
danielfmiranda Oct 1, 2021
386c726
7379-people-voted
Oct 1, 2021
340ef7d
New localization approach for Mozilla researched (#7553)
TheoChevalier Oct 4, 2021
f725bef
added requested changes from design and review
Oct 4, 2021
2d5b86d
New localization approach for People voted (#7554)
TheoChevalier Oct 5, 2021
7335ea5
7379-people-voted
Oct 5, 2021
aaf63be
spacing
Oct 5, 2021
d7cfef7
Update research_details.html
danielfmiranda Oct 5, 2021
c9c0cd8
comments
Oct 5, 2021
f6b6f85
Merge branch '7379-people-voted' of github.com:mozilla/foundation.moz…
Oct 5, 2021
5b6982e
removed % sign, implemented feedback from review
Oct 6, 2021
ced1c20
Removed rogue space
danielfmiranda Oct 6, 2021
c4f8d30
Update network-api/networkapi/wagtailpages/templates/fragments/most_v…
danielfmiranda Oct 6, 2021
a6d7b67
merging with q3
Oct 7, 2021
6312962
merging with q3
Oct 7, 2021
0349cfe
Merge branch 'pni-q3-2021' into 7379-people-voted
Pomax Oct 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions network-api/networkapi/wagtailpages/pagemodels/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,28 @@ def get_votes(self):
votes = [int(x) for x in self.vote_bins.split(",")]
return votes

def get_most_voted(self):
votes = self.get_votes()
vote_breakdown = {k: v for (k, v) in enumerate(votes)}
highest = max(vote_breakdown, key=vote_breakdown.get)
label = self.get_vote_labels()[highest]

return {
"bin": highest,
"value": votes[highest],
"label": label[0],
"localized": label[1],
}

def get_vote_labels(self):
return [
("Not creepy", gettext("Not creepy")),
("A little creepy", gettext("A little creepy")),
("Somewhat creepy", gettext("Somewhat creepy")),
("Very creepy", gettext("Very creepy")),
("Super creepy", gettext("Super creepy")),
]


class ProductPageCategory(TranslatableMixin, Orderable):
product = ParentalKey(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h1 class="h1-heading col-12">{{product.title}}</h1>
</div>
{% endif %}
</div>
{% include "fragments/research_details.html" with review_date=product.review_date time_researched=product.time_researched mozilla_says=product.mozilla_says %}
{% include "fragments/research_details.html" with review_date=product.review_date time_researched=product.time_researched mozilla_says=product.mozilla_says %}
<div class="col-12"><p class="body mb-0">{{product.blurb}}</p></div>
</div>

Expand All @@ -85,15 +85,16 @@ <h2 class="h3-heading">{% trans "What could happen if something goes wrong?" %}<
</div>

<div id="product-research" data-is-wagtail-page="true">
<div id="creepiness-vote">
<div class="row">
<div class="col-12">
<div class="creep-vote-target mb-5 mt-3 mt-md-4 p-5" data-product-name="{{product.title}}" data-product-type="{{product.product_type}}">
<input type="hidden" name="productID" value="{{ product.id }}">
<input type="hidden" name="votes" value='{{ product.get_voting_json | safe }}'>
{% csrf_token %}
</div>

</div>
</div>
{% with tab_class="tw-bg-white tw-text-black tw-font-zilla tw-capitalize tw-text-3xl tw-py-2 tw-px-5 tw-flex tw-justify-center tw-items-center medium:tw-flex-1 tw-flex-shrink-0 tw-text-center tw-relative tw-cursor-pointer tw-ease-in tw-transform tw-duration-150 medium:tw-w-auto" %}
<!-- Should probably be refactored into a wagtail template afterwards -->
<div id="product-tab" class="tw-w-full tw-mx-4 tw-mb-4">
Expand Down Expand Up @@ -261,13 +262,9 @@ <h3 class="tw-mb-4 tw-font-zilla tw-text-2xl tw-leading-7">{% trans "What data d
</div>
{% endwith %}

{% if product.updates.count > 0 %}
<hr class="pni-section-divider"/>

<div class="col-12">
{% if product.updates.count > 0 %}
<h3 class="h2-heading mb-4 mb-md-5">{% trans "News" %}</h3>
{% endif %}
{% if product.updates.count > 0 %}
<h3 id="news" class="h2-heading mb-3">{% trans "News" %}</h3>
<div class="mb-5">
{% for item in product.updates.all %}
{% with update=item.update %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% load i18n %}

<span class="body-small">
{% with vote_data=product.votes.get_most_voted %}
<a class="body-small" href="#creepiness-vote">{% trans "People voted:" %}</a>
<span class="people-voted {{ vote_data.label|slugify }}">{{ vote_data.localized }}</span>
{% endwith %}
</span>
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
This is the section underneath the title of the products heading, where we display date and time spent researching, as well as creepiness level people have voted.
{% endcomment %}

<div class="col-12 mt-3 tw-flex tw-flex-col medium:tw-flex-wrap large:tw-flex-row">
<div class="col-12 tw-mt-5 tw-mb-3 tw-flex tw-flex-col medium:tw-flex-wrap large:tw-flex-row">
<div class="tw-flex tw-flex-col medium:tw-flex-2 medium:tw-flex-row">
<div class="pr-2 pl-0 tw-flex-2">
<p class="body-small date-reviewed">{% blocktrans with date=review_date|date:"DATE_FORMAT" context "Date format (e.g. Nov. 19, 2020)" %}Review date: {{ date }}{% endblocktrans %}</p>
</div>
<span class="tw-text-gray-20 body-small tw-hidden medium:tw-inline"> | </span>
<div class="d-flex pb-2 tw-flex-2 medium:tw-px-2">
<div class="d-flex pb-3 tw-flex-2 medium:tw-px-2">
<span class="body-small">
{% blocktrans count count=time_researched with link_attrs='class="body-small time-researched" href="/privacynotincluded/about/methodology"' trimmed %}
<a {{ link_attrs }}>Mozilla researched</a> {{ time_researched }} hour
Expand All @@ -26,5 +26,9 @@
<div class="d-flex tw-pr-2 large:tw-px-2">
<p class="body-small mozilla-says {% if mozilla_says %} thumb-up {% elif mozilla_says == False %} thumb-down {% else %} thumb-side {% endif %}"> {% trans "Mozilla says" context "This string is followed by a thumb up, thumb down, or thumb on the side icon to summarize Mozilla’s review of the product" %} </p>
</div>
<span class="tw-text-gray-20 body-small tw-hidden medium:tw-inline"> | </span>
<div class="d-flex medium:tw-pl-2 pr-0 ">
{% include "fragments/most_voted_rating.html"%}
</div>
</div>
</div>
10 changes: 10 additions & 0 deletions source/images/buyers-guide/faces/a-little-creepy-face.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions source/images/buyers-guide/faces/not-creepy-face.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions source/images/buyers-guide/faces/somewhat-creepy-face.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions source/images/buyers-guide/faces/super-creepy-face.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading