Skip to content

Instantly share code, notes, and snippets.

@seaneshbaugh
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save seaneshbaugh/03b680dfcdc6dd244e6c to your computer and use it in GitHub Desktop.

Select an option

Save seaneshbaugh/03b680dfcdc6dd244e6c to your computer and use it in GitHub Desktop.
elixir haml
This is what I ultimately want to reproduce:
<%= form_for @changeset, @action, fn f -> %>
<div class="form-group">
<label for="page[title]">Title</label>
<%= text_input f, :title, class: "form-control" %>
</div>
<div class="form-group">
<label for="page[body"]>Body</label>
<%= textarea f, :body, class: "form-control" %>
</div>
<div class="form-group">
<%= submit "Submit", class: "btn btn-primary" %>
</div>
<% end %>
This "works" in that it produces what I want. But it's an abomination.
- form_for(@changeset, @action, fn f ->
[safe("<div class=\"form-group\">"),
safe("<label for=\"page[title]\">Title:</label>"),
text_input(f, :title, class: "form-control"),
safe("</div>"),
safe("<div class=\"form-group\">"),
safe("<label for=\"page[body]\">Body:</label>"),
textarea(f, :body, class: "form-control"),
safe("</div>"),
safe("<div class=\"form-group\">"),
submit("Submit", class: "btn btn-primary"),
safe("</div>")]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment