Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding option to specify the css class name to show_more templatetag #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions endless_pagination/templates/endless/show_more.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% load i18n %}
{% if querystring %}
<div class="endless_container">
<a class="endless_more" href="{{ path }}{{ querystring }}"
rel="{{ querystring_key }}">{% if label %}{{ label }}{% else %}{% trans "more" %}{% endif %}</a>
<a class="endless_more {% if class_name %}{{ class_name }}{% endif %}" href="{{ path }}{{ querystring }}"
rel="{{ querystring_key }}">{% if label %}{{ label|safe }}{% else %}{% trans "more" %}{% endif %}</a>
<div class="endless_loading" style="display: none;">{{ loading|safe }}</div>
</div>
{% endif %}
7 changes: 6 additions & 1 deletion endless_pagination/templatetags/endless.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def render(self, context):


@register.inclusion_tag('endless/show_more.html', takes_context=True)
def show_more(context, label=None, loading=settings.LOADING):
def show_more(context, label=None, loading=settings.LOADING, class_name=None):
"""Show the link to get the next page in a Twitter-like pagination.

Usage::
Expand All @@ -339,6 +339,10 @@ def show_more(context, label=None, loading=settings.LOADING):

{% show_more "even more" "working" %}

You could pass in the extra CSS style class name as a third argument

{% show_more "even more" "working" "class_name" %}

Must be called after ``{% paginate objects %}``.
"""
# This template tag could raise a PaginationError: you have to call
Expand All @@ -357,6 +361,7 @@ def show_more(context, label=None, loading=settings.LOADING):
return {
'label': label,
'loading': loading,
'class_name': class_name,
'path': iri_to_uri(data['override_path'] or request.path),
'querystring': querystring,
'querystring_key': querystring_key,
Expand Down