Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iPPIDB
ippidb-web
Commits
d950315d
Commit
d950315d
authored
7 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
add sort options to compound list (#43 WIP)
Former-commit-id: be28f3ef1caeaada5be3293fc092906141b4ab25
parent
c67f33f8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ippisite/ippidb/templates/compound_list.html
+10
-0
10 additions, 0 deletions
ippisite/ippidb/templates/compound_list.html
ippisite/ippidb/views.py
+7
-1
7 additions, 1 deletion
ippisite/ippidb/views.py
with
17 additions
and
1 deletion
ippisite/ippidb/templates/compound_list.html
+
10
−
0
View file @
d950315d
...
@@ -67,6 +67,16 @@
...
@@ -67,6 +67,16 @@
{% endif %}
{% endif %}
{% endif %}
{% endif %}
</span>
</span>
<div
class=
"dropdown"
>
<button
class=
"btn btn-secondary dropdown-toggle"
type=
"button"
id=
"sortMenuButton"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<i
class=
"fas fa-sort-amount-down"
title=
"sort by"
></i>
</button>
<div
class=
"dropdown-menu"
aria-labelledby=
"sortMenuButto"
>
{% for sort_by_option, verbose_name in sort_by_options.items %}
<a
class=
"dropdown-item {% if sort_by_option == sort_by %}active{% endif %}"
href=
"#"
onclick=
"modifyUrl('sort_by','{{ sort_by_option }}')"
>
{{ verbose_name }}
</a>
{% endfor %}
</div>
</div>
<span
class=
"btn-group col-md-2"
>
<span
class=
"btn-group col-md-2"
>
<a
class=
"btn btn-default btn-outline-primary {% if display == 'v' %}active{% endif %}"
href=
"#"
{%
if
display
!=
'
v
'
%}
onclick=
"modifyUrl('display', 'v')"
{%
endif
%}
>
<a
class=
"btn btn-default btn-outline-primary {% if display == 'v' %}active{% endif %}"
href=
"#"
{%
if
display
!=
'
v
'
%}
onclick=
"modifyUrl('display', 'v')"
{%
endif
%}
>
<i
class=
"fa fa-th"
title=
"Vignettes"
></i>
<i
class=
"fa fa-th"
title=
"Vignettes"
></i>
...
...
This diff is collapsed.
Click to expand it.
ippisite/ippidb/views.py
+
7
−
1
View file @
d950315d
...
@@ -198,6 +198,9 @@ def compound_list(request):
...
@@ -198,6 +198,9 @@ def compound_list(request):
boundcomplexes
=
ProteinDomainBoundComplex
.
objects
.
exclude
(
id__in
=
request
.
GET
.
getlist
(
'
boundcomplex
'
))
boundcomplexes
=
ProteinDomainBoundComplex
.
objects
.
exclude
(
id__in
=
request
.
GET
.
getlist
(
'
boundcomplex
'
))
if
boundcomplexes_all
is
None
:
if
boundcomplexes_all
is
None
:
boundcomplexes
=
boundcomplexes
[:
5
]
boundcomplexes
=
boundcomplexes
[:
5
]
sort_by_options
=
[
'
id
'
,
'
molecular_weight
'
,
'
a_log_p
'
,
'
nb_aromatic_sssr
'
,
'
nb_chiral_centers
'
]
sort_by
=
request
.
GET
.
get
(
'
sort_by
'
,
'
id
'
)
compounds
=
compounds
.
order_by
(
sort_by
)
compounds
=
compounds
.
distinct
()
compounds
=
compounds
.
distinct
()
count
=
compounds
.
count
()
count
=
compounds
.
count
()
# handle pagination in compounds list
# handle pagination in compounds list
...
@@ -215,6 +218,7 @@ def compound_list(request):
...
@@ -215,6 +218,7 @@ def compound_list(request):
if
display
not
in
[
'
l
'
,
'
t
'
]:
if
display
not
in
[
'
l
'
,
'
t
'
]:
display
=
'
v
'
display
=
'
v
'
compound_fields
=
{
f
.
name
:
f
.
verbose_name
for
f
in
Compound
.
_meta
.
get_fields
()
if
not
(
f
.
is_relation
)}
compound_fields
=
{
f
.
name
:
f
.
verbose_name
for
f
in
Compound
.
_meta
.
get_fields
()
if
not
(
f
.
is_relation
)}
sort_by_options
=
{
sort_by_option
:
compound_fields
[
sort_by_option
]
for
sort_by_option
in
sort_by_options
}
fields
=
request
.
GET
.
get
(
'
fields
'
,[
'
id
'
,
'
common_name
'
,
'
molecular_weight
'
,
'
a_log_p
'
,
'
compound_action_pdb_ids
'
,
'
biblio_refs
'
])
fields
=
request
.
GET
.
get
(
'
fields
'
,[
'
id
'
,
'
common_name
'
,
'
molecular_weight
'
,
'
a_log_p
'
,
'
compound_action_pdb_ids
'
,
'
biblio_refs
'
])
return
render
(
request
,
'
compound_list.html
'
,
{
'
compounds
'
:
compounds
,
return
render
(
request
,
'
compound_list.html
'
,
{
'
compounds
'
:
compounds
,
'
count
'
:
count
,
'
count
'
:
count
,
...
@@ -232,7 +236,9 @@ def compound_list(request):
...
@@ -232,7 +236,9 @@ def compound_list(request):
'
boundcomplexes_all
'
:
boundcomplexes_all
,
'
boundcomplexes_all
'
:
boundcomplexes_all
,
'
display
'
:
display
,
'
display
'
:
display
,
'
compound_fields
'
:
compound_fields
,
'
compound_fields
'
:
compound_fields
,
'
fields
'
:
fields
'
fields
'
:
fields
,
'
sort_by
'
:
sort_by
,
'
sort_by_options
'
:
sort_by_options
})
})
def
compound_card
(
request
,
compound_id
):
def
compound_card
(
request
,
compound_id
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment