who knows Semantic UI CSS Tool?
- hegerworld
- Member | 4
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
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
- Zapotocny
- Member | 16
@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)
- Zapotocny
- Member | 16
@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.