LIL-316. Add school schedules print page

remotes/origin/hasaccess
Ivlev Denis 8 years ago
parent f8b0d68bb3
commit cb388de775
  1. 2
      project/templates/lilcity/main.html
  2. 52
      project/templates/lilcity/school_schedules.html
  3. 3
      project/urls.py
  4. 9
      project/views.py

@ -367,7 +367,7 @@
{% endfor %}
</div>
<div class="text text_mb0">
<a href='#'>Распечатать расписание</a> чтобы не забыть</div>
<a target="_blank" href="{% url 'school_schedules' %}">Распечатать расписание</a> чтобы не забыть</div>
</div>
</div>
{% if course_items %}

@ -0,0 +1,52 @@
{% load static %}
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" media="all" href={% static "app.css" %}>
</head>
<body>
<div class="section section_gray">
<div class="section__center center center_md">
<a id="schedule" name="schedule">
<div class="title title_center">Расписание</div>
</a>
<div class="schedule">
{% for school_schedule in school_schedules %}
<div class="schedule__item">
<div class="schedule__day">{{ school_schedule }}</div>
<div class="schedule__wrap">
<div class="schedule__title">{{ school_schedule.title }}</div>
<div class="schedule__content">{{ school_schedule.description }}</div>
<div class="schedule__toggle toggle">
<button class="toggle__head js-toggle-head active">Материалы
<svg class="icon icon-arrow-down">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-arrow-down"></use>
</svg>
</button>
<div class="toggle__body">{{ school_schedule.materials }}</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% comment %} <div class="text text_mb0">
<a href='#'>Распечатать расписание</a> чтобы не забыть
</div> {% endcomment %}
</div>
</div>
<script type="text/javascript" src={% static "app.js" %}></script>
<script type="text/javascript">
var toggle__body = Array.from(document.getElementsByClassName("toggle__body"));
toggle__body.forEach(function (item, i, toggle__body) {
item.style.display = "block"
});
window.print();
window.close();
</script>
</body>
</html>

@ -36,7 +36,7 @@ from apps.payment.views import (
SchoolBuyView,
)
from .views import IndexView
from .views import IndexView, SchoolSchedulesView
urlpatterns = [
path('admin/', admin.site.urls),
@ -71,6 +71,7 @@ urlpatterns = [
path('privacy', TemplateView.as_view(template_name='templates/lilcity/privacy_policy.html'), name='privacy'),
path('terms', TemplateView.as_view(template_name='templates/lilcity/terms.html'), name='terms'),
path('refund-policy', TemplateView.as_view(template_name='templates/lilcity/refund_policy.html'), name='refund_policy'),
path('school-schedules', SchoolSchedulesView.as_view(), name='school_schedules'),
path('', IndexView.as_view(), name='index'),
path('api/v1/', include(('api.v1.urls', 'api_v1'))),
path('test', TemplateView.as_view(template_name='templates/lilcity/test.html'), name='test'),

@ -14,3 +14,12 @@ class IndexView(TemplateView):
'school_schedules': SchoolSchedule.objects.all(),
})
return context
class SchoolSchedulesView(TemplateView):
template_name = 'templates/lilcity/school_schedules.html'
def get_context_data(self):
context = super().get_context_data()
context['school_schedules'] = SchoolSchedule.objects.all()
return context

Loading…
Cancel
Save