Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts: app/views/courses/_member_list.html.erb
This commit is contained in:
commit
cf5b03a379
|
@ -205,7 +205,12 @@ class CoursesController < ApplicationController
|
|||
@is_remote = true
|
||||
q = "#{params[:name].strip}"
|
||||
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
|
||||
@results = searchStudent_by_name(@course, q)
|
||||
if params[:incourse]
|
||||
@results = searchStudent_by_name(@course, q)
|
||||
elsif params[:ingroup]
|
||||
@group = CourseGroup.find(params[:search_group_id])
|
||||
@results = searchgroupstudent_by_name(@group, @course, q)
|
||||
end
|
||||
@result_count = @results.count
|
||||
@results = paginateHelper @results
|
||||
|
||||
|
@ -226,6 +231,16 @@ class CoursesController < ApplicationController
|
|||
@course_groups = @course.course_groups
|
||||
end
|
||||
|
||||
def deletegroup
|
||||
CourseGroup.delete(params[:group_id])
|
||||
@subPage_title = l :label_student_list
|
||||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
||||
@is_remote = true
|
||||
@members = searchStudent(@course)
|
||||
@membercount = @members.count
|
||||
@course_groups = @course.course_groups
|
||||
end
|
||||
|
||||
def updategroupname
|
||||
@subPage_title = l :label_student_list
|
||||
if params[:group_name]
|
||||
|
|
|
@ -184,6 +184,18 @@ module CoursesHelper
|
|||
end
|
||||
members
|
||||
end
|
||||
def searchgroupstudent_by_name(group, project, name)
|
||||
members = []
|
||||
group.members.each do |m|
|
||||
if m && m.user && m.user.allowed_to?(:as_student,project)
|
||||
username = m.user[:lastname].to_s + m.user[:firstname].to_s
|
||||
if(m.user[:login].to_s.include?(name) || m.user.user_extensions[:student_id].to_s.include?(name) || username.include?(name))
|
||||
members << m
|
||||
end
|
||||
end
|
||||
end
|
||||
members
|
||||
end
|
||||
def searchStudent_by_group group, project
|
||||
#searchPeopleByRoles(project, StudentRoles)
|
||||
members = []
|
||||
|
|
|
@ -1,40 +1,4 @@
|
|||
<script type=" text/javascript" charset="utf-8">
|
||||
function validate_groupname(value1) {
|
||||
|
||||
if(value1.length > 20) {
|
||||
alert('<%= l(:label_limit_groupname) %>');
|
||||
}
|
||||
}
|
||||
function checkclass(value) {
|
||||
|
||||
for(var i = 0; i < document.getElementsByName("check_group_name").length; i++) {
|
||||
if(document.getElementsByName("check_group_name")[i].id == value) {
|
||||
document.getElementById(value).className = "selected";
|
||||
}
|
||||
else {
|
||||
document.getElementsByName("check_group_name")[i].className = "classbox";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function validate_groupname_null(value1) {
|
||||
value1 = value1.trim();
|
||||
if(value1.length == 0 ) {
|
||||
alert('<%= l(:label_limit_groupname_null) %>');
|
||||
}
|
||||
}
|
||||
function validate_update(name) {
|
||||
value1 = document.getElementById(name).value;
|
||||
validate_groupname(value1);
|
||||
|
||||
}
|
||||
function validate_add_group() {
|
||||
value1 = document.getElementById('group_name').value;
|
||||
validate_groupname(value1);
|
||||
validate_groupname_null(value1);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<ul>
|
||||
|
@ -48,6 +12,13 @@
|
|||
<li class="classbox" id="group_name_<%= group.id %>" name="check_group_name">
|
||||
<%= link_to group_display, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true,
|
||||
:onclick => "checkclass('group_name_#{group.id}')",:style => " border:0px; color: #0d90c3; float:left;"%>
|
||||
<% if @canShowCode && group.members.count == 0 %>
|
||||
<%= link_to '', deletegroup_course_path(:group_id => group.id), :method => 'delete', :remote => true,
|
||||
:data => {confirm: l(:label_delete_group)},
|
||||
:class => 'f_1',
|
||||
:style => "width: 16px;height: 21px;margin-top:3px;margin-left:5px;background: url(/images/pic_del.gif) no-repeat 0 0;"
|
||||
%>
|
||||
<% end %>
|
||||
<% if @canShowCode %>
|
||||
<a href="javascript:void(0)" class="f_l" onclick="$('#add_tag_<%= group.id %>').slideToggle();"><img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" /></a>
|
||||
<% end %>
|
||||
|
|
|
@ -6,9 +6,14 @@
|
|||
<span style="font-size: 18px; float: left; margin-right: 35px"><%= l(:label_current_group)%>: <%= @group.name %></span>
|
||||
<% end %>
|
||||
<% if @subPage_title && @subPage_title == l(:label_student_list)%>
|
||||
<% if @subPage_title == l(:label_student_list) %>
|
||||
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:style => "margin-left: 5px; ",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'f_1', :style => "height:15px"%>
|
||||
<%= submit_tag l(:label_search), :class => "f_2"%>
|
||||
<% if @group %>
|
||||
<%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
|
||||
<%= submit_tag l(:label_search_member_in_group), :name => "ingroup",:class => "f_2"%>
|
||||
<% end %>
|
||||
<%= submit_tag l(:label_search_member_in_course), :name => 'incourse',:onclick => "checkclass('group_name_0')",:class => "f_2"%>
|
||||
<%#= link_to l(:label_search),'' , :class => 'f_2' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
|
|
@ -1,3 +1,40 @@
|
|||
<script type=" text/javascript" charset="utf-8">
|
||||
function validate_groupname(value1) {
|
||||
|
||||
if(value1.length > 20) {
|
||||
alert('<%= l(:label_limit_groupname) %>');
|
||||
}
|
||||
}
|
||||
function checkclass(value) {
|
||||
|
||||
for(var i = 0; i < document.getElementsByName("check_group_name").length; i++) {
|
||||
if(document.getElementsByName("check_group_name")[i].id == value) {
|
||||
document.getElementById(value).className = "selected";
|
||||
}
|
||||
else {
|
||||
document.getElementsByName("check_group_name")[i].className = "classbox";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function validate_groupname_null(value1) {
|
||||
value1 = value1.trim();
|
||||
if(value1.length == 0 ) {
|
||||
alert('<%= l(:label_limit_groupname_null) %>');
|
||||
}
|
||||
}
|
||||
function validate_update(name) {
|
||||
value1 = document.getElementById(name).value;
|
||||
validate_groupname(value1);
|
||||
|
||||
}
|
||||
function validate_add_group() {
|
||||
value1 = document.getElementById('group_name').value;
|
||||
validate_groupname(value1);
|
||||
validate_groupname_null(value1);
|
||||
|
||||
}
|
||||
</script>
|
||||
<%= stylesheet_link_tag 'course_group', :media => 'all' %>
|
||||
<script type="text/javascript" src="javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js"></script>
|
||||
<div class="st_list">
|
||||
|
|
|
@ -570,8 +570,11 @@ zh:
|
|||
label_role_new: 新建角色
|
||||
label_role_and_permissions: 角色和权限
|
||||
label_member: 成员
|
||||
label_search_member_in_group: 班内搜索
|
||||
label_search_member_in_course: 课内搜索
|
||||
label_search_member_count: 共搜索到
|
||||
label_member_people: 人
|
||||
label_delete_group: 确定删除分班?
|
||||
label_current_group: 当前分班
|
||||
label_limit_groupname: 组别名不能超出20字符
|
||||
label_limit_groupname_null: 组别名不能为空
|
||||
|
|
|
@ -646,7 +646,8 @@ RedmineApp::Application.routes.draw do
|
|||
match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get]
|
||||
match "searchgroupmembers", :via => [:post, :get]
|
||||
match "updategroupname", :via => [:post, :get]
|
||||
match "addgroups", :via => [:post, :get]
|
||||
match "addgroups", :via => [:post, :get]
|
||||
match 'deletegroup', :via => [:delete]
|
||||
post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group'
|
||||
delete 'join_in/join_group', :to => 'courses#unjoin_group'
|
||||
end
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 100 B |
Loading…
Reference in New Issue