members split (teacher,student) in course
This commit is contained in:
parent
b617f3d42f
commit
2286fbeff5
|
@ -28,6 +28,8 @@ module ApplicationHelper
|
|||
include AvatarHelper
|
||||
## added by william
|
||||
include PraiseTreadHelper
|
||||
# add by nyan
|
||||
include CoursesHelper
|
||||
|
||||
extend Forwardable
|
||||
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
## This helper be included in applicationHelper
|
||||
module CoursesHelper
|
||||
# 返回学生数量,即roles表中定义的Reporter, 返回结果 -1 为查询失败
|
||||
def studentCount project
|
||||
searchCountByRoles project, 5
|
||||
end
|
||||
|
||||
# 返回教师数量,即roles表中定义的Manager, 返回结果 -1 为查询失败
|
||||
def teacherCount project
|
||||
searchCountByRoles project, 3
|
||||
end
|
||||
|
||||
# 返回TA数量,即roles表中定义的TA, 返回结果 -1 为查询失败
|
||||
def teacherAssistantCount project
|
||||
searchCountByRoles project, 7
|
||||
end
|
||||
|
||||
# 根据角色查询
|
||||
def searchCountByRoles project, roles_id
|
||||
count = -1
|
||||
begin
|
||||
count = project.members.joins(:member_roles).where("member_roles.role_id = :role_id", {:role_id => roles_id }).count
|
||||
rescue Exception => e
|
||||
logger.error "[CoursesHelper] ===> #{e}"
|
||||
end
|
||||
count
|
||||
end
|
||||
end
|
|
@ -80,13 +80,28 @@
|
|||
<% files_count += version.attachments.count %>
|
||||
<% end %>
|
||||
|
||||
<td class="font_index"><%= link_to "#{@project.members.count}", project_member_path(@project) ,:course =>'1'%></td>
|
||||
|
||||
<td class="font_index">
|
||||
<!-- %= link_to "#{@project.members.count}", project_member_path(@project) ,:course =>'1'% -->
|
||||
<!-- 1 教师; 2 学生;0 全部-->
|
||||
<%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1) ,:course =>'1'%>
|
||||
</td>
|
||||
<td class="font_index">
|
||||
<%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2) ,:course =>'1'%>
|
||||
</td>
|
||||
<td class="font_index"><%= link_to files_count, project_files_path(@project) %></td>
|
||||
<tr class="font_aram">
|
||||
<td align="center" width="80px"> <%= l(:label_x_base_courses_member, :count => @project.members.count) %></td>
|
||||
<td align="center" width="80px" id="teacherCount">
|
||||
<!-- %= l(:label_x_base_courses_member, :count => @project.members.count) % -->
|
||||
<%= l(:label_x_base_courses_teacher, :count => teacherCount(@project)) %>
|
||||
</td>
|
||||
<td align="center" width="80px" id="studentCount">
|
||||
<%= l(:label_x_base_courses_student, :count => studentCount(@project)) %>
|
||||
<!-- %= l(:label_x_course_data, :count => files_count) % -->
|
||||
</td>
|
||||
<td align="center" width="80px">
|
||||
<%= l(:label_x_course_data, :count => files_count) %>
|
||||
</td>
|
||||
|
||||
<td align="center" width="80px"><%= l(:label_x_course_data, :count => files_count) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="user_underline"></div>
|
||||
|
@ -188,6 +203,7 @@
|
|||
|
||||
</div>
|
||||
<%= render :partial => 'layouts/base_footer'%>
|
||||
<%= debug(params) if Rails.env.development? %>
|
||||
</div>
|
||||
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="member_header">
|
||||
<p>
|
||||
<%= l(:label_member_list)%>
|
||||
<%= l(:label_member_list) if params[:role].blank? %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="member_content">
|
||||
|
|
|
@ -1436,6 +1436,15 @@ en:
|
|||
zero: File
|
||||
one: File
|
||||
other: Files
|
||||
|
||||
label_x_base_courses_student:
|
||||
zero: student
|
||||
one: students
|
||||
other: students
|
||||
label_x_base_courses_teacher:
|
||||
zero: teacher
|
||||
one: teachers
|
||||
other: teachers
|
||||
#add by men
|
||||
label_brief_introduction: Personality words
|
||||
label_technical_title: Title
|
||||
|
|
|
@ -716,7 +716,7 @@ zh:
|
|||
label_sort_higher: 上移
|
||||
label_sort_lower: 下移
|
||||
label_sort_lowest: 置底
|
||||
label_roadmap: 路线图
|
||||
label_roadmap: 版本路线图 #nyan
|
||||
label_roadmap_due_in: "截止日期到 %{value}"
|
||||
label_roadmap_overdue: "%{value} 延期"
|
||||
label_roadmap_no_issues: 该版本没有问题
|
||||
|
@ -1563,6 +1563,14 @@ zh:
|
|||
zero: 资料
|
||||
one: 资料
|
||||
other: 资料
|
||||
label_x_base_courses_student:
|
||||
zero: 学生
|
||||
one: 学生
|
||||
other: 学生
|
||||
label_x_base_courses_teacher:
|
||||
zero: 教师
|
||||
one: 教师
|
||||
other: 教师
|
||||
|
||||
label_homework_statistics: 作业统计
|
||||
label_technical_title: 职称
|
||||
|
@ -1616,9 +1624,9 @@ zh:
|
|||
label_contest_list: 竞赛列表
|
||||
|
||||
label_x_base_courses_member:
|
||||
zero: 成员
|
||||
one: 成员
|
||||
other: 成员
|
||||
zero: 学生
|
||||
one: 学生
|
||||
other: 学生
|
||||
|
||||
label_bids_task_list: 作业列表
|
||||
label_join_course: 加入课程
|
||||
|
|
Loading…
Reference in New Issue