编辑作业逻辑修改

This commit is contained in:
nwb 2014-06-17 15:17:04 +08:00
parent 936c40b490
commit ec72bb2904
4 changed files with 7 additions and 7 deletions

View File

@ -972,9 +972,9 @@ class BidsController < ApplicationController
def memberAccess
# 是课程,则判断当前用户是否参加了课程
return true if current_user.admin?
return 0 if @bid.courses.first.project_type == Project::ProjectType_project
#return 0 if @bid.courses.first.project_type == Project::ProjectType_project
currentUser = User.current
render_403 unless currentUser.member_of?(@bid.courses.first)
render_403 unless currentUser.member_of_cousrse?(@bid.courses.first)
end
end

View File

@ -37,7 +37,7 @@ class ZipdownController < ApplicationController
#下载某一学生的作业的所有文件
def download_user_homework
homework = HomeworkAttach.find params[:homework]
if homework != nil && (User.current.admin? || User.current.member_of?(homework.bid.courses.first))
if homework != nil && (User.current.admin? || User.current.member_of_course?(homework.bid.courses.first))
zipfile = zip_homework_by_user homework
send_file zipfile, :filename => homework.name, :type => detect_content_type(zipfile) if zipfile
else

View File

@ -3,7 +3,7 @@
<% is_teacher = is_course_teacher User.current,@bid.courses.first %>
<!-- 当is_evaluation为1或者null(null主要是为了兼容前面数据)时代表启用互评功能2表示未启用 -->
<% is_evaluation = @bid.is_evaluation == 1 || @bid.is_evaluation == nil %>
<%= form_tag(:controller => 'bids', :action => "show_project", :method => :get) do %>
<%= form_tag(:controller => 'bids', :action => "show_courseEx", :method => :get) do %>
<div class="project-search-block">
<table width="100%" valign="center">
<tr>

View File

@ -16,9 +16,9 @@
</tr>
<tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/courses", :controller => 'projects', :action => 'course'%></a></td>
<td><p class="top-content-list-homework"><%=link_to "主页", home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course' %> >
<span><%= link_to(@homework.bid.courses.first.name.to_s, homework_project_path(@homework.bid.courses.first)) if @homework.bid.courses.first%></span> >
<td style="padding-left: 8px"><a><%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index'%></a></td>
<td><p class="top-content-list-homework"><%=link_to "主页", home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'index' %> >
<span><%= link_to(@homework.bid.courses.first.name.to_s, homework_course_path(@homework.bid.courses.first)) if @homework.bid.courses.first%></span> >
<%=link_to(@homework.bid.name, respond_path(@homework.bid)) %> > <span><%= link_to "修改作业",edit_homework_attach_path(@homework)%></span></p></td>
</tr>
</table>