diff --git a/app/helpers/bids_helper.rb b/app/helpers/bids_helper.rb index 721b30361..a5c25ecb5 100644 --- a/app/helpers/bids_helper.rb +++ b/app/helpers/bids_helper.rb @@ -145,6 +145,17 @@ module BidsHelper people.include?(User.current) end + # 当前用户是否加入了此课程(包括教师) + def is_cur_course_user? bid + people = [] + #people << bid.author + course = bid.courses.first + course.members.each do |member| + people << member.user + end + people.include?(User.current) + end + # def select_option_helper option # tmp = Hash.new # option.each do |project| diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index f7db8a375..3bcd12964 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -44,7 +44,7 @@ <% end %> - <% if display_id %> + <% if is_cur_course_user? @bid %> <%= link_to "互评>>" , homework_attach_path(homework)%> <% end %> diff --git a/app/views/homework_attach/_showjour.html.erb b/app/views/homework_attach/_showjour.html.erb index 939deff3b..de5c3eb42 100644 --- a/app/views/homework_attach/_showjour.html.erb +++ b/app/views/homework_attach/_showjour.html.erb @@ -70,4 +70,12 @@ <% end %> -<% end %> \ No newline at end of file +<% end %> + + + + \ No newline at end of file diff --git a/app/views/homework_attach/show.html.erb b/app/views/homework_attach/show.html.erb index f2c37d9ac..a0917a066 100644 --- a/app/views/homework_attach/show.html.erb +++ b/app/views/homework_attach/show.html.erb @@ -145,12 +145,5 @@ <%= render :partial => 'showjour', :locals => {:jour => @jour} %> - - -