10
10
{% load annotation_idgloss_translation %}
11
11
12
12
{% block extrajs %}
13
+ < style >
14
+ .trash_button : hover {
15
+ color : red;
16
+ }
17
+ .trash_button .active {
18
+ color : red;
19
+ }
20
+ </ style >
13
21
< script type ='text/javascript '>
14
22
15
23
var csrf_token = '{{csrf_token}}' ;
19
27
var url = '{{PREFIX_URL}}' ;
20
28
var language_2chars = { { language_2chars| safe } } ;
21
29
30
+ function ready_videos ( el ) {
31
+ $ ( el ) . find ( 'video' ) . hide ( ) ;
32
+
33
+ $ ( el ) . mouseenter ( function ( )
34
+ {
35
+ var video = $ ( this ) . find ( 'video' ) ;
36
+ if ( video . length > 0 ) {
37
+ $ ( this ) . find ( 'img' ) . hide ( ) ;
38
+ video . show ( ) ;
39
+ video . get ( 0 ) . play ( ) ;
40
+ }
41
+ } ) ;
42
+
43
+ $ ( el ) . mouseleave ( function ( )
44
+ {
45
+ $ ( this ) . find ( 'img' ) . show ( ) ;
46
+
47
+ var video = $ ( this ) . find ( 'video' ) ;
48
+ if ( video . length > 0 ) {
49
+ video . hide ( ) ;
50
+ video . get ( 0 ) . pause ( ) ;
51
+ video . get ( 0 ) . currentTime = 0 ;
52
+ }
53
+ } ) ;
54
+ }
22
55
function toggle_restore ( data ) {
23
56
if ( $ . isEmptyObject ( data ) ) {
24
57
return ;
69
102
success : toggle_restore
70
103
} ) ;
71
104
} ) ;
105
+ $ ( '.hover-shows-video' ) . each ( function ( ) {
106
+ ready_videos ( this ) ;
107
+ } ) ;
72
108
} ) ;
73
109
74
110
var search_results_url = '{% url ' dictionary:lemma_ajax_search_results ' %}' ;
@@ -116,25 +152,38 @@ <h3>{% trans "Update Lemma" %}</h3>
116
152
< input type ='hidden ' id ="gloss_id " name ="gloss_id " value ="{{gloss_id}} ">
117
153
< input class ='btn btn-primary ' type ='submit ' value ='{% trans "Update" %} '>
118
154
</ form >
155
+ < br >
119
156
< div >
120
157
{% if SHOW_DATASET_INTERFACE_OPTIONS %}
158
+ {% url 'dictionary:protected_media' '' as protected_media_url %}
121
159
{% csrf_token %}
122
- < table class ='table ' style ='width: 800px ; '>
160
+ < table class ='table ' style ='width: 1200px ; '>
123
161
< tr >
124
162
< th > {% trans "Dataset" %}</ th >
125
163
< td > < a href ="{{PREFIX_URL}}/datasets/{{object.dataset.acronym}} " > {{ object.dataset.acronym }}</ a > </ td >
126
164
</ tr >
127
165
< tr >
128
166
< th > {% trans "Glosses" %}</ th >
129
- < th > {% trans "Signbank ID" %}</ th >
167
+ < th > {% trans "Video" %}</ th >
168
+ < th style ="width:200px; "> {% trans "Signbank ID" %}</ th >
130
169
{% for dataset_lang in dataset_languages %}
131
- < th > {% trans "Annotation ID Gloss" %} ({{dataset_lang.name}})</ th >
170
+ < th style =" width:400px; " > {% trans "Annotation ID Gloss" %} ({{dataset_lang.name}})</ th >
132
171
{% endfor %}
133
172
< th > </ th >
134
173
</ tr >
135
174
{% for gloss, annotation_idgloss_translations in lemma_group_list %}
136
175
< tr > < td > </ td >
137
-
176
+ < td > {% if gloss.get_image_path or gloss.has_video %}
177
+ < div id ='glossvideo_{{gloss.id}} ' class ="hover-shows-video ">
178
+ < img class ="thumbnail " src ="{{protected_media_url}}{{gloss.get_image_url}} ">
179
+ {% if gloss.has_video %}
180
+ < video id ="videoplayer " class ="thumbnail-video "
181
+ src ="{{protected_media_url}}{{gloss.get_video_url}} "
182
+ type ="video/* " muted ="muted "> </ video >
183
+ {% endif %}
184
+ </ div >
185
+ {% endif %}
186
+ </ td >
138
187
< td id ="signbank_id_{{gloss.id}} "> {{gloss.id}} {% if gloss.archived %}({% trans "Archived" %}){% endif %}</ td >
139
188
{% for dataset_lang in dataset_languages %}
140
189
{% with gloss|get_annotation_idgloss_translation:dataset_lang as annotation_translation %}
@@ -151,13 +200,51 @@ <h3>{% trans "Update Lemma" %}</h3>
151
200
{% endfor %}
152
201
< td id ="restore_gloss_{{gloss.id}} ">
153
202
{% if gloss.archived and perms.dictionary.change_gloss %}
154
- < button id ='quick_restore_btn_{{gloss.id}} ' class ="quick_restore btn btn-danger "
203
+ < button id ='quick_restore_btn_{{gloss.id}} ' class ="quick_restore btn btn-success "
155
204
name ='quick_restore_{{gloss.id}} '
156
205
value ='{{gloss.id}} ' style ="height:36px; "
157
206
type ="submit " > {% trans "Restore Gloss" %}</ button >
158
207
159
208
{% endif %}
160
209
</ td >
210
+ < td id ="trash_gloss_{{gloss.id}} ">
211
+ {% if gloss.archived and perms.dictionary.change_gloss %}
212
+ < button id ='quick_trash_btn_{{gloss.id}} ' class ="quick_trash btn trash_button "
213
+ name ='quick_trash_{{gloss.id}} ' data-toggle ='modal ' data-target ='#delete_gloss_modal_{{gloss.id}} '
214
+ value ='{{gloss.id}} ' style ="font-size:20px;background-color:transparent; "
215
+ type ="submit " > < span class ='glyphicon glyphicon-trash '> </ span > </ button >
216
+
217
+ < div class ="modal fade " id ="delete_gloss_modal_{{gloss.id}} " tabindex ="-1 " role ="dialog " aria-labelledby ="#modalTitleDelete " aria-hidden ="true ">
218
+ < div class ="modal-dialog modal-lg left-modal ">
219
+ < div class ="modal-content ">
220
+ < div class ='modal-header '>
221
+ < h2 id ='modalTitleDelete '> {% trans "Delete This Sign" %}</ h2 >
222
+ < br >
223
+ < h4 > {% trans "Signbank ID" %}: {{gloss.id}}</ h4 >
224
+ {% with gloss.get_annotationidglosstranslation_texts as annotations %}
225
+ {% for lang in dataset_languages %}
226
+ < p > {{lang.name}}: {{annotations|get_item:lang.language_code_2char}}</ p >
227
+ {% endfor %}
228
+ {% endwith %}
229
+ </ div >
230
+ < div class ='modal-body '>
231
+ < p > {% trans "This action will delete this sign and all associated records. It cannot be undone." %}</ p >
232
+ </ div >
233
+ < form action ="{% url 'dictionary:trash_gloss' gloss.id %} " method ='post '>
234
+ {% csrf_token %}
235
+ < input type ='hidden ' name ='id ' value ='trash '>
236
+ < input type ='hidden ' name ='value ' value ='trash '>
237
+ < div class ="modal-footer ">
238
+ < button type ="button " class ="btn btn-primary " data-dismiss ="modal "> {% trans "Cancel" %}</ button >
239
+ < input type ="submit " class ="btn btn-danger " value ='{% trans "Confirm Delete" %} '>
240
+ </ div >
241
+ </ form >
242
+
243
+ </ div >
244
+ </ div >
245
+ </ div >
246
+ {% endif %}
247
+ </ td >
161
248
</ tr >
162
249
{% endfor %}
163
250
</ table >
0 commit comments