Skip to content

Commit b984d9c

Browse files
fix visual star bug; don't show rating if it is None
1 parent be503bd commit b984d9c

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

frontend/templates/frontend/content/detail.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,17 @@ <h5 class="modal-title" id="deleteContentModalLabel">{% trans "Delete" %} <i>{{
9797
{{ content.description|linebreaks }} <!-- resolves to s -->
9898
</div>
9999
</div>
100-
<h5><a name="rating">{% trans "Rating" %}</a><span class="badge float-right text-right">{{ content.get_rate }}/5</span></h5>
100+
<h5><a name="rating">{% trans "Rating" %}</a>
101+
{% if content.get_rate != -1 %}
102+
<span class="badge float-right text-right">{{ content.get_rate }}/5</span>
103+
{% else %}
104+
<span class="badge float-right text-right">No rating yet</span>
105+
{% endif %}
106+
</h5>
101107
<div class="starrating risingstar d-flex justify-content-end flex-row-reverse">
102108
{% for i in 5|rev_range %}
103109
<input type="radio" id="star{{ i }}" name="rating" value="{{ i }}"
104-
{% if i <= user_rate %}class="active" {% endif %}/>
110+
{% if i <= content.get_rate %}class="active" {% endif %}/>
105111
<label for="star{{ i }}" onclick="window.location.href='{% url 'frontend:rating' course.id topic.id content.id i %}'"></label>
106112
{% endfor %}
107113
</div>

frontend/templates/frontend/course/topic_contents.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@
1919
</a>
2020
<div class="card-footer">
2121
<span class="badge badge-primary">{{ content.language }}</span>
22-
&nbsp;&middot;&nbsp;
2322
{% if content.tags.count > 0 %}
23+
&nbsp;&middot;&nbsp;
2424
{% for tag in content.tags.all %}
2525
<span class="badge badge-secondary">{{ tag }}</span>
2626
{% endfor %}
2727
{% endif %}
28+
{% if content.get_rate != -1 %}
2829
&nbsp;&middot;&nbsp;
29-
{% if content.get_rate == -1 %}
30-
<span class="badge badge-info"> ~ </span>
31-
{% else %}
3230
<span class="badge badge-info">{{ content.get_rate}}</span>
3331
{% endif %}
3432
</div>

0 commit comments

Comments
 (0)