Skip to content

Commit

Permalink
Add collapsing of PMASA listing
Browse files Browse the repository at this point in the history
There is too many of them, so group them by year.

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Aug 5, 2016
1 parent 8cf2819 commit f44bde0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions pmaweb/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def basic(request):
'themecssversions': CSSVERSIONS,
'awards': AWARDS,
'pmasas': PMASA.objects.filter(draft=False),
'pmasa_year': PMASA.objects.filter(draft=False).order_by('-year').values_list('year', flat=True)[0],
'translations': Translation.objects.all(),
'demo_stable': Demo.objects.exclude(name__startswith='master'),
'demo_devel': Demo.objects.filter(name__startswith='master'),
Expand Down
6 changes: 6 additions & 0 deletions pmaweb/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,9 @@ footer li{
color:gray;
border:none;
}
.security a {
white-space: nowrap;
}
.ahead {
display: block;
}
22 changes: 21 additions & 1 deletion pmaweb/templates/security/_list.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
<div class="col-md-2">
<h2>Announcements</h2>

<div class="panel-group security" id="accordion" role="tablist" aria-multiselectable="true">

{% regroup pmasas by year as pmasa_list %}
{% for year in pmasa_list %}
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading{{ year.grouper }}">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#pmasa{{ year.grouper }}" {% if year.grouper == pmasa_year %}aria-expanded="true"{% endif %} aria-controls="pmasa{{ year.grouper }}" class="ahead">
{{ year.grouper }}
</a>
</h4>
</div>
<div id="pmasa{{ year.grouper }}" class="panel-collapse collapse {% if year.grouper == pmasa_year %}in{% endif %}" role="tabpanel" aria-labelledby="heading{{ year.grouper }}">
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
{% for item in pmasas %}
{% for item in year.list %}
<li {% if pmasa == item %}class="active"{% endif %}><a href="{{ item.get_absolute_url }}">{{ item }}</a></li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
1 change: 1 addition & 0 deletions security/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def get_context_data(self, **kwargs):
context['page_title'] = 'Security - {0}'.format(self.object)
context['page_rss'] = reverse('feed-security')
context['page_rss_title'] = 'phpMyAdmin security announcements'
context['pmasa_year'] = self.object.year
return context

def get_object(self, queryset=None):
Expand Down

0 comments on commit f44bde0

Please sign in to comment.