formex v0.2.2 Formex.View
Helper functions for templating.
Example of use:
<%= formex_form_for @form, @action, fn f -> %>
<%= if @form.changeset.action do %>
<div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p>
</div>
<% end %>
<%= formex_rows f %>
<div class="form-group">
<%= submit "Submit", class: "btn btn-primary" %>
</div>
<% end %>
Summary
Functions
Works similar to a Phoenix.HTML.Form.form_for/4
Generates a row with Bootstrap’s .form-group
class. Example of use
Generates a row with Bootstrap’s .form-group
class. Should be used with .form-horizontal
class
Generates all formex_row/2
s at once
Generates all formex_row_horizontal/2
s at once
Functions
Works similar to a Phoenix.HTML.Form.form_for/4
In the callback function the first argument is Formex.Form.t/0
instead of a
Phoenix.HTML.Form.t/0
.
This argument contains the Phoenix.HTML.Form.t/0
under a :phoenix_form
key
Generates a row with Bootstrap’s .form-group
class. Example of use:
<%= formex_row f, :title %>
<%= formex_row f, :content %>
<%= formex_row f, :category_id %>
formex_row_horizontal(Formex.Form.t, Atom.t) :: Phoenix.HTML.safe
Generates a row with Bootstrap’s .form-group
class. Should be used with .form-horizontal
class.
<div class="form-horizontal">
<%= formex_row_horizontal f, :title %>
<%= formex_row_horizontal f, :content %>
<%= formex_row_horizontal f, :category_id %>
</div>
Generates all formex_row/2
s at once
Generates all formex_row_horizontal/2
s at once