parent
45339e53d8
commit
21e58ce3df
|
@ -14,6 +14,8 @@ class BidsController < ApplicationController
|
|||
# end
|
||||
before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ]
|
||||
|
||||
before_filter :memberAccess, only: :show_project
|
||||
|
||||
helper :watchers
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
|
@ -877,5 +879,12 @@ class BidsController < ApplicationController
|
|||
render_404
|
||||
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
|
||||
|
||||
|
|
|
@ -114,10 +114,18 @@
|
|||
|
||||
<td class="font_index">
|
||||
<!-- 1 教师; 2 学生;0 全部-->
|
||||
<% 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 class="font_index">
|
||||
<% 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 class="font_index"><%= link_to files_count, project_files_path(@project) %></td>
|
||||
<tr class="font_aram">
|
||||
|
|
|
@ -151,6 +151,7 @@
|
|||
<li>
|
||||
<%= link_to l(:label_question_student), {:controller => 'bids', :action => 'show' },:class => link_class(:respond)%>
|
||||
</li>
|
||||
<% if User.current.member_of? @bid.courses.first%>
|
||||
<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) %>
|
||||
<%= link_to l(:label_homework_commit), {:controller => 'bids', :action => 'show_project' },:class => link_class(:project)%>
|
||||
|
@ -159,9 +160,10 @@
|
|||
|
||||
<% end %>
|
||||
</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_respond), { :controller => 'bids', :action => 'homework_respond' },:class => link_class(:homework_respond)%></li>
|
||||
--><ul>
|
||||
--></ul>
|
||||
</div>
|
||||
|
||||
<%= yield %>
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<%= content_tag('span', l(:label_x_data,:count => files_count)) %>
|
||||
</p>
|
||||
<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)) %>
|
||||
</p>
|
||||
|
||||
|
|
Loading…
Reference in New Issue