week: Create new weeks and change active one
Implement a way for admins to introduce new weeks and set them as the last active one. The last active week is the last one that is accessible to players, and will also prevent the graph from being displayed. Implement arrows for navigating between the weeks in the HTML.
This commit is contained in:
parent
635716c04b
commit
e08a46af3a
5 changed files with 153 additions and 4 deletions
|
@ -12,6 +12,30 @@
|
|||
<script defer="defer" type="text/javascript" src="/vote_chart.js"></script>
|
||||
</head>
|
||||
|
||||
{#{% import "week_change_arrows" as week_macro %}#}
|
||||
{# For some reason the import does not work ? Figure it out at some point... #}
|
||||
{%- macro display(display_character, to, enabled) -%}
|
||||
{%- set class = "week_change" -%}
|
||||
{%- if enabled == true %}
|
||||
{% set target = ("href=/" ~ to) %}
|
||||
{%- else -%}
|
||||
{% set class = class ~ " week_change_hidden" -%}
|
||||
{% set target = "" %}
|
||||
{%- endif -%}
|
||||
<a {{ target }} class="{{ class }}">{%- if enabled == true -%}{{- display_character -}}{%- endif -%}</a>
|
||||
{%- endmacro display -%}
|
||||
|
||||
|
||||
{% set back_arrow_enabled = week_data.number > 1 %}
|
||||
{% set next_arrow_enabled = (week_data.is_last_week != true or user.is_admin == true) %}
|
||||
{% set next_arrow_href = (week_data.number + 1) %}
|
||||
{% if user.is_admin == true %}
|
||||
{% set next_arrow_href = next_arrow_href ~ "/create" %}
|
||||
{% set next_arrow_chara = '⥅' %}
|
||||
{% else %}
|
||||
{% set next_arrow_chara = '⟹' %}
|
||||
{% endif %}
|
||||
|
||||
<body>
|
||||
<div class="top_bar">
|
||||
<h1>{{ title }}</h1>
|
||||
|
@ -26,9 +50,18 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
|
||||
<h2>Semaine {{ week_data.number }}</h2>
|
||||
<h2>{{- self::display(display_character='⟸', to=(week_data.number - 1), enabled=back_arrow_enabled) }}
|
||||
Semaine {{ week_data.number }}
|
||||
{{- self::display(display_character=next_arrow_chara, to=next_arrow_href, enabled=next_arrow_enabled) -}}</h2>
|
||||
<div class="page_body">
|
||||
<div class="truth_list">
|
||||
{% if user.is_admin == true and week_data.is_last_week != true %}
|
||||
<form action="/{{ week_data.number }}/set_last" method="post">
|
||||
<button>
|
||||
Définir comme dernière semaine active
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
<div class="week_intro">
|
||||
{{ week_data.rendered_text | safe }}
|
||||
{%- if user.is_admin == true -%}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue