Skip to content

Instantly share code, notes, and snippets.

@ovargas27
Created June 8, 2011 16:19
Show Gist options
  • Save ovargas27/1014746 to your computer and use it in GitHub Desktop.
Save ovargas27/1014746 to your computer and use it in GitHub Desktop.
Modal dialog with jQuery UI
<%= link_to 'New brand', '#new-brand-link', {:id => "new-brand-link"} %>
<div id="new-brand-form" title="Create new brand">
<%= form_for [:admin, @brand], :remote => true do |form| %>
<%= form.label :name %>
<%= form.text_field :name %><br />
<%= form.submit 'Save' %><br />
<% end %>
</div>
<% content_for :javascripts do %>
<script>
$(document).ready(function(){
$("#new-brand-form" ).dialog({ autoOpen: false, modal: true });
$("#new-brand-link" ).click(function() {
$("#new-brand-form" ).dialog( "open" );
});
});
</script>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment