Skip to content

Instantly share code, notes, and snippets.

@axilaris
Created March 5, 2014 06:40
Show Gist options
  • Save axilaris/9362295 to your computer and use it in GitHub Desktop.
Save axilaris/9362295 to your computer and use it in GitHub Desktop.
<%= form_for(@payment_account) do |f| %>
<% if @payment_account.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@payment_account.errors.count, "error") %> prohibited this payment_account from being saved:</h2>
<ul>
<% @payment_account.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br>
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :data %><br>
<%= f.text_field :data %>
</div>
<div id="skillSet">
<%= render partial: "skills_form" %>
</div>
<a href="javascript:;" id="addNewTag">Add New Tag</a>
<div class="actions">
<%= f.submit %>
</div>
<div class="hide" id="new_skills_form" style="visibility: hidden">
<%= render partial: "skills_form", locals: {skill: false} %>
</div>
<% end %>
<%= content_for :js do %>
<script type='text/javascript'>
$(document).ready(function(){
$("#addNewTag").click(function(){
$("#skillSet").append($("#new_skills_form").html());
});
$("#removeTag").click(function(){
console.log("removetag");
$(this).parent('div').remove()
});
});
</script>
<%- end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment