Tepmlates fixes

This commit is contained in:
2022-01-26 21:30:25 +01:00
parent b4380aeb95
commit cddc8b970e
6 changed files with 123 additions and 82 deletions

View File

@@ -125,7 +125,7 @@ final class HomePresenter extends BaseFrontPresenter
$translation = $values->translation;
$clen = $values->clen;
$term = $values->string;
$result = $this->doSearch('TermsQuery',$translation,$term,$clen);
$this->template->result = $result;
}
@@ -171,56 +171,60 @@ final class HomePresenter extends BaseFrontPresenter
public function actionDefault()
{
if ($this->getRequest()->isMethod('GET') && $this->term) {
$this['searchForm']['string']->setValue($this->term);
$t = $this->slugs[$this->slug];
$result = $this->doSearch('TermsQuery',$t->id,$this->term);
if ($result) $this->template->result = $result;
}
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceeded');
/*
if ($this->getRequest()->isMethod('GET') && $this->term) {
$this['searchForm']['string']->setValue($this->term);
$t = $this->slugs[$this->slug];
$result = $this->doSearch('TermsQuery',$t->id,$this->term);
if ($result) $this->template->result = $result;
}
*/
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceeded');
}
public function actionSelect($slug,$term = null)
{
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceededIpa');
if ($this->getRequest()->isMethod('GET')) {
if (isset($this->slugs[$slug])) {
$t = $this->slugs[$slug];
$this['searchForm']['translation']->setValue($t->id);
$translation = $t;
}
} else {
$id = $this['searchForm']['translation']->value;
if (isset($this->translations[$id])) {
$t = $this->translations[$id];
$this->redirect('Homepage:select',$t["slug"],$this['searchForm']['string']->value);
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceededIpa');
if ($this->getRequest()->isMethod('GET')) {
if (isset($this->slugs[$slug])) {
$t = $this->slugs[$slug];
$this['searchForm']['translation']->setValue($t->id);
$translation = $t;
}
} 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);
}
}
}
if ($term) {
$query = new TermsFullQuery($translation->dictionary,$term,$translation->direction);
$result = $this->repoTerms->fetch($query);
if ($term) {
$query = new TermsFullQuery($translation->dictionary,$term,$translation->direction);
$result = $this->repoTerms->fetch($query);
$this->template->result = $result;
$this->template->translation = $translation;
}
$this->setView('ipa');
$this->template->result = $result;
$this->template->translation = $translation;
}
$this->setView('ipa');
}
public function handleGetInfo($id)
{
$term = $this->repoTerms->find($id);
$termFlags = $this->repoTermFlags->findAssoc([],'id');
$term = $this->repoTerms->find($id);
$termFlags = $this->repoTermFlags->findAssoc([],'id');
$dictionary = $term->dictionary;
$dictionary = $term->dictionary;
$query = new TermsFullQuery($dictionary,$term->string1,1,false);
$result = $this->repoTerms->fetch($query);
$query = new TermsFullQuery($dictionary,$term->string1,1,false);
$result = $this->repoTerms->fetch($query);
$this->template->result = $result;
$this->template->termFlags = $termFlags;
$this->template->result = $result;
$this->template->termFlags = $termFlags;
$this->setView('info');
$this->setView('info');
}
public function renderDefault()

View File

@@ -31,7 +31,7 @@ $( document ).ready(function() {
{/block}
{block content}
<div id="content">
<p>Zadaj vyhladavany vyraz.</p>
<h2>Zadaj vyhladavany vyraz.</h2>
<div class="boxes">
{form searchForm}

View File

@@ -1,5 +1,4 @@
{block title}Slovnik{/block}
{layout ../@layout.latte}
{block head}
<script>
$( document ).ready(function() {
@@ -7,7 +6,7 @@ $( document ).ready(function() {
event.preventDefault();
id = $(this).attr("data-sound-id");
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', {link Homepage:play} + "/" + id);
audioElement.setAttribute('src', {link Home:play} + "/" + id);
console.log("Play sound:" + id);
audioElement.play();
});
@@ -17,7 +16,7 @@ $(function() {
$("input[name=" + select_name + "]").autocomplete({
source: function( request, response ) {
$.ajax({
url: "{!$presenter->link('autocomplete')}",
url: {!$presenter->link('autocomplete')},
data: {
whichData: select_name,
typedText: request.term,
@@ -94,8 +93,8 @@ $(function() {
{$last == $term->string1 && trim($last2) != '' && trim($term->string2) != '' ? ', ' : ''}{$term->string2}{**
Nutne kvoli newline
**}
{? $last = $term->string1}
{? $last2 = $term->string2}
{var $last = $term->string1}
{var $last2 = $term->string2}
{/foreach}
</table>
{/ifset}

View File

@@ -1,5 +1,4 @@
{block title}Slovnik{/block}
{layout ../@layout.latte}
{block head}
<script>
$( document ).ready(function() {
@@ -7,7 +6,7 @@ $( document ).ready(function() {
event.preventDefault();
id = $(this).attr("data-sound-id");
var audioElement = document.createElement('audio');
var link = {link Homepage:play 123456 };
var link = {link Home:play 123456 };
audioElement.setAttribute('src', link.replace('123456',id));
console.log("Play sound:" + id);
audioElement.play();
@@ -56,8 +55,8 @@ $( document ).ready(function() {
{$last == $term->string1 && trim($last2) != '' && trim($term->string2) != '' ? ', ' : ''}{$term->string2}{**
Nutne kvoli newline
**}
{? $last = $term->string1}
{? $last2 = $term->string2}
{var $last = $term->string1}
{var $last2 = $term->string2}
{/foreach}
</table>
{/ifset}