Skip to content

Instantly share code, notes, and snippets.

@axilaris
Created March 15, 2014 03:44
Show Gist options
  • Select an option

  • Save axilaris/9561559 to your computer and use it in GitHub Desktop.

Select an option

Save axilaris/9561559 to your computer and use it in GitHub Desktop.
<%= form_for(@vendor) do |f| %>
<% if @vendor.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@vendor.errors.count, "error") %> prohibited this vendor from being saved:</h2>
<ul>
<% @vendor.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :company_id %><br>
<%= f.text_field :company_id %>
</div>
<div class="field">
<%= f.label :data %><br>
<%= f.text_field :data %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<button id="create-user">Create new user</button>
<% end %>
<%= content_for :js do %>
<script type='text/javascript'>
$(document).ready(function() {
$("#create-user").button.click(function() {
console.log("create user button clicked");
});
});
</script>
<%- end -%>
<%= content_for :modaldiv do %>
<div id="dialog-form" title="Create new user">
<p class="validateTips">All form fields are required.</p>
<form>
<fieldset>
<label for="name">Name</label>
<input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all">
<label for="email">Email</label>
<input type="text" name="email" id="email" value="" class="text ui-widget-content ui-corner-all">
<label for="password">Password</label>
<input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all">
</fieldset>
</form>
</div>
<%- end -%>
@axilaris
Copy link
Copy Markdown
Author

edit.html.erb

<%= render 'form' %>
<%= yield :js %>

<%= link_to 'Show', @Vendor %> |
<%= link_to 'Back', vendors_path %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment