1- # Rozšíření pro WebChemistry\Forms\Form
1+ # Form wizard for nette/forms
2+ [ ![ Build Status] ( https://travis-ci.org/WebChemistry/Forms-Wizard.svg?branch=master )] ( https://travis-ci.org/WebChemistry/Forms-Wizard )
23
3- ## Instalace
4+ ## Installation
45
56** Composer**
67```
@@ -11,10 +12,12 @@ composer require webchemistry/forms-wizard
1112
1213``` yaml
1314extensions :
14- - WebChemistry\Forms\Controls\DI\WizardExtension
15+ - WebChemistry\Forms\Controls\DI\WizardExtension # # Autoregistration of macros
1516` ` `
1617
17- ## Komponenta
18+ # Usage
19+
20+ ## Component
1821
1922` ` ` php
2023class Wizard extends WebChemistry\Forms\Wizard\Component {
@@ -26,10 +29,10 @@ class Wizard extends WebChemistry\Forms\Wizard\Component {
2629 protected function createStep1() {
2730 $form = $this->getForm();
2831
29- $form->addText('name', 'Uživatelské jméno ')
32+ $form->addText('name', 'User name ')
3033 ->setRequired();
3134
32- $form->addSubmit(self::NEXT_SUBMIT_NAME, 'Další ');
35+ $form->addSubmit(self::NEXT_SUBMIT_NAME, 'Next ');
3336
3437 return $form;
3538 }
@@ -40,20 +43,48 @@ class Wizard extends WebChemistry\Forms\Wizard\Component {
4043 $form->addText('email', 'Email')
4144 ->setRequired();
4245
43- $form->addSubmit(self::PREV_SUBMIT_NAME, 'Zpět ');
44- $form->addSubmit(self::FINISH_SUBMIT_NAME, 'Registrovat ');
46+ $form->addSubmit(self::PREV_SUBMIT_NAME, 'Back ');
47+ $form->addSubmit(self::FINISH_SUBMIT_NAME, 'Register ');
4548
4649 return $form;
4750 }
4851}
4952```
5053
51- ## Šablona
54+ ``` yaml
55+ services :
56+ - Wizard
57+ ` ` `
58+
59+ ## Presenter
60+
61+ ` ` ` php
62+
63+ class HomepagePresenter extends Nette\Application\UI\Presenter {
64+
65+ /** @var Wizard */
66+ private $wizard;
67+
68+ public function __construct(Wizard $wizard) {
69+ $this->wizard = $wizard;
70+ }
71+
72+ protected function createComponentWizard() {
73+ return $this->wizard;
74+ }
75+
76+ }
77+
78+ ```
79+
80+ ## Template
5281
5382``` html
5483<div n:wizard =" wizard" >
5584 <ul n:if =" !$wizard->isSuccess()" >
56- <li n:foreach =" $wizard->steps as $step" n:class =" $wizard->isDisabled($step) ? disabled, $wizard->isActive($step) ? active" ><a n:tag-if =" $wizard->useLink($step)" n:href =" changeStep! $step" >{$step}</a ></li >
85+ <li n:foreach =" $wizard->steps as $step" n:class =" $wizard->isDisabled($step) ? disabled, $wizard->isActive($step) ? active" >
86+ <a n:tag-if =" $wizard->useLink($step)" n:href =" changeStep! $step" >{$step}</a >
87+ </li >
5788 </ul >
5889
5990 {step 1}
@@ -65,7 +96,7 @@ class Wizard extends WebChemistry\Forms\Wizard\Component {
6596 {/step}
6697
6798 {step success}
68- Úspěšně jste se registroval/a.
99+ Registration was successful
69100 {/step}
70101</div >
71102```
0 commit comments