aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/templates/edit_phenotype.html
blob: e6cb3e9ea18e8c03dd6edf343e90890d0179b4f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
{% extends "index_page.html" %}
{% block title %}Trait Submission{% endblock %}
{% block content %}
<!-- Start of body -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="container-fluid bg-{{ category }}">
    <p>{{ message|safe }}</p>
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div class="container">
    <div class="page-header text-left">
        <h1>Trait Metadata and Data Editing Form: {{ name }}</h1>
        <small><a href="{{url_for('metadata_edit.show_history', dataset_id=dataset_id, name=name)}}" target="_blank">[View History]</a></small>
    </div>

    <form id="edit-form" class="form-horizontal" method="post" action="/datasets/{{dataset_id}}/traits/{{publish_xref.id_}}?resource-id={{resource_id}}&dataset_name={{dataset_name}}" enctype='multipart/form-data'>
	<div class="form-group">
	    <div class="controls left-block col-sm-8 col-lg-8" style="width: max-content;">
            <input name="inbred-set-id" class="changed" type="hidden" value="{{ publish_xref.inbred_set_id }}"/>
            <input name="phenotype-id" class="changed" type="hidden" value="{{ publish_xref.phenotype_id }}"/>
            <input name="comments" class="changed" type="hidden" value="{{ publish_xref.comments }}"/>
            <input name="edited" class="changed" type="hidden" value="false"/>
        </div>
	</div>
    <div>
        <h2>Edit Sample Data</h2>
        <p>
            Download a spreadsheet of sample values to edit in Excel (or a similar program) and then upload the edited file
        </p>
        <div>
            <a href="/datasets/pheno/{{ name }}/group/{{ dataset_id }}/csv?resource-id={{ resource_id }}" class="btn btn-link">
                Click to Download Sample Data
            </a>
        </div>
        <div class="form-group">
            <input type = "file" class="col-md-4 control-label text-left" name = "file" />
        </div>
        <input type="submit" style="width: 125px; margin-right: 25px;" class="btn btn-success form-control changed" value="Submit Change">
    </div>
    <hr>
    <div>
        <h2>Edit Metadata</h2>
        <div class="form-group">
            <label for="pubmed-id" class="col-sm-3 col-lg-2 control-label text-left">PubMed ID</label>
            <!-- Do not enter PubMed_ID if this trait has not been Published.
                If the PubMed_ID you entered is alreday stored in our
                database, all the following fields except Postpublication
                Description will be ignored.  Do not enter any non-digit
                character in this field. -->
            <div class="col-sm-7 col-lg-8">
              <input type="text" name="pubmed-id" class="form-control"
		     value="{{publication.pubmed_id |default('', true)}}">
		<input name="old_id_" class="changed" type="hidden" value="{{ publication.id_ |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="pre-pub-desc" class="col-sm-3 col-lg-2 control-label text-left">Prepublication Description</label>
            <div class="col-sm-7 col-lg-8">
                <textarea name="pre-pub-desc" class="form-control" rows="4">{{ phenotype.pre_pub_description |default('', true) }}</textarea>
                <input name="old_pre_pub_description" class="changed" type="hidden" value="{{ phenotype.pre_pub_description |default('', true) }}"/>
            </div>
            <!-- If the PubMed ID is entered, the Postpublication Description
                will be shown to all users. If there is no PubMed ID, and the
                Prepublication Description is entered, only you and
                authorized users can see the Postpublication Description -->
        </div>
        <div class="form-group">
            <label for="post-pub-desc" class="col-sm-3 col-lg-2 control-label text-left">Postpublication Description</label>
            <div class="col-sm-7 col-lg-8">
                <textarea name="post-pub-desc" class="form-control" rows="4">{{ phenotype.post_pub_description |default('', true) }}</textarea>
                <input name="old_post_pub_description" class="changed" type="hidden" value="{{ phenotype.post_pub_description |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="orig-desc" class="col-sm-3 col-lg-2 control-label text-left">Original Description</label>
            <div class="col-sm-7 col-lg-8">
                <textarea name="orig-desc" class="form-control" rows="4">{{ phenotype.original_description |default('', true) }}</textarea>
                <input name="old_original_description" class="changed" type="hidden" value="{{ phenotype.original_description |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="txt:units" class="col-sm-3 col-lg-2 control-label text-left">Units</label>
            <div class="col-sm-7 col-lg-8">
              <input id="txt:units" type="text" name="units"
		     class="form-control"
		     value="{{phenotype.units |default('', true)}}" />
                <input name="old_units" class="changed" type="hidden" value="{{ phenotype.units |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="pre-pub-abbrev" class="col-sm-3 col-lg-2 control-label text-left">
                Prepublication Abbreviation
            </label>
            <div class="col-sm-7 col-lg-8">
              <input id="pre-pub-abbrev" name="pre-pub-abbrev"
		     class="form-control"
		     value="{{phenotype.pre_pub_abbreviation |default('', true)}}" />
                <input name="old_pre_pub_abbreviation" class="changed" type="hidden" value="{{ phenotype.pre_pub_abbreviation |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="post-pub-abbrev" class="col-sm-3 col-lg-2 control-label text-left">
                Postpublication Abbreviation
            </label>
            <div class="col-sm-7 col-lg-8">
              <input type="text" id="post-pub-abbrex" name="post-pub-abbrev"
		     class="form-control"
		     value="{{phenotype.post_pub_abbreviation |default('', true)}}" />
                <input name="old_post_pub_abbreviation" class="changed" type="hidden" value="{{ phenotype.post_pub_abbreviation |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="labcode" class="col-sm-3 col-lg-2 control-label text-left">
                Lab Code
            </label>
            <div class="col-sm-7 col-lg-8">
              <input type="text" id="labcode" name="labcode"
		     class="form-control"
		     value="{{phenotype.lab_code |default('', true) }}" />
                <input name="old_lab_code" class="changed" type="hidden" value="{{ phenotype.lab_code |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="submitter" class="col-sm-3 col-lg-2 control-label text-left">
                Submitter
            </label>
            <div class="col-sm-7 col-lg-8">
              <input type="text" id="submitter" name="submitter"
		     class="form-control"
		     value="{{phenotype.submitter |default('', true)}}" />
                <input name="old_submitter" class="changed" type="hidden" value="{{ phenotype.submitter |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="authorized-users" class="col-sm-3 col-lg-2 control-label text-left">
                Authorized Users
            </label>
            <div class="col-sm-7 col-lg-8">
              <input type="text" id="authorized-users" name="authorized-users"
		     class="form-control"
		     value="{{phenotype.authorized_users |default('', true)}}" />
                <input name="old_authorized_users" class="changed" type="hidden" value="{{ phenotype.authorized_users |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="authors" class="col-sm-3 col-lg-2 control-label text-left">Authors</label>
            <div class="col-sm-7 col-lg-8">
                <textarea name="authors" class="form-control" rows="3" placeholder="Example: Roy S, Ingels J, Bohl CJ, McCarty M, Lu L, Mulligan MK, Mozhui K, Centeno A, Williams EG, Auwerx J, Williams RW">{{ publication.authors |default('', true) }}</textarea>
                <input name="old_authors" class="changed" type="hidden" value="{{ publication.authors |default('', true) }}"/>
            </div>
	    </div>
        <div class="form-group">
                <label for="year" class="col-sm-3 col-lg-2 control-label text-left">Year</label>
                <div class="col-sm-7 col-lg-8">
                  <input type="number" name="year" class="form-control"
			 min="1000"
			 value="{{publication.year |default(datetime.datetime.now().year) }}" />
                    <input name="old_year" class="changed" type="hidden" value="{{ publication.year |default('', true) }}"/>
                </div>
        </div>
        <div class="form-group">
                <label for="month" class="col-sm-3 col-lg-2 control-label text-left">Month</label>
                <div class="col-sm-7 col-lg-8">
		  <select id="month" name="month" class="form-control">
		    {%set selected_month =(publication.month or datetime.datetime.now().strftime("%b"))%}
		    {%for smonth, lmonth in (("Jan", "January"),("Feb", "February"),("Mar", "March"),("Apr", "April"),("May", "May"),("Jun", "Jun"),("Jul", "July"),("Aug", "August"),("Sep", "September"),("Oct", "October"),("Nov", "November"),("Dec", "December"))%}
		    <option value="{{smonth}}"
			    {%if smonth == selected_month%}
			    selected="selected"
			    {%endif%}>{{lmonth}}</option>
		    {%endfor%}
		  </select>
                    <input name="old_month" class="changed" type="hidden" value="{{ publication.month |default('', true) }}"/>
                </div>
        </div>
	    <div class="form-group">
            <label for="txt:title" class="col-sm-3 col-lg-2 control-label text-left">Title</label>
            <div class="col-sm-7 col-lg-8">
              <input type="text" id="txt:title" name="title"
		     class="form-control"
		     value="{{publication.title |default('', true)}}" />
                <input name="old_title" class="changed" type="hidden" value="{{ publication.title |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="abstract" class="col-sm-3 col-lg-2 control-label text-left">Abstract</label>
            <div class="col-sm-7 col-lg-8">
                <textarea name="abstract" class="form-control" rows="6">{{ publication.abstract |default('', true) }}</textarea>
                <input name="old_abstract" class="changed" type="hidden" value="{{ publication.abstract |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
                <label for="volume" class="col-sm-3 col-lg-2 control-label text-left">Volume</label>
                <div class="col-sm-7 col-lg-8">
                  <input type="text" id="volume" name="volume"
			 class="form-control"
			 value="{{publication.volume |default('', true)}}" />
                    <input name="old_volume" class="changed" type="hidden" value="{{ publication.volume |default('', true) }}"/>
                </div>
        </div>
		<div class="form-group">
            <label for="journal" class="col-sm-3 col-lg-2 control-label text-left">Journal</label>
            <div class="col-sm-7 col-lg-8">
              <input type="text" id="journal" name="journal"
		     class="form-control"
		     value="{{publication.journal |default('', true)}}" />
                <input name="old_journal" class="changed" type="hidden" value="{{ publication.journal_ |default('', true) }}"/>
            </div>
        </div>
        <div class="form-group">
            <label for="pages" class="col-sm-3 col-lg-2 control-label text-left">Pages</label>
            <div class="col-sm-7 col-lg-8">
              <input type="text" id="pages" name="pages"
		     class="form-control"
		     value="{{publication.pages |default('', true)}}" />
                <input name="old_pages" class="changed" type="hidden" value="{{ publication.pages |default('', true) }}"/>
            </div>
        </div>
        <input type="submit" style="width: 125px; margin-right: 25px;" class="btn btn-success form-control changed" value="Submit Change">
    </div>
    {% if sample_list|length < 2000 %}
    <div style="padding-top: 20px;">
      <p class="text-info" style="padding-left: 5em;">
	<strong>Type "x" to delete a value.</strong>
      </p>
        <table style="width: 500px;" class="table table-hover table-striped table-bordered left-float">
            <thead>
                <th></th>
                <th>ID</th>
                <th>Sample</th>
                <th>Value</th>
                <th></th>
                <th>SE</th>
                <th>N</th>
            </thead>
            <tbody>
                {% for sample in sample_list %}
                <tr>
                    <td><input type="checkbox"></td>
                    <td>{{ loop.index }}</td>
                    <td>{{ sample }}</td>
                    <td><input type="text" name="value:{{ sample }}" class="table_input" value="{% if sample_data.get(sample) %}{{ '%0.3f' | format(sample_data.get(sample).value | float) }}{% else %}x{% endif %}" size=4 maxlength=6></input></td>
                    <td>±</td>
                    <td><input type="text" name="error:{{ sample }}" class="table_input" value="{% if sample_data.get(sample).error %}{{ '%0.3f' | format(sample_data.get(sample).error | float) }}{% else %}x{% endif %}" size=4 maxlength=5></input></td>
                    <td><input type="text" name="n_cases:{{ sample }}" class="table_input" value="{% if sample_data.get(sample).n_cases %}{{ sample_data.get(sample).n_cases }}{% else %}x{% endif %}" size=3 maxlength=3></input></td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
    {% endif %}

    </form>
</div>

{%endblock%}

{% block js %}
<script>
 gn_server_url = "{{ gn_server_url }}";
 function MarkAsChanged(){
     $(this).addClass("changed");
 }
 $(":input").blur(MarkAsChanged).change(MarkAsChanged);

 $("input[type=submit]").click(function(){
     $(":input:not(.changed)").attr("disabled", "disabled");
 });

 // This is an awkward way to detect changes to table data, so it doesn't process it otherwise
 $(".table_input").change(function(){
    $("input[name=edited]").val("true");
 });
</script>
{% endblock %}