manager: link to week views on month view (#72321)

This commit is contained in:
Lauréline Guérin 2022-12-13 09:30:00 +01:00 committed by Gitea
parent b14f77e94e
commit 6d241627d7
5 changed files with 29 additions and 8 deletions

View File

@ -137,6 +137,10 @@ table.agenda-table {
&.hour {
text-align: left;
}
&.weeknum {
text-align: left;
padding-top: 3rem;
}
a {
color: #000;
border: 0;
@ -149,14 +153,15 @@ table.agenda-table {
}
}
.agenda-table tbody tr:first-child th.weekday {
.agenda-table tbody tr:first-child th.weekday,
.agenda-table tbody tr:first-child th.weeknum {
// don't add extra padding on top row
padding-top: 1ex;
}
// hour cells width
.agenda-table thead tr:first-child td:first-child,
.agenda-table tbody tr:first-child th:not(.weekday) {
width: 5em;
width: 6em;
}
.agenda-table tbody tr.odd th.hour,

View File

@ -5,8 +5,16 @@
<tbody>
{% endif %}
<tr>
<th></th>
{% for day in week_days.days %}
{% if forloop.first %}
<th class="weeknum">
{% if kind == 'month' %}
<a href="{% url 'chrono-manager-agenda-week-view' pk=agenda.pk year=day.date|date:"Y" week=day.date|date:"W" %}">
{% blocktrans with weeknum=day.date|date:"W" %}Week{{ weeknum }}{% endblocktrans %}
</a>
{% endif %}
</th>
{% endif %}
<th class="weekday {% if day.today %}today{% endif %}">{% if kind == 'month' and not day.other_month or kind == 'week' %}<a href="{% url 'chrono-manager-agenda-day-view' pk=agenda.id year=day.date|date:"Y" month=day.date|date:"m" day=day.date|date:"d" %}">{{ day.date|date:"l j" }}{% if kind == 'week' %}<br />{{ day.date|date:"F" }}{% endif %}</a>{% endif %}</th>
{% endfor %}
</tr>

View File

@ -6,8 +6,16 @@
<tbody>
{% endif %}
<tr>
<th></th>
{% for day in week_days.days %}
{% if forloop.first %}
<th class="weeknum">
{% if kind == 'month' %}
<a href="{% url 'chrono-manager-resource-week-view' pk=resource.pk year=day.date|date:"Y" week=day.date|date:"W" %}">
{% blocktrans with weeknum=day.date|date:"W" %}Week{{ weeknum }}{% endblocktrans %}
</a>
{% endif %}
</th>
{% endif %}
<th class="weekday {% if day.today %}today{% endif %}">{% if kind == 'month' and not day.other_month or kind == 'week' %}<a href="{% url 'chrono-manager-resource-day-view' pk=resource.pk year=day.date|date:"Y" month=day.date|date:"m" day=day.date|date:"d" %}">{{ day.date|date:"l j" }}{% if kind == 'week' %}<br />{{ day.date|date:"F" }}{% endif %}</a>{% endif %}</th>
{% endfor %}
</tr>

View File

@ -1817,7 +1817,7 @@ def test_agenda_month_view_januaries(app, admin_user, kind):
with freezegun.freeze_time(date):
login(app)
resp = app.get('/manage/agendas/%s/%s/1/' % (agenda.id, date.year))
assert resp.text.count('<th></th>') in (4, 5)
assert resp.text.count('<th class="weeknum">') in (4, 5)
@pytest.mark.parametrize('kind', ['meetings', 'virtual'])
@ -2194,7 +2194,7 @@ def test_agenda_week_view_januaries(app, admin_user, kind):
with freezegun.freeze_time(date):
login(app)
resp = app.get('/manage/agendas/%s/%s/week/01/' % (agenda.id, date.year))
assert resp.text.count('<th></th>') == 1
assert resp.text.count('<th class="weeknum">') == 1
@pytest.mark.parametrize('kind', ['meetings', 'virtual'])

View File

@ -399,7 +399,7 @@ def test_resource_week_view_januaries(app, admin_user):
with freezegun.freeze_time(date):
login(app)
resp = app.get('/manage/resource/%s/%s/week/01/' % (resource.pk, date.year))
assert resp.text.count('<th></th>') == 1
assert resp.text.count('<th class="weeknum">') == 1
def test_resource_week_view_event_outside_timeperiod(app, admin_user):
@ -699,7 +699,7 @@ def test_resource_month_view_januaries(app, admin_user):
with freezegun.freeze_time(date):
login(app)
resp = app.get('/manage/resource/%s/%s/1/' % (resource.pk, date.year))
assert resp.text.count('<th></th>') in (4, 5)
assert resp.text.count('<th class="weeknum">') in (4, 5)
def test_resource_month_view_event_outside_timeperiod(app, admin_user):