Revize d99d8a5b
Přidáno uživatelem Ondřej Anděl před téměř 4 roky(ů)
application/view/modals/editModal.html | ||
---|---|---|
9 | 9 |
<div class="container"> |
10 | 10 |
<div class="row my-1"> |
11 | 11 |
<div class="col-xs-12 col-sm-4"> |
12 |
<label for="lemma">Lemma:</label> |
|
12 |
<label for="lemma">Lemma: <b class="required">*</b></label>
|
|
13 | 13 |
</div> |
14 | 14 |
<div class="col-xs-12 col-sm-8"> |
15 | 15 |
<input class="min-wdth" id="lemma"/> |
... | ... | |
17 | 17 |
</div> |
18 | 18 |
<div class="row my-1"> |
19 | 19 |
<div class="col-xs-12 col-sm-4"> |
20 |
<label for="word">Slovo:</label> |
|
20 |
<label for="word">Slovo: <b class="required">*</b></label>
|
|
21 | 21 |
</div> |
22 | 22 |
<div class="col-xs-12 col-sm-8"> |
23 | 23 |
<input class="min-wdth" id="word"/> |
... | ... | |
50 | 50 |
</div> |
51 | 51 |
<div class="row my-1"> |
52 | 52 |
<div class="col-xs-12 col-sm-4"> |
53 |
<label for="position">Pozice:</label> |
|
53 |
<label for="position">Pozice: <b class="required">*</b></label>
|
|
54 | 54 |
</div> |
55 | 55 |
<div class="col-xs-12 col-sm-8"> |
56 | 56 |
<input class="min-wdth" id="position" title="Jedotlivé oddíly zadávejte oddělené lomítkem (bez mezery)" /> |
... | ... | |
98 | 98 |
</div> |
99 | 99 |
<div class="row my-1"> |
100 | 100 |
<div class="col-xs-12 col-sm-4"> |
101 |
<label for="wordclass">Slovní druh:</label> |
|
101 |
<label for="wordclass">Slovní druh: <b class="required">*</b></label>
|
|
102 | 102 |
</div> |
103 | 103 |
<div class="col-xs-12 col-sm-8"> |
104 | 104 |
<select class="min-wdth" onchange="changeWordType()" id="wordclass"> |
... | ... | |
329 | 329 |
changeWordType(); |
330 | 330 |
modal.find('#submit-but').text("Založit"); |
331 | 331 |
modal.find('#submit-but').click(() => createData(modal)); |
332 |
|
|
333 |
enableSubmit(modal); |
|
334 |
modal.find("#lemma").change(() => enableSubmit(modal)); |
|
335 |
modal.find("#word").change(() => enableSubmit(modal)); |
|
336 |
modal.find("#position").change(() => enableSubmit(modal)); |
|
337 |
modal.find("#wordclass").change(() => enableSubmit(modal)); |
|
332 | 338 |
} else { |
333 | 339 |
const data_obj = data[pseudo_id]; |
334 | 340 |
modal.find('#submit-but').text("Upravit"); |
... | ... | |
338 | 344 |
prefill(modal, data_obj); |
339 | 345 |
moodMChange(modal); |
340 | 346 |
irregularMChange(modal); |
347 |
|
|
348 |
enableSubmit(modal); |
|
349 |
modal.find("#lemma").change(() => enableSubmit(modal)); |
|
350 |
modal.find("#word").change(() => enableSubmit(modal)); |
|
351 |
modal.find("#position").change(() => enableSubmit(modal)); |
|
352 |
modal.find("#wordclass").change(() => enableSubmit(modal)); |
|
341 | 353 |
} |
342 | 354 |
}); |
343 | 355 |
|
... | ... | |
650 | 662 |
} |
651 | 663 |
} |
652 | 664 |
|
665 |
function enableSubmit(modal) { |
|
666 |
if ( |
|
667 |
modal.find("#lemma")[0].value === "" || |
|
668 |
modal.find("#word")[0].value === "" || |
|
669 |
modal.find("#position")[0].value === "" || |
|
670 |
modal.find("#wordclass")[0].value === "" |
|
671 |
) { |
|
672 |
modal.find("#submit-but").prop("disabled", true); |
|
673 |
} else { |
|
674 |
modal.find("#submit-but").prop("disabled", false); |
|
675 |
} |
|
676 |
} |
|
677 |
|
|
653 | 678 |
function editData(data, modal){ |
654 | 679 |
const formData = prepareFormData(modal); |
655 | 680 |
formData.append("id", data.id); |
application/view/modals/editUserModal.html | ||
---|---|---|
9 | 9 |
<div class="container"> |
10 | 10 |
<div class="row my-1" id="username-wrapper"> |
11 | 11 |
<div class="col-xs-12 col-sm-4"> |
12 |
<label for="username">Uživatelské jméno:</label> |
|
12 |
<label for="username">Uživatelské jméno: <b class="required">*</b></label>
|
|
13 | 13 |
</div> |
14 | 14 |
<div class="col-xs-12 col-sm-8"> |
15 | 15 |
<input class="min-wdth" id="username"/> |
... | ... | |
25 | 25 |
</div> |
26 | 26 |
<div class="row my-1"> |
27 | 27 |
<div class="col-xs-12 col-sm-4"> |
28 |
<label for="email">Email:</label> |
|
28 |
<label for="email">Email: <b class="required">*</b></label>
|
|
29 | 29 |
</div> |
30 | 30 |
<div class="col-xs-12 col-sm-8"> |
31 | 31 |
<input class="min-wdth" id="email"/> |
... | ... | |
33 | 33 |
</div> |
34 | 34 |
<div class="row my-1"> |
35 | 35 |
<div class="col-xs-12 col-sm-4"> |
36 |
<label for="rights">Práva:</label> |
|
36 |
<label for="rights">Práva: <b class="required">*</b></label>
|
|
37 | 37 |
</div> |
38 | 38 |
<div class="col-xs-12 col-sm-8"> |
39 | 39 |
<select class="min-wdth" id="rights"> |
... | ... | |
68 | 68 |
modal.find("#username-wrapper").show(); |
69 | 69 |
modal.find("#password-wrapper").show(); |
70 | 70 |
modal.find('#submit-but').click(() => createData(modal)); |
71 |
|
|
72 |
enableSubmit(modal, true); |
|
73 |
modal.find("#email").change(() => enableSubmit(modal, true)); |
|
74 |
modal.find("#rights").change(() => enableSubmit(modal, true)); |
|
75 |
modal.find("#username").change(() => enableSubmit(modal, true)); |
|
71 | 76 |
} else { |
72 | 77 |
const data_obj = users[pseudo_id]; |
73 | 78 |
modal.find('#submit-but').text("Upravit"); |
... | ... | |
75 | 80 |
modal.find("#password-wrapper").hide(); |
76 | 81 |
modal.find('#submit-but').click(() => editData(data_obj, modal)); |
77 | 82 |
prefill(modal, data_obj); |
83 |
|
|
84 |
enableSubmit(modal, false); |
|
85 |
modal.find("#email").change(() => enableSubmit(modal, true)); |
|
86 |
modal.find("#rights").change(() => enableSubmit(modal, true)); |
|
87 |
modal.find("#username").change(() => enableSubmit(modal, true)); |
|
78 | 88 |
} |
79 | 89 |
}); |
80 | 90 |
|
91 |
function enableSubmit(modal, createNew){ |
|
92 |
if( |
|
93 |
modal.find("#email")[0].value === "" || |
|
94 |
modal.find("#rights")[0].value === "" || |
|
95 |
(modal.find("#username")[0].value === "" && !createNew) |
|
96 |
){ |
|
97 |
modal.find("#submit-but").prop( "disabled", true ); |
|
98 |
} else { |
|
99 |
modal.find("#submit-but").prop( "disabled", false ); |
|
100 |
} |
|
101 |
} |
|
81 | 102 |
|
82 | 103 |
function prefill(modal, data = null){ |
83 | 104 |
modal.find("#username").val(""); |
application/view/style.css | ||
---|---|---|
22 | 22 |
height: 80%; |
23 | 23 |
} |
24 | 24 |
|
25 |
.required { |
|
26 |
color: red; |
|
27 |
} |
|
28 |
|
|
25 | 29 |
.app-content .menu { |
26 | 30 |
background-color: #e0e9d8; |
27 | 31 |
border-right: #4B4B4B solid 2px; |
Také k dispozici: Unified diff
Bug #8692: Povinné prvky u modalů