who knows Semantic UI CSS Tool?

Notice: This thread is very old.
hegerworld
Member | 4
+
0
-

Who has already used Nette together with Semantic UI?
I implement a project with this wonderful CSS tool. semantic-ui.com
Has anyone already gained experience? I would like to exchange.

Bye, Michael

Zapotocny
Member | 16
+
0
-

Hi,

i want to work with semantic ui, but i am stucked, at rendering checkbox.
Because nette renders checkbox this way

<label><input/></label>

and semantic wants

<label></label>
<input/>

So far, it works great, but i cant figure out this one.
Maybe if i will success, i will put some examples.

hegerworld wrote:

Who has already used Nette together with Semantic UI?
I implement a project with this wonderful CSS tool. semantic-ui.com
Has anyone already gained experience? I would like to exchange.

Bye, Michael

JZechy
Member | 161
+
0
-

@Zapotocny You can use manual rendering or write your own form renderer.

Zapotocny
Member | 16
+
0
-

@JZechy Hi, i tried create own renderer, but i needed to create new control, because this

so i created almost same class, but changed this method to

/**
 * Generates control's HTML element.
 * @return Html
*/
public function getControl()
{
	return $this->wrapper->addHtml($this->getLabelPart())->addHtml($this->getControlPart());
}

is this legit? can this be done only by custom renderer?

JZechy wrote:

@Zapotocny You can use manual rendering or write your own form renderer.

Last edited by Zapotocny (2017-09-18 13:01)

JZechy
Member | 161
+
0
-

@Zapotocny you don't need to call getControl(), you can use getControlPrototype() where is stored Html class with input itself.

If you don't need to render, use prototype method.

Last edited by JZechy (2017-09-18 13:06)

Zapotocny
Member | 16
+
0
-

@JZechy
my custom renderer

public function render(Nette\Forms\Form $form, $mode = null)
{
    foreach ($form->getControls() as $control) {
        if ($control instanceof Controls\Button) {
            $control->getControlPrototype()->addAttributes(['class' =>'ui button']);
        } elseif ($control instanceof Controls\Checkbox) {

            $control->getSeparatorPrototype()->setName('div')->addAttributes(['class' => ['ui', $control->getControlPrototype()->type]]);
        }
    }
    return parent::render($form, $mode);
}

can you help me?

JZechy wrote:

@Zapotocny you don't need to call getControl(), you can use getControlPrototype() where is stored Html class with input itself.

If you don't need to render, use prototype method.

JZechy
Member | 161
+
0
-

@Zapotocny Where's the problem? First, don't call parent render, just return string (rendered form). Try to look at Nette Default Form renderer.