Packages

Material Design Bootstrap 4 LiveViews for Phoenix Applications

Current section

Files

Jump to
phoenix_mdbootstrap_live_view priv templates phx.gen.mdlive form_component.html.leex
Raw

priv/templates/phx.gen.mdlive/form_component.html.leex

<div class="phx-modal-content">
<%%= f = form_for @changeset, "#",
id: "<%= schema.singular %>-form",
class: "needs-validation col-sm-12",
phx_target: @myself,
phx_change: "validate",
phx_submit: "save" %>
<div class="modal-header">
<h5 class="modal-title" id="modalTitle">
<%%= if !@<%= schema.singular %>.id do %>
<%%= gettext "New %{model}", model: gettext("<%= schema.human_singular %>") %>
<%% else %>
<%%= gettext "Editing %{model}: %{name}", model: gettext("<%= schema.human_singular %>"), name: @<%= schema.singular %>.name %>
<%% end %>
</h5>
<%%= live_patch raw("&times;"), to: @return_to, class: "close", "data-dismiss": "modal", "aria-label": "Close" %>
</div>
<div class="modal-body">
<%= for input <- inputs, input do %>
<%= input %>
<% end %>
</div>
<div class="modal-footer">
<%%= live_redirect gettext("Back"), to: @return_to, class: "btn btn-secondary btn-rounded" %>
<%%= submit gettext("Save"), phx_disable_with: gettext("Saving..."), class: "btn btn-primary btn-rounded" %>
</div>
</form>
</div>