我希望将未创建个人资料的用户定向到指示他们这样做的页面。 如果用户没有创建配置文件,我希望引导程序可以跨页面。我只能通过注释掉第7行(或第一行:div class =“col-md-6”)来使它工作,如果用户创建了一个配置文件,这会弄乱界面。
<div class="jumbotron text-center">
<h1>Welcome to Jr. Dev Mentoring</h1>
<h3>Harnessing the Power of Mentorship <br>To Build A Community of Work Ready Jr. Devs.</h3>
</div>
<div class="row">
<% if user_signed_in? %>
<div class="col-md-6">
<div class="well">
<h2 class="text-center">Your Profile</h2>
<% if current_user.profile %>
<%= link_to "Edit your profile", "#", class: 'btn btn-default btn-lg btn-block' %>
<%= link_to "View your profile", user_path(current_user), class: 'btn btn-default btn-lg btn-block' %>
</div>
</div>
<div class="col-md-6">
<% if current_user.plan.name == "mentor" %>
<%= render partial: "pages/mentor" %>
<% else %>
<%= render partial: "pages/mentee" %>
<% end %>
</div>
<% else %>
<div class='container'>
<div class='row'>
<div class='col-md-8 col-md-offset-2'>
<p class='text-center'>Create your profile so that you can share your information with the Jr. Dev Mentoring community.</p>
<%= link_to "Create your profile", new_user_profile_path(current_user), class: 'btn btn-default btn-lg btn-block'%>
</div>
</div>
</div>
<% end %>
<% else %>
<div class="col-md-6">
<div class="well">
<h2 class="text-center">Mentee</h2>
<h4 class="text-center">Sign up for free to gain access to our community of mentors.</h4>
<br/>
<%= link_to "Sign Up", new_user_registration_path(plan: @mentee_plan.id), class: 'btn btn-primary btn-lg btn-block' %>
</div>
</div>
<div class="col-md-6">
<div class="well">
<h2 class="text-center">Mentor</h2>
<h4 class="text-center">Sign up for free to lend your expertise and support!</h4><br>
<%= link_to "Sign Up", new_user_registration_path(plan: @mentor_plan.id), class: 'btn btn-success btn-lg btn-block' %>
</div>
</div>
<% end %>
</div>
答案 0 :(得分:1)
你在这里:你在第7行周围有一点误导,:)。
<div class="jumbotron text-center">
<h1>Welcome to Jr. Dev Mentoring</h1>
<h3>Harnessing the Power of Mentorship <br>To Build A Community of Work Ready Jr. Devs.</h3>
</div>
<div class="row">
<% if user_signed_in? %>
<% if current_user.profile %>
<div class="col-md-6">
<div class="well">
<h2 class="text-center">Your Profile</h2>
<%= link_to "Edit your profile", "#", class: 'btn btn-default btn-lg btn-block' %>
<%= link_to "View your profile", user_path(current_user), class: 'btn btn-default btn-lg btn-block' %>
</div>
</div>
<div class="col-md-6">
<% if current_user.plan.name == "mentor" %>
<%= render partial: "pages/mentor" %>
<% else %>
<%= render partial: "pages/mentee" %>
<% end %>
</div>
<% else %>
<div class='container'>
<div class='row'>
<div class='col-md-8 col-md-offset-2'>
<p class='text-center'>Create your profile so that you can share your information with the Jr. Dev Mentoring community.</p>
<%= link_to "Create your profile", new_user_profile_path(current_user), class: 'btn btn-default btn-lg btn-block'%>
</div>
</div>
</div>
<% end %>
<% else %>
<div class="col-md-6">
<div class="well">
<h2 class="text-center">Mentee</h2>
<h4 class="text-center">Sign up for free to gain access to our community of mentors.</h4>
<br/>
<%= link_to "Sign Up", new_user_registration_path(plan: @mentee_plan.id), class: 'btn btn-primary btn-lg btn-block' %>
</div>
</div>
<div class="col-md-6">
<div class="well">
<h2 class="text-center">Mentor</h2>
<h4 class="text-center">Sign up for free to lend your expertise and support!</h4><br>
<%= link_to "Sign Up", new_user_registration_path(plan: @mentor_plan.id), class: 'btn btn-success btn-lg btn-block' %>
</div>
</div>
<% end %>
</div>