- <%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %>
- <%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生姓名、学号进行搜索'%>
- <% if @group %>
- <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
-
- <% else %>
-
- <% end %>
- <% end %>
-
搜索
- <%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'),:class=>'xls'%>
+
+ <%= render :partial => 'searchmembers' %>
diff --git a/app/views/courses/_searchmembers.html.erb b/app/views/courses/_searchmembers.html.erb
index 71bacd02e..c6b577c8d 100644
--- a/app/views/courses/_searchmembers.html.erb
+++ b/app/views/courses/_searchmembers.html.erb
@@ -1,12 +1,11 @@
-<% if @subPage_title && @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; float: left;"%>
- <% if @group %>
- <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
- <%= submit_tag l(:label_search_member), :name => "ingroup",:class => "f_2", :style => "float: left "%>
- <% else %>
- <%= submit_tag l(:label_search_member),:style => "float: left", :name => 'incourse',:onclick => "checkclass('group_name_0')",:class => "f_2"%>
- <% end %>
+<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %>
+ <%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生姓名、学号进行搜索'%>
+ <% if @group %>
+ <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
+
+ <% else %>
+
<% end %>
- <%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'),:class=>'xls'%>
-<% end %>
\ No newline at end of file
+<% end %>
+
搜索
+<%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'),:class=>'xls'%>
\ No newline at end of file
From ab7d12e514f204a3d90085c461be552794e451d0 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 26 Mar 2015 11:30:00 +0800
Subject: [PATCH 3/4] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E3=80=81?=
=?UTF-8?q?=E5=88=A0=E9=99=A4=E5=88=86=E7=8F=AD=E6=98=AFjs=E6=96=B9?=
=?UTF-8?q?=E6=B3=95=E9=87=8D=E6=9E=84=202=E3=80=81=E9=AA=8C=E8=AF=81?=
=?UTF-8?q?=E5=88=86=E7=8F=AD=E5=90=8D=E6=98=AF=E5=90=A6=E9=87=8D=E5=A4=8D?=
=?UTF-8?q?=E9=87=8D=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 27 +++++---
app/views/courses/_course_student.html.erb | 2 +-
app/views/courses/_new_groups_name.html.erb | 14 ++---
app/views/courses/addgroups.js.erb | 2 +-
app/views/courses/deletegroup.js.erb | 2 +-
app/views/courses/updategroupname.js.erb | 2 +-
config/locales/zh.yml | 1 +
public/javascripts/course.js | 68 ++++++++++-----------
8 files changed, 63 insertions(+), 55 deletions(-)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index b3170e0b9..0b3f88d68 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -202,7 +202,7 @@ class CoursesController < ApplicationController
group.course_id = @course.id
group.save
end
- @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
+ @canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1'
@is_remote = true
@course_groups = @course.course_groups
@@ -236,17 +236,26 @@ class CoursesController < ApplicationController
valid_attr = params[:valid]
valid_value = params[:value]
-
- faker = CourseGroup.new
+ group_id = params[:group_id]
+ # faker = CourseGroup.new
if valid_attr.eql?('name')
- faker.name = valid_value
- faker.course_id = params[:course_id]
- faker.valid?
- req[:valid] = faker.errors[:name].blank?
- req[:message] = faker.errors[:name]
+ course = Course.find params[:course_id]
+ group_names = course.course_groups.map{|group| group.name unless group.id.to_s == group_id}.select{|group| !group.nil?}
+ if group_names.include?(valid_value)
+ req[:valid] = false
+ req[:message] = l(:modal_valid_unpassing)
+ else
+ req[:valid] = true
+ req[:message] = l(:modal_valid_passing)
+ end
+ # faker.name = valid_value
+ # faker.course_id = params[:course_id]
+ # faker.valid?
+ # req[:valid] = faker.errors[:name].blank?
+ # req[:message] = faker.errors[:name]
end
- req[:message] = l(:modal_valid_passing) if req[:message].blank?
+ # req[:message] = l(:modal_valid_passing) if req[:message].blank?
render :json => req
end
def join_group
diff --git a/app/views/courses/_course_student.html.erb b/app/views/courses/_course_student.html.erb
index c096fd2dc..8da3987a8 100644
--- a/app/views/courses/_course_student.html.erb
+++ b/app/views/courses/_course_student.html.erb
@@ -4,7 +4,7 @@