Last active
August 29, 2015 14:11
-
-
Save twined/53bbae0c192d75e38643 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
defmodule Brando.Form.UserForm do | |
use Brando.Form | |
import Brando.Router.Helpers | |
def get_status_choices do | |
[[value: "0", text: "Choice 1"], | |
[value: "1", text: "Choice 2"]] | |
end | |
form "user", [method: "POST", action: admin_user_path(:create)] do | |
field :full_name, :text, | |
[required: true, | |
label: "Full name"] | |
field :username, :text, | |
[required: true, | |
label: "Username"] | |
field :email, :email, | |
[required: true, | |
label: "Email"] | |
field :password, :password, | |
[required: true, | |
label: "Password"] | |
field :administrator, :checkbox, | |
[label: "Administrator", | |
default: false] | |
field :editor, :checkbox, | |
[label: "Editor", | |
default: true] | |
field :status, :select, | |
[choices: quote do Brando.Form.UserForm.get_status_choices end, | |
default: "1", | |
label: "Status"] | |
submit "Save user!", | |
[class: "btn btn-default"] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment