I found this link Link to another page using Twitter Bootstrap jquery modal in rails and here is completely what I need – registration and others using Bootstrap modal and Devise.
I made that steps, but it doesn’t popup, but redirects me to another page and shows not proper page.
It behaves really strange, it opens NOT MINE form.
_new.html.erb
<div class="modal hide fade in" id="sign_up">
<%= form_for resource, :as => resource_name, :url => registration_path(resource_name),do |f| %>
<%= devise_error_messages! %>
....
<% end %>
Create new.js.erb:
$("#main").before("<%= escape_javascript(render "new", :formats => [:html]) %>");
$("#sign_up").modal();
and link_to :
<%= link_to "Sign up", new_user_registration_path, :remote => true %>
and in application.html.erb:
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' %>
<%= csrf_meta_tags %>
EDITED.
In my logs:
Processing by Devise::RegistrationsController#new as JS
Rendered devise/registrations/new.js.erb (15.6ms)
Completed 500 Internal Server Error in 31ms
ActionView::Template::Error (Missing partial devise/new with {:locale=>[:en], :f
ormats=>[:js, :html], :handlers=>[:erb, :builder, :coffee, :rabl]}. Searched in:
* "D:/print_it_green/app/views"
* "C:/Ruby192/lib/ruby/gems/1.9.1/gems/devise-2.1.0/app/views"
):
1: $("#sign_up").before("<%= escape_javascript(render "devise/new", :formats
=> [:html]) %>");
2: $("#sign_up").modal();
app/views/devise/registrations/new.js.erb:1:in `_app_views_devise_registration
s_new_js_erb___312569811_25856784'
Where is problem ?
In what folder are your files? If you’re going to use Devise then you can use
rails generate devise:viewsto customize the views. Then put yournewpartial andnewjs file in that folder.You can also configure the controller if you need to, but if you create the views, then Devise should automatically point to the Devise folder that the aforementioned command creates.
In your jQuery, you’d put
render "devise/registrations/new"instead of just"new".