添加《添加相同组时应该给出相关提示信息》功能
Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
parent
f9a86356ad
commit
815d2ceb3d
|
@ -261,6 +261,25 @@ class CoursesController < ApplicationController
|
|||
@membercount = @members.count
|
||||
@course_groups = @course.course_groups
|
||||
end
|
||||
|
||||
def valid_ajax
|
||||
req = Hash.new(false)
|
||||
req[:message] = ''
|
||||
|
||||
valid_attr = params[:valid]
|
||||
valid_value = params[:value]
|
||||
|
||||
faker = CourseGroup.new
|
||||
|
||||
if valid_attr.eql?('name')
|
||||
faker.name = valid_value
|
||||
faker.valid?
|
||||
req[:valid] = faker.errors[:name].blank?
|
||||
req[:message] = faker.errors[:name]
|
||||
end
|
||||
req[:message] = l(:modal_valid_passing) if req[:message].blank?
|
||||
render :json => req
|
||||
end
|
||||
def join_group
|
||||
@subPage_title = l :label_student_list
|
||||
group = CourseGroup.find(params[:object_id])
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
var $group_name = $('#group_name')
|
||||
$group_name.blur(function (event) {
|
||||
if ($(this).is('#group_name')) {
|
||||
$.get(
|
||||
'<%=valid_ajax_course_path%>',
|
||||
{ valid: "name",
|
||||
value: this.value },
|
||||
function (data) {
|
||||
if (!data.valid) {
|
||||
alert('<%= l(:label_groupname_repeat) %>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type=" text/javascript" charset="utf-8">
|
||||
function validate_groupname(value1) {
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<% @nav_dispaly_project_label = 1
|
||||
@nav_dispaly_forum_label = 1 %>
|
||||
<% @nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%= current_language %>">
|
||||
<head>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<div class="member_header">
|
||||
|
||||
<div class="member_header">
|
||||
<p>
|
||||
<%= @subPage_title %>
|
||||
</p>
|
||||
|
|
|
@ -576,8 +576,9 @@ zh:
|
|||
label_member_people: 人
|
||||
label_delete_group: 确定删除分班?
|
||||
label_current_group: 当前分班
|
||||
label_limit_groupname: 组别名不能超出20字符
|
||||
label_limit_groupname_null: 组别名不能为空
|
||||
label_limit_groupname: 班名不能超出20字符
|
||||
label_groupname_repeat: 该班名已存在
|
||||
label_limit_groupname_null: 班名不能为空
|
||||
label_member_new: 添加成员
|
||||
label_member_plural: 成员
|
||||
label_tracker: 跟踪标签
|
||||
|
|
|
@ -651,6 +651,7 @@ RedmineApp::Application.routes.draw do
|
|||
match "addgroups", :via => [:post, :get]
|
||||
match 'deletegroup', :via => [:delete]
|
||||
match 'show_member_score', :via => [:get]
|
||||
match 'valid_ajax', :to => 'courses#valid_ajax', :via => :get
|
||||
post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group'
|
||||
delete 'join_in/join_group', :to => 'courses#unjoin_group'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue