Reputation: 3992
This is the current situation, a general rails app with index.html.erb
related to index
action, and a new.html.erb
with new
action to create a new object.
My request is that I want to use modal to replace the index.html.erb to create a new object. In detail, when user click a New
Button in the index.html
page, a dialog display with a form of creating object, instead of opening the new.html page.
Is there a possible way to realise this ignoring copying the code in new.html.erb
to index.html.erb
? Because it would also move the code in new action to index action.
I have tried an approach below, but it didn't meet my requirement:
<%= link_to "New sites", new_site_path, :class => "btn btn-primary", "data-toggle" => "modal", "data-target" => ".bs-example-modal-lg" %>
It would open a modal dialog including the components in application.html.erb
, such as navigation bar ,side bar and so on, not only the creating form.
Upvotes: 0
Views: 254