Last active
May 6, 2021 20:04
-
-
Save Kcko/d1e10ce0c936dd3e4ff8 to your computer and use it in GitHub Desktop.
Nette rendering - containers (form)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
public function createComponentRatingForm() | |
{ | |
$form = new Nette\Application\UI\Form; | |
$form->setTranslator($this->translator); | |
$messages = array( | |
'Bylo Vám zboží doručeno včas podle zadaného požadavku?' => 'double-line', | |
'Byl/a jste spokojený/á s kvalitou balení a označení?' => 'double-line', | |
'Byl/a jste spokojený/á s kvalitou přepravní služby?' => 'double-line', | |
'Vyhovuje Vám nabídka zboží?' => 'single-line', | |
'Co dalšího byste vylepšil/a?' => 'single-line', | |
); | |
$container = $form->addContainer('container'); | |
$part = 1; | |
foreach ($messages as $message => $class) | |
{ | |
$part++; | |
$sub = $container->addContainer($part); | |
$sub->addTextarea('question', $message); | |
$sub->addCheckbox('question_checkbox_yes', 'Ano'); | |
$sub->addCheckbox('question_checkbox_no', 'Ne'); | |
} | |
$form->addSubmit('submit'); | |
$form->onSuccess[] = $this->submit; | |
return $form; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{form ratingForm} | |
<div class="rating-form"> | |
{foreach $form['container']->components as $name => $container} | |
<div class="double-line"> | |
<div class="headline"> | |
{$form["container-$name-question"]->caption} | |
</div> | |
<div class="inputs"> | |
{* <textarea placeholder="Komentář" class="common autosize" rows="1"></textarea> *} | |
{input container-$name-question class => "common autosize", rows => "1"} | |
<!-- <input type="text" class="common" placeholder="Komentář" /> --> | |
<div class="radio-group"> | |
<label class="fakeradio"> | |
{input container-$name-question_checkbox_yes} | |
<span class="fakeradio"> | |
<span></span> | |
</span> | |
<span class="text">{$form["container-$name-question_checkbox_yes"]->caption}</span> | |
</label> | |
<label class="fakeradio"> | |
{input container-$name-question_checkbox_no} | |
<span class="fakeradio"> | |
<span></span> | |
</span> | |
<span class="text">{$form["container-$name-question_checkbox_no"]->caption}</span> | |
</label> | |
</div> | |
</div> | |
</div> | |
{/foreach} | |
<div> | |
<a class="cart-button arrow-right blue formSubmit" href=""><span class="inner">{_}Odeslat{/_}</span></a> | |
</div> | |
</div> | |
{input submit class => "nod"} | |
{/form} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment