I'm trying to alter my devise registration view file to work with bootstrap modals.
I have followed the bootstrap instructions and slotted the form into the modal and linked it to the navbar menu. Now, when i click on 'Register' in my navbar. Nothing happens. The form doesn't go anywhere. I had this working when it was just a standard page view. Can anyone help? Thank you.
I am trying to follow this answer but am getting confused: Twitter Bootstrap Modal not popping up for user login
I have:
views/devise/shared/registration_items:
<% if user_signed_in? %> <li> <%= link_to('Edit registration', edit_user_registration_path) %> </li> <% else %> <li> <%= link_to 'Register', new_user_registration_path, :remote => true, 'data-toggle' => "modal", 'data-target' => "#myModal", :method: 'get' %> </li> <% end %>
views/devise/registrations/new
<!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel">Sign up</h4> </div> <div class="modal-body"> <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> <%= f.error_notification %> <div class="form-inputs"> <%= f.input :first_name, required: true, autofocus: true %> <%= f.input :last_name, required: true, autofocus: true %> <%= f.input :email, required: true, autofocus: true %> <%= f.input :password, required: true %> <%= f.input :password_confirmation, required: true %> </div> </div> <div class="modal-footer"> <div class="form-actions"> <%= f.button :submit, "Sign up" %> </div> <% end %> <%= render "devise/shared/links" %> </div> </div> </div> </div> respond_to do |format| format.js end
I get a syntax error (syntax error, unexpected ':', expecting =>) on this line:
<%= render 'devise/shared/registration_items' %>
Please can anyone help. Thank you.