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
iPPIDB
ippidb-web
Commits
926e2e82
Commit
926e2e82
authored
Sep 17, 2020
by
Hervé MENAGER
Browse files
tweak the testactivitydescription layout to widen some inputs
more specifically, test name and cell line name FIX #237
parent
3b882bd3
Pipeline
#37624
passed with stages
in 14 minutes and 18 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ippisite/ippidb/forms.py
View file @
926e2e82
...
...
@@ -1009,7 +1009,7 @@ CompoundActivityResultInlineFormset = inlineformset_factory(
class
TestActivityDescriptionForm
(
forms
.
ModelForm
):
test_name
=
CharFieldDataList
(
data_class
=
models
.
TestActivityDescription
,
data_attr
=
"test_name"
data_class
=
models
.
TestActivityDescription
,
data_attr
=
"test_name"
,
)
cell_line_name
=
CharFieldDataList
(
...
...
@@ -1034,6 +1034,11 @@ class TestActivityDescriptionForm(forms.ModelForm):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
"test_type"
].
widget
.
attrs
[
"onchange"
]
=
"test_type_changed(this);"
self
.
fields
[
"test_type"
].
widget
.
attrs
.
update
({
"class"
:
"col-2"
})
self
.
fields
[
"test_name"
].
widget
.
attrs
.
update
({
"class"
:
"col-9"
})
self
.
fields
[
"test_modulation_type"
].
widget
.
attrs
.
update
({
"class"
:
"col-2"
})
self
.
fields
[
"nb_active_compounds"
].
widget
.
attrs
.
update
({
"class"
:
"col-3"
})
self
.
fields
[
"cell_line_name"
].
widget
.
attrs
.
update
({
"class"
:
"col-6"
})
def
has_changed
(
self
):
"""
...
...
ippisite/ippidb/static/js/ActivityDescriptionFormSet.js
View file @
926e2e82
function
test_type_changed
(
source
){
var
cell_line_input
=
document
.
getElementById
(
source
.
id
.
replace
(
"
test_type
"
,
"
cell_line_name
"
)).
parentNode
;
if
(
source
.
value
==
"
CELL
"
){
cell_line_input
.
style
.
d
is
pla
y
=
''
;
cell_line_input
.
style
.
v
is
ibilit
y
=
''
;
}
else
{
cell_line_input
.
style
.
d
is
play
=
'
none
'
;
cell_line_input
.
style
.
v
is
ibility
=
'
hidden
'
;
}
}
\ No newline at end of file
ippisite/ippidb/templates/form_with_nested_formset.html
View file @
926e2e82
...
...
@@ -11,9 +11,11 @@
</script>
{% endblock extra_js %}
<div
class=
"formset-item
formset-item-inline-grid
"
>
<div
class=
"formset-item"
>
<h3
class=
"test_title"
>
Test description
</h3>
{{ form|bootstrap}}
<div
class=
"row"
>
{{ form|bootstrap}}
</div>
<div
class=
"formset-nested-container"
>
{{ form.nested.management_form }}
{{ form.nested.non_form_errors|bootstrap }}
...
...
ippisite/ippidb/templatetags/customtags.py
View file @
926e2e82
...
...
@@ -86,6 +86,11 @@ def bootstrap_core(object):
field
.
label
=
ugettext
(
"DELETE_label"
)
wrapping_classes
+=
" formset-item-delete-host delete-btn"
css_classes
.
add
(
"formset-item-delete"
)
# HACK: if the css_class is a bootstrap column layout, transfer it to container element
for
css_class
in
css_classes
:
if
css_class
.
startswith
(
"col-"
):
wrapping_classes
+=
f
"
{
css_class
}
"
css_classes
=
set
([
css_class
for
css_class
in
css_classes
if
not
(
css_class
.
startswith
(
'col-'
))])
# overwrite the css classes
attrs
[
"class"
]
=
" "
.
join
(
css_classes
)
...
...
Bryan BRANCOTTE
@bbrancot
mentioned in commit
f06420b3
·
Nov 03, 2020
mentioned in commit
f06420b3
mentioned in commit f06420b35f014d17699d39a23168e40b854ba339
Toggle commit list
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