增加未登录用户不可通过首页加入课程按钮加入相应课程

This commit is contained in:
sw 2014-10-17 08:59:14 +08:00
parent 43f2cc71ce
commit ef10ccb76f
3 changed files with 13 additions and 8 deletions

View File

@ -39,6 +39,8 @@ class CoursesController < ApplicationController
else else
@state = 3 @state = 3
end end
else
@state = 4
end end
respond_to do |format| respond_to do |format|
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}

View File

@ -3,16 +3,18 @@
<% end %> <% end %>
<% if @state %> <% if @state %>
<% if @state == 0 %> <% if @state == 0 %>
alert("加入成功") alert("加入成功");
<% elsif @state == 1 %> <% elsif @state == 1 %>
alert("密码错误") alert("密码错误");
<% elsif @state == 2 %> <% elsif @state == 2 %>
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)") alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
<% elsif @state == 3 %> <% elsif @state == 3 %>
alert("您已经加入了课程"); alert("您已经加入了课程");
<% elsif @state == 3 %> <% elsif @state == 4 %>
alert("您已经的课程不存在") alert("您已经的课程不存在");
<% elsif @state == 4 %>
alert("您还未登录");
<% else %> <% else %>
alert("未知错误,请稍后再试") alert("未知错误,请稍后再试");
<% end %> <% end %>
<% end %> <% end %>

View File

@ -4,7 +4,8 @@
:class => 'icon icon-add') if User.current.allowed_to?(:add_course,nil, :global => true) %> :class => 'icon icon-add') if User.current.allowed_to?(:add_course,nil, :global => true) %>
<% end %> <% end %>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to l(:label_course_join_student), join_private_courses_courses_path ,:remote => true, :class => 'icon icon-add' %>
&nbsp;&nbsp;&nbsp;&nbsp;
<% end %> <% end %>
<%= link_to l(:label_course_join_student), join_private_courses_courses_path ,:remote => true, :class => 'icon icon-add' %>
&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to l(:label_more), {:controller => 'courses', :action => 'index', :school_id => school_id} %> <%= link_to l(:label_more), {:controller => 'courses', :action => 'index', :school_id => school_id} %>