parent
45339e53d8
commit
21e58ce3df
|
@ -14,6 +14,8 @@ class BidsController < ApplicationController
|
||||||
# end
|
# end
|
||||||
before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ]
|
before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ]
|
||||||
|
|
||||||
|
before_filter :memberAccess, only: :show_project
|
||||||
|
|
||||||
helper :watchers
|
helper :watchers
|
||||||
helper :attachments
|
helper :attachments
|
||||||
include AttachmentsHelper
|
include AttachmentsHelper
|
||||||
|
@ -875,7 +877,14 @@ class BidsController < ApplicationController
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def memberAccess
|
||||||
|
# 是课程,则判断当前用户是否参加了课程
|
||||||
|
return 0 if @bid.courses.first.project_type == Project::ProjectType_project
|
||||||
|
currentUser = User.current
|
||||||
|
render_403 unless currentUser.member_of?(@bid.courses.first)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -114,10 +114,18 @@
|
||||||
|
|
||||||
<td class="font_index">
|
<td class="font_index">
|
||||||
<!-- 1 教师; 2 学生;0 全部-->
|
<!-- 1 教师; 2 学生;0 全部-->
|
||||||
<%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1), :course => '1' %>
|
<% if User.current.member_of?(@project) %>
|
||||||
|
<%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1), :course => '1' %>
|
||||||
|
<% else %>
|
||||||
|
<span><%= teacherCount(@project)%></span> <!--<%= link_to "#{teacherCount(@project)}", "javascript:void(0)", :course => '1' %>-->
|
||||||
|
<% end%>
|
||||||
</td>
|
</td>
|
||||||
<td class="font_index">
|
<td class="font_index">
|
||||||
<%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2), :course => '1' %>
|
<% if User.current.member_of?(@project) %>
|
||||||
|
<%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2), :course => '1' %>
|
||||||
|
<% else %>
|
||||||
|
<span><%= studentCount(@project)%></span>
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td class="font_index"><%= link_to files_count, project_files_path(@project) %></td>
|
<td class="font_index"><%= link_to files_count, project_files_path(@project) %></td>
|
||||||
<tr class="font_aram">
|
<tr class="font_aram">
|
||||||
|
|
|
@ -151,6 +151,7 @@
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:label_question_student), {:controller => 'bids', :action => 'show' },:class => link_class(:respond)%>
|
<%= link_to l(:label_question_student), {:controller => 'bids', :action => 'show' },:class => link_class(:respond)%>
|
||||||
</li>
|
</li>
|
||||||
|
<% if User.current.member_of? @bid.courses.first%>
|
||||||
<li>
|
<li>
|
||||||
<% if User.current.logged? && @bid.courses.first && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %>
|
<% if User.current.logged? && @bid.courses.first && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %>
|
||||||
<%= link_to l(:label_homework_commit), {:controller => 'bids', :action => 'show_project' },:class => link_class(:project)%>
|
<%= link_to l(:label_homework_commit), {:controller => 'bids', :action => 'show_project' },:class => link_class(:project)%>
|
||||||
|
@ -159,9 +160,10 @@
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
<% end %>
|
||||||
<!-- <li><%= link_to l(:label_homework_statistics), { :controller => 'bids', :action => 'homework_statistics' },:class => link_class(:homework_statistics)%></li> -->
|
<!-- <li><%= link_to l(:label_homework_statistics), { :controller => 'bids', :action => 'homework_statistics' },:class => link_class(:homework_statistics)%></li> -->
|
||||||
<!-- <li><%= link_to l(:label_homework_respond), { :controller => 'bids', :action => 'homework_respond' },:class => link_class(:homework_respond)%></li>
|
<!-- <li><%= link_to l(:label_homework_respond), { :controller => 'bids', :action => 'homework_respond' },:class => link_class(:homework_respond)%></li>
|
||||||
--><ul>
|
--></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<%= content_tag('span', l(:label_x_data,:count => files_count)) %>
|
<%= content_tag('span', l(:label_x_data,:count => files_count)) %>
|
||||||
</p>
|
</p>
|
||||||
<p class="stats">
|
<p class="stats">
|
||||||
<%= content_tag('span', "#{@project.members.count}", :class => "info") %>
|
<%= content_tag('span', "#{garble @project.members.count}", :class => "info") %>
|
||||||
<%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>
|
<%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue