Skip to content

Instantly share code, notes, and snippets.

@vojtech-dobes
Created March 23, 2011 20:45
Show Gist options
  • Save vojtech-dobes/883924 to your computer and use it in GitHub Desktop.
Save vojtech-dobes/883924 to your computer and use it in GitHub Desktop.
First draft for UI abstraction - UiMacros for Nette Framework
{*
* All ui:* macros should support basic HTML attributes as modificators,
* because in fact they are only abstractions of common HTML elements
* compatible with proper unobtrusive javascript service.
*}
{*
* Basic link
* 'href' attribute is automatically evaluated as 'n:href'
*}
{ui:link href => ":Admin:Articles:delete!, $article->id", confirm => "Really wanna' delete this?"}delete{/ui:link}
{*
* Dialog popup
*}
{ui:dialog id => my-dialog, if => $showDialog, title => "New article", size => [60%, 300px], modal => TRUE}
<p>To create new article fill required fields please.</p>
{control addForm}
<p>* = unnecessary fields</p>
{/ui:dialog}
{* Dialogs can be defined on PHP side and provided to macro as variable. Still possible to set modificators... *}
{ui:dialog $dialog, if => $showDialog ... }
{* Link can be assigned to open dialog. *}
{ui:link launch => #my-dialog}show popup{/ui:link}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment