课程大纲教师团队的管理
This commit is contained in:
parent
d1c284c953
commit
caf5602389
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the SyllabusMember controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,64 @@
|
|||
class SyllabusMemberController < ApplicationController
|
||||
|
||||
def syl_member_autocomplete
|
||||
@syllabus = Syllabus.find(params[:syllabus])
|
||||
@flag = params[:flag] || false
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@syllabus = Syllabus.find(params[:syllabus])
|
||||
if params[:membership].nil?
|
||||
@fail_hint = l(:label_blank_user_lists_for_org)
|
||||
else
|
||||
member_ids = params[:membership][:user_ids]
|
||||
last_rank = @syllabus.syllabus_members.order("rank asc").last.rank
|
||||
user_ids = @syllabus.syllabus_members.map{|sy| sy.user_id}
|
||||
member_ids.each_with_index do |user_id, i|
|
||||
unless user_ids.include?(user_id.to_i)
|
||||
member = SyllabusMember.create(:user_id => user_id, :rank => last_rank + 1 + i)
|
||||
@syllabus.syllabus_members << member
|
||||
end
|
||||
end
|
||||
@members = @syllabus.syllabus_members.order("rank asc")
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
member = SyllabusMember.find(params[:id])
|
||||
@syllabus = member.syllabus
|
||||
after_syl_members = @syllabus.syllabus_members.where("rank > #{member.rank}")
|
||||
after_syl_members.update_all("rank = rank - 1")
|
||||
member.destroy
|
||||
@members = @syllabus.syllabus_members.order("rank asc")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def update_rank
|
||||
member = SyllabusMember.find(params[:id])
|
||||
@syllabus = member.syllabus
|
||||
members = @syllabus.syllabus_members
|
||||
if params[:opr] == 'up' && member.rank > 2
|
||||
before_mem = members.where("rank = #{member.rank - 1}").first
|
||||
if before_mem && member.update_attribute('rank', member.rank - 1)
|
||||
before_mem.update_attribute('rank', before_mem.rank + 1)
|
||||
end
|
||||
elsif params[:opr] == 'down' && member.rank > 1 && member.rank < members.count
|
||||
after_mem = members.where("rank = #{member.rank + 1}").first
|
||||
if after_mem && member.update_attribute('rank', member.rank + 1)
|
||||
after_mem.update_attribute('rank', after_mem.rank - 1)
|
||||
end
|
||||
end
|
||||
@members = @syllabus.syllabus_members.order("rank asc")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
|
@ -6,7 +6,7 @@ class SyllabusesController < ApplicationController
|
|||
include CoursesHelper
|
||||
|
||||
before_filter :is_logged, :only => [:index, :show, :edit, :new, :update, :destroy, :delete_syllabus]
|
||||
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :edit_syllabus_title, :update_base_info, :delete_syllabus, :delete_des]
|
||||
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :edit_syllabus_title, :update_base_info, :delete_syllabus, :delete_des, :members]
|
||||
def index
|
||||
user = User.current
|
||||
@syllabuses = user.syllabuses
|
||||
|
@ -170,6 +170,14 @@ class SyllabusesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def members
|
||||
@members = @syllabus.syllabus_members.includes(:user => {:user_extensions => [], :courses => []}).order("rank asc")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{render :layout => 'base_syllabus'}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def find_syllabus
|
||||
@syllabus = Syllabus.find params[:id]
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
module SyllabusMemberHelper
|
||||
include ApplicationHelper
|
||||
|
||||
def find_user_not_in_current_syllabus_by_name syllabus
|
||||
if params[:q] && params[:q].lstrip.rstrip != ""
|
||||
scope = Principal.active.sorted.not_member_of_syllabus(syllabus).like(params[:q])
|
||||
else
|
||||
scope = []
|
||||
end
|
||||
principals = paginateHelper scope,10
|
||||
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals', :class => 'sy_new_tchlist')
|
||||
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
|
||||
link_to text, host_with_protocol + "/syllabus_member/syl_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:syllabus=> syllabus, :format => 'js').to_query, :remote => true
|
||||
}
|
||||
s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "syllabus_member_pagination_links" )
|
||||
end
|
||||
end
|
|
@ -4,6 +4,20 @@ module SyllabusesHelper
|
|||
Syllabus.tagged_with(tag_name).order('updated_at desc')
|
||||
end
|
||||
|
||||
def find_user_not_in_current_syllabus_by_name syllabus
|
||||
if params[:q] && params[:q].lstrip.rstrip != ""
|
||||
scope = Principal.active.sorted.not_member_of_syllabus(syllabus).like(params[:q])
|
||||
else
|
||||
scope = []
|
||||
end
|
||||
principals = paginateHelper scope,10
|
||||
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals', :class => 'sy_new_tchlist')
|
||||
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
|
||||
link_to text, host_with_protocol + "/syllabus_member/syl_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:syllabus=> syllabus, :format => 'js').to_query, :remote => true
|
||||
}
|
||||
s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "syllabus_member_pagination_links" )
|
||||
end
|
||||
|
||||
def teacher_count syllabus
|
||||
count = 0
|
||||
courses = syllabus.courses
|
||||
|
|
|
@ -97,6 +97,16 @@ class Principal < ActiveRecord::Base
|
|||
end
|
||||
}
|
||||
|
||||
scope :not_member_of_syllabus, lambda {|syllabus|
|
||||
syllabuses = [syllabus] unless syllabus.is_a?(Array)
|
||||
if syllabuses.empty?
|
||||
where("1=0")
|
||||
else
|
||||
ids = syllabuses.map(&:id)
|
||||
where("#{Principal.table_name}.id NOT IN (SELECT DISTINCT user_id FROM #{SyllabusMember.table_name} WHERE syllabus_id IN (?))", ids)
|
||||
end
|
||||
}
|
||||
|
||||
scope :sorted, lambda { order(*Principal.fields_for_order_statement)}
|
||||
|
||||
scope :applied_members, lambda {|project|
|
||||
|
|
|
@ -9,6 +9,7 @@ class Syllabus < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
has_many :courses
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :syllabus_members, :dependent => :destroy
|
||||
attr_accessible :description, :user_id, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course
|
||||
safe_attributes 'title','user', 'description', 'eng_name', 'syllabus_type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course'
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class SyllabusMember < ActiveRecord::Base
|
||||
belongs_to :syllabus
|
||||
belongs_to :user
|
||||
attr_accessible :rank, :user_id, :syllabus_id
|
||||
end
|
|
@ -91,6 +91,7 @@ class User < Principal
|
|||
has_many :homework_attaches, :through => :homework_users
|
||||
has_many :homework_evaluations
|
||||
has_many :syllabuses, :dependent => :destroy
|
||||
has_many :syllabus_members, :dependent => :destroy
|
||||
#问卷相关关关系
|
||||
has_many :poll_users, :dependent => :destroy
|
||||
has_many :poll_votes, :dependent => :destroy
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
<h3 class="sy_right_title">教师团队
|
||||
<a href="javascript:void(0);" class="sy_cmore fr mr10 none" >增加教师</a>
|
||||
<% if User.current == @syllabus.user || User.current.admin? %>
|
||||
<a href="<%=members_syllabus_path(syllabus) %>" class="sy_cmore fr mr10" >增加教师</a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</h3>
|
||||
<ul class="sy_teachers_list">
|
||||
<% teacher = syllabus.user %>
|
||||
<%# teachers.each do |teacher| %>
|
||||
<% members.each do |member| %>
|
||||
<% teacher = member.user %>
|
||||
<li >
|
||||
<%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %>
|
||||
<div class="sy_teachers_txt fl">
|
||||
|
@ -17,5 +19,5 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<%# end %>
|
||||
<% end %>
|
||||
</ul>
|
|
@ -60,11 +60,12 @@
|
|||
<%= yield %>
|
||||
</div><!--sy_con_l end-->
|
||||
<div class="sy_con_r fr mb10">
|
||||
<% members = @syllabus.syllabus_members.order("rank asc") %>
|
||||
<div class="sy_right_box" id="syllabus_base_info">
|
||||
<%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %>
|
||||
</div>
|
||||
<div class="sy_right_box">
|
||||
<%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus} %>
|
||||
<div class="sy_right_box" id="syllabus_teacher_list">
|
||||
<%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus, :members => members} %>
|
||||
</div>
|
||||
</div><!--sy_con_r end-->
|
||||
<div class="cl"></div>
|
||||
|
@ -123,16 +124,18 @@
|
|||
}
|
||||
function g(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
for(var i=1;i<=2;i++){
|
||||
//for(var i=1;i<=2;i++){
|
||||
//g('sy_tab_nav_'+i).className='sy_tab_nomal';
|
||||
//g('sy_tab_con_'+i).className='undis';
|
||||
}
|
||||
//}
|
||||
//g('sy_tab_con_'+n).className='dis';
|
||||
//g('sy_tab_nav_'+n).className='sy_tab_hover';
|
||||
if(n == 1) {
|
||||
window.location.href = '<%=syllabus_path(@syllabus) %>';
|
||||
} else {
|
||||
} else if(n == 2) {
|
||||
window.location.href = '<%=syllabus_courselist_syllabus_path(@syllabus) %>';
|
||||
} else if(n == 3) {
|
||||
window.location.href = '<%=members_syllabus_path(@syllabus) %>';
|
||||
}
|
||||
}
|
||||
//侧导航栏配置设置
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
$("#syllabus_member_list").replaceWith("<%= escape_javascript(render :partial => 'syllabuses/syllabus_member_list') %>");
|
||||
$("#syllabus_teacher_list").html("<%= escape_javascript(render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus, :members => @members}) %>");
|
||||
$("#principal_search").val("");
|
||||
$("#principals_for_new_member").html("");
|
|
@ -0,0 +1,2 @@
|
|||
$("#syllabus_member_list").replaceWith("<%= escape_javascript(render :partial => 'syllabuses/syllabus_member_list') %>");
|
||||
$("#syllabus_teacher_list").html("<%= escape_javascript(render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus, :members => @members}) %>");
|
|
@ -0,0 +1,19 @@
|
|||
<% if @syllabus %>
|
||||
var checked = $("#principals_for_new_member input:checked").size();
|
||||
if(checked > 0)
|
||||
{
|
||||
alert('翻页或搜索后将丢失当前选择的用户数据!');
|
||||
}
|
||||
$('#principals_for_new_member').html('<%= escape_javascript(find_user_not_in_current_syllabus_by_name(@syllabus)) %>');
|
||||
|
||||
<% end %>
|
||||
var collection = $("#principals_for_new_member").children("#principals").children("label");
|
||||
collection.css("text-overflow", "ellipsis");
|
||||
collection.css("white-space", "nowrap");
|
||||
collection.css("width", "200px");
|
||||
collection.css("overflow", "hidden");
|
||||
for(i = 0; i < collection.length; i++) { //增加悬浮显示
|
||||
var label = collection[i];
|
||||
var text = $(label).text();
|
||||
$(label).attr("title", text);
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
$("#syllabus_member_list").replaceWith("<%= escape_javascript(render :partial => 'syllabuses/syllabus_member_list') %>");
|
||||
$("#syllabus_teacher_list").html("<%= escape_javascript(render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus, :members => @members}) %>");
|
|
@ -9,7 +9,7 @@
|
|||
<% if @type.to_i == 2 %>
|
||||
<%= link_to "", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
|
||||
<% end %>
|
||||
<% if @syllabus.user == User.current %>
|
||||
<% if @syllabus.syllabus_members.map{|sm| sm.user_id}.include?(User.current.id) %>
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "sy_btn_green fr mt10 mr15", :target => '_blank'%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
@ -21,13 +21,13 @@
|
|||
<% if course.is_public == 0 && !User.current.member_of_course?(course) && !User.current.admin? %>
|
||||
<h3 class="sy_classlist_title fl">
|
||||
<%= link_to @syllabus.title, syllabus_path(@syllabus.id), :style => 'color:#000', :target => '_blank' %>
|
||||
<font class="fb">·</font>
|
||||
<font class="fb"> · </font>
|
||||
<%=course.name %>(<%=current_time_and_term_short(course) %>)
|
||||
</h3>
|
||||
<% else %>
|
||||
<h3 class="sy_classlist_title fl">
|
||||
<%= link_to @syllabus.title, syllabus_path(@syllabus.id), :style => 'color:#000', :target => '_blank' %>
|
||||
<font class="fb">·</font>
|
||||
<font class="fb"> · </font>
|
||||
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course),
|
||||
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
</h3>
|
||||
|
@ -88,12 +88,6 @@
|
|||
<script type="text/javascript">
|
||||
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
$(function() {
|
||||
var leftHeight = $("#LSide").height() - $(".fontGrey5").height() - 20;
|
||||
var rightHeight = $(".homepageRight").height();
|
||||
if (rightHeight < leftHeight) {
|
||||
var diffHeight = leftHeight - rightHeight;
|
||||
var tmpHeight = $(".listbox").height() + diffHeight;
|
||||
$(".listbox").css("height", tmpHeight);
|
||||
}
|
||||
$(".sy_con_l").css("min-height",$(".sy_con_r").height());
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,55 @@
|
|||
<% is_admin = User.current == @syllabus.user || User.current.admin? %>
|
||||
<table class="sy_new_table clear mb15" cellpadding="0" cellspacing="0" id="syllabus_member_list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th class="sy_new_namebox">姓名</th>
|
||||
<th>身份</th>
|
||||
<th>创建班级数</th>
|
||||
<th>参与班级数</th>
|
||||
<% if is_admin %>
|
||||
<th>操作</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @members.each_with_index do |member, i| %>
|
||||
<% user = member.user %>
|
||||
<tr>
|
||||
<td><%= member.rank %></td>
|
||||
<td>
|
||||
<% if member.rank == 1 %>
|
||||
<div style="display: inline-block"><span class="sy_new_name fl"><%= user.show_name %></span><span class="sy_new_orange ml5 fl mt12">创建者</span></div>
|
||||
<% else %>
|
||||
<span class="sy_new_long_name"><%= user.show_name %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if user.user_extensions && user.user_extensions.identity %>
|
||||
<%= get_user_roll user %>
|
||||
<% end%>
|
||||
</td>
|
||||
<% courses = user.courses.not_deleted %>
|
||||
<td><%= courses.where("tea_id = #{user.id}").count %></td>
|
||||
<td><%= courses.where("tea_id != #{user.id}").count %></td>
|
||||
<% if is_admin %>
|
||||
<td>
|
||||
<% if i == 0 %>
|
||||
|
||||
<% elsif i == 1 %>
|
||||
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
|
||||
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
|
||||
<% elsif i == @members.count - 1 %>
|
||||
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
|
||||
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
|
||||
<% else %>
|
||||
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
|
||||
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
|
||||
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,51 @@
|
|||
<ul id="sy_tab_nav">
|
||||
<li id="sy_tab_nav_1" onclick="HoverLi(1);">
|
||||
<a href="javascript:void(0);" class="sy_tab_type" >课程大纲</a>
|
||||
</li>
|
||||
<li id="sy_tab_nav_2" onclick="HoverLi(2);">
|
||||
<a href="javascript:void(0);" class="sy_tab_type" >班级列表</a>
|
||||
</li>
|
||||
<li id="sy_tab_nav_3" class="sy_tab_hover" onclick="HoverLi(3);">
|
||||
<a href="javascript:void(0);" class="sy_tab_type" >教师团队</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="sy_tab_con_3">
|
||||
<div class="sy_new_tablebox clear">
|
||||
<%= render :partial => 'syllabus_member_list' %>
|
||||
<a href="javascript:void(0);" class="fl sy_btn_green" onclick="toggle_search();">添加成员</a>
|
||||
</div>
|
||||
<div class="sy_new_tchbox clear undis" id="sy_search_box">
|
||||
<%= form_tag url_for(:controller => 'syllabus_member', :action => 'create', :syllabus => @syllabus),:id => 'syllabus_member_add_form', :remote => true do |f|%>
|
||||
<input hidden="hidden" value="true" name="flag">
|
||||
<div class="hw_search_box mb10">
|
||||
<input id="principal_search" class="sy_new_search" type="text" placeholder="<%= l(:label_invite_trustie_user_tips)%>">
|
||||
<%= javascript_tag "observeSearchfield('principal_search', null, '#{escape_javascript "/syllabus_member/syl_member_autocomplete?" + {:syllabus => @syllabus.id}.to_query }')" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="principals_for_new_member">
|
||||
<%= find_user_not_in_current_syllabus_by_name(@syllabus) %>
|
||||
</div>
|
||||
<div class="cl mb10"></div>
|
||||
<a href="javascript:void(0);" class="fl sy_btn_blue mr5" onclick="$('#syllabus_member_add_form').submit();">确定</a>
|
||||
<a href="javascript:void(0);" class="fl sy_btn_grey mr5" onclick="reset_search();">取消</a>
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
$(function() {
|
||||
$(".sy_con_l").css("min-height",$(".sy_con_r").height());
|
||||
});
|
||||
|
||||
function toggle_search() {
|
||||
$("#sy_search_box").toggle();
|
||||
}
|
||||
function reset_search() {
|
||||
$("#sy_search_box").toggle();
|
||||
$("#principal_search").val("");
|
||||
$("#principals_for_new_member").html("");
|
||||
}
|
||||
</script>
|
|
@ -14,6 +14,9 @@
|
|||
<li id="sy_tab_nav_2" onclick="HoverLi(2);">
|
||||
<a href="javascript:void(0);" class="sy_tab_type" >班级列表</a>
|
||||
</li>
|
||||
<li id="sy_tab_nav_3" onclick="HoverLi(3);">
|
||||
<a href="javascript:void(0);" class="sy_tab_type" >教师团队</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="sy_tab_con_1">
|
||||
<% if @syllabus.des_status == 0 && User.current == @syllabus.user %>
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
<li id="sy_tab_nav_2" class="sy_tab_hover" onclick="HoverLi(2);">
|
||||
<a href="javascript:void(0);" class="sy_tab_type" >班级列表</a>
|
||||
</li>
|
||||
<li id="sy_tab_nav_3" onclick="HoverLi(3);">
|
||||
<a href="javascript:void(0);" class="sy_tab_type" >教师团队</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="sy_tab_con_2">
|
||||
|
|
|
@ -369,7 +369,7 @@ zh:
|
|||
label_input_email: 请输入邮箱地址
|
||||
|
||||
label_invite_trustie_user: "邀请Trustie注册用户"
|
||||
label_invite_trustie_user_tips: "支持姓名、邮箱、登录名搜索!"
|
||||
label_invite_trustie_user_tips: "支持姓名、邮箱、登录名搜索"
|
||||
label_user_role_null: 用户和角色不能留空!
|
||||
label_invite_project: 邀请您加入项目
|
||||
label_mail_invite_success: 您已成功加入项目!
|
||||
|
|
|
@ -1140,6 +1140,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'update_base_info'
|
||||
get 'delete_syllabus'
|
||||
get 'delete_des'
|
||||
get 'members'
|
||||
end
|
||||
|
||||
collection do
|
||||
|
@ -1147,6 +1148,16 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
resources :syllabus_member do
|
||||
member do
|
||||
post 'update_rank'
|
||||
end
|
||||
|
||||
collection do
|
||||
get 'syl_member_autocomplete'
|
||||
end
|
||||
end
|
||||
|
||||
# add by nwb
|
||||
# 课程路由设置
|
||||
resources :courses do
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
class CreateSyllabusMembers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :syllabus_members do |t|
|
||||
t.integer :rank
|
||||
t.references :syllabus
|
||||
t.references :user
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :syllabus_members, :syllabus_id
|
||||
add_index :syllabus_members, :user_id
|
||||
add_index :syllabus_members, :rank
|
||||
|
||||
count = Syllabus.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
Syllabus.page(i).per(30).each do |syllabus|
|
||||
SyllabusMember.create(:user_id => syllabus.user_id, :syllabus_id => syllabus.id, :rank => 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
46
db/schema.rb
46
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160907080621) do
|
||||
ActiveRecord::Schema.define(:version => 20160921062340) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -56,10 +56,10 @@ ActiveRecord::Schema.define(:version => 20160907080621) do
|
|||
t.integer "user_id"
|
||||
t.integer "applied_id"
|
||||
t.string "applied_type"
|
||||
t.integer "viewed"
|
||||
t.integer "status"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "viewed", :default => 0
|
||||
t.integer "status", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "name"
|
||||
t.integer "applied_user_id"
|
||||
t.integer "role"
|
||||
|
@ -157,13 +157,13 @@ ActiveRecord::Schema.define(:version => 20160907080621) do
|
|||
create_table "attachments", :force => true do |t|
|
||||
t.integer "container_id"
|
||||
t.string "container_type", :limit => 30
|
||||
t.string "filename", :default => "", :null => false
|
||||
t.string "disk_filename", :default => "", :null => false
|
||||
t.integer "filesize", :default => 0, :null => false
|
||||
t.string "filename", :default => "", :null => false
|
||||
t.string "disk_filename", :default => "", :null => false
|
||||
t.integer "filesize", :default => 0, :null => false
|
||||
t.string "content_type", :default => ""
|
||||
t.string "digest", :limit => 40, :default => "", :null => false
|
||||
t.integer "downloads", :default => 0, :null => false
|
||||
t.integer "author_id", :default => 0, :null => false
|
||||
t.string "digest", :limit => 40, :default => "", :null => false
|
||||
t.integer "downloads", :default => 0, :null => false
|
||||
t.integer "author_id", :default => 0, :null => false
|
||||
t.datetime "created_on"
|
||||
t.string "description"
|
||||
t.string "disk_directory"
|
||||
|
@ -173,7 +173,6 @@ ActiveRecord::Schema.define(:version => 20160907080621) do
|
|||
t.integer "quotes"
|
||||
t.integer "is_publish", :default => 1
|
||||
t.date "publish_time"
|
||||
t.boolean "init_file", :default => false
|
||||
end
|
||||
|
||||
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
|
||||
|
@ -311,16 +310,14 @@ ActiveRecord::Schema.define(:version => 20160907080621) do
|
|||
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
|
||||
|
||||
create_table "changesets", :force => true do |t|
|
||||
t.integer "repository_id", :null => false
|
||||
t.string "revision", :null => false
|
||||
t.integer "repository_id", :null => false
|
||||
t.string "revision", :null => false
|
||||
t.string "committer"
|
||||
t.datetime "committed_on", :null => false
|
||||
t.datetime "committed_on", :null => false
|
||||
t.text "comments"
|
||||
t.date "commit_date"
|
||||
t.string "scmid"
|
||||
t.integer "user_id"
|
||||
t.integer "project_id"
|
||||
t.integer "type", :default => 0
|
||||
end
|
||||
|
||||
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
|
||||
|
@ -1881,6 +1878,9 @@ ActiveRecord::Schema.define(:version => 20160907080621) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "student_works_scores", ["student_work_id"], :name => "student_work_id"
|
||||
add_index "student_works_scores", ["user_id"], :name => "user_id"
|
||||
|
||||
create_table "students_for_courses", :force => true do |t|
|
||||
t.integer "student_id"
|
||||
t.integer "course_id"
|
||||
|
@ -1923,6 +1923,18 @@ ActiveRecord::Schema.define(:version => 20160907080621) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "syllabus_members", :force => true do |t|
|
||||
t.integer "rank"
|
||||
t.integer "syllabus_id"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "syllabus_members", ["rank"], :name => "index_syllabus_members_on_rank"
|
||||
add_index "syllabus_members", ["syllabus_id"], :name => "index_syllabus_members_on_syllabus_id"
|
||||
add_index "syllabus_members", ["user_id"], :name => "index_syllabus_members_on_user_id"
|
||||
|
||||
create_table "syllabuses", :force => true do |t|
|
||||
t.string "title"
|
||||
t.text "description"
|
||||
|
|
|
@ -617,3 +617,20 @@ a:hover.sy_class_ltitle{ color:#333;}
|
|||
/* 我的作业 */
|
||||
.hw_classname{ width:180px; overflow:hidden; display:block;overflow:hidden;white-space: nowrap; text-overflow:ellipsis;}
|
||||
.hw_tab_top{ height: 50px; line-height: 50px; padding-left: 15px; border-bottom:1px solid #ddd; border-left:3px solid #3b94d6; }
|
||||
|
||||
/*20160918教师团队*/
|
||||
.sy_new_tablebox{ padding:15px; padding-bottom:none;}
|
||||
.sy_new_table{ width:100%; background:#fff; border:1px solid #e5e5e5; padding-bottom:30px;}
|
||||
.sy_new_table thead tr{ height:40px; line-height:40px;}
|
||||
.sy_new_table thead tr th{ border-bottom:1px solid #e5e5e5;}
|
||||
.sy_new_table tbody tr:hover{ background:#f5f5f5;}
|
||||
.sy_new_table tbody tr td{ height:40px; line-height:40px; border-bottom:1px dashed #e5e5e5; font-weight:normal; color:#888; text-align: center}
|
||||
.sy_new_table tbody tr:last-child{ height:40px;}
|
||||
.sy_new_tchlist li{ height:30px; line-height:30px;}
|
||||
.sy_new_search{-webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px; border:1px solid #d3d3d3; background:#fff; padding-left:5px; color:#888; height:32px; width:370px;box-shadow: inset 0px 0px 3px #dcdcdc; }
|
||||
.sy_new_tchbox{ background:#f5f5f5; padding:15px; margin:15px; margin-top:0px;}
|
||||
.sy_new_orange{font-size: 12px;padding: 0 5px;border-radius: 3px;line-height: 14px;color: #ff4a1b;border: 1px solid #ff4a1b;}
|
||||
.sy_new_namebox{ width:180px; overflow:hidden;}
|
||||
.sy_new_name{ display:block;max-width:120px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;}
|
||||
.sy_new_long_name{ display:block;width:180px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;}
|
||||
.mt12{ margin-top:12px;}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe SyllabusMemberController, :type => :controller do
|
||||
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :syllabus_member do
|
||||
rank 1
|
||||
syllabus nil
|
||||
user nil
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe SyllabusMember, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue