Newer
Older
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
<!DOCTYPE html>
<html>
<head>
{% for src in js %}
<script type="text/javascript" src="{{ src }}"></script>
{% endfor %}
{% for src in css %}
<link type="text/css" rel="stylesheet" href="{{ src }}">
{% endfor %}
<script type="text/javascript" src="{{ url_for( 'files.send_app_files', subpath = 'functions.js' ) }}"></script>
<link type="text/css" rel="stylesheet" href="{{ url_for( 'files.send_app_files', subpath = 'app.css' ) }}">
<script type="text/javascript">
baseurl = "{{ baseurl }}";
submission_id = "{{ submission_id }}";
var update_gp = function( finger )
{
var classes = [];
{% for gp in gp_list %}
classes.push( { id: "{{ gp.div_name }}", label: "{{ gp.name }}" } );
{% endfor %}
var url = "{{ url_for( 'submission.submission_segment_set_gp', submission_id = submission_id, pc = '<pc>' ) }}".replace( "%3Cpc%3E", finger );
var div = $( "<div />" ).attr( "id", "gp_select_dialog" );
var div2 = $( "<div />" ).addClass( "gp_grid" );
_.each( classes, function( element, key ){
div2.append(
$( "<div />" )
.attr( "id", "general_pattern_" + element.id )
.append(
$( "<img />" )
.attr( "src", "{{ url_for( 'files.send_static_files', subpath = '<subpath>' ) }}".replace( "%3Csubpath%3E", element.id + ".png" ) )
.attr( "height", "200px" )
.attr( "width", "200px" )
)
.append(
$( "<div />" )
.css( "text-align", "center" )
.text( element.label )
)
.on( "click", function(){
$.ajax( {
url: url,
dataType: "json",
method: "POST",
data: {
gp: element.id
},
success: function( data )
{
$( "#finger_gp_f" + finger ).empty();
$( "#finger_gp_f" + finger ).append(
$( "<img />" )
.css( "width", "100%" )
.attr( "src", "{{ url_for( 'files.send_static_files', subpath = '<subpath>' ) }}".replace( "%3Csubpath%3E", element.id + ".png" ) )
)
.append(
$( "<div />" )
.css( "text-align", "center" )
.text( element.label )
);
},
error: function( data )
{
toastr.error( "Error while saving the general pattern" );
}
} );
$( "#gp_select_dialog" ).dialog( "close" );
} )
);
} );
div.append( div2 );
div.dialog( {
title: "Set the general pattern for the finger F" + finger,
modal: true,
width: "auto",
minWidth: "700px",
buttons: {
"Cancel": function()
{
$( this ).dialog( "close" );
},
},
close: function()
{
$( this ).remove();
}
} );
}
</script>
<style type="text/css">
#icnml_submission_form {
width: 90%;
max-width: 1200px;
margin-top: 30px;
margin-left: auto;
margin-right: auto;
}
#set_all_gp {
margin-top: 35px;
display: grid;
grid-template-columns: repeat( 5, 1fr );
grid-auto-rows: 1fr;
grid-gap: 10px;
cursor: pointer;
}
#set_all_gp::before {
content: '';
width: 0;
padding-bottom: 100%;
grid-row: 1 / 1;
grid-column: 1 / 1;
}
#set_all_gp > *:first-child {
grid-row: 1 / 1;
grid-column: 1 / 1;
}
.label_float {
position: absolute;
float: left;
z-index: 9;
padding-left: 5px;
padding-right: 10px;
margin-left: 10px;
margin-top: -0.75em;
background-color: #ffffff;
}
.zone {
border: 1px solid #aaaaaa;
border-radius: 10px;
padding: 20px;
box-sizing: border-box;
height: 100%;
width: 100%;
}
.gp_grid {
z-index: 99;
display: grid;
grid-template-columns: repeat( 5, 1fr );
grid-auto-rows: 1fr;
grid-gap: 10px;
}
.gp_grid::before {
content: '';
width: 0;
padding-bottom: 100%;
grid-row: 1 / 1;
grid-column: 1 / 1;
}
.gp_grid > *:first-child {
grid-row: 1 / 1;
grid-column: 1 / 1;
}
.gp_grid > div {
display: table;
margin: 0px;
padding: 0px;
height: 100%;
width: 100%;
}
.gp_grid > div > span {
padding: 5px;
text-align: center;
display: table-cell;
vertical-align: middle;
}
</style>
</head>
<body class="icnml_main_layout">
{% include "header.html" %}
{% include navigation %}
<div class="icnml_content">
<form id="icnml_submission_form">
<div class="ui-widget-header ui-corner-top icnml_box_top">{{ donor[ 'username' ] }}</div>
<div class="ui-widget-content ui-corner-bottom icnml_box_content">
<div id="set_all_gp">
{% for n in range( 10 ) %}
<div>
<div class="label_float">{{ finger_names[ n ] }} (F{{ n + 1 }})</div>
<div id="finger_gp_f{{ n + 1 }}" class="zone">
<span style="color: #cccccc">click to set</span>
</div>
</div>
{% endfor %}
</div>
</div>
</form>
</div>
<script type="text/javascript">
{% for n in range( 10 ) %}
$( "#finger_gp_f{{ n + 1 }}" ).on( "click", function(){
update_gp( {{ n + 1 }} );
} );
{% endfor %}
{% for gp in current_gp %}
$( "#finger_gp_f{{ gp.fpc }}" ).empty();
$( "#finger_gp_f{{ gp.fpc }}" ).append(
$( "<img />" )
.css( "width", "100%" )
.attr( "src", "{{ url_for( 'files.send_static_files', subpath = '<subpath>' ) }}".replace( "%3Csubpath%3E", "{{ gp.div_name }}.png" ) )
)
.append(
$( "<div />" )
.css( "text-align", "center" )
.text( "{{ gp.name }}" )
);
{% endfor %}
$( "#icnml_navigation_updatedonor" )
.addClass( "activated" );
$( "#navloc" ).append(
$( "<a />" )
.attr( "href", "{{ url_for( 'submission.admin_submission_list' ) }}" )
.text( "Submissions" )
)
.append(
$( "<span />" ).text( ">" )
)
.append(
$( "<a />" )
.attr( "href", "{{ url_for( 'submission.admin_submission_home', submission_id = submission_id ) }}" )
.text( "{{ donor[ 'username' ] }}" )
)
.append(
$( "<span />" ).text( ">" )
)
.append(
$( "<span />" ).text( "Fingers general pattern" )
);
</script>
</body>
</html>