Skip to content

Commit

Permalink
Add has_other_pages to table and render pagination only if need it.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkuty committed Nov 30, 2015
1 parent 6ffbe2d commit 3e2688c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions horizon_contrib/tables/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ def has_next(self):
return True
return False

@property
def has_other_pages(self):
return True if (self.has_previous or self.has_next) else False

def has_more_data(self):
"""in default state is disabled, but can be used, but must be
implemented some extra methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ <h3 class='table_title'>{{ table }}</h3>
{% block table_footer %}
{% if table.footer %}
<tfoot>
{% if table.pagination and table.position == "both" or table.position == "bottom" %}
{% if table.pagination and table.has_other_pages %}
{% if table.position == "both" or table.position == "bottom" %}
<tr>
<td colspan="{{ table.get_columns|length }}">
<span style="float:right!important;margin-top:9px;" class="table_count">{% blocktrans count counter=rows|length %}Displaying {{ counter }} item{% plural %}Displaying {{ counter }} items{% endblocktrans %}</span>
Expand All @@ -42,7 +43,8 @@ <h3 class='table_title'>{{ table }}</h3>
{% endif %}
{% endfor %}
</tr>
{% endif %}
{% endif %}
{% endif %}
{% else %}
{% if table.needs_summary_row %}
<tr class="summation">
Expand Down

0 comments on commit 3e2688c

Please sign in to comment.