Changeset View
Changeset View
Standalone View
Standalone View
films/templates/films/components/pagination_dates.html
| <div class="row justify-content-center mt-3"> | <div class="row justify-content-center mt-3"> | ||||
| <div class="col-auto text-center"> | <div class="col-auto text-center"> | ||||
| <nav aria-label="page navigation"> | <nav aria-label="page navigation"> | ||||
| {% with current=object_list|first %} | {% with current=object_list|first %} | ||||
| {% with current_month=current.start_date|date:"YM"|lower %} | {% with current_month=current.start_date|date:"YM"|lower %} | ||||
| <ul class="pagination production-logs-dates"> | <ul class="pagination production-logs-dates"> | ||||
| {% if next_month %} | {% if next_month %} | ||||
| <li class="page-item"> | <li class="page-item"> | ||||
| <a class="page-link" | <a class="page-link" | ||||
| href="{% url 'film-production-logs-month' film_slug=film.slug year=next_month.year month=next_month|date:"M"|lower %}">Previous</a> | href="{% url 'film-production-logs-month' film_slug=film.slug year=next_month.year month=next_month|date:"M"|lower %}">Previous</a> | ||||
| </li> | </li> | ||||
| {% if next_month != date_list|first %} | {% if next_month != date_list|first %} | ||||
| <li class="page-item"> | <li class="page-item"> | ||||
| <a class="page-link" | <a class="page-link" | ||||
| href="{% url 'film-production-logs-month' film_slug=film.slug year=date_list|first|date:"Y"|lower month=date_list|first|date:"M"|lower %}">{{ date_list|first|date:"M Y" }}</a> | href="{% url 'film-production-logs-month' film_slug=film.slug year=date_list|first|date:"Y"|lower month=date_list|first|date:"M"|lower %}">{{ date_list|first|date:"M Y" }}</a> | ||||
| </li> | </li> | ||||
| <li class="page-item disabled"> | <li class="page-item disabled"> | ||||
| <span class="page-link">...</span> | <span class="page-link">...</span> | ||||
| </li> | </li> | ||||
| {% endif %} | {% endif %} | ||||
| {% endif %} | {% endif %} | ||||
| {% for date in date_list %} | {% for date in date_list %} | ||||
| {% with month=date|date:"YM"|lower %} | {% with month=date|date:"YM"|lower %} | ||||
| {% if current_month == month or date == previous_month or date == next_month %} | {% if current_month == month or date == previous_month or date == next_month %} | ||||
| <li class="page-item {% if current_month == month %}active{% endif %} "> | <li class="page-item {% if current_month == month %}active{% endif %} "> | ||||
| <a class="page-link" | <a class="page-link" | ||||
| href="{% url 'film-production-logs-month' film_slug=film.slug year=date.year month=date|date:"M"|lower %}">{{ date|date:"M Y" }}</a> | href="{% url 'film-production-logs-month' film_slug=film.slug year=date.year month=date|date:"M"|lower %}">{{ date|date:"M Y" }}</a> | ||||
| </li> | </li> | ||||
| {% endif %} | {% endif %} | ||||
| {% endwith %} | {% endwith %} | ||||
| {% endfor %} | {% endfor %} | ||||
| {% if previous_month %} | {% if previous_month %} | ||||
| {% if previous_month != date_list|last %} | {% if previous_month != date_list|last %} | ||||
| <li class="page-item disabled"> | <li class="page-item disabled"> | ||||
| <span class="page-link">...</span> | <span class="page-link">...</span> | ||||
| </li> | </li> | ||||
| <li class="page-item"> | <li class="page-item"> | ||||
| <a class="page-link" | <a class="page-link" | ||||
| href="{% url 'film-production-logs-month' film_slug=film.slug year=date_list|last|date:"Y"|lower month=date_list|last|date:"M"|lower %}">{{ date_list|last|date:"M Y" }}</a> | href="{% url 'film-production-logs-month' film_slug=film.slug year=date_list|last|date:"Y"|lower month=date_list|last|date:"M"|lower %}">{{ date_list|last|date:"M Y" }}</a> | ||||
| </li> | </li> | ||||
| {% endif %} | {% endif %} | ||||
| <li class="page-item"> | <li class="page-item"> | ||||
| <a class="page-link" | <a class="page-link" | ||||
| href="{% url 'film-production-logs-month' film_slug=film.slug year=previous_month.year month=previous_month|date:"M"|lower %}">Next</a> | href="{% url 'film-production-logs-month' film_slug=film.slug year=previous_month.year month=previous_month|date:"M"|lower %}">Next</a> | ||||
| </li> | </li> | ||||
| {% endif %} | {% endif %} | ||||
| </ul> | </ul> | ||||
| {% endwith %} | {% endwith %} | ||||
| {% endwith %} | {% endwith %} | ||||
| </nav> | </nav> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||