Fix nette 3.0

This commit is contained in:
2022-01-30 22:35:13 +01:00
parent 7ecaa70768
commit a4b67569a4
9 changed files with 82 additions and 53 deletions

View File

@@ -21,26 +21,6 @@ use App\Model\Database\Facade\TermFacade;
final class HomePresenter extends BaseFrontPresenter
{
/**
* @return AlesWita\Components\VisualPaginator
*/
protected function createComponentPaginator(): VisualPaginator
{
$paginator = $this->visualPaginatorFactory->create();
$paginator->ajax = false;
$paginator->canSetItemsPerPage = true;
$paginator->setItemsPerPage(100);
//$paginator->templateFile = __DIR__ . '/my_awesome_template.latte';
return $paginator;
}
public function searchFormSucceededIpa(UI\Form $form, $values)
{
$translation = $values->translation;
@@ -96,7 +76,6 @@ final class HomePresenter extends BaseFrontPresenter
} else {
$id = $this['searchForm']['translation']->value;
dump($id);
if (isset($this->translations[$id])) {
$t = $this->translations[$id];
$this->redirect('Front:Home:select', $t["slug"], $this['searchForm']['string']->value);
@@ -120,15 +99,7 @@ final class HomePresenter extends BaseFrontPresenter
public function actionIpa()
{
if ($this->getRequest()->isMethod('GET')) {
if ($this->term) {
$this['searchForm']['string']->setValue($this->term);
$result = $this->doSearch('TermsFullQuery', $this->slugs[$this->slug]->id, $this->term);
if ($result) $this->template->result = $result;
}
}
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceededIpa');
$this->redirect('Search:ipa',$this->translation,$this->term);
}
public function actionInteractive()

View File

@@ -1,58 +0,0 @@
{block title}Slovnik{/block}
{block head}
<script>
$( document ).ready(function() {
$("img.ajax").on("click", function (event) {
event.preventDefault();
id = $(this).attr("data-sound-id");
var audioElement = document.createElement('audio');
var link = {link Home:play 123456 };
audioElement.setAttribute('src', link.replace('123456',id));
console.log("Play sound:" + id);
audioElement.play();
});
});
</script>
{/block}
{block content}
{block form}
{/block}
{ifset $result}
<table class="trans">
<tr>
<th>Preklad</th>
</tr>
{var $last = ''}
{foreach $result as $term}
{if ($last != $term->string1 && $last != '') }
</div>
</td>
</tr>
{/if}
{if $last != $term->string1}
<tr>
<td>
<span class="term">{$term->string1}</span>&nbsp;
{foreach $term->pronunciations as $pron}
<span class="ipa-{$pron->type->id}">[{$pron->ipa}]</span>
<img n:if="$pron->filename" class="sound-ipa ajax" src="/images/sound.png" alt="Prehraj" style="vertical-align: middle;" data-sound-id="{$pron->id}" ></image>
{/foreach}
<br/>
<div style="margin-left: 20px;" class="translations">
{/if}
{$last == $term->string1 && trim($last2) != '' && trim($term->string2) != '' ? ', ' : ''}{$term->string2}{**
Nutne kvoli newline
**}
{var $last = $term->string1}
{var $last2 = $term->string2}
{/foreach}
</table>
{/ifset}
{/form}
{control paginator}
</div>
{/block}