wcs: add a link to display all forms of category (#11410)
This commit is contained in:
parent
c9ebf38ed9
commit
5a91a25ddc
|
@ -334,7 +334,7 @@ class WcsFormsOfCategoryCell(WcsCommonCategoryCell, WcsBlurpMixin):
|
|||
|
||||
if self.limit:
|
||||
if len(context['forms']) > self.limit:
|
||||
context['more_forms'] = True
|
||||
context['more_forms'] = context['forms'][self.limit:]
|
||||
context['forms'] = context['forms'][:self.limit]
|
||||
|
||||
return super(WcsFormsOfCategoryCell, self).render(context)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{% load i18n %}
|
||||
<div class="wcs-forms-of-category-{{slug}}">
|
||||
<h2>{{ title }}</h2>
|
||||
{% if description %}
|
||||
|
@ -13,6 +14,17 @@
|
|||
{% if form.description %}<div class="description">{{ form.description|safe }}</div>{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
{% if more_forms %}
|
||||
<li class="more-items"><a>+</a></li>
|
||||
{% for form in more_forms %}
|
||||
<li style="display: none" class="additional-form {% if form.authentication_required %}required-authentication"{% endif %}
|
||||
{% if form.redirection %}is-redirection{% endif %}"
|
||||
><a href="{{ form.url }}tryauth">{{ form.title }}</a>
|
||||
{% if form.description %}<div class="description">{{ form.description|safe }}</div>{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -101,6 +101,11 @@ $(function() {
|
|||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.more-items a', function() {
|
||||
$(this).parent().hide();
|
||||
$(this).parent().nextAll().show();
|
||||
});
|
||||
|
||||
var menu_page_ids = $.makeArray($('[data-menu-page-id]').map(function() { return $(this).data('menu-page-id'); }));
|
||||
if (menu_page_ids.length && $('body').data('check-badges') === true) {
|
||||
$.ajax({url: $('body').data('api-root') + 'menu-badges/',
|
||||
|
|
Loading…
Reference in New Issue