修复加入课程报错的BUG

This commit is contained in:
sw 2014-10-22 12:02:05 +08:00
parent 3a48034fca
commit bf49f46b22
2 changed files with 14 additions and 5 deletions

View File

@ -26,7 +26,7 @@ class CoursesController < ApplicationController
def join
if User.current.logged?
course = Course.find_by_id params[:object_id]
if course
unless course
@state = 4
else
unless (allow_join(course) && User.current.member_of_course?(course))

View File

@ -1,11 +1,19 @@
<% if User.current.id == @user.id %>
<div class="menu-div">
<div class="menu">
<span style="color: #000; font-weight: bold;"><%= "#{@user.name}的动态" %></span>
<span style="color: #000; font-weight: bold;">
<%= "#{@user.name}的动态" %>
</span>
<ul><%#链接绑定在页面最下方的jQuery%>
<li mode='all' class="<%= "on" if @state.eql?(0) %>"><%= l :label_user_all_activity %></li>
<li mode='myself' class="<%= "on" if @state.eql?(1) %>"><%= l :label_user_activity_myself %></li>
<li mode='respond' class="<%= "on" if @state.eql?(2) %>"><%= l :label_user_all_respond %></li>
<li mode='all' class="<%= "on" if @state.eql?(0) %>">
<%= l :label_user_all_activity %>
</li>
<li mode='myself' class="<%= "on" if @state.eql?(1) %>">
<%= l :label_user_activity_myself %>
</li>
<li mode='respond' class="<%= "on" if @state.eql?(2) %>">
<%= l :label_user_all_respond %>
</li>
</ul>
</div>
<script type="text/javascript">
@ -28,6 +36,7 @@
<% end %>
<% end %>
<%= render_flash_messages %>
<% unless @state == 2 %>
<% unless @activity.empty? %>
<div id="activity">