Skip to content

Commit

Permalink
Add option to show colored names for bartenders in current week and u…
Browse files Browse the repository at this point in the history
…pdate styling
  • Loading branch information
AndersSeverinsen committed Jan 15, 2025
1 parent b884d7c commit 364a840
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
15 changes: 12 additions & 3 deletions bartenders/templates/barplan.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,21 @@ <h2 id="barplan">{% translate "Barplan" %}</h2>
</thead>
<tbody>
{% for shift in bartendershifts %}
<tr style="{% if shift|is_with_user:user %}background-color: skyblue;{% endif %}{% if shift|compare_to_current_week == -1 %}color:gray;{% endif %}">
<tr style="{% if shift|is_with_user:user %}background-color: skyblue;{% endif %}"{% if shift|compare_to_current_week == -1 %}class="gray-out"{% endif %}>
<td class="col-md-2">{% if shift|compare_to_current_week == 0 %}<b alt="{% translate "This weeks friday" %}">{{ shift.display_str }}{% if show_all_bartendershifts %}, {{ shift.start_datetime.year }}{% endif %}{% else %} {{ shift.display_str }}{% if show_all_bartendershifts %}, {{ shift.start_datetime.year }}{% endif %}{% endif %}</td>
<td class="col-md-3">{{ shift.responsible.name }}</td>
{% if shift|compare_to_current_week == 0 and config.SHOW_COLORED_NAMES_ON_BARPLAN %}
<td class="col-md-3"><p style="color:red;display:inline;">{{ shift.responsible.name }}</p></td>
{% else %}
<td class="col-md-3">{{ shift.responsible.name }}</td>
{% endif %}
<td class="col-md-7">
{% for bartender in shift.other_bartenders.all %}
{% if bartender.first_bartender_shift == shift %}<b alt="{% translate "Bartender's first shift" %}">{{ bartender.name }}</b>{% else %}{{ bartender.name }}{% endif %}{% if not forloop.last %},{% endif %}
{% if shift|compare_to_current_week == 0 and config.SHOW_COLORED_NAMES_ON_BARPLAN %}
{% cycle 'blue' 'orange' 'green' as color silent %}
{% if bartender.first_bartender_shift == shift %}<b style="color:{{ color }};" alt="{% translate "Bartender's first shift" %}">{{ bartender.name }}</b>{% else %}<p style="color:{{ color }};display:inline;">{{ bartender.name }}</p>{% endif %}{% if not forloop.last %},{% endif %}
{% else %}
{% if bartender.first_bartender_shift == shift %}<b class="gray-out" alt="{% translate "Bartender's first shift" %}">{{ bartender.name }}</b>{% else %}{{ bartender.name }}{% endif %}{% if not forloop.last %},{% endif %}
{% endif %}
{% endfor %}
</td>
{% if user.is_staff %}
Expand Down
5 changes: 5 additions & 0 deletions fredagscafeen/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
bool,
),
"BANNER_HTML": ("", "HTML banner", str),
"SHOW_COLORED_NAMES_ON_BARPLAN": (
False,
"Skal der vises farver på bartendernes navne for indeværende uge?",
bool,
),
}

SECRET_ADMIN_KEYS = [
Expand Down
8 changes: 8 additions & 0 deletions web/static/css/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ html.light {
border-radius:5px;
font-weight: lighter;
}

.gray-out td, .gray-out b {
color: grey;
}
}

/* dark theme */
Expand Down Expand Up @@ -825,4 +829,8 @@ html.dark {
border-radius:5px;
font-weight: lighter;
}

.gray-out td, .gray-out b {
color: darkgrey;
}
}

0 comments on commit 364a840

Please sign in to comment.