Created
September 26, 2011 12:57
-
-
Save julienrf/1242177 to your computer and use it in GitHub Desktop.
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
*{ Liste éditable d’éléments }* | |
*{ @param _arg: Iterable[A] Liste des éléments constitutifs de la liste }* | |
*{ @param as: String Name of the iterator }* | |
*{ @param (optional) addAction: ActionDefinition URL permettant d’ajouter un élément }* | |
*{ @param (optional) pager: Pager }* | |
#{ui.list users, as: 'user', addAction: @Users.add(), pager: pager} | |
#{useritem user /} | |
#{/ui.list} | |
*{ Formulaire }* | |
*{ @param _arg: ActionDefinition }* | |
*{ @param (optional) model: Model to use (will prefix each field name with the model name and add validation annotations inside fields) }* | |
#{ui.form @User.create(), model: user} | |
#{ui.field 'name' /} | |
#{ui.field 'password', type: 'password' /} | |
#{ui.field 'hasFoo', type: 'checkbox' /} | |
#{customfield 'bar' /} | |
#{ui.field 'avatar', type: 'file' /} | |
#{ui.formbuttons} | |
#{ui.button 'user-create', type: 'submit' /} | |
#{/ui.formbuttons} | |
#{/ui.form} | |
%{ | |
form = new utils.ui.FormBuilder(@Users.create(), user) {{ | |
field('name') | |
field('password', 'password') | |
field('hasFoo', 'checkbox') | |
customField('bar', 'modules/users/customfield.html') | |
field() | |
button('user-create', 'submit') | |
}} | |
}% | |
${form.make()} |
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
%{ user = _arg }% | |
#{extends 'listitem.html' /} | |
<div class="user"> | |
<span class="name">${user.name}</span> | |
… | |
</div> | |
#{set 'delete'} | |
<button type="button" class="delete" data-id="${user.id}">&{'delete'}</button> | |
#{/set} | |
#{set 'edit'} | |
<a href="@Users.edit(user.id)" class="button edit">&{'edit'}</a> | |
#{/set} |
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
*{ Base template to write list items }* | |
*{ Build a list item by appending an item content, an edit button and then a delete button }* | |
<li class="list-item"> | |
<span class="content"> | |
#{doLayout /} | |
</span> | |
#{if get('edit') || get('delete')} | |
<span class="aside"> | |
#{if get('edit')} | |
#{get 'edit' /} | |
#{/if} | |
#{if get('delete')} | |
#{get 'delete' /} | |
#{/if} | |
</span> | |
#{/if} | |
</li> |
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
*{ Custom field keeping consistency with sematic built-in fields }* | |
*{ @params _arg: String Name of the field }* | |
#{extends 'ui.fieldbase.html' /} | |
%{ field = utils.GroovyFieldHelper.field(_arg) }% | |
#{ui.fieldbase _arg } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment