diff options
Diffstat (limited to 'templates/form.html')
| -rw-r--r-- | templates/form.html | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/templates/form.html b/templates/form.html index fce5e48..23e6d2d 100644 --- a/templates/form.html +++ b/templates/form.html @@ -83,14 +83,20 @@ </div> <div class="field"> - <label for="stars">Stars</label> - {% set current_stars = film.stars if film else 0 %} - <select id="stars" name="stars"> - <option value="0" {% if current_stars|string == '0' %}selected{% endif %}>Unstarred</option> - <option value="1" {% if current_stars|string == '1' %}selected{% endif %}>1 star</option> - <option value="2" {% if current_stars|string == '2' %}selected{% endif %}>2 stars</option> - <option value="3" {% if current_stars|string == '3' %}selected{% endif %}>3 stars</option> - </select> + <label>Stars</label> + {% set current_stars = film.stars if film and film.stars else 0 %} + <input type="hidden" id="stars" name="stars" value="{{ current_stars }}"> + <div class="star-control" role="group" aria-label="Rate film" data-form-stars data-current-stars="{{ current_stars }}"> + {% for value in range(1, 4) %} + <button + type="button" + class="star-button {% if current_stars >= value %}is-active{% endif %}" + data-stars="{{ value }}" + aria-label="{{ value }} star{% if value > 1 %}s{% endif %}" + aria-pressed="{% if current_stars >= value %}true{% else %}false{% endif %}" + >✦</button> + {% endfor %} + </div> </div> <div class="field checkbox-field"> |
