新建作业 除了学生
This commit is contained in:
parent
15550ead3e
commit
2878c57d43
|
@ -271,7 +271,20 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def new_homework
|
||||
if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0))
|
||||
# Dear maintainer:
|
||||
# once you are done trying to 'optimize' this Magic routine,
|
||||
# well, it's on you, I'll leave it to you.
|
||||
if (User.current.logged? &&
|
||||
(User.current.admin? ||
|
||||
(
|
||||
!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? &&
|
||||
(
|
||||
Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles &&
|
||||
( Role.where(id: [3, 4, 7, 9]).size > 0 )
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@homework = Bid.new
|
||||
@homework.safe_attributes = params[:bid]
|
||||
render :layout => 'base_courses'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!-- fq -->
|
||||
<!--modified by huang-->
|
||||
<div class="content-title-top">
|
||||
<% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0))%>
|
||||
<% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles&Role.where(id: [3, 4, 7, 9] )).size >0))%>
|
||||
<%= link_to(l(:label_course_homework_new), {:controller => 'projects', :action => 'new_homework'}, :class => 'icon icon-add') %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue