Projekt

Obecné

Profil

Stáhnout (14.2 KB) Statistiky
| Větev: | Revize:
1
<div id="detail-modal" class="modal fade" role="dialog">
2
    <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
3
        <div class="modal-content">
4
            <div class="modal-header">
5
                <h4 class="modal-title">Detail záznamu</h4>
6
                <button type="button" class="close" data-dismiss="modal">&times;</button>
7
            </div>
8
            <div class="modal-body">
9
                <div class="container">
10
                    <div class="row">
11
                        <div class="col-xs-12 col-sm-4">
12
                            <label>Lemma:</label>
13
                        </div>
14
                        <div class="col-xs-12 col-sm-8">
15
                            <i id="lemma"></i>
16
                        </div>
17
                    </div>
18
                    <div class="row">
19
                        <div class="col-xs-12 col-sm-4">
20
                            <label>Slovní tvar:</label>
21
                        </div>
22
                        <div class="col-xs-12 col-sm-8">
23
                            <i id="word"></i>
24
                        </div>
25
                    </div>
26
                    <div class="row">
27
                        <div class="col-xs-12 col-sm-4">
28
                            <label>Datum přídání:</label>
29
                        </div>
30
                        <div class="col-xs-12 col-sm-8">
31
                            <i id="date"></i>
32
                        </div>
33
                    </div>
34
                    <div class="row">
35
                        <div class="col-xs-12 col-sm-4">
36
                            <label>Poznámka:</label>
37
                        </div>
38
                        <div class="col-xs-12 col-sm-8">
39
                            <i id="description"></i>
40
                        </div>
41
                    </div>
42
                    <div class="row">
43
                        <div class="col-xs-12 col-sm-4">
44
                            <label>Doplňující údaj:</label>
45
                        </div>
46
                        <div class="col-xs-12 col-sm-8">
47
                            <i id="description2"></i>
48
                        </div>
49
                    </div>
50
                    <?php if(isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == true) {?>
51
                    <div class="row">
52
                        <div class="col-xs-12 col-sm-4">
53
                            <label>Varia:</label>
54
                        </div>
55
                        <div class="col-xs-12 col-sm-8">
56
                            <i id="description3"></i>
57
                        </div>
58
                    </div>
59
                    <?php }?>
60
                    <div class="row">
61
                        <div class="col-xs-12 col-sm-4">
62
                            <label>Rukopisy:</label>
63
                        </div>
64
                        <div class="col-xs-12 col-sm-8">
65
                            <i id="manuscript"></i>
66
                        </div>
67
                    </div>
68
                    <div class="row">
69
                        <div class="col-xs-12 col-sm-4">
70
                            <label>Pozice:</label>
71
                        </div>
72
                        <div class="col-xs-12 col-sm-8">
73
                            <i id="position"></i>
74
                        </div>
75
                    </div>
76
                    <div class="row">
77
                        <div class="col-xs-12 col-sm-4">
78
                            <label>Vlastní jméno:</label>
79
                        </div>
80
                        <div class="col-xs-12 col-sm-8">
81
                            <i id="namedentity"></i>
82
                        </div>
83
                    </div>
84
                    <div class="row">
85
                        <div class="col-xs-12 col-sm-4">
86
                            <label>Slovní druh:</label>
87
                        </div>
88
                        <div class="col-xs-12 col-sm-8">
89
                            <i id="wordclass"></i>
90
                        </div>
91
                    </div>
92

    
93
                    <!-- conditional render -->
94
                    <div class="row" id="person-wrapper">
95
                        <div class="col-xs-12 col-sm-4">
96
                            <label>Osoba:</label>
97
                        </div>
98
                        <div class="col-xs-12 col-sm-8">
99
                            <i id="person"></i>
100
                        </div>
101
                    </div>
102
                    <div class="row" id="case-wrapper">
103
                        <div class="col-xs-12 col-sm-4">
104
                            <label>Pád:</label>
105
                        </div>
106
                        <div class="col-xs-12 col-sm-8">
107
                            <i id="case"></i>
108
                        </div>
109
                    </div>
110
                    <div class="row" id="countability-wrapper">
111
                        <div class="col-xs-12 col-sm-4">
112
                            <label>Číslo:</label>
113
                        </div>
114
                        <div class="col-xs-12 col-sm-8">
115
                            <i id="countability"></i>
116
                        </div>
117
                    </div>
118
                    <div class="row" id="mood-wrapper">
119
                        <div class="col-xs-12 col-sm-4">
120
                            <label>Způsob:</label>
121
                        </div>
122
                        <div class="col-xs-12 col-sm-8">
123
                            <i id="mood"></i>
124
                        </div>
125
                    </div>
126
                    <div class="row" id="time-wrapper">
127
                        <div class="col-xs-12 col-sm-4">
128
                            <label>Čas:</label>
129
                        </div>
130
                        <div class="col-xs-12 col-sm-8">
131
                            <i id="time"></i>
132
                        </div>
133
                    </div>
134
                    <div class="row" id="v-type-wrapper">
135
                        <div class="col-xs-12 col-sm-4">
136
                            <label>Slovesný rod:</label>
137
                        </div>
138
                        <div class="col-xs-12 col-sm-8">
139
                            <i id="v-type"></i>
140
                        </div>
141
                    </div>
142
                    <div class="row" id="vid-wrapper">
143
                        <div class="col-xs-12 col-sm-4">
144
                            <label>Slovesný vid:</label>
145
                        </div>
146
                        <div class="col-xs-12 col-sm-8">
147
                            <i id="vid"></i>
148
                        </div>
149
                    </div>
150
                    <div class="row" id="irregular-wrapper">
151
                        <div class="col-xs-12 col-sm-4">
152
                            <label>Neurčitý slovesný tvar:</label>
153
                        </div>
154
                        <div class="col-xs-12 col-sm-8">
155
                            <i id="irregular"></i>
156
                        </div>
157
                    </div>
158
                    <div class="row" id="gender-wrapper">
159
                        <div class="col-xs-12 col-sm-4">
160
                            <label>Rod:</label>
161
                        </div>
162
                        <div class="col-xs-12 col-sm-8">
163
                            <i id="gender"></i>
164
                        </div>
165
                    </div>
166
                    <div class="row" id="shape-wrapper">
167
                        <div class="col-xs-12 col-sm-4">
168
                            <label>Tvar:</label>
169
                        </div>
170
                        <div class="col-xs-12 col-sm-8">
171
                            <i id="shape"></i>
172
                        </div>
173
                    </div>
174
                    <div class="row" id="grade-wrapper">
175
                        <div class="col-xs-12 col-sm-4">
176
                            <label>Stupeň:</label>
177
                        </div>
178
                        <div class="col-xs-12 col-sm-8">
179
                            <i id="grade"></i>
180
                        </div>
181
                    </div>
182
                    <div class="row" id="type-wrapper">
183
                        <div class="col-xs-12 col-sm-4">
184
                            <label>Druh:</label>
185
                        </div>
186
                        <div class="col-xs-12 col-sm-8">
187
                            <i id="type"></i>
188
                        </div>
189
                    </div>
190
                    <div class="row" id="k-type-wrapper">
191
                        <div class="col-xs-12 col-sm-4">
192
                            <label>Typ:</label>
193
                        </div>
194
                        <div class="col-xs-12 col-sm-8">
195
                            <i id="k-type"></i>
196
                        </div>
197
                    </div>
198
                </div>
199
            </div>
200
            <div class="modal-footer">
201
                <button type="button" class="btn btn-default" data-dismiss="modal">Zavřít</button>
202
            </div>
203
        </div>
204
    </div>
205
</div>
206

    
207
<script>
208
    $('#detail-modal').on('show.bs.modal', function (event) {
209
        const button = $(event.relatedTarget);
210
        const pseudo_id = button.data('pseudo-id') ;// Extract info from data-* attributes
211

    
212
        const data_obj = data[pseudo_id];
213
        let modal = $(this);
214

    
215
        modal.find('#word').text(data_obj.context + " " + data_obj.word);
216
        modal.find('#lemma').text(data_obj.lemma.lemma);
217
        modal.find('#description').text(data_obj.description === ""? "-" :  normalizeDescription(data_obj.description));
218
        modal.find('#description2').text(data_obj.description2 === ""? "-" :  normalizeDescription(data_obj.description2));
219
        modal.find('#description3').text(data_obj.description3 === ""? "-" :  normalizeDescription(data_obj.description3));
220
        modal.find('#date').text(convertDate(data_obj.date));
221
        modal.find('#manuscript').text(renderManuscript(data_obj.manuscript, false));
222
        modal.find('#position').text(data_obj.position1 + (data_obj.position2 ? ("/" + data_obj.position2 + (data_obj.positiondetail ? "/"  + data_obj.positiondetail :  "")) : ""));
223
        modal.find('#namedentity').text(data_obj.namedentity === 1? "ano" :  "ne");
224

    
225
        const morphem = data_obj.tag.tag;
226
        analyzeMorphem(modal, morphem);
227
    });
228

    
229
    function analyzeMorphem(modal, morphem) {
230
        modal.find('#wordclass').text(codeToWordclass[morphem.charAt(0)]);
231

    
232
        let movedNode;
233
        let beforeNode;
234
        if(morphem.charAt(0) === 'V') {
235
            movedNode = document.getElementById("case-wrapper");
236
            beforeNode = document.getElementById(null);
237
            movedNode.parentNode.insertBefore(movedNode, beforeNode);
238
        } else {
239
            movedNode = document.getElementById("case-wrapper");
240
            beforeNode = document.getElementById("countability-wrapper");
241
            movedNode.parentNode.insertBefore(movedNode, beforeNode);
242
        }
243

    
244
        (morphem.charAt(1) === '-') ? modal.find('#case-wrapper').hide() :
245
            modal.find('#case-wrapper').show();
246
        modal.find('#case').text(codeToCase[morphem.charAt(1)]);
247

    
248
        (morphem.charAt(2) === '-') ? modal.find('#countability-wrapper').hide() :
249
            modal.find('#countability-wrapper').show();
250
        modal.find('#countability').text(codeToCountability[morphem.charAt(2)]);
251

    
252
        (morphem.charAt(3) === '-') ? modal.find('#gender-wrapper').hide() :
253
            modal.find('#gender-wrapper').show();
254
        modal.find('#gender').text(codeToGender[morphem.charAt(3)]);
255

    
256
        (morphem.charAt(4) === '-') ? modal.find('#grade-wrapper').hide() :
257
            modal.find('#grade-wrapper').show();
258
        modal.find('#grade').text(codeToGrade[morphem.charAt(4)]);
259

    
260
        (morphem.charAt(5) === '-') ? modal.find('#shape-wrapper').hide() :
261
            modal.find('#shape-wrapper').show();
262
        modal.find('#shape').text(codeToShape[morphem.charAt(5)]);
263

    
264
        if(morphem.charAt(7) === '-'){
265
            modal.find('#k-type-wrapper').hide();
266
            modal.find('#type-wrapper').hide();
267
            modal.find('#mood-wrapper').hide();
268
            modal.find('#irregular-wrapper').hide();
269
        } else {
270
            if(morphem.charAt(0) === 'J') {
271
                modal.find('#mood-wrapper').hide();
272
                modal.find('#type-wrapper').hide();
273
                modal.find('#irregular-wrapper').hide();
274

    
275
                modal.find('#k-type-wrapper').show();
276
                modal.find('#k-type').text(codeToKType[morphem.charAt(7)]);
277
            } else if(morphem.charAt(0) === 'P') {
278
                modal.find('#k-type-wrapper').hide();
279
                modal.find('#mood-wrapper').hide();
280
                modal.find('#irregular-wrapper').hide();
281

    
282
                modal.find('#type-wrapper').show();
283
                modal.find('#type').text(codeToType[morphem.charAt(7)]);
284
            } else if(morphem.charAt(0) === 'V') {
285
                modal.find('#k-type-wrapper').hide();
286
                modal.find('#type-wrapper').hide();
287

    
288
                if(codeToMood[morphem.charAt(7)] !== undefined){
289
                    modal.find('#irregular-wrapper').hide();
290
                    modal.find('#mood-wrapper').show();
291
                    modal.find('#mood').text(codeToMood[morphem.charAt(7)]);
292
                } else {
293
                    modal.find('#mood-wrapper').hide();
294
                    modal.find('#irregular-wrapper').show();
295
                    modal.find('#irregular').text(codeToIrregular[morphem.charAt(7)]);
296
                }
297
            } else {
298
                modal.find('#k-type-wrapper').hide();
299
                modal.find('#type-wrapper').hide();
300
                modal.find('#mood-wrapper').hide();
301
                modal.find('#irregular-wrapper').hide();
302
            }
303
        }
304

    
305
        (morphem.charAt(8) === '-') ? modal.find('#person-wrapper').hide() :
306
            modal.find('#person-wrapper').show();
307
        modal.find('#person').text(morphem.charAt(8) + ".");
308

    
309
        (morphem.charAt(9) === '-') ? modal.find('#time-wrapper').hide() :
310
            modal.find('#time-wrapper').show();
311
        modal.find('#time').text(codeToTime[morphem.charAt(9)]);
312

    
313
        (morphem.charAt(10) === '-') ? modal.find('#v-type-wrapper').hide() :
314
            modal.find('#v-type-wrapper').show();
315
        modal.find('#v-type').text(codeToVType[morphem.charAt(10)]);
316

    
317
        (morphem.charAt(11) === '-') ? modal.find('#vid-wrapper').hide() :
318
            modal.find('#vid-wrapper').show();
319
        modal.find('#vid').text(codeToVid[morphem.charAt(11)]);
320
    }
321
</script>
(2-2/10)