Files
slovnik30/app/modules/Front/Search/templates/default.latte
2022-01-28 20:25:36 +01:00

65 lines
1.8 KiB
Plaintext

{block head}
<script>
$( document ).ready(function() {
console.log( "ready!" );
$("tr[id*='term']").on("click",function () {
var id = this.id + '-info';
if ($('#' + id).length == 0) {
$(this).after('<tr id=' + '"' + id + '"></tr>');
console.log('Append ' + id);
$.ajax({
url: $(this).attr('data-url'),
context: $('#' + id)
}).done(function (response) {
console.log(response);
$(this).html("<td colspan='4'>" + response + "</td>");
$("img.ajax").on("click", function (event) {
event.preventDefault();
id = $(this).attr("data-sound-id");
var audioElement = document.createElement('audio');
var link = {link Home:play 1234567};
audioElement.setAttribute('src', link.replace('1234567',id));
console.log("Play sound:" + id);
audioElement.play();
});
});
}
});
});
</script>
{/block}
{block content}
<div class="boxes">
{ifset $result}
<table class="e-table" n:snippet="termsComnainer">
<tr>
<th>Vyraz</th><th>Preklad</th><th>Typ</th><th>Member</th>
</tr>
{foreach $result as $term}
<tr data-url="{link getInfo! $term->id}" n:snippet="term-$term->id">
{if $translation->getDirection() == 1}
<td>{$term->string1}{if $term->suffix1}&nbsp;{$term->suffix1->text}{/if}</td>
<td>{$term->string2}{if $term->suffix2}&nbsp;{$term->suffix2->text}{/if}</td>
{else}
<td>{$term->string2}{if $term->suffix2}&nbsp;{$term->suffix2->text}{/if}</td>
<td>{$term->string1}{if $term->suffix1}&nbsp;{$term->suffix1->text}{/if}</td>
{/if}
<td n:attr="title => $term->type ? $dicttypes[$term->type->id]->fullName : null">{$term->type ? $dicttypes[$term->type->id]->shortName : ''}</td>
<td>{$term->member}</td>
</tr>
{/foreach}
</table>
{/ifset}
</div>
{/block}