aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-01-03 11:03:21 +0300
committerzsloan2022-01-29 00:42:44 -0600
commitddd8e18cb236d6131e9f12a56d4f869649466a09 (patch)
treeb15495f28ff995b324c60ed2549e9fd80d34dc11 /wqflask
parentea728239a571e1991530d17d48d7b93b939b3b11 (diff)
downloadgenenetwork2-ddd8e18cb236d6131e9f12a56d4f869649466a09.tar.gz
Include template to get rid of repetitive template code
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * The generation of input elements that relate to the traits is very similar, therefore this commit pulls it out into a separate template that can be included where needed.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/templates/partial_correlations.html30
-rw-r--r--wqflask/wqflask/templates/with-trait-items.html18
2 files changed, 23 insertions, 25 deletions
diff --git a/wqflask/wqflask/templates/partial_correlations.html b/wqflask/wqflask/templates/partial_correlations.html
index 800222ba..c565d4bf 100644
--- a/wqflask/wqflask/templates/partial_correlations.html
+++ b/wqflask/wqflask/templates/partial_correlations.html
@@ -24,18 +24,8 @@
{%if step == "select-primary":%}
<p>Please select the primary trait (X)</p>
- {%for trait in traits_list:%}
- <div class="label-element-combo with-trait">
- <input type="radio"
- name="primary_trait"
- value="{{trait['name']}}:::{{trait['dataset']}}:::{{trait['symbol']}}:::{{trait['description']}}:::{{trait['data_hmac']}}"
- id="trait_{{trait['data_hmac']}}"
- class="selector-element" />
- <label for="trait_{{trait['data_hmac']}}" class="label-element">
- {{trait["name"]}} - {{trait["symbol"]}} - {{trait["description"]}}
- </label>
- </div>
- {%endfor%}
+ {%include "with-trait-items.html" %}
+
<button type="submit" class="btn btn-primary">
Next: Select Control Traits
</button>
@@ -46,20 +36,10 @@
{%if step == "select-controls":%}
<p>Select a maximum of three (3) control traits (Z)</p>
- {%for trait in traits_list:%}
- <div class="label-element-combo with-trait">
- <input type="checkbox"
- name="control_traits[]"
- value="{{trait['name']}}:::{{trait['dataset']}}:::{{trait['symbol']}}:::{{trait['description']}}:::{{trait['data_hmac']}}"
- id="trait_{{trait['data_hmac']}}"
- class="selector-element" />
- <label for="trait_{{trait['data_hmac']}}" class="label-element">
- {{trait["name"]}} - {{trait["symbol"]}} - {{trait["description"]}}
- </label>
- </div>
- {%endfor%}
+ {%include "with-trait-items.html" %}
+
<button type="submit" class="btn btn-primary">
- Next: Select Target Traits
+ Next: Select Target
</button>
{%endif%}
diff --git a/wqflask/wqflask/templates/with-trait-items.html b/wqflask/wqflask/templates/with-trait-items.html
new file mode 100644
index 00000000..66d6fd22
--- /dev/null
+++ b/wqflask/wqflask/templates/with-trait-items.html
@@ -0,0 +1,18 @@
+{%for trait in traits_list:%}
+<div class="with-trait">
+ <input type="{%if step=='select-primary':%}radio{%else:%}checkbox{%endif%}"
+ name="{%if step=='select-primary':%}primary_trait{%else:%}control_traits[]{%endif%}"
+ value="{{trait['name']}}:::{{trait['dataset']}}:::{{trait['symbol']}}:::{{trait['description']}}:::{{trait['location']}}:::{{trait['mean_expr']}}:::{{trait['max_lrs']}}:::{{trait['data_hmac']}}"
+ id="trait_{{trait['data_hmac']}}"
+ class="selector-element" />
+ <label for="trait_{{trait['data_hmac']}}" class="label-element">
+ <span class="trait-dataset" data-title="dataset">{{trait["dataset"]}}</span>
+ <span class="trait-name" data-title="name">{{trait["name"]}}</span>
+ <span class="trait-symbol" data-title="symbol">{{trait["symbol"]}}</span>
+ <span class="trait-description" data-title="description">{{trait["description"]}}</span>
+ <span class="trait-locatin" data-title="location">{{trait["location"]}}</span>
+ <span class="trait-mean-expr" data-title="mean">{{"%0.3f" % trait["mean_expr"]|float}}</span>
+ <span class="trait-max-lrs" data-title="max LRS">{{trait["max_lrs"]}}</span>
+ </label>
+</div>
+{%endfor%}