parent
cbb348dc0e
commit
130f9f87c2
|
@ -80,6 +80,8 @@ class HomeworkAttachController < ApplicationController
|
|||
if User.current.admin? || User.current.member_of?(@bid.courses.first)
|
||||
#该课程的学生的集合
|
||||
@members = @bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and user_id <> #{User.current.id}", {:role_id => [5, 10]})
|
||||
|
||||
@members = paginateHelper @members,10
|
||||
#@all_user = []
|
||||
#@bid.courses.first.members.each do |member|
|
||||
# @all_user << member.user
|
||||
|
@ -96,6 +98,22 @@ class HomeworkAttachController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def get_homework_member_list
|
||||
@bid = Bid.find(params[:bid_id])
|
||||
if User.current.admin? || User.current.member_of?(@bid.courses.first)
|
||||
#该课程的学生的集合
|
||||
@members = @bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and user_id <> #{User.current.id}", {:role_id => [5, 10]})
|
||||
|
||||
@members = paginateHelper @members,10
|
||||
else
|
||||
raise "error"
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#获取指定作业的所有成员
|
||||
def members_for_homework homework
|
||||
people = []
|
||||
|
|
|
@ -19,7 +19,8 @@ module HomeworkAttachHelper
|
|||
def render_new_members_for_homework members
|
||||
#scope = Principal.active.sorted.not_member_of(project).like(params[:q])
|
||||
#scope = project.members
|
||||
principals = paginateHelper members,10
|
||||
#principals = paginateHelper members,10
|
||||
principals = members
|
||||
#principal_count = members.count
|
||||
#limit = 10
|
||||
#principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
|
||||
|
@ -27,7 +28,7 @@ module HomeworkAttachHelper
|
|||
#principals = members[offset, limit]
|
||||
s = content_tag('div', member_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals')
|
||||
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
|
||||
link_to text, new_homework_attach_path( parameters.merge(:q => params[:q], :format => 'js')), :remote => true }
|
||||
link_to text, get_homework_member_list_homework_attach_index_path( parameters.merge(:q => params[:q], bid_id: params[:id]||@bid)), :remote => true }
|
||||
return s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
|
||||
end
|
||||
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
<%= error_messages_for 'member' %>
|
||||
<div style="float:left; width:60%;height:410px;padding-left: 10px;padding-right: 10px">
|
||||
<div style="float:left; width:60%;height:400px;padding-left: 10px;padding-right: 10px">
|
||||
<table class="list members" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:label_user) %></th>
|
||||
<th><%= l(:label_role_plural) %></th>
|
||||
<th style="width:15%"></th>
|
||||
<th style="width:10%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for m in (1..10) %>
|
||||
<tr id="member-<%= User.current.id %>" class="<%= cycle 'odd', 'even' %> member" style="text-align: center">
|
||||
<td style="width: 40%"><%= link_to_user User.current %></td>
|
||||
<td style="text-align: center;width: 60%"> 发布人员 </td>
|
||||
<td style="text-align: center;width: 50%"> 发布人员 </td>
|
||||
<td><a>删除</a></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright" style="width: 37%">
|
||||
<div class="splitcontentright" style="width: 37%;height: 400px">
|
||||
<fieldset>
|
||||
<legend><%= l(:label_member_new) %></legend>
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<div id="principals_for_new_member">
|
||||
<%= render_new_members_for_homework(members) %>
|
||||
</div>
|
|
@ -0,0 +1,2 @@
|
|||
$('#principals_for_new_member').replaceWith('<%= j(render :partial => "member_list_partial", locals:{members: @members})%>');
|
||||
|
|
@ -26,11 +26,13 @@ RedmineApp::Application.routes.draw do
|
|||
|
||||
resources :homework_attach do
|
||||
collection do
|
||||
get 'get_homework_member_list'
|
||||
match 'addjours', via: [:get, :post]
|
||||
match 'add_jour_reply', via: [:get,:post]
|
||||
match 'destroy_jour', via: [:get,:post]
|
||||
end
|
||||
end
|
||||
|
||||
resources :open_source_projects do
|
||||
collection do
|
||||
match 'search', via: [:get, :post]
|
||||
|
|
Loading…
Reference in New Issue