diff --git a/ippisite/ippidb/forms.py b/ippisite/ippidb/forms.py index 4e1791300bc41b4b3305b8de7f14e3892902f0c3..925fbf2f4e6a9b671a23484e457ebefbcafd8d61 100644 --- a/ippisite/ippidb/forms.py +++ b/ippisite/ippidb/forms.py @@ -1,4 +1,4 @@ -from django.forms import ModelForm,modelformset_factory +from django.forms import ModelForm,modelformset_factory,formset_factory from django import forms from django.db import models from .models import Bibliography, Protein, ProteinDomainComplex, Ppi, PpiComplex @@ -26,6 +26,8 @@ class BibliographyForm(ModelForm): class PDBForm(forms.Form): pdb_id = forms.CharField(label="PDB ID",max_length=4, widget=forms.TextInput(attrs={'placeholder': 'e.g 4HHB'})) +PDBFormSet = formset_factory(PDBForm) + class ProteinForm(ModelForm): class Meta: diff --git a/ippisite/ippidb/static/css/ippidb.css b/ippisite/ippidb/static/css/ippidb.css index ac0da657f498890fed954427532f37169a1cfcd7..e8be82936ad08625336a4ec3ae67dc63f39f017b 100644 --- a/ippisite/ippidb/static/css/ippidb.css +++ b/ippisite/ippidb/static/css/ippidb.css @@ -744,28 +744,77 @@ body { overflow: hidden; width: 600px; padding-bottom: 5px; - background-image: url('/static/images/PPITypes/Inhibited/{{radio.choice_label|cut:" "}}_Apo.png'); - background-position: center; - background-repeat: no-repeat; + display: flex; +} + +/* Background image classes */ +.imageBack_Inhib_Hetero2-merAB input { + display:none; } -#id_ProteinDomainComplexTypeForm-inhibited label span{ +.imageBack_Inhib_Hetero2-merAB label span{ display: inline-block; width: 180px; text-align: center; border: 1px solid #8D8888; + background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Inhibited/Hetero2-merAB_Apo.png'); + background-position: center; + background-repeat: no-repeat; height: 180px; font-size: 12px; } -#id_ProteinDomainComplexTypeForm-inhibited input { +.imageBack_Inhib_Hetero2-merAB input:hover+label span{ + cursor: pointer; + background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Inhibited/Hetero2-merAB_Holo.png'); + background-position: center; + background-repeat: no-repeat; + color: #000000; + border-bottom: 1px solid #2D96FA; + border-top: 1px solid #E3E9EB; + border-left: 1px solid #E3E9EB; + border-right: 1px solid #E3E9EB; +} + +.imageBack_Inhib_Hetero2-merAB input[type="radio"]:checked+label span{ + background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Inhibited/Hetero2-merAB_Holo.png'); + background-position: center; + background-repeat: no-repeat; + color: #000000; + border-bottom: 1px solid #2D96FA; + border-top: 1px solid #E3E9EB; + border-left: 1px solid #E3E9EB; + border-right: 1px solid #E3E9EB; +} + + +.imageBack_Inhib_Homo2-merA2 input { display:none; } -#id_ProteinDomainComplexTypeForm-inhibited input:hover+label span{ +.imageBack_Inhib_Homo2-merA2 label span{ + display: inline-block; + width: 180px; + text-align: center; + border: 1px solid #8D8888; + background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Inhibited/Homo2-merA2_Apo.png'); + background-position: center; + background-repeat: no-repeat; + height: 180px; + font-size: 12px; +} + +.imageBack_Inhib_Homo2-merA2 input:hover+label span{ cursor: pointer; background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Inhibited/Homo2-merA2_Holo.png'); + background-position: center; + background-repeat: no-repeat; color: #000000; border-bottom: 1px solid #2D96FA; border-top: 1px solid #E3E9EB; @@ -773,8 +822,11 @@ body { border-right: 1px solid #E3E9EB; } -#id_ProteinDomainComplexTypeForm-inhibited input[type="radio"]:checked+label span{ +.imageBack_Inhib_Homo2-merA2 input[type="radio"]:checked+label span{ background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Inhibited/Homo2-merA2_Holo.png'); + background-position: center; + background-repeat: no-repeat; color: #000000; border-bottom: 1px solid #2D96FA; border-top: 1px solid #E3E9EB; @@ -782,16 +834,48 @@ body { border-right: 1px solid #E3E9EB; } -.image-inhibited label span{ +.imageBack_Inhib_Customyourown input { + display:none; +} + +.imageBack_Inhib_Customyourown label span{ + display: inline-block; + width: 180px; + text-align: center; + border: 1px solid #8D8888; + background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Inhibited/Customyourown_Apo.png'); + background-position: center; + background-repeat: no-repeat; + height: 180px; + font-size: 12px; + +} + +.imageBack_Inhib_Customyourown input:hover+label span{ + cursor: pointer; + background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Inhibited/Customyourown_Holo.png'); background-position: center; background-repeat: no-repeat; + color: #000000; + border-bottom: 1px solid #2D96FA; + border-top: 1px solid #E3E9EB; + border-left: 1px solid #E3E9EB; + border-right: 1px solid #E3E9EB; } -.image-inhibited label span:hover { +.imageBack_Inhib_Customyourown input[type="radio"]:checked+label span{ + background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Inhibited/Customyourown_Holo.png'); background-position: center; background-repeat: no-repeat; + color: #000000; + border-bottom: 1px solid #2D96FA; + border-top: 1px solid #E3E9EB; + border-left: 1px solid #E3E9EB; + border-right: 1px solid #E3E9EB; } - /* Stabilized */ #stabilized{ @@ -802,24 +886,34 @@ body { overflow: hidden; width: 600px; padding-bottom: 5px; + display: flex; + flex-wrap: wrap; } -#id_ProteinDomainComplexTypeForm-stabilized label span{ +.imageBack_Stab_Customyourown input { + display:none; +} + +.imageBack_Stab_Customyourown label span{ display: inline-block; width: 180px; text-align: center; border: 1px solid #8D8888; + background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Stabilized/Customyourown_Apo.png'); + background-position: center; + background-repeat: no-repeat; height: 180px; font-size: 12px; -} -#id_ProteinDomainComplexTypeForm-stabilized input { - display:none; -} +} -#id_ProteinDomainComplexTypeForm-stabilized input:hover+label span{ +.imageBack_Stab_Customyourown input:hover+label span{ cursor: pointer; background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Stabilized/Customyourown_Holo.png'); + background-position: center; + background-repeat: no-repeat; color: #000000; border-bottom: 1px solid #2D96FA; border-top: 1px solid #E3E9EB; @@ -827,8 +921,11 @@ body { border-right: 1px solid #E3E9EB; } -#id_ProteinDomainComplexTypeForm-stabilized input[type="radio"]:checked+label span{ +.imageBack_Stab_Customyourown input[type="radio"]:checked+label span{ background-color: #FFFFFF; + background-image: url('/static/images/PPITypes/Stabilized/Customyourown_Holo.png'); + background-position: center; + background-repeat: no-repeat; color: #000000; border-bottom: 1px solid #2D96FA; border-top: 1px solid #E3E9EB; @@ -837,6 +934,10 @@ body { } + + + + button, input, select, textarea { line-height: inherit; font-family: "BrandonGrotesqueReg"; diff --git a/ippisite/ippidb/static/images/PPITypes/Inhibited/Customyourown_Apo.png b/ippisite/ippidb/static/images/PPITypes/Inhibited/Customyourown_Apo.png index 3726d3e314ccb7c3e948171be5bd96293090c455..90ecfaf138fd40773474bc71847888c92db595f9 100644 Binary files a/ippisite/ippidb/static/images/PPITypes/Inhibited/Customyourown_Apo.png and b/ippisite/ippidb/static/images/PPITypes/Inhibited/Customyourown_Apo.png differ diff --git a/ippisite/ippidb/static/images/PPITypes/Inhibited/Customyourown_Holo.png b/ippisite/ippidb/static/images/PPITypes/Inhibited/Customyourown_Holo.png index 3726d3e314ccb7c3e948171be5bd96293090c455..c094ea6329150b771b729db3f26e1bd150e47c6f 100644 Binary files a/ippisite/ippidb/static/images/PPITypes/Inhibited/Customyourown_Holo.png and b/ippisite/ippidb/static/images/PPITypes/Inhibited/Customyourown_Holo.png differ diff --git a/ippisite/ippidb/static/images/PPITypes/Stabilized/Customyourown_Apo.png b/ippisite/ippidb/static/images/PPITypes/Stabilized/Customyourown_Apo.png index 3726d3e314ccb7c3e948171be5bd96293090c455..90ecfaf138fd40773474bc71847888c92db595f9 100644 Binary files a/ippisite/ippidb/static/images/PPITypes/Stabilized/Customyourown_Apo.png and b/ippisite/ippidb/static/images/PPITypes/Stabilized/Customyourown_Apo.png differ diff --git a/ippisite/ippidb/static/images/PPITypes/Stabilized/Customyourown_Holo.png b/ippisite/ippidb/static/images/PPITypes/Stabilized/Customyourown_Holo.png index 3726d3e314ccb7c3e948171be5bd96293090c455..c094ea6329150b771b729db3f26e1bd150e47c6f 100644 Binary files a/ippisite/ippidb/static/images/PPITypes/Stabilized/Customyourown_Holo.png and b/ippisite/ippidb/static/images/PPITypes/Stabilized/Customyourown_Holo.png differ diff --git a/ippisite/ippidb/static/images/PPITypes/Stabilized/Hetero2merApo.png b/ippisite/ippidb/static/images/PPITypes/Stabilized/Hetero2-merABApo.png similarity index 100% rename from ippisite/ippidb/static/images/PPITypes/Stabilized/Hetero2merApo.png rename to ippisite/ippidb/static/images/PPITypes/Stabilized/Hetero2-merABApo.png diff --git a/ippisite/ippidb/templates/PDBForm.html b/ippisite/ippidb/templates/PDBForm.html index 1efe561d9f2109baccf6a4e3d314f8177e126dbb..fc081b80415278b3bd22023cb32a52326cde0832 100644 --- a/ippisite/ippidb/templates/PDBForm.html +++ b/ippisite/ippidb/templates/PDBForm.html @@ -25,15 +25,17 @@ {% block custom_form %}{% endblock %} {% if wizard.form.forms %} - {{ wizard.form.management_form }} + {{ formset.management_form }} {% for form in wizard.form.forms %} {{ form }} {% endfor %} {% else %} - <div class="input_fields_wrap"> - <div class="input_size">{{ wizard.form.pdb_id }} - <div class="add_field_button"><img class="small_icon" src="/static/images/Other/AddMore.png"></div></div> - </div> + {{ formset.management_form }} + {% for form in formset %} + {% for field in form %} + {{ field.label_tag }} {{ field }} + {% endfor %} + {% endfor %} {% endif %} </table> <input type="submit" value="{% trans "Next step" %}"/> diff --git a/ippisite/ippidb/templates/ProteinDomainComplexTypeForm.html b/ippisite/ippidb/templates/ProteinDomainComplexTypeForm.html index 976d058c286bfa94ee3ecb61828d864947bf31d3..db177f898dc34c4344f4c6c99b60254ab5f31118 100644 --- a/ippisite/ippidb/templates/ProteinDomainComplexTypeForm.html +++ b/ippisite/ippidb/templates/ProteinDomainComplexTypeForm.html @@ -35,23 +35,29 @@ If your PPI complex is not among them, please select « Create you Own »</p> <div class="type_title"> <h1>Inhibited</h1> </div> - <div id="id_ProteinDomainComplexTypeForm-inhibited" class="image-inhibited"> + <div id="id_ProteinDomainComplexTypeForm-inhibited"> {% for radio in wizard.form.inhibited %} - {{ radio.tag }} - <label style="background-image: url('/static/images/PPITypes/Inhibited/{{radio.choice_label|cut:" "}}_Apo.png');" for="{{ radio.id_for_label }}"> - <span>{{ radio.choice_label}}</span> - </label> + <div class="imageBack_Inhib_{{radio.choice_label|cut:" "}}"> + {{ radio.tag }} + <label for="{{ radio.id_for_label }}"> + <span>{{ radio.choice_label}}</span> + </label> + </div> {% endfor %} </div> </div> <div id="stabilized" class="type_style"> - <div class="type_title"><h1>Stabilized</h1></div> + <div class="type_title"> + <h1>Stabilized</h1> + </div> <div id="id_ProteinDomainComplexTypeForm-stabilized"> {% for radio in wizard.form.stabilized %} - {{ radio.tag }} - <label style="background-image: url('/static/images/DimericsPPI/Stabilized/{{radio.choice_label|cut:" "}}.png');" for="{{ radio.id_for_label }}"> - <span>{{ radio.choice_label}}</span> - </label> + <div class="imageBack_Stab_{{radio.choice_label|cut:" "}}"> + {{ radio.tag }} + <label for="{{ radio.id_for_label }}"> + <span>{{ radio.choice_label}}</span> + </label> + </div> {% endfor %} </div> </div> diff --git a/ippisite/ippidb/templates/ProteinForm.html b/ippisite/ippidb/templates/ProteinForm.html index 68a4279c4ddbd1c631ad807ac29bc5ac326eada0..1664265c92b630dada2485edae66585381f96975 100644 --- a/ippisite/ippidb/templates/ProteinForm.html +++ b/ippisite/ippidb/templates/ProteinForm.html @@ -25,12 +25,12 @@ {% block custom_form %}{% endblock %} {% if wizard.form.forms %} - {{ wizard.form.management_form }} + {{ formset.management_form }} {% for form in wizard.form.forms %} {{ form }} {% endfor %} {% else %} - {{ wizard.form.management_form }} + {{ formset.management_form }} {% for form in formset %} {% for field in form %} {{ field.label_tag }} {{ field }} diff --git a/ippisite/ippidb/views.py b/ippisite/ippidb/views.py index 862fe3b01350b4313b2e7508666ca7bc4808a3b4..bb12abebf0c746b2a32e46ca2985d3c1ed6dc968 100644 --- a/ippisite/ippidb/views.py +++ b/ippisite/ippidb/views.py @@ -3,7 +3,7 @@ from django.shortcuts import render from django.http import HttpResponseRedirect from formtools.wizard.views import SessionWizardView,NamedUrlSessionWizardView -from .forms import IdForm, BibliographyForm, PDBForm, ProteinForm, ProteinDomainComplexTypeForm, ProteinDomainComplexForm, PpiForm, ProteinFormSet +from .forms import IdForm, BibliographyForm, PDBForm, ProteinForm, ProteinDomainComplexTypeForm, ProteinDomainComplexForm, PpiForm, ProteinFormSet, PDBFormSet from .models import Protein from .ws import get_pdb_uniprot_mapping @@ -24,7 +24,7 @@ def adminSession(request): FORMS = [("IdForm", ippidb.forms.IdForm), ("BibliographyForm", ippidb.forms.BibliographyForm), - ("PDBForm", ippidb.forms.PDBForm), + ("PDBForm", ippidb.forms.PDBFormSet), ("ProteinForm",ippidb.forms.ProteinFormSet), ("ProteinDomainComplexTypeForm", ippidb.forms.ProteinDomainComplexTypeForm), ("ProteinDomainComplexForm", ippidb.forms.ProteinDomainComplexForm),