#1173 重启课程、关闭课程、加入课程、退出课程等按钮页面的刷新

This commit is contained in:
sw 2014-10-13 14:52:07 +08:00
parent 3dd14b6112
commit 864d969c15
5 changed files with 43 additions and 41 deletions

View File

@ -544,7 +544,6 @@ class CoursesController < ApplicationController
def finishcourse
yesterday = Date.today.prev_day.to_time
@course_prefs.endup_time = yesterday
@save_flag = @course_prefs.save
get_courses

View File

@ -1,12 +1,12 @@
<% if @save_flag %>
<% if Rails.env.development? %>
console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>');
<% end %>
$('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user,
:memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>")
$('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>")
<% if Rails.env.development? %>
console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>');
<% end %>
$('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user,
:memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>");
$('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>");
<% else %>
alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。');
alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。');
<% end %>

View File

@ -42,48 +42,25 @@
<ul class="sub_menu">
<% if @show_course == 1 %>
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<% hasCourse=false %>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<% hasCourse=true %>
<% end %>
<% end %>
<% if hasCourse %>
<li id="course_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id} %>
<ul class="course_sub_menu">
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=course.name%>"><%= link_to course.name, {:controller => 'courses',:action => 'show',id:course.id} %></li>
<% end %>
<% end %>
</ul>
</li>
<% end %>
<%= render :partial => 'layouts/user_courses_list', :locals => {:hasCourse => hasCourse} %>
<% end -%>
<% end %>
<% if User.current.projects.count>0 %>
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<% if hasCourse %>
<ul class="project_sub_menu" style="top: 35px">
<% else %>
<ul class="project_sub_menu" style="top: 0px">
<% end %>
<% User.current.projects.each do |project| %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>"><%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %></li>
<% end %>
</ul>
</li>
<% end %>
<li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
<%= render :partial => 'layouts/user_project_list', :locals => {:hasCourse => hasCourse} %>
<li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
</li>
</ul>
</li>
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain }, {:class => 'my-message'} if User.current.logged?%>
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')',
{ :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain },
{:class => 'my-message'} if User.current.logged?%>
</li>
</ul>
</div>
@ -98,7 +75,7 @@
<script type="text/javascript">
function setMessageCount () {
var mes = $('#loggedas .my-message')
mes.html(mes.html()+'('+<%=User.current.count_new_jour.to_s%>+")")
mes.html(mes.html()+ '(' + <%=User.current.count_new_jour.to_s%> + ")")
}
function addSlipMenu () {

View File

@ -0,0 +1,14 @@
<% if hasCourse %>
<li id="course_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id} %>
<ul class="course_sub_menu">
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=course.name%>">
<%= link_to course.name, {:controller => 'courses',:action => 'show',id:course.id} %>
</li>
<% end %>
<% end %>
</ul>
</li>
<% end %>

View File

@ -0,0 +1,12 @@
<% if User.current.projects.count>0 %>
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;">
<% User.current.projects.each do |project| %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %>
</li>
<% end %>
</ul>
</li>
<% end %>