Revize 6c152ae0
Přidáno uživatelem Ondřej Drtina před téměř 4 roky(ů)
application/view/modals/removeModal.html | ||
---|---|---|
8 | 8 |
<div class="modal-body"> |
9 | 9 |
<div class="container"> |
10 | 10 |
<div class="row"> |
11 |
<p>Opravdu chcete odstranit zvolený záznam?</p>
|
|
11 |
<p id="mesBody"></p>
|
|
12 | 12 |
</div> |
13 | 13 |
</div> |
14 | 14 |
</div> |
15 | 15 |
<div class="modal-footer"> |
16 |
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="removeSelectedItem()">Ano</button> |
|
16 |
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="removeSelectedItem(document.getElementById('idToRemoveInput').value)">Ano</button>
|
|
17 | 17 |
<button type="button" class="btn btn-default" data-dismiss="modal">Ne</button> |
18 |
</div> |
|
18 |
<input type="hidden" id="idToRemoveInput" /> |
|
19 |
</div> |
|
19 | 20 |
</div> |
20 | 21 |
</div> |
21 | 22 |
</div> |
22 | 23 |
|
23 | 24 |
<script> |
24 |
$('#remove-modal').on('show.bs.modal', function (event){ |
|
25 |
$('#remove-modal').on('show.bs.modal', function (event){ //wait for modal to show
|
|
25 | 26 |
const button = $(event.relatedTarget); |
26 | 27 |
const pseudo_id = button.data('pseudo-id');//Extract info from data-* attributes |
27 | 28 |
|
28 | 29 |
const data_obj = data[pseudo_id]; |
29 | 30 |
let modal = $(this); |
30 | 31 |
|
31 |
alert("id: " + data_obj.id); |
|
32 |
modal.find('#mesBody').text("Opravdu chcete odstranit záznam týkající se slova \"" + data_obj.word + "\"?"); |
|
33 |
modal.find('#idToRemoveInput').val(data_obj.id); //assign id to delete to hidden input |
|
32 | 34 |
}); |
33 | 35 |
</script> |
Také k dispozici: Unified diff
funkční remove, ještě opravím drobnosti (err v console.log) - nicméně funguje