diff options
Diffstat (limited to 'qc_app/templates')
-rw-r--r-- | qc_app/templates/dbupdate_hidden_fields.html | 14 | ||||
-rw-r--r-- | qc_app/templates/select_study.html | 55 |
2 files changed, 57 insertions, 12 deletions
diff --git a/qc_app/templates/dbupdate_hidden_fields.html b/qc_app/templates/dbupdate_hidden_fields.html new file mode 100644 index 0000000..cdebeab --- /dev/null +++ b/qc_app/templates/dbupdate_hidden_fields.html @@ -0,0 +1,14 @@ +{%macro hidden_fields(filename, filetype):%} + +<!-- {{kwargs}}: mostly for accessing the kwargs in macro --> + +<input type="hidden" name="filename" value="{{filename}}" /> +<input type="hidden" name="filetype" value="{{filetype}}" /> +{%if kwargs.get("species"):%} +<input type="hidden" name="species" value="{{species}}" /> +{%endif%} +{%if kwargs.get("genechipid"):%} +<input type="hidden" name="genechipid" value="{{genechipid}}" /> +{%endif%} + +{%endmacro%} diff --git a/qc_app/templates/select_study.html b/qc_app/templates/select_study.html index 8d7a98b..e4b629c 100644 --- a/qc_app/templates/select_study.html +++ b/qc_app/templates/select_study.html @@ -1,4 +1,5 @@ {%extends "base.html"%} +{%from "dbupdate_hidden_fields.html" import hidden_fields%} {%block title%}Select Dataset{%endblock%} @@ -14,10 +15,7 @@ id="select-platform-form" data-genechips="{{genechips_data}}" class="two-col-sep-col1"> <legend>Select from existing study</legend> - <input type="hidden" name="filename" value="{{filename}}" /> - <input type="hidden" name="filetype" value="{{filetype}}" /> - <input type="hidden" name="species" value="{{species}}" /> - <input type="hidden" name="genechipid" value="{{genechipid}}" /> + {{hidden_fields(filename, filetype, species=species, genechipid=genechipid)}} <fieldset> <label for="study" class="form-col-1">study:</label> @@ -39,19 +37,28 @@ <p class="two-col-sep-separator">OR</p> - <form method="POST" action="{{url_for('dbinsert.select_study')}}" + <form method="POST" action="{{url_for('dbinsert.create_study')}}" id="select-platform-form" data-genechips="{{genechips_data}}" class="two-col-sep-col2"> + {%with messages = get_flashed_messages(with_categories=true)%} + {%if messages:%} + <ul> + {%for category, message in messages:%} + <li class="{{category}}">{{message}}</li> + {%endfor%} + </ul> + {%endif%} + {%endwith%} <legend>Create new study</legend> - <input type="hidden" name="filename" value="{{filename}}" /> - <input type="hidden" name="filetype" value="{{filetype}}" /> - <input type="hidden" name="species" value="{{species}}" /> - <input type="hidden" name="genechipid" value="{{genechipid}}" /> + {{hidden_fields(filename, filetype, species=species, genechipid=genechipid)}} <fieldset> <label for="studyname" class="form-col-1">name:</label> <input type="text" id="studyname" name="studyname" class="form-col-2" - required="required" /> + required="required" + {%if studyname:%} + value="{{studyname}}" + {%endif%} /> </fieldset> <fieldset> @@ -68,13 +75,37 @@ <fieldset> <label for="group" class="form-col-1">group:</label> - <select id="group" name="inbredsetid" class="form-col-2"> + <select id="group" name="inbredsetid" class="form-col-2" + required="required"> + <option value="">Select group</option> + {%for family in groups:%} + <optgroup label="{{family}}"> + {%for group in groups[family]:%} + <option value="{{group['InbredSetId']}}" + {%if group["InbredSetId"] == selected_group:%} + selected="selected" + {%endif%}> + {{group["FullName"]}} + </option> + {%endfor%} + </optgroup> + {%endfor%} </select> </fieldset> <fieldset> <label for="tissue" class="form-col-1">tissue:</label> - <select id="tissue" name="tissueid" class="form-col-2"> + <select id="tissue" name="tissueid" class="form-col-2" + required="required"> + <option value="">Select type</option> + {%for tissue in tissues:%} + <option value="{{tissue['TissueId']}}" + {%if tissue["TissueId"] == selected_tissue:%} + selected="selected" + {%endif%}> + {{tissue["Name"]}} + </option> + {%endfor%} </select> </fieldset> |