Improve stars layout and styling in secondary-content

This commit is contained in:
Mikko Nieminen 2016-11-25 14:59:54 +02:00
parent 0fd81cc135
commit 993cee3323
4 changed files with 21 additions and 9 deletions

View File

@ -2,6 +2,10 @@
margin: 20px 0; margin: 20px 0;
} }
.rating .heading {
margin-bottom: 0;
}
.rating-container { .rating-container {
margin-bottom: 20px; margin-bottom: 20px;
} }
@ -14,3 +18,8 @@ a.rating-star-hover,
a.rating-star-hover:hover { a.rating-star-hover:hover {
color: #a38729; color: #a38729;
} }
.rating-description {
color: #7c7c82;
font-size: 14px;
}

View File

@ -16,7 +16,7 @@ package - The package for which the rating is displayed
{% block user_rating %} {% block user_rating %}
<h2 class="heading">{{ _('Your rating') }}</h2> <h2 class="heading">{{ _('Your rating') }}</h2>
<div class="rating-container"> <div class="rating-container">
{%- snippet "rating/snippets/stars.html", package=package -%} {%- snippet "rating/snippets/stars.html", package=package -%}<br>
<span class="rating-details"> <span class="rating-details">
{%- snippet "rating/snippets/rating_description.html", rating=h.get_user_rating(package.id) -%} {%- snippet "rating/snippets/rating_description.html", rating=h.get_user_rating(package.id) -%}
</span> </span>

View File

@ -6,16 +6,18 @@ rating - The numerical value of the rating to display
{% snippet "rating/snippets/rating_description.html", rating=4 %} {% snippet "rating/snippets/rating_description.html", rating=4 %}
#} #}
{%- if not rating -%} <span class="rating-description">
({{ _('no rating given') }}) {%- if not rating -%}
{%- elif rating|int == 1 -%} {{ _('no rating given') }}
{%- elif rating|int == 1 -%}
({{ _('bad') }}) ({{ _('bad') }})
{%- elif rating|int == 2 -%} {%- elif rating|int == 2 -%}
({{ _('passable') }}) ({{ _('passable') }})
{%- elif rating|int == 3 -%} {%- elif rating|int == 3 -%}
({{ _('ok') }}) ({{ _('ok') }})
{%- elif rating|int == 4 -%} {%- elif rating|int == 4 -%}
({{ _('good') }}) ({{ _('good') }})
{%- elif rating|int == 5 -%} {%- elif rating|int == 5 -%}
({{ _('excellent') }}) ({{ _('excellent') }})
{%- endif -%} {%- endif -%}
</span>

View File

@ -19,6 +19,7 @@ stars - The number of stars to be displayed.
{%- endfor -%} {%- endfor -%}
</span> </span>
</span> </span>
<br>
<span class="rating-description"> <span class="rating-description">
{{ ratings_count }} {{ _('rating') if ratings_count == 1 else _('ratings') }} {{ ratings_count }} {{ _('rating') if ratings_count == 1 else _('ratings') }}
</span> </span>