Korektury: rozdělení aktuálních a starých na dvě stránky
This commit is contained in:
		
							parent
							
								
									ba5ceb14ba
								
							
						
					
					
						commit
						2e9ff73eac
					
				
					 6 changed files with 51 additions and 1 deletions
				
			
		|  | @ -1,5 +1,9 @@ | ||||||
| {% extends "base.html" %} | {% extends "base.html" %} | ||||||
| 
 | 
 | ||||||
|  | {% block submenu %} | ||||||
|  |   {% include "korektury/submenu.html" %} | ||||||
|  | {% endblock %} | ||||||
|  | 
 | ||||||
| {% block content %} | {% block content %} | ||||||
| {# blok do kterého se nacita text, v pripade jinyhc templatu obalit vlastnim blokem #} | {# blok do kterého se nacita text, v pripade jinyhc templatu obalit vlastnim blokem #} | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
|  | @ -1,4 +1,11 @@ | ||||||
| {% extends "korektury/base.html" %} | {% extends "korektury/base.html" %} | ||||||
|  | 
 | ||||||
|  | {% block submenu %} | ||||||
|  |   {% with "help" as selected %} | ||||||
|  |     {% include "korektury/submenu.html" %} | ||||||
|  |   {% endwith %} | ||||||
|  | {% endblock %} | ||||||
|  | 
 | ||||||
| {% load staticfiles %} | {% load staticfiles %} | ||||||
| 
 | 
 | ||||||
| {% block title %} Nápověda ke korigovátku {% endblock title %} | {% block title %} Nápověda ke korigovátku {% endblock title %} | ||||||
|  |  | ||||||
|  | @ -1,6 +1,18 @@ | ||||||
| {% extends "korektury/base.html" %} | {% extends "korektury/base.html" %} | ||||||
| {% load staticfiles %} | {% load staticfiles %} | ||||||
| 
 | 
 | ||||||
|  | {% block submenu %} | ||||||
|  |   {% if aktualni %} | ||||||
|  |     {% with "aktualni" as selected %} | ||||||
|  |       {% include "korektury/submenu.html" %} | ||||||
|  |     {% endwith %} | ||||||
|  |   {% else %} | ||||||
|  |     {% with "zastarale" as selected %} | ||||||
|  |       {% include "korektury/submenu.html" %} | ||||||
|  |     {% endwith %} | ||||||
|  |   {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  | 
 | ||||||
| {% block script%} | {% block script%} | ||||||
|   <link rel="stylesheet" type="text/css" media="screen, projection" href="{% static "korektury/opraf-list.css" %}" /> |   <link rel="stylesheet" type="text/css" media="screen, projection" href="{% static "korektury/opraf-list.css" %}" /> | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
							
								
								
									
										13
									
								
								korektury/templates/korektury/submenu.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								korektury/templates/korektury/submenu.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | ||||||
|  | {% with "/korektury" as cesta %} | ||||||
|  | 
 | ||||||
|  | <div id='submenu'> | ||||||
|  | <ul> | ||||||
|  |   <li class="{% if selected == "aktualni" %}selected{% endif %}"><a href="{{cesta}}/">Aktuální</a> | ||||||
|  |   <li class="{% if selected == "zastarale" %}selected{% endif %}"><a href="{{cesta}}/zastarale/">Zastaralé</a> | ||||||
|  |   <li class="{% if selected == "help" %}selected{% endif %}"><a href="{{cesta}}/help/">Nápověda</a> | ||||||
|  | </ul> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
|  | {% endwith %} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @ -6,7 +6,8 @@ from . import views | ||||||
| staff_member_required = user_passes_test(lambda u: u.is_staff) | staff_member_required = user_passes_test(lambda u: u.is_staff) | ||||||
| 
 | 
 | ||||||
| urlpatterns = [ | urlpatterns = [ | ||||||
|     url(r'^korektury/$', staff_member_required(views.KorekturyListView.as_view()), name='korektury-list'), |     url(r'^korektury/$', staff_member_required(views.KorekturyAktualniListView.as_view()), name='korektury-list'), | ||||||
|  |     url(r'^korektury/zastarale/$', staff_member_required(views.KorekturyZastaraleListView.as_view()), name='korektury-list-zastarale'), | ||||||
|     url(r'^korektury/(?P<pdf>\d+)/$', staff_member_required(views.KorekturyView.as_view()), name='korektury'), |     url(r'^korektury/(?P<pdf>\d+)/$', staff_member_required(views.KorekturyView.as_view()), name='korektury'), | ||||||
|     url(r'^korektury/help/', staff_member_required(views.KorekturyHelpView.as_view()), name='korektury-help'), |     url(r'^korektury/help/', staff_member_required(views.KorekturyHelpView.as_view()), name='korektury-help'), | ||||||
| ] | ] | ||||||
|  |  | ||||||
|  | @ -21,6 +21,19 @@ class KorekturyListView(generic.ListView): | ||||||
|     model = KorekturovanePDF |     model = KorekturovanePDF | ||||||
|     template_name = 'korektury/seznam.html' |     template_name = 'korektury/seznam.html' | ||||||
| 
 | 
 | ||||||
|  | class KorekturyAktualniListView(KorekturyListView): | ||||||
|  |     def __init__ (self): | ||||||
|  |         self.queryset=self.get_queryset().exclude(status="zastarale") | ||||||
|  | 
 | ||||||
|  |     def get_context_data(self, **kwargs): | ||||||
|  |         context = super(KorekturyAktualniListView,self).get_context_data(**kwargs) | ||||||
|  |         context['aktualni'] = True | ||||||
|  |         return context | ||||||
|  | 
 | ||||||
|  | class KorekturyZastaraleListView(KorekturyListView): | ||||||
|  |     def __init__ (self): | ||||||
|  |         self.queryset=self.get_queryset().filter(status="zastarale") | ||||||
|  | 
 | ||||||
| ### Korektury | ### Korektury | ||||||
| class KorekturyView(generic.TemplateView): | class KorekturyView(generic.TemplateView): | ||||||
|     model = Oprava |     model = Oprava | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 LEdoian
						LEdoian