Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
37efef02
Commit
37efef02
authored
Nov 23, 2016
by
HERBERT Ryan
Browse files
sample_set * add basic pagination
parent
50bf2dbd
Changes
3
Hide whitespace changes
Inline
Side-by-side
server/web2py/applications/vidjil/controllers/sample_set.py
View file @
37efef02
...
...
@@ -158,7 +158,14 @@ def all():
else
:
type
=
'generic'
list
=
SampleSetList
(
type
)
step
=
None
page
=
None
is_not_filtered
=
"sort"
not
in
request
.
vars
and
"filter"
not
in
request
.
vars
if
request
.
vars
[
'page'
]
is
not
None
and
is_not_filtered
:
page
=
int
(
request
.
vars
[
'page'
])
step
=
50
list
=
SampleSetList
(
type
,
page
,
step
)
list
.
load_creator_names
()
list
.
load_sample_information
()
list
.
load_config_information
()
...
...
@@ -192,7 +199,9 @@ def all():
fields
=
fields
,
type
=
type
,
isAdmin
=
isAdmin
,
reverse
=
False
)
reverse
=
False
,
step
=
step
,
page
=
page
)
## return form to create new generic sample_set
...
...
server/web2py/applications/vidjil/models/sample_set_list.py
View file @
37efef02
class
SampleSetList
():
def
__init__
(
self
,
type
):
def
__init__
(
self
,
type
,
page
=
None
,
step
=
None
):
self
.
type
=
type
limitby
=
None
if
page
is
not
None
and
step
is
not
None
:
limitby
=
(
page
*
step
,
(
page
+
1
)
*
step
+
1
)
# one more element to indicate if another page exists
query_gss
=
db
(
(
auth
.
vidjil_accessible_query
(
PermissionEnum
.
read
.
value
,
db
[
type
]))
).
select
(
db
[
type
].
ALL
,
limitby
=
limitby
,
orderby
=
~
db
[
type
].
id
)
...
...
server/web2py/applications/vidjil/views/sample_set/all.html
View file @
37efef02
...
...
@@ -10,6 +10,16 @@
search
<input
id=
"db_filter_input"
type=
"text"
value=
"{{=request.vars["
filter
"]}}"
onchange=
"db.call('sample_set/all', {'type': '{{=type}}', 'filter' : this.value} )"
>
</div>
<div
class=
"db_block_right"
>
page:
{{ if page > 0: }}
<div
class=
"button"
onclick=
"db.call('sample_set/all', {'type': '{{=type}}', 'page': {{=page-1}}})"
><
</
div
>
{{ pass }}
{{= page + 1 }}
{{if len(query) > step : }}
<div
class=
"button"
onclick=
"db.call('sample_set/all', {'type': '{{=type}}', 'page': {{=page+1}}})"
>
>
</div>
{{ pass }}
</div>
</div>
<div
id=
"db_table_container"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment