Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iPPIDB
ippidb-web
Commits
09b1e0be
Commit
09b1e0be
authored
Jun 29, 2022
by
Bryan BRANCOTTE
Browse files
load near_cavities html fragment only on demand
parent
a63645d4
Pipeline
#84275
failed with stages
in 8 minutes and 46 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ippisite/ippidb/static/js/targetcentric-near-cavities-rows.js
0 → 100644
View file @
09b1e0be
$
(
document
).
ready
(
function
(){
$
(
"
.asnyc-construction.now[data-cavity-id]
"
).
each
(
function
()
{
loadNearCavityRows
(
$
(
this
));
});
});
function
loadNearCavityRows
(
$row
){
if
(
$row
.
length
==
0
)
return
;
$row
.
addClass
(
"
loading
"
);
$
.
ajax
({
url
:
'
/cavity/
'
+
$row
.
data
(
"
cavityId
"
)
+
'
/near-cavities
'
,
data
:
{
'
chaincount
'
:
$row
.
data
(
"
chaincount
"
),
'
cavcount
'
:
$row
.
data
(
"
cavcount
"
)},
success
:
function
(
data
){
var
$data
=
$
(
data
);
if
(
$row
.
hasClass
(
"
show
"
))
$data
.
addClass
(
"
show
"
);
$data
.
insertAfter
(
$row
);
$row
.
remove
();
}
});
}
\ No newline at end of file
ippisite/ippidb/templates/targetcentric.html
View file @
09b1e0be
...
...
@@ -8,6 +8,10 @@
<link
rel=
"stylesheet"
href=
"/static/css/targetcentric.css"
>
{% endblock %}
{% block content %}
{% block extra_js %}
{{block.super}}
<script
src=
"{% static '/js/targetcentric-near-cavities-rows.js'%}"
></script>
{% endblock extra_js %}
<div
class=
"inner-wrap"
>
...
...
@@ -237,7 +241,10 @@ Comparison and druggability prediction of protein-ligand binding sites from phar
{% for cavity in cavities %}
{% with cavcount=forloop.counter %}
{% include "targetcentric_cavity_row.html" with chaincount=chaincount cavcount=cavcount %}
{% include "targetcentric_near_cavities.html" with object=cavity %}
<tr
class=
"collapse out collapseme{{ chaincount }}_{{ cavcount }} asnyc-construction"
data-cavity-id=
"{{cavity.id}}"
data-cavcount=
"{{cavcount}}"
data-chaincount=
"{{chaincount}}"
>
<td
colspan=
"27"
><i>
Loading
</i></td>
</tr>
{% include "targetcentric_near_cavities.html" with object=cavityXXX %}
{% endwith %}
{% endfor %}
{% endwith %}
...
...
ippisite/ippidb/urls.py
View file @
09b1e0be
...
...
@@ -74,6 +74,7 @@ urlpatterns = [
),
re_path
(
r
"^targetcentric/$"
,
views
.
PDBView
.
as_view
(),
name
=
"cavities"
),
re_path
(
r
"^targetcentric/networks$"
,
views
.
NetworkView
.
as_view
(),
name
=
"networks"
),
re_path
(
r
"^cavity/(?P<pk>\d+)/near-cavities$"
,
views
.
NearCavitiesHTMLFragmentView
.
as_view
(),
name
=
"near_cavities"
),
re_path
(
r
"^api/"
,
include
(
ROUTER
.
urls
)),
re_path
(
r
"^compounds/$"
,
views
.
CompoundListView
.
as_view
(),
name
=
"compound_list"
),
re_path
(
...
...
ippisite/ippidb/views/__init__.py
View file @
09b1e0be
...
...
@@ -11,7 +11,7 @@ iPPI-DB views
"""
from
django.contrib.auth.decorators
import
login_required
from
django.shortcuts
import
render
from
.targetcentric
import
PdbViewSet
,
DistanceViewSet
,
PDBView
,
NetworkView
from
.targetcentric
import
PdbViewSet
,
DistanceViewSet
,
PDBView
,
NetworkView
,
NearCavitiesHTMLFragmentView
from
.contribute
import
ippidb_wizard_view
,
ContributionDetailView
from
.compound_query
import
(
CompoundListView
,
...
...
ippisite/ippidb/views/targetcentric.py
View file @
09b1e0be
...
...
@@ -4,7 +4,7 @@ iPPI-DB targetcentric views and related classes
from
itertools
import
product
from
functools
import
reduce
from
operator
import
add
from
django.views.generic
import
ListView
from
django.views.generic
import
ListView
,
DetailView
from
django.contrib
import
messages
from
django.db.models
import
Case
,
When
,
Value
,
IntegerField
,
F
,
Q
from
rest_framework
import
viewsets
...
...
@@ -308,3 +308,16 @@ class NetworkView(ListView):
def
get_queryset
(
self
):
queryset
=
self
.
model
.
objects
.
all
()
return
queryset
.
order_by
(
"number"
)
class
NearCavitiesHTMLFragmentView
(
DetailView
):
model
=
Cavity
template_name
=
"targetcentric_near_cavities.html"
def
get_context_data
(
self
,
*
,
object_list
=
None
,
**
kwargs
):
return
dict
(
**
super
().
get_context_data
(
**
kwargs
),
chaincount
=
self
.
request
.
GET
.
get
(
'chaincount'
,
'0'
),
cavcount
=
self
.
request
.
GET
.
get
(
'cavcount'
,
'0'
),
avg_std
=
MetaInformation
.
objects
.
first
(),
)
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment