From 63c9804da85e480dea04cf59a717eb1027d1e80a Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Tue, 2 Dec 2014 14:41:36 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0course=5Fgroup=E8=A1=A8?=
=?UTF-8?q?=E5=8D=95=E5=88=B0=E6=95=B0=E6=8D=AE=E5=BA=93=E4=B8=AD=EF=BC=8C?=
=?UTF-8?q?=E5=B9=B6=E5=BB=BA=E7=AB=8B=E5=AF=B9=E5=BA=94=E4=BA=8Emembers?=
=?UTF-8?q?=E5=92=8Ccourses=E4=B9=8B=E9=97=B4=E7=9A=84=E5=85=B3=E8=81=94?=
=?UTF-8?q?=EF=BC=8C=20=E5=AF=B9=E7=9B=B8=E5=BA=94=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: alan <547533434@qq.com>
---
app/controllers/courses_controller.rb | 8 +-
app/helpers/courses_helper.rb | 10 +-
app/models/course.rb | 2 +
app/models/course_group.rb | 15 +
app/models/member.rb | 1 +
app/views/courses/member.html.erb | 21 +-
.../20141126091207_create_course_groups.rb | 11 +
.../20141126091750_add_column_to_members.rb | 5 +
db/schema.rb | 10 +-
public/images/btn.png | Bin 0 -> 1308 bytes
public/images/close2.png | Bin 0 -> 1637 bytes
public/images/inputBg.png | Bin 0 -> 958 bytes
public/images/pic_edit.png | Bin 0 -> 629 bytes
public/images/pic_up.png | Bin 0 -> 217 bytes
public/javascripts/application.js.bak | 696 ------------------
public/stylesheets/course_group.css | 67 ++
test/fixtures/course_groups.yml | 11 +
test/unit/course_group_test.rb | 7 +
18 files changed, 157 insertions(+), 707 deletions(-)
create mode 100644 app/models/course_group.rb
create mode 100644 db/migrate/20141126091207_create_course_groups.rb
create mode 100644 db/migrate/20141126091750_add_column_to_members.rb
create mode 100644 public/images/btn.png
create mode 100644 public/images/close2.png
create mode 100644 public/images/inputBg.png
create mode 100644 public/images/pic_edit.png
create mode 100644 public/images/pic_up.png
delete mode 100644 public/javascripts/application.js.bak
create mode 100644 public/stylesheets/course_group.css
create mode 100644 test/fixtures/course_groups.yml
create mode 100644 test/unit/course_group_test.rb
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index bd389ff68..78f75f31a 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -201,13 +201,19 @@ class CoursesController < ApplicationController
@render_file = 'member_list'
@teachers= searchTeacherAndAssistant(@course)
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
+ @role = params[:role]
+ @course_group_id = params[:@course_group_id] unless params[:@course_group_id].nil?
case params[:role]
when '1'
@subPage_title = l :label_teacher_list
@members = searchTeacherAndAssistant(@course)
when '2'
@subPage_title = l :label_student_list
- @members = searchStudent(@course)
+ if @course_group_id
+ @members = search_student_in_group(@course, @course_group_id)
+ else
+ @members = searchStudent(@course)
+ end
else
@subPage_title = ''
@members = @course.member_principals.includes(:roles, :principal).all.sort
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 178782da3..92f95bdc1 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -170,7 +170,7 @@ module CoursesHelper
members
end
- def searchStudent project
+ def search_student_in_group(project, course_group_id)
#searchPeopleByRoles(project, StudentRoles)
members = []
project.members.each do |m|
@@ -178,6 +178,14 @@ module CoursesHelper
end
members
end
+ def searchStudent project
+ #searchPeopleByRoles(project, StudentRoles)
+ members = []
+ project.members.each do |m|
+ members << m if m && m.user && m.user.allowed_to?(:as_student,project)
+ end
+ members
+ end
# =====================================================================================
#def searchCountByRoles project, roles_id
diff --git a/app/models/course.rb b/app/models/course.rb
index 6bb7a75d4..099ae7ae5 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -29,6 +29,8 @@ class Course < ActiveRecord::Base
has_many :news, :dependent => :destroy, :include => :author
has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy
+ has_many :course_groups, :dependent => :destroy
+
acts_as_taggable
acts_as_nested_set :order => 'name', :dependent => :destroy
acts_as_attachable :view_permission => :view_files,
diff --git a/app/models/course_group.rb b/app/models/course_group.rb
new file mode 100644
index 000000000..236a51145
--- /dev/null
+++ b/app/models/course_group.rb
@@ -0,0 +1,15 @@
+class CourseGroup < ActiveRecord::Base
+ # attr_accessible :title, :body
+ belongs_to :course
+ has_many :members
+
+ before_destroy :set_member_nil
+
+ attr_accessible :name
+
+ def set_member_nil
+ if self.members && self.members.count > 0
+ self.members.update_all("course_group_id = 0")
+ end
+ end
+end
diff --git a/app/models/member.rb b/app/models/member.rb
index 46aefbd09..716f6a7c5 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -24,6 +24,7 @@ class Member < ActiveRecord::Base
belongs_to :project
belongs_to :course
+ belongs_to :course_group
validates_presence_of :principal
validates_uniqueness_of :user_id, :scope => [:project_id,:course_id]
validate :validate_role
diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb
index 3d3076bcc..aff9ffeb5 100644
--- a/app/views/courses/member.html.erb
+++ b/app/views/courses/member.html.erb
@@ -1,10 +1,15 @@
-
-
- <%= error_messages_for 'member' %>
- <%= render :partial => @render_file, :locals => {:members => @members} %>
+<%= stylesheet_link_tag 'course_group', :media => 'all' %>
+
+
+ <%= @subPage_title %>
+ <% if @subPage_title == l(:label_student_list) %>
+
+ <%= submit_tag l(:label_search), :class => 'f_2' %>
+ <% end %>
+
+
+ <%= error_messages_for 'member' %>
+ <%= render :partial => @render_file, :locals => {:members => @members} %>
+
diff --git a/db/migrate/20141126091207_create_course_groups.rb b/db/migrate/20141126091207_create_course_groups.rb
new file mode 100644
index 000000000..2ee849b6f
--- /dev/null
+++ b/db/migrate/20141126091207_create_course_groups.rb
@@ -0,0 +1,11 @@
+class CreateCourseGroups < ActiveRecord::Migration
+ def change
+ create_table :course_groups do |t|
+ t.string :name
+ t.integer :course_id
+
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20141126091750_add_column_to_members.rb b/db/migrate/20141126091750_add_column_to_members.rb
new file mode 100644
index 000000000..ce1ac7a75
--- /dev/null
+++ b/db/migrate/20141126091750_add_column_to_members.rb
@@ -0,0 +1,5 @@
+class AddColumnToMembers < ActiveRecord::Migration
+ def change
+ add_column :members, :course_group_id, :integer, default: 0
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 973e2afbe..36fcb15cf 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20141120091234) do
+ActiveRecord::Schema.define(:version => 20141126091750) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -313,6 +313,13 @@ ActiveRecord::Schema.define(:version => 20141120091234) do
t.integer "container_id", :default => 0
end
+ create_table "course_groups", :force => true do |t|
+ t.string "name"
+ t.integer "course_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "course_infos", :force => true do |t|
t.integer "course_id"
t.integer "user_id"
@@ -651,6 +658,7 @@ ActiveRecord::Schema.define(:version => 20141120091234) do
t.datetime "created_on"
t.boolean "mail_notification", :default => false, :null => false
t.integer "course_id", :default => -1
+ t.integer "course_group_id", :default => 0
end
add_index "members", ["project_id"], :name => "index_members_on_project_id"
diff --git a/public/images/btn.png b/public/images/btn.png
new file mode 100644
index 0000000000000000000000000000000000000000..85cea7f5c179b272cbe136f07f804ab663f8b161
GIT binary patch
literal 1308
zcmV+%1>^dOP)
(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd
zMgRZ=qDe$SRCwCVn9Xk!M;OL`Gv0iV0||8$5CI7)acRn@3Q^e;s^}&ELMv63s#L<>
z9D3-fBJ{+i2XAs{sZ`7GQ#{@3QS<9h$;eUJbAan=E(kaBu&-wyuX&@6>PCV+0sN%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BHs5Rcwth!O<88K})Gp>&9sfT=$
zah-FnzLuLB!3$_)9fj^=4V%(B^E5dMBN(
zOiLFl+asTPJ*1}Yeg1wzFGSJMYu)7Q;KAFY`#T%C{-tlfzg&LUzxL!M_vz>9>C@-;
fK3sgQo0~g*=8t{Del5JIq&Lc_H}zNh{bzpx7X2%s
literal 0
HcmV?d00001
diff --git a/public/images/pic_edit.png b/public/images/pic_edit.png
new file mode 100644
index 0000000000000000000000000000000000000000..fc2f3ae13a4c12b1e73e6494568d239ef14a29bb
GIT binary patch
literal 629
zcmV-*0*d{KP)(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd
zMgRZ-`$>bWkV^bN%X|wCvlq5dA=X;&Qr|gPrd#
zT9$Q6CdUU^TEcz)%yC0et^tVcqb{d=e+LdjQYtrhA4=%CTn|#XG(~7n_buI>JBy}igu~&;tLDZV=_V}$AQm1U1_7FG|5Y+g5z@WEb{q+%X|f+u
zs~^9$gq}~dj{NDZ)KEI1dxPy*Yar)X{FF?!c&rP3-9JaFOVw?ppzaO&kaJ*}WT#{6
zE+Ix$7cXJ!E|dzXt7IrwbZ^jyF$0!CDiJRjh8QqyaYvQ~a#PU1e+4NeQc6^#q_{1c
zW8R~8PqJ|jRGrxP>$eR%cj9wL*U
zwHF?@!$h{J=Hk`$l6sns%YA%_%sxtPOnuLL#@;My8K4cw*EsU{`Xx${bPe$OC~uCty~rT;(mm7XSK=dI$sp%C7+c*N@(mC&bl5
P00000NkvXXu0mjf4wwr>
literal 0
HcmV?d00001
diff --git a/public/images/pic_up.png b/public/images/pic_up.png
new file mode 100644
index 0000000000000000000000000000000000000000..84401074a7d586610910efab0f3b5c4283563b3e
GIT binary patch
literal 217
zcmeAS@N?(olHy`uVBq!ia0vp^96+qV!3HGtKUiJ>Qk(@Ik;M!Q+`=Ht$S`Y;1V}})
zN02WALzOB6LqjtI!_WUf`XvKHsR0ASs{{rHs~HRo;`x)}kGcWX#(TOrhE&{2nliI|
z4kOn;=S(*?Hnz6oonky7;KRehAUrFt#H>*5&v7L_@#IEJuDcUeA`LHaMNGKS(|mQJ
zv){q`oX+$UOWOZiOtMiv!;-_zopr
E0Q9^(asU7T
literal 0
HcmV?d00001
diff --git a/public/javascripts/application.js.bak b/public/javascripts/application.js.bak
deleted file mode 100644
index 0c09ffb03..000000000
--- a/public/javascripts/application.js.bak
+++ /dev/null
@@ -1,696 +0,0 @@
-//= require_directory ./rateable
-/* Redmine - project management software
- Copyright (C) 2006-2013 Jean-Philippe Lang */
-
-function cleanArray (actual){
- var newArray = new Array();
- for (var i = 0; i< actual.length; i++){
- if (actual[i]){
- newArray.push(actual[i]);
- }
- }
- return newArray;
-}
-
-function checkAll(id, checked) {
- if (checked) {
- $('#'+id).find('input[type=checkbox]').attr('checked', true);
- } else {
- $('#'+id).find('input[type=checkbox]').removeAttr('checked');
- }
-}
-
-function toggleCheckboxesBySelector(selector) {
- var all_checked = true;
- $(selector).each(function(index) {
- if (!$(this).is(':checked')) { all_checked = false; }
- });
- $(selector).attr('checked', !all_checked);
-}
-
-function showAndScrollTo(id, focus) {
- $('#'+id).show();
- if (focus !== null) {
- $('#'+focus).focus();
- }
- $('html, body').animate({scrollTop: $('#'+id).offset().top}, 400);
-}
-
-function toggleRowGroup(el) {
- var tr = $(el).parents('tr').first();
- var n = tr.next();
- tr.toggleClass('open');
- while (n.length && !n.hasClass('group')) {
- n.toggle();
- n = n.next('tr');
- }
-}
-
-function collapseAllRowGroups(el) {
- var tbody = $(el).parents('tbody').first();
- tbody.children('tr').each(function(index) {
- if ($(this).hasClass('group')) {
- $(this).removeClass('open');
- } else {
- $(this).hide();
- }
- });
-}
-
-function expandAllRowGroups(el) {
- var tbody = $(el).parents('tbody').first();
- tbody.children('tr').each(function(index) {
- if ($(this).hasClass('group')) {
- $(this).addClass('open');
- } else {
- $(this).show();
- }
- });
-}
-
-function toggleAllRowGroups(el) {
- var tr = $(el).parents('tr').first();
- if (tr.hasClass('open')) {
- collapseAllRowGroups(el);
- } else {
- expandAllRowGroups(el);
- }
-}
-
-function toggleFieldset(el) {
- var fieldset = $(el).parents('fieldset').first();
- fieldset.toggleClass('collapsed');
- fieldset.children('div').toggle();
-}
-
-function hideFieldset(el) {
- var fieldset = $(el).parents('fieldset').first();
- fieldset.toggleClass('collapsed');
- fieldset.children('div').hide();
-}
-
-function initFilters(){
- $('#add_filter_select').change(function(){
- addFilter($(this).val(), '', []);
- });
- $('#filters-table td.field input[type=checkbox]').each(function(){
- toggleFilter($(this).val());
- });
- $('#filters-table td.field input[type=checkbox]').live('click',function(){
- toggleFilter($(this).val());
- });
- $('#filters-table .toggle-multiselect').live('click',function(){
- toggleMultiSelect($(this).siblings('select'));
- });
- $('#filters-table input[type=text]').live('keypress', function(e){
- if (e.keyCode == 13) submit_query_form("query_form");
- });
-}
-
-function addFilter(field, operator, values) {
- var fieldId = field.replace('.', '_');
- var tr = $('#tr_'+fieldId);
- if (tr.length > 0) {
- tr.show();
- } else {
- buildFilterRow(field, operator, values);
- }
- $('#cb_'+fieldId).attr('checked', true);
- toggleFilter(field);
- $('#add_filter_select').val('').children('option').each(function(){
- if ($(this).attr('value') == field) {
- $(this).attr('disabled', true);
- }
- });
-}
-
-function buildFilterRow(field, operator, values) {
- var fieldId = field.replace('.', '_');
- var filterTable = $("#filters-table");
- var filterOptions = availableFilters[field];
- var operators = operatorByType[filterOptions['type']];
- var filterValues = filterOptions['values'];
- var i, select;
-
- var tr = $('').attr('id', 'tr_'+fieldId).html(
- ' | ' +
- ' | ' +
- ' | '
- );
- filterTable.append(tr);
-
- select = tr.find('td.operator select');
- for (i=0;i').val(operators[i]).text(operatorLabels[operators[i]]);
- if (operators[i] == operator) { option.attr('selected', true); }
- select.append(option);
- }
- select.change(function(){ toggleOperator(field); });
-
- switch (filterOptions['type']){
- case "list":
- case "list_optional":
- case "list_status":
- case "list_subprojects":
- tr.find('td.values').append(
- '' +
- ' 复选/multi-select'
- );
- select = tr.find('td.values select');
- if (values.length > 1) { select.attr('multiple', true); }
- for (i=0;i');
- if ($.isArray(filterValue)) {
- option.val(filterValue[1]).text(filterValue[0]);
- if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);}
- } else {
- option.val(filterValue).text(filterValue);
- if ($.inArray(filterValue, values) > -1) {option.attr('selected', true);}
- }
- select.append(option);
- }
- break;
- case "date":
- case "date_past":
- tr.find('td.values').append(
- '' +
- ' ' +
- ' '+labelDayPlural+''
- );
- $('#values_'+fieldId+'_1').val(values[0]).datepicker(datepickerOptions);
- $('#values_'+fieldId+'_2').val(values[1]).datepicker(datepickerOptions);
- $('#values_'+fieldId).val(values[0]);
- break;
- case "string":
- case "text":
- tr.find('td.values').append(
- ''
- );
- $('#values_'+fieldId).val(values[0]);
- break;
- case "relation":
- tr.find('td.values').append(
- '' +
- ''
- );
- $('#values_'+fieldId).val(values[0]);
- select = tr.find('td.values select');
- for (i=0;i');
- option.val(filterValue[1]).text(filterValue[0]);
- if (values[0] == filterValue[1]) { option.attr('selected', true); }
- select.append(option);
- }
- case "integer":
- case "float":
- tr.find('td.values').append(
- '' +
- ' '
- );
- $('#values_'+fieldId+'_1').val(values[0]);
- $('#values_'+fieldId+'_2').val(values[1]);
- break;
- }
-}
-
-function toggleFilter(field) {
- var fieldId = field.replace('.', '_');
- if ($('#cb_' + fieldId).is(':checked')) {
- $("#operators_" + fieldId).show().removeAttr('disabled');
- toggleOperator(field);
- } else {
- $("#operators_" + fieldId).hide().attr('disabled', true);
- enableValues(field, []);
- }
-}
-
-function enableValues(field, indexes) {
- var fieldId = field.replace('.', '_');
- $('#tr_'+fieldId+' td.values .value').each(function(index) {
- if ($.inArray(index, indexes) >= 0) {
- $(this).removeAttr('disabled');
- $(this).parents('span').first().show();
- } else {
- $(this).val('');
- $(this).attr('disabled', true);
- $(this).parents('span').first().hide();
- }
-
- if ($(this).hasClass('group')) {
- $(this).addClass('open');
- } else {
- $(this).show();
- }
- });
-}
-
-function toggleOperator(field) {
- var fieldId = field.replace('.', '_');
- var operator = $("#operators_" + fieldId);
- switch (operator.val()) {
- case "!*":
- case "*":
- case "t":
- case "ld":
- case "w":
- case "lw":
- case "l2w":
- case "m":
- case "lm":
- case "y":
- case "o":
- case "c":
- enableValues(field, []);
- break;
- case "><":
- enableValues(field, [0,1]);
- break;
- case "t+":
- case ">t-":
- case "0) {
- lis.eq(i-1).show();
- }
-}
-
-function displayTabsButtons() {
- var lis;
- var tabsWidth = 0;
- var el;
- $('div.tabs').each(function() {
- el = $(this);
- lis = el.find('ul').children();
- lis.each(function(){
- if ($(this).is(':visible')) {
- tabsWidth += $(this).width() + 6;
- }
- });
- if ((tabsWidth < el.width() - 60) && (lis.first().is(':visible'))) {
- el.find('div.tabs-buttons').hide();
- } else {
- el.find('div.tabs-buttons').show();
- }
- });
-}
-
-function setPredecessorFieldsVisibility() {
- var relationType = $('#relation_relation_type');
- if (relationType.val() == "precedes" || relationType.val() == "follows") {
- $('#predecessor_fields').show();
- } else {
- $('#predecessor_fields').hide();
- }
-}
-
-function showModal(id, width) {
- var el = $('#'+id).first();
- if (el.length === 0 || el.is(':visible')) {return;}
- var title = el.find('h3.title').text();
- el.dialog({
- width: width,
- modal: true,
- resizable: false,
- dialogClass: 'modal',
- title: title
- });
- el.find("input[type=text], input[type=submit]").first().focus();
-}
-
-function hideModal(el) {
- var modal;
- if (el) {
- modal = $(el).parents('.ui-dialog-content');
- } else {
- modal = $('#ajax-modal');
- }
- modal.dialog("close");
-}
-
-function submitPreview(url, form, target) {
- $.ajax({
- url: url,
- type: 'post',
- beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))},
- data: $('#'+form).serialize(),
- success: function(data){
- $('#'+target).html(data);
- }
- });
-}
-
-function collapseScmEntry(id) {
- $('.'+id).each(function() {
- if ($(this).hasClass('open')) {
- collapseScmEntry($(this).attr('id'));
- }
- $(this).hide();
- });
- $('#'+id).removeClass('open');
-}
-
-function expandScmEntry(id) {
- $('.'+id).each(function() {
- $(this).show();
- if ($(this).hasClass('loaded') && !$(this).hasClass('collapsed')) {
- expandScmEntry($(this).attr('id'));
- }
- });
- $('#'+id).addClass('open');
-}
-
-function scmEntryClick(id, url) {
- el = $('#'+id);
- if (el.hasClass('open')) {
- collapseScmEntry(id);
- el.addClass('collapsed');
- return false;
- } else if (el.hasClass('loaded')) {
- expandScmEntry(id);
- el.removeClass('collapsed');
- return false;
- }
- if (el.hasClass('loading')) {
- return false;
- }
- el.addClass('loading');
- $.ajax({
- url: url,
- success: function(data){
- el.after(data);
- el.addClass('open').addClass('loaded').removeClass('loading');
- }
- });
- return true;
-}
-
-function randomKey(size) {
- var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
- var key = '';
- for (i = 0; i < size; i++) {
- key += chars[Math.floor(Math.random() * chars.length)];
- }
- return key;
-}
-
-// Can't use Rails' remote select because we need the form data
-function updateIssueFrom(url) {
- $.ajax({
- url: url,
- type: 'post',
- data: $('#issue-form').serialize()
- });
-}
-
-function updateBulkEditFrom(url) {
- $.ajax({
- url: url,
- type: 'post',
- data: $('#bulk_edit_form').serialize()
- });
-}
-
-function clearMessage(id) {
- $('#'+id).val("");
-}
-
-
-function observeAutocompleteField(fieldId, url, options) {
- $(document).ready(function() {
- $('#'+fieldId).autocomplete($.extend({
- source: url,
- select: function(e,ui){self.location="/issues/"+ui.item.value;},
- minLength: 2,
- search: function(){$('#'+fieldId).addClass('ajax-loading');},
- response: function(){$('#'+fieldId).removeClass('ajax-loading');
- }
- }, options));
- $('#'+fieldId).addClass('autocomplete');
-
- });
-
-}
-
-function observeSearchfield(fieldId, targetId, url) {
- $('#'+fieldId).each(function() {
- var $this = $(this);
- $this.addClass('autocomplete');
- $this.attr('data-value-was', $this.val());
- var check = function() {
- var val = $this.val();
- if ($this.attr('data-value-was') != val){
- $this.attr('data-value-was', val);
- $.ajax({
- url: url,
- type: 'get',
- data: {q: $this.val()},
- success: function(data){ if(targetId) $('#'+targetId).html(data); },
- beforeSend: function(){ $this.addClass('ajax-loading'); },
- complete: function(){ $this.removeClass('ajax-loading'); }
- });
- }
- };
- var reset = function() {
- if (timer) {
- clearInterval(timer);
- timer = setInterval(check, 300);
- }
- };
- var timer = setInterval(check, 300);
- $this.bind('keyup click mousemove', reset);
- });
-}
-
-function observeProjectModules() {
- var f = function() {
- /* Hides trackers and issues custom fields on the new project form when issue_tracking module is disabled */
- if ($('#project_enabled_module_names_issue_tracking').attr('checked')) {
- $('#project_trackers').show();
- }else{
- $('#project_trackers').hide();
- }
- };
-
- $(window).load(f);
- $('#project_enabled_module_names_issue_tracking').change(f);
-}
-
-function initMyPageSortable(list, url) {
- $('#list-'+list).sortable({
- connectWith: '.block-receiver',
- tolerance: 'pointer',
- update: function(){
- $.ajax({
- url: url,
- type: 'post',
- data: {'blocks': $.map($('#list-'+list).children(), function(el){return $(el).attr('id');})}
- });
- }
- });
- $("#list-top, #list-left, #list-right").disableSelection();
-}
-
-var warnLeavingUnsavedMessage;
-function warnLeavingUnsaved(message) {
- warnLeavingUnsavedMessage = message;
-
- $('form').submit(function(){
- $('textarea').removeData('changed');
- });
- $('textarea').change(function(){
- $(this).data('changed', 'changed');
- });
- window.onbeforeunload = function(){
- var warn = false;
- $('textarea').blur().each(function(){
- if ($(this).data('changed')) {
- warn = true;
- }
- });
- if (warn) {return warnLeavingUnsavedMessage;}
- };
-}
-
-function setupAjaxIndicator() {
-
- $('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) {
-
- if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') {
- $('#ajax-indicator').show();
- }
- });
-
- $('#ajax-indicator').bind('ajaxStop', function() {
- $('#ajax-indicator').hide();
- });
-}
-
-function hideOnLoad() {
- $('.hol').hide();
-}
-
-function addFormObserversForDoubleSubmit() {
- $('form[method=post]').each(function() {
- if (!$(this).hasClass('multiple-submit')) {
- $(this).submit(function(form_submission) {
- if ($(form_submission.target).attr('data-submitted')) {
- form_submission.preventDefault();
- } else {
- $(form_submission.target).attr('data-submitted', true);
- }
- });
- }
- });
-}
-
-function blockEventPropagation(event) {
- event.stopPropagation();
- event.preventDefault();
-}
-
-function toggleAndSettingWordsVal(parent_widget, text_widget, value){
- text_widget.val(value)
- parent_widget.slideToggle(400)
-}
-function transpotUrl (scope) {
- $(scope).each(function(){
- var tmpContent = $(this).html();
- tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,,]+)/gi,"$1$2$3<\/a>");
- // tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,,]+)/gi,"$1$2");
- $(this).html(tmpContent);
- });
-}
-
-$(document).ready(setupAjaxIndicator);
-$(document).ready(hideOnLoad);
-$(document).ready(addFormObserversForDoubleSubmit);
-$(document).ready(function(){
- $.ajaxSetup({
- headers: {
- 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
- }
- });
- }
-)
-
-function img_thumbnails() {
- $('.thumbnails a').colorbox({rel:'nofollow'});
- $('.attachments').find('a').each(function(index, element) {
- var href_value = $(element).attr('href');
- if (/\.(jpg|png|gif|bmp)$/.test(href_value)) {
- $(element).colorbox({rel:'nofollow'});
- }
-
- });
-}
-$(document).ready(img_thumbnails);
-
-function TimeClose(dateText, inst) {
- if(inst.id=="issue_start_date"){
- time=dateText;
- }
-}
-var time=new Date();
-function TimeBeforeShow(input){
- if(input.id=="issue_due_date"){
- //var minDate = $(input).datepicker('option', 'minDate');
- var tempdata=$("#issue_start_date").attr("value");
-
- $(input).datepicker('option', 'minDate',new Date(tempdata.replace(/-/g, "/")));
- //$('.selector').datepicker('option', 'minDate', '12/25/2012');
- }
-}
-
-function SetMinValue(){
- /// var tempdata=$("#issue_start_date").attr("value");
- //$('.selector').datepicker('option', 'minDate', '12/25/2012');
- //alert(tempdata);
- //$("#issue_due_date").datepicker({
- // minDate: new Date(2014,08,23)
- //var datepickerOptions=
- //{dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
- //alert( $('.issue_due_date').length);
- //$('.selector')[1].datepicker('option', 'minDate', new Date(2014, 0 - 8, 23));
- //$("#issue_due_date").datepicker(datepickerOptions);
- //$("##{issue_due_date}").datepicker(datepickerOptions);
- //$("#issue_due_date").datepicker(
- // {dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}
- //)
- //});
-}
-function PrecentChange(obj){
- var _v= obj;
- if(_v==100)
- {
- //var select=$("select[id='issue_status_id']");
- $("select[id='issue_status_id']").find("option[value='3']").attr("selected","selected");
- }
- else if(_v==0)
- {
- //alert(1);
- $("select[id='issue_status_id']").find("option[value='1']").attr("selected","selected");
- }
- else if(_v!=100&&_v!=0)
- {
- // alert(2);
- $("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected");
- }
-}
diff --git a/public/stylesheets/course_group.css b/public/stylesheets/course_group.css
new file mode 100644
index 000000000..638dddb20
--- /dev/null
+++ b/public/stylesheets/course_group.css
@@ -0,0 +1,67 @@
+body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
+div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea,form{ margin:0; padding:0;}
+div,img,tr,td,textarea,form{ border:0;}
+table,tr,td{border:0; cellspacing:0; cellpadding:0;}
+ul,li{ list-style-type:none}
+.cl{ clear:both; overflow:hidden; }
+a{ text-decoration:none; }
+a:hover{ }
+/**** 常用***/
+.f_l{ float:left;}
+.f_r{ float:right;}
+.b_lblue{ background:#64bdd9;}
+.b_dblue{ background:#55a1b9; cursor:pointer;}
+.f_b{ font-weight: bold;}
+.c_blue{ color:#64bdd9;}
+.c_grey{ color:#999999;}
+.c_grey02{ color:#666666;}
+.f_14{ font-size:14px;}
+.c_dblue{ color:#3e6d8e;}
+.c_red{ color:#ec0016;}
+.w90{width:90px;}
+.ml10{margin-left:10px;}
+
+.container{ width:940px; margin:0 auto; font-size:12px;}
+
+.st_list{ width:688px; padding-left:5px; height:800px;}
+.st_search{ margin:10px 0;}
+.st_search span{ font-size:14px; font-weight:bold; color:#606060; margin-right:35px;}
+.st_search input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:200px;}
+.st_search input.f_2{ background:#1c9ec7; padding: 3px; margin-left: 3px; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:45px; height:28px; float:left; font-size:12px; }
+.st_search a:hover{ background:#048fbb; text-decoration:none;}
+
+.classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;}
+.st_addclass{ margin-top:5px;}
+.st_addclass ul li{ margin-bottom:10px;}
+.st_addclass ul li,.st_addclass a,.st_addclass img{ float:left;}
+.st_addclass img{ margin-top:3px;}
+.st_addclass a{ color:#0d90c3;}
+
+.st_box{ margin-top:10px; border-top:1px solid #CCC; padding-top:10px;}
+.st_box ul li{ float:left;}
+.st_box_top a{ font-weight:bold; color:#7a7a7a; float:left;}
+.st_box_top a:hover{ color:#1c9ec7;}
+a.st_up{ display: block; width:8px; float:left; height:13px; background:url(images/pic_up.png) 0 0 no-repeat; margin-top:5px; margin-left:3px;}
+a.st_down{ display: block; width:8px; float:left; height:13px; background:url(images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;}
+a.st_img { display:block;width:40px; height:40px; border:1px solid #CCC; padding:1px;}
+a:hover.st_img { border:1px solid #1c9ec7; }
+.st_boxlist{ border-bottom:1px dashed #CCC; height:53px; padding-top:10px; }
+.st_boxlist a{ float:left;}
+.st_boxlist ul{ float:left; width:200px; margin-left:10px;}
+.st_boxlist ul li a{ color:#5d5d5d;}
+.st_boxlist ul li a span{ color:#1c9ec7;}
+.st_boxlist ul li a:hover span{ color:#ff8e15;}
+.ml50{ margin-left:50px;}
+.ml358{ margin-left:358px;}
+.ml258{ margin-left:254px;}
+.ml65{ margin-left:65px;}
+a:hover.st_add{ color:#ff8e15;}
+
+/****翻页***/
+.wlist{ margin-top:15px; float:right;}
+.wlist a{ float:left; border:1px solid #15bccf; padding:0 5px; margin-left:3px; color:#15bccf;}
+.wlist a:hover{border:1px solid #15bccf; background-color:#15bccf; color:#fff;}
+.wlist_select a { background-color:#64bdd9; color:#fff;}
+
+.submit{height:21px;border:0; cursor:pointer; background:url(images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; }
+.isTxt{background:#fbfbfb url(images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;}
\ No newline at end of file
diff --git a/test/fixtures/course_groups.yml b/test/fixtures/course_groups.yml
new file mode 100644
index 000000000..c63aac0b6
--- /dev/null
+++ b/test/fixtures/course_groups.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value
diff --git a/test/unit/course_group_test.rb b/test/unit/course_group_test.rb
new file mode 100644
index 000000000..c08ede23f
--- /dev/null
+++ b/test/unit/course_group_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class CourseGroupTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end