Rails Devise Bootstrap注册模式 [英] Rails Devise Bootstrap Sign Up modal
问题描述
我已经遵循引导指令,并将表单插入到模态并链接它到导航栏菜单。现在,当我点击我的导航栏中的注册。什么都没发生。表格不会去任何地方。当这只是一个标准的页面视图时,我已经工作了。谁能帮忙?谢谢你。
我试图跟随这个答案,但是变得困惑: Twitter Bootstrap Modal不弹出用户登录
我有:
views / devise / shared / registration_items:
<%if user_signed_in? %GT;
< li>
<%= link_to('编辑注册',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 / registration / new
<! - Modal - >
< div class =modal fadeid =myModaltabindex = - 1role =dialogaria-labelledby =myModalLabelaria-hidden =true>
< div class =modal-dialog>
< div class =modal-content>
< div class =modal-header>
< button type =buttonclass =closedata-dismiss =modalaria-hidden =true>& times;< / button>
< h4 class =modal-titleid =myModalLabel>注册< / h4>
< / div>
< div class =modal-body>
<%= simple_form_for(resource,as:resource_name,url:registration_path(resource_name))do | f | %GT;
<%= f.error_notification%>
< div class =form-inputs>
<%= f.input:first_name,必需: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,注册%>
< / div>
<%end%>
<%= renderdevise / shared / links%>
< / div>
< / div>
< / div>
< / div>
respond_to do | format |
format.js
end
我收到语法错误(语法错误,意外的':',expecting =>)在这一行:
<%= render'devise / shared / registration_items'% >
请任何人帮忙。谢谢。
有一个语法错误。更改为:method => 'get'
或方法:下面的行中的'get'
'data-toggle'=> modal,data-target=> #myModal,:方法:'get'
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.
There is a syntax error. Change to :method => 'get'
or method: 'get'
in the line below
'data-toggle' => "modal", 'data-target' => "#myModal", :method: 'get'
这篇关于Rails Devise Bootstrap注册模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!