mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Show dates in calendar week selection
This commit is contained in:
@@ -16,9 +16,9 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-4 col-xs-12 text-center">
|
||||
<select name="week" class="form-control">
|
||||
<select name="week" class="form-control select-calendar-week-short">
|
||||
{% for w in weeks %}
|
||||
<option value="{{ w }}" {% if w == date.isocalendar.1 %}selected{% endif %}>{% trans "W" %} {{ w }}</option>
|
||||
<option value="{{ w.0.isocalendar.1 }}" {% if w.0.isocalendar.1 == date.isocalendar.1 %}selected{% endif %}>{% trans "W" %} {{ w.0.isocalendar.1 }} ({{ w.0|date:"SHORT_DATE_FORMAT" }} – {{ w.1|date:"SHORT_DATE_FORMAT" }})</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select name="year" class="form-control">
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-4 col-xs-12 text-center">
|
||||
<select name="week" class="form-control">
|
||||
<select name="week" class="form-control select-calendar-week-short">
|
||||
{% for w in weeks %}
|
||||
<option value="{{ w }}" {% if w == date.isocalendar.1 %}selected{% endif %}>{% trans "W" %} {{ w }}</option>
|
||||
<option value="{{ w.0.isocalendar.1 }}" {% if w.0.isocalendar.1 == date.isocalendar.1 %}selected{% endif %}>{% trans "W" %} {{ w.0.isocalendar.1 }} ({{ w.0|date:"SHORT_DATE_FORMAT" }} – {{ w.1|date:"SHORT_DATE_FORMAT" }})</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select name="year" class="form-control">
|
||||
|
||||
@@ -465,8 +465,10 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView):
|
||||
len(i) for i in ebd.values() if isinstance(i, list)
|
||||
) < 2
|
||||
context['days'] = days_for_template(ebd, week)
|
||||
context['weeks'] = [date(self.year, i + 1, 1) for i in range(12)]
|
||||
context['weeks'] = [i + 1 for i in range(53)]
|
||||
context['weeks'] = [
|
||||
(date.fromisocalendar(self.year, i + 1, 1), date.fromisocalendar(self.year, i + 1, 7))
|
||||
for i in range(53)
|
||||
]
|
||||
context['years'] = range(now().year - 2, now().year + 3)
|
||||
context['week_format'] = get_format('WEEK_FORMAT')
|
||||
if context['week_format'] == 'WEEK_FORMAT':
|
||||
|
||||
@@ -522,8 +522,7 @@ class WeekCalendarView(OrganizerViewMixin, EventListMixin, TemplateView):
|
||||
ebd = self._events_by_day(before, after)
|
||||
|
||||
ctx['days'] = days_for_template(ebd, week)
|
||||
ctx['weeks'] = [date(self.year, i + 1, 1) for i in range(12)]
|
||||
ctx['weeks'] = [i + 1 for i in range(53)]
|
||||
ctx['weeks'] = [(date.fromisocalendar(self.year, i + 1, 1), date.fromisocalendar(self.year, i + 1, 7)) for i in range(53)]
|
||||
ctx['years'] = range(now().year - 2, now().year + 3)
|
||||
ctx['week_format'] = get_format('WEEK_FORMAT')
|
||||
if ctx['week_format'] == 'WEEK_FORMAT':
|
||||
|
||||
@@ -124,3 +124,8 @@
|
||||
#monthselform .row > div {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
@media(min-width: $screen-md-min) {
|
||||
.select-calendar-week-short {
|
||||
max-width: 50%;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user