mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-19 06:22:16 +00:00
Start building a page to select items based on category.
Requires some new CSS for the side nav.
This commit is contained in:
52
training/templates/training/trainingcategory_item_list.html
Normal file
52
training/templates/training/trainingcategory_item_list.html
Normal file
@@ -0,0 +1,52 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block title %}Training Items{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Training Items</h2>
|
||||
|
||||
<div class="row toc-wrapper">
|
||||
<div class="col-xs-12 hidden-md hidden-lg">
|
||||
<ul class="nav nav-pills">
|
||||
{% for category in object_list %}
|
||||
<li role="presentation"><a href="#{{ category.category_name|slugify }}">{{ category }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-lg-9" id="fish">
|
||||
{% for category in object_list %}
|
||||
<div style="margin-bottom: 50em;">
|
||||
<a class="anchor" id="{{ category.category_name|slugify }}"></a>
|
||||
<h3>{{ category }}</h3>
|
||||
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 visible-md visible-lg">
|
||||
<div class="toc-nav">
|
||||
<h3>Available Categories</h3>
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
{% for category in object_list %}
|
||||
<li role="presentation"><a href="#{{ category.category_name|slugify }}">{{ category }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script src="{% static 'js/affix.js' %}"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.toc-nav').affix({
|
||||
offset: {
|
||||
top: ($('.toc-wrapper').offset().top - $('.navbar').height())
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -5,5 +5,6 @@ from training import views
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$', views.SelfUserTrainingRecordView.as_view()),
|
||||
url(r'user/(?P<pk>\d+)/$', views.UserTrainingRecordView.as_view())
|
||||
url(r'user/(?P<pk>\d+)/$', views.UserTrainingRecordView.as_view()),
|
||||
url(r'item/', views.TrainingCategoryItemListView.as_view()),
|
||||
)
|
||||
|
||||
@@ -27,3 +27,8 @@ class SelfUserTrainingRecordView(UserTrainingRecordView):
|
||||
self.kwargs['pk'] = pk
|
||||
|
||||
return self.model.objects.filter(pk=pk)
|
||||
|
||||
|
||||
class TrainingCategoryItemListView(generic.ListView):
|
||||
model = models.TrainingCategory
|
||||
template_name = 'training/trainingcategory_item_list.html'
|
||||
|
||||
Reference in New Issue
Block a user