Commit 926e2e82 authored by Hervé  MENAGER's avatar 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
......@@ -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):
"""
......
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.display = '';
cell_line_input.style.visibility = '';
}else{
cell_line_input.style.display = 'none';
cell_line_input.style.visibility = 'hidden';
}
}
\ No newline at end of file
......@@ -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 }}
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment