summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-12-26 11:49:01 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-01-11 17:30:46 +0100
commitc71af289d24d6befca494ffe166c7bb8851f06ea (patch)
tree1471e277ff0b6a6dca36909888df79d04e001376 /ishtar_common
parent307b94638bf02f2af88a13fed9521234c4c6ad72 (diff)
downloadIshtar-c71af289d24d6befca494ffe166c7bb8851f06ea.tar.bz2
Ishtar-c71af289d24d6befca494ffe166c7bb8851f06ea.zip
Fix gallery pagination
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/forms.py7
-rw-r--r--ishtar_common/forms_common.py1
-rw-r--r--ishtar_common/static/js/ishtar.js1
-rw-r--r--ishtar_common/templates/blocks/DataTables-gallery.html1
4 files changed, 7 insertions, 3 deletions
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py
index 91e9fb3e9..526255277 100644
--- a/ishtar_common/forms.py
+++ b/ishtar_common/forms.py
@@ -623,7 +623,9 @@ class ClosingDateFormSelection(IshtarForm):
def get_form_selection(
class_name, label, key, model, base_form, get_url,
not_selected_error=_(u"You should select an item."), new=False,
- new_message=_(u"Add a new item"), get_full_url=None):
+ new_message=_(u"Add a new item"), get_full_url=None,
+ gallery=False
+ ):
"""
Generate a class selection form
class_name -- name of the class
@@ -634,6 +636,7 @@ def get_form_selection(
not_selected_error -- message displayed when no item is selected
new -- can add new items
new_message -- message of link to add new items
+ gallery -- display a gallery
"""
attrs = {'_main_key': key,
'_not_selected_error': not_selected_error,
@@ -643,6 +646,8 @@ def get_form_selection(
widget_kwargs = {"new": new, "new_message": new_message}
if get_full_url:
widget_kwargs['source_full'] = reverse_lazy(get_full_url)
+ if gallery:
+ widget_kwargs['gallery'] = True
attrs[key] = forms.IntegerField(
label="", required=False,
validators=[models.valid_id(model)],
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index ff1cd9b5b..1cbaecb92 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -1280,6 +1280,7 @@ class DocumentFormSelection(forms.Form):
widget=widgets.DataTable(
reverse_lazy('get-document'), DocumentSelect,
models.Document,
+ gallery=True
),
validators=[models.valid_id(models.Document)])
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js
index e2a022190..03b9efb78 100644
--- a/ishtar_common/static/js/ishtar.js
+++ b/ishtar_common/static/js/ishtar.js
@@ -1045,7 +1045,6 @@ var render_gallery = function(data_table, table_name, nb_select){
if (page_total > 6){
html += render_paginate_button('...');
}
- if (page_total > 1) html += render_paginate_button(page_total, page_current);
} else {
html += render_paginate_button('...');
if (page_total < page_current + 2 &&
diff --git a/ishtar_common/templates/blocks/DataTables-gallery.html b/ishtar_common/templates/blocks/DataTables-gallery.html
index 5fa448d89..fc9e0505a 100644
--- a/ishtar_common/templates/blocks/DataTables-gallery.html
+++ b/ishtar_common/templates/blocks/DataTables-gallery.html
@@ -17,7 +17,6 @@
</li>
</ul>
-
<div class="tab-content">
<div class="tab-pane active"
id="tab-content-grid-{{name}}" role="tabpanel"