This commit is contained in:
huang 2015-11-02 17:51:25 +08:00
commit e5574b2f00
8 changed files with 81 additions and 7 deletions

View File

@ -107,7 +107,7 @@ class CoursesController < ApplicationController
courses = Course.visible courses = Course.visible
@courses = paginateHelper courses,10 @courses = paginateHelper courses,10
else else
courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'") courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'").order("time desc, created_at desc")
@courses = paginateHelper courses,10 @courses = paginateHelper courses,10
end end
@name = params[:name] @name = params[:name]

View File

@ -2,6 +2,8 @@
$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>'); $('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>');
<%elsif @course%> <%elsif @course%>
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); $('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>');
$("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>")
$("#student_number").html("<%= studentCount(@course) %>");
<%end%> <%end%>
hideOnLoad(); hideOnLoad();

View File

@ -17,7 +17,7 @@
<ul class="setting_left"> <ul class="setting_left">
<li>登录名&nbsp;:&nbsp;<span style="color:red;">*</span></li> <li>登录名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li>邮箱&nbsp;:&nbsp;<span style="color:red;">*</span></li> <li>邮箱&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li>身份&nbsp;:&nbsp;</li> <li>身份&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">姓(First Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li> <li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">姓(First Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">名(Last Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li> <li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">名(Last Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_2="true" style="display:none;">组织名&nbsp;:&nbsp;<span style="color:red;">*</span></li> <li nhname="tag" nh_tag_2="true" style="display:none;">组织名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
@ -34,7 +34,10 @@
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li> <li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li>
<li> <li>
<select onchange="showtechnical_title(this.value);" name="identity" id="userIdentity" class="location" class="w70" style="height:28px;margin-left:2px;"> <select onchange="showtechnical_title(this.value);" required = true, nh_required="1" name="identity" id="userIdentity" class="location" class="w70" style="height:28px;margin-left:2px;">
<option value="-1">
<%= l(:label_account_identity_choose) %>
</option>
<option value="0"> <option value="0">
<%= l(:label_account_identity_teacher) %> <%= l(:label_account_identity_teacher) %>
</option> </option>
@ -61,6 +64,7 @@
<%= text_field_tag :no, nil, :placeholder => l(:label_account_identity_studentID),:style=>"60px" %></span> <%= text_field_tag :no, nil, :placeholder => l(:label_account_identity_studentID),:style=>"60px" %></span>
<% end %> <% end %>
</span> </span>
<span id="identity_hint" style="display: none"></span>
</li> </li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= f.text_field :lastname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %> <li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= f.text_field :lastname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
@ -701,6 +705,11 @@
$("#users_tb_2").click(); $("#users_tb_2").click();
<% end %> <% end %>
$('#my_account_form_link').click(function(e){ $('#my_account_form_link').click(function(e){
if($("#userIdentity").val() == -1 ) {
$("#identity_hint").html('<span style="color:red">请选择身份</span>').show();
e.stopImmediatePropagation();
return;
}
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话 if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
$("#hint").html('<span style="color:red">学校必须是从下拉列表中选择的,不能手动修改</span>').show(); $("#hint").html('<span style="color:red">学校必须是从下拉列表中选择的,不能手动修改</span>').show();
e.stopImmediatePropagation(); e.stopImmediatePropagation();

View File

@ -18,13 +18,13 @@
<div class=" mt10"> <div class=" mt10">
<%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%> <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%>
<div class="calendar_div fl"> <div class="calendar_div fl">
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" placeholder="发布日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
<%= calendar_for('homework_publish_time')%>
</div>
<div class="calendar_div fl ml10">
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" > <input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
<%= calendar_for('homework_end_time')%> <%= calendar_for('homework_end_time')%>
</div> </div>
<div class="calendar_div fl ml10">
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" placeholder="发布日期(可选)" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
<%= calendar_for('homework_publish_time')%>
</div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<p id="homework_end_time_span" class="c_red mt5"></p> <p id="homework_end_time_span" class="c_red mt5"></p>

View File

@ -145,6 +145,7 @@
var id; //资源id var id; //资源id
var sendType; //发送到课程 1 发送到项目 2 var sendType; //发送到课程 1 发送到项目 2
var lastSendType; //保存上次发送的发送类型 var lastSendType; //保存上次发送的发送类型
var last_op
$("#resources_list").mousedown(function(e) { $("#resources_list").mousedown(function(e) {
//如果是右键的话 //如果是右键的话
if (3 == e.which) { if (3 == e.which) {
@ -179,6 +180,28 @@
last_line = line; last_line = line;
} }
}); });
//鼠标经过时,背景颜色设为灰色
$("#resources_list").mouseover(function(e){
pageX = e.clientX;
pageY = e.clientY;
var ele = document.elementFromPoint(pageX,pageY);
line = $(ele).parent();
if(last_op != null){
last_op.children().css("background-color", 'white');
restore();
last_op == null;
}
//如果当前的tag是li那么还要li的父级元素
if(line.get(0).tagName === 'LI'){
line = line.parent();
}
//将当前的元素的所有子元素的背景色改为蓝色
line.children().css("background-color", '#e1e1e1');
//将当前元素赋给 上一个对象 保存起来。
last_op = line;
});
//元素包含关系计算 //元素包含关系计算
var contains = function(root, el) { var contains = function(root, el) {
if (root.compareDocumentPosition) if (root.compareDocumentPosition)

View File

@ -0,0 +1,8 @@
class DropOrganization < ActiveRecord::Migration
def up
drop_table :organizations
end
def down
end
end

View File

@ -0,0 +1,18 @@
class CreateOrganization < ActiveRecord::Migration
def up
create_table :organizations do |t|
t.string :name
t.text :description
t.integer :creator_id
t.integer :home_id
t.string :domain
t.boolean :is_public
t.timestamps
end
end
def down
drop_table :organizations
end
end

View File

@ -0,0 +1,14 @@
class CreateOrgMembers < ActiveRecord::Migration
def up
create_table :org_members do |t|
t.integer :user_id
t.integer :organization_id
t.string :role
end
end
def down
drop_table :org_members
end
end