访问他人课程列表,非课程成员的课程显示加入课程,加入课程后界面刷新

This commit is contained in:
sw 2015-07-30 11:21:35 +08:00
parent 7628a53cdc
commit 01bdf5fdca
2 changed files with 9 additions and 3 deletions

View File

@ -1,10 +1,11 @@
<% if object_id%>
$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(course, user)) %>");
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
<% end %>
<% if @state %>
<% if @state == 0 %>
alert("加入成功");
hideModal($("#popbox"));
hideModal($("#popbox02"));
<% elsif @state == 1 %>
alert("密码错误");
<% elsif @state == 2 %>

View File

@ -30,7 +30,10 @@
<td>学生人数:</td>
<td><a href="<%= url_for(:controller => 'courses', :action=>"member", :id=>item.id,:role=>2, :host=>Setting.host_course) %>"><%= studentCount(item) %></a></td>
<td>开课学期:</td>
<td><%= item.time %><%= get_course_term_locales item %></td>
<td>
<%= item.time %>
<%= get_course_term_locales item %>
</td>
</tr>
</tbody></table>
</div>
@ -39,8 +42,10 @@
<span class="grey_n_btn fr mt20">课程结束</span>
<% elsif(can_edit_flag) %>
<a href="<%=url_for(:controller => 'homework_common', :action => 'new',:course=>item.id, :host=>Setting.host_course)%>" target="_blank" class="blue_n_btn fr mt20">发布作业</a>
<% else %>
<% elsif User.current.member_of_course? item %>
<a href="<%=url_for(:controller => 'homework_common', :action => 'index',:course=>item.id, :host=>Setting.host_course)%>" target="_blank" class="blue_n_btn fr mt20">提交作品</a>
<% elsif User.current.logged?%>
<%= link_to "加入课程",try_join_path(:object_id => item.id), :class => "blue_n_btn fr mt20", :remote => "true",:id => "try_join_course_link"%>
<% end %>
<div class="cl"></div>
</div>