缺陷修复

This commit is contained in:
XuCheng642 2017-09-01 19:37:09 +08:00
parent 8f74cc4b42
commit bb9fb39396
30 changed files with 426 additions and 102 deletions

View File

@ -1,5 +1,7 @@
class DepartmentController < ApplicationController
before_filter :find_department, :only => [:destroy]
#根据部门名字或者拼音来查询
def on_search
school = School.find params[:school_id]
@ -95,4 +97,24 @@ class DepartmentController < ApplicationController
render :json =>status
end
def destroy
if @department
if UserExtensions.where(:department_id => @department.id).count == 0
ApplyAddDepartment.where(:department_id=>@department.id).update_all(:status => 2)
@apply_dep = ApplyAddDepartment.where(:department_id=>@department.id).first
@department.destroy
end
respond_to do |format|
format.js
end
end
end
private
def find_department
@department = Department.find params[:id]
rescue ActiveRecord::RecordNotFound
render_404
end
end

View File

@ -136,7 +136,7 @@ class ManagementsController < ApplicationController
end
if params[:support_shixuns]
@major = @major.where(:support_shixuns => params[:support_shixuns].to_i,:major_level=> 1)
@major = @major.where(:support_shixuns => params[:support_shixuns].to_i,:major_level=>2)
end
@major = @major.order("created_at #{@sx_order}")
@ -219,7 +219,7 @@ end
@menu_type = 6
@sub_type = 2
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
@department =Department.where("0=0")
@department = ApplyAddDepartment.where(:status => 1)
search=params[:search]
if search.blank?
@department = @department
@ -239,6 +239,72 @@ end
end
end
# 新增
def create_departments
respond_to do |format|
format.js
end
end
def add_department
department = Department.where(:school_id => params[:school], :name => params[:department]).first
if department.nil?
department = Department.create(:school_id => params[:school],:name => params[:department])
ApplyAddDepartment.create(:school_id => params[:school],
:status => 1,
:name => params[:department],
:department_id => department.id,
:user_id => User.current.id);
end
respond_to do |format|
format.js
end
#redirect_to departments_managements_path
end
# 修改单位部门列表
def update_department
dep = Department.find params[:department_id]
apply_schools = ApplyAddDepartment.where(:status => 1, :school_id => dep.school_id)
apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.department_id}.join(',') + ")"
@edit_id = params[:department_id]
@search = params[:search]
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@departments = Department.where("id in #{apply_school_ids} and #{Department.table_name}.name like :p", :p => search)
#@schools = School.all
else
@departments = Department.where("id in #{apply_school_ids}")
end
respond_to do |format|
format.js
end
end
def edit_departments_school
begin
dep = Department.find(params[:department_id]);
alter_dep = Department.find(params[:alter_dep_id]);
apply_dep = ApplyAddDepartment.where(:department_id => params[:alter_dep_id])
if dep && alter_dep
# users = UserExtensions.where("department_id = #{dep.id}")
# users.update_all(:department_id => params[:alter_dep_id])
# dep.destroy
# apply_dep.update_all(:status => 2)
# ApplyAddDepartment.where(:department_id =>params[:departments]).update_all(:department_id=>department_id)
# users = UserExtensions.where("department_id = #{alt_dep.department_id}")
# users.update_all(:department_id => department.id)
apply_dep.destroy_all;
users = UserExtensions.where(:department_id => params[:alter_dep_id])
users.update_all(:department_id => dep.id)
alter_dep.destroy
end
rescue Exception => e
puts e
end
redirect_to departments_managements_path
end
# 单位列表
def departments_part
@menu_type = 6
@ -324,23 +390,24 @@ end
# 部门修改
def all_department
apply_department = ApplyAddDepartment.where("status = 0")
@edit_id = params[:department_id]
@search = params[:search]
apply_department = ApplyAddDepartment.where(:status => 1)
apply_department_ids = apply_department.empty? ? "(-1)" : "(" + apply_department.map{|sc| sc.department_id}.join(',') + ")"
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@department = Department.where("id not in #{apply_department_ids} and #{Department.table_name}.name like :p", :p => search)
@department = Department.where("id in #{apply_department_ids} and #{Department.table_name}.name like :p", :p => search)
#@schools = School.all
else
#@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
@department = Department.where("id not in #{apply_department_ids}")
@department = Department.where("id in #{apply_department_ids}")
end
@edit_id = params[:department_id]
@search = params[:search]
respond_to do |format|
format.js
end
# redirect_to unit_managements_path
end
# 修改
def edit_applied_department
aas =ApplyAddDepartment.find(params[:applied_id])
@ -349,19 +416,19 @@ end
department =Department.find params[:department_id]
begin
#更新消息表的status
applied_message_id = aas.department_id
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddDepartment")
applied_message.update_all(:status => 4)
aas.update_attribute(:status, 2)
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => 0, :applied_id => aas.id, :applied_type => "ApplyAddDepartment", :name =>department[0].name )
users = UserExtensions.where("department_id = #{aas.department_id}")
users.update_all(:department_id => department.id)
if aas.department_id != department.id.to_i
applied_message_id = aas.department_id
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddDepartment")
applied_message.update_all(:status => 4)
aas.update_attribute(:status, 2)
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => 0, :applied_id => aas.id, :applied_type => "ApplyAddDepartment", :name =>department.name )
users = UserExtensions.where("department_id = #{aas.department_id}")
users.update_all(:department_id => department.id)
aas.department.destroy
ApplyAddDepartment.where(:department_id => aas.department_id).update_all(:department_id => department.id)
Department.where(:department_id => aas.department_id).destroy_all
aas.destroy_all
end
ApplyAddDepartment.where(:department_id => aas.department_id).update_all(:department_id => department.id)
Department.where(:department_id => aas.department_id).update_all(:department_id => department.id)
aas.update_attribute(:department_id, department.id)
rescue Exception => e
puts e
end
@ -463,19 +530,20 @@ end
school = School.find params[:school_id]
begin
#更新消息表的status
applied_message_id = aas.school_id
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
applied_message.update_all(:status => 4)
aas.update_attribute(:status, 2)
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => 0, :applied_id => aas.id, :applied_type => "ApplyAddSchools", :name => school[0].name )
users = UserExtensions.where("school_id = #{aas.school_id}")
users.update_all(:school_id => school.id)
if aas.school_id != school.id.to_i
applied_message_id = aas.school_id
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
applied_message.update_all(:status => 4)
aas.update_attribute(:status, 2)
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => 0, :applied_id => aas.id, :applied_type => "ApplyAddSchools", :name => school.name )
users = UserExtensions.where("school_id = #{aas.school_id}")
users.update_all(:school_id => school.id)
ApplyAddDepartment.where(:school_id => aas.school_id).update_all(:school_id => school.id)
Department.where(:school_id => aas.school_id).update_all(:school_id => school.id)
aas.school.destroy
aas.update_attribute(:school_id, school.id)
end
ApplyAddDepartment.where(:school_id => aas.school_id).update_all(:school_id => school.id)
Department.where(:school_id => aas.school_id).update_all(:school_id => school.id)
aas.update_attribute(:school_id, school.id)
rescue Exception => e
puts e
end
@ -539,7 +607,7 @@ end
end
end
# 班级列表
# 课堂列表
def classroom_classment
@menu_type = 2
@sub_type = 2

View File

@ -1,7 +1,7 @@
class SchoolController < ApplicationController
layout 'course_base'
before_filter :require_admin, :only => :upload_logo
before_filter :find_school, :only => [:destroy]
def upload
uploaded_io = params[:logo]
school_id ||= params[:id]
@ -283,4 +283,23 @@ class SchoolController < ApplicationController
render :json=>{:status=>status,:id=>params[:id],:province=>province,:city=>city}
end
def destroy
if @school
if UserExtensions.where(:school_id => @school.id).count == 0
School.where(:id=>@school.id).destroy_all
@school.destroy
end
respond_to do |format|
format.js
end
end
end
private
def find_school
@school = School.find params[:id]
rescue ActiveRecord::RecordNotFound
render_404
end
end

View File

@ -1,7 +1,8 @@
class ApplyAddDepartment < ActiveRecord::Base
belongs_to :school
belongs_to :user
attr_accessible :name, :remarks, :status, :school_id, :user_id
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied
belongs_to :department
end
class ApplyAddDepartment < ActiveRecord::Base
belongs_to :school
belongs_to :user
attr_accessible :name, :remarks, :status, :school_id, :user_id, :department_id
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied
belongs_to :department
# status: 0表示未批准 status1表示已批准 status 2表示已更改 status 3表示已拒绝 status: 4表示已更改后废除的部门
end

View File

@ -11,7 +11,7 @@
<% end %>
<% end %>
<div class="task-tag tag-grey mt5 mr10 fl <%= @challenge_tags.count > 0 ? "undis" : "" %>" id="add_shixun_skill">
<div class="task-tag tag-grey mt5 mr10 fl <%#= @challenge_tags.count > 0 ? "undis" : "" %>" id="add_shixun_skill">
<button data-dismiss="alert" class="close fr mt3 ml5" type="button" onclick="$('#add_shixun_skill').slideToggle();">×</button>
<input type="text" class="task-tag-input" onblur="add_tag();" id="shixun_skill_input" placeholder="请输入技能标签" />
</div>

View File

@ -58,7 +58,7 @@
<div class="entry">
<em></em>
<span class="after"></span>
<p class="color-grey">结束日期过后,课堂进入归档状态,只能在历史课堂中查看</p>
<p class="color-grey">结束日期过后,课堂进入<%= link_to '归档状态', courses_path(:select => "end", :is_end => 1),:target => '_blank', :class => 'color-orange05' %>,只能在历史课堂中查看</p>
</div>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,6 @@
console.log(111);
for(var i=0; i<$("#apply_add_department_<%= @apply_dep.id %>").nextAll().length; i++){
var index = parseInt($($("#apply_add_department_<%= @apply_dep.id %>").nextAll()[i]).children(":first").html());
$($("#apply_add_department_<%= @apply_dep.id %>").nextAll()[i]).children(":first").html(index - 1);
}
$("#apply_add_department_<%= @apply_dep.id %>").remove();

View File

@ -26,7 +26,7 @@
<span class="color-dark-grey">
<% case @menu_type %>
<% when 2 %>
<%= @sub_type == 1 ? "课程列表" : "班级列表" %>
<%= @sub_type == 1 ? "课程列表" : "课堂列表" %>
<% when 3 %>
<%= @sub_type == 1 ? "实训列表" :(@sub_type == 2 ? "已发布的实训": (@sub_type == 3 ? "已关闭的实训": "镜像管理")) %>
<% when 4 %>
@ -55,7 +55,7 @@
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 2 %>"><a href="javascript:void(0);" class="edu-admin-nav-a">课堂+</a>
<ul class="edu-admin-nav-inner edu-absolute">
<li><%= link_to "课程列表", classroom_managements_path %></li>
<li><%= link_to "班级列表", classroom_classment_managements_path %></li>
<li><%= link_to "课堂列表", classroom_classment_managements_path %></li>
</ul>
</li>
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 3 %>"><a href="javascript:void(0);" class="edu-admin-nav-a">全部实训+</a>

View File

@ -27,7 +27,7 @@
throttle(search_courses, window, e);
});
function department_submit() {
var checkboxs = $("input[name='department_id[]']:checked");
var checkboxs = $("input[name='department_id']:checked");
if(checkboxs.length == 0) {
$("#choose_courses_notice").text("请选择单位");
} else{

View File

@ -27,7 +27,7 @@
throttle(search_courses, window, e);
});
function school_submit() {
var checkboxs = $("input[name='school_id[]']:checked");
var checkboxs = $("input[name='school_id']:checked");
if(checkboxs.length == 0) {
$("#choose_courses_notice").text("请选择单位");
} else{

View File

@ -2,13 +2,12 @@
<thead>
<tr>
<th width="9%">ID</th>
<th width="20%" class="edu-txt-left">班级名称</th>
<th width="20%" class="edu-txt-left">课堂名称</th>
<th width="4%">成员</th>
<th width="4%">资源</th>
<th width="4%">作业</th>
<th width="4%">试卷</th>
<th width="4%">私有</th>
<th width="4%">模版</th>
<th width="8%">状态</th>
<th width="13%" class="edu-txt-left">创建者单位</th>
<th width="11%">创建者</th>
@ -26,14 +25,13 @@
<td><%= course.homework_commons.count%></td>
<td><%= course.exercises.count %></td>
<td><%= course.is_public.to_i == 1 ? '--' : '√' %></td>
<td></td>
<td><%= course.is_end ? "已结束" : "正在进行" %></td>
<td class="edu-txt-left"><%= course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.try(:user_extensions).try(:school) %></td>
<td> <%= link_to course.teacher.show_real_name, user_path(course.teacher) %></td>
<td> <%= format_time(course.updatetime) %></td>
<td>
<input type="checkbox" name="homepage_show" value="<%= course.id %>" <%= course.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= course.id %>">
<label style="top:-14px;padding-left: 35px;float:right;" for="join_course_role_<%= course.id %>"></label>
<label style="top:-14px;padding-left: 55px;float:right;" for="join_course_role_<%= course.id %>"></label>
</td>
</tr>
<% end %>

View File

@ -0,0 +1,99 @@
<div style="width:400px" class="task-popup">
<div class="task-popup-title clearfix ">
<h3 class="fl color-grey mt10 ml5">添加子单位名称</h3>
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
</div>
<div class="mt10 ml30">
<span class="fl font-16 color-grey mr10 mt3 ">单位全称:</span><input nhname="tag" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请选择单位" style="width: 260px" />
<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> <!-- 单位名称的test框选中下拉列表框的id -->
<div class="cl"></div>
<span class="color-orange fl none" id="school_id_notice" style="margin-left:20%;"><i class="fa fa-exclamation-circle mr5" ></i>请选择单位</span>
</div>
<div id="search_school_result_list" style="width: 260px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
</div>
<div class="mt10 ml30">
<span class="fl font-16 color-grey mr10 mt3 ">子单位名称:</span><input class="task-height-40 panel-box-sizing fl" type="text" placeholder="请输入子单位名称" style="width: 260px" name="add_department" />
<div class="cl"></div>
<span class="color-orange fl none" id="add_department_notice" style="margin-left:20%;"><i class="fa fa-exclamation-circle mr5" ></i>请输入子单位名称</span>
</div>
<div class="cl"></div>
<div id="schools_list" class="mt10 mb20 ml40 mr40">
</div>
<span id="choose_courses_notice" class="c_red"></span>
<div class="task-popup-submit clearfix ml25">
<a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl pop_close mr10">取消</a>
<a href="javascript:void(0);" onfocus='this.blur();' onclick="school_submit();" class="task-btn task-btn-blue fr" >确定</a>
</div>
<div class="cl"></div>
</div>
<script type="text/javascript">
$("input[name='school']").on('input', function (e) {
throttle(department_search_fn, window, e);
});
var d_lastSearchCondition = '';
var d_page = 1; //唯一控制页码 变量
var d_count = 0; //查询结果的总量
var d_maxPage = 0;//最大页面值
function department_search_fn(e) {
if($(e.target).val().trim() == ''){
$("#search_school_result_list").hide();
$("input[name='school_id']").val("");
return;
}
if ($(e.target).val().trim() == d_lastSearchCondition && $(e.target).val().trim() != '') {//如果输入框没有改变或者输入框为空就返回
return;
}
d_lastSearchCondition = $(e.target).val().trim();
page = 1; //有新的搜索页面重置为1
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&school_id=' + $("input[name='occupation']").val() + '&page=' + d_page,
type: 'post',
success: function (data) {
d_schoolsResult = data.schools;
count = data.count;
maxPage = Math.ceil(count / 100); //最大页码值
if (d_schoolsResult.length != undefined && d_schoolsResult.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < d_schoolsResult.length; i++) {
link = '<a onclick="window.changeSchoolValue(\'' + d_schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + d_schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + d_schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left',108);
$("#search_school_result_list").css('top',113);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
} else {
$("#search_school_result_list").css('left', 108);
$("#search_school_result_list").css('top',113);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").html('你的学校不在列表中?请确认后输入');
$("#search_school_result_list").show();
}
}
});
}
function changeSchoolValue(value, data) {
$("input[name='school']").val(value);
$("input[name='school_id']").val(data);
$("#search_school_result_list").hide();
};
function school_submit(){
var school=$("input[name='school_id']").val();
var department=$("input[name='add_department']").val()
// console.log(school ,department);
if($("input[name='school']").val() == ""){
$("#school_id_notice").show();
} else if($("input[name='add_department']").val() ==""){
$("#add_department_notice").show();
}else{
$.ajax({
url: '/managements/add_department',
type: 'post',
dataType: 'script',
data:{school:school,department:department}
});
}
}
</script>

View File

@ -2,22 +2,31 @@
<thead>
<tr>
<th width="9%">序号</th>
<th width="30%" class="edu-txt-left">部门名称</th>
<th width="15%">用户数</th>
<th width="15%">已认证职业</th>
<th width="20%" class="edu-txt-left">部门名称</th>
<th width="20%" class="edu-txt-left">单位名称</th>
<th width="10%">用户数</th>
<th width="10%">已认证职业</th>
<th width="20%" class="eud-pointer">创建于<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title=""></i></th>
<th></th>
</tr>
</thead>
<tbody>
<% @department.each do |department| %>
<tr>
<td><%=department.id %></td>
<% @department.each_with_index do |department,index| %>
<tr id="apply_add_department_<%= department.id %>">
<td><%= index + 1 %></td>
<td class="edu-txt-left"><%= department.name %></td>
<td><%= UserExtensions.where(:department_id => department.id).count %></td>
<td>3</td>
<td class="edu-txt-left"><%= School.where(:id => department.school_id).first %></td>
<td><%= UserExtensions.where(:department_id => department.id,:school_id => department.school_id ).count %></td>
<td><%= ApplyUserAuthentication.where(:auth_type => 2,:user_id =>UserExtensions.where(:department_id => department.id,:school_id => department.school_id).map(&:user_id)).count%></td>
<td><%= format_time department.created_at %></td>
<td><a href="javascript:void(0);"><i class="fa fa-edit font-16"></i> 修改</a></td>
<td>
<% if UserExtensions.where(:department_id => department.id,:school_id => department.school_id ).count == 0 %>
<a href="javascript:void(0);" onclick="delete_confirm_box_2('<%= department_path(department.department_id) %>', '确定要删除该部门吗?')">删除&nbsp;</a>
<% else %>
--
<% end %>
<%= link_to '更改', update_department_managements_path(:school_id=> department.school_id,:department_id => department.department_id), :remote => true, :class => "application-default-link" %>
</td>
</tr>
<% end %>
</tbody>
@ -50,4 +59,10 @@
dateType: "script"
});
});
function alert_update_departments(){
/* var html = <%#= j (render :partial => '', :department => department) %>*/
}
</script>

View File

@ -25,7 +25,7 @@
</span>
</td>
<td><%= schools.province %></td>
<td class="edu-txt-left"><%= schools.address == nil ? "--" :schools.address %></td>
<td class="edu-txt-left"><%= schools.province == nil ? "--" :schools.province%><%= schools.city == nil ? "" :schools.city %><%= schools.address == nil ? "" :schools.address %></td>
<td><%= UserExtensions.where(:school_id => schools.id).count %></td>
<td><%= schools.departments.count %></td>
<td><%= format_time schools.created_at %></td>

View File

@ -0,0 +1,52 @@
<div style="width:400px" class="task-popup">
<div class="task-popup-title clearfix ">
<h3 class="fl color-grey mt10 ml5">更改为</h3>
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
</div>
<div class="mt10 ml10">
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入名称搜索" class="task-height-40 panel-box-sizing fl edu-txt-w320 ml30" style="padding: 2px 5px" />
</div>
<div class="cl"></div>
<div id="schools_list" class="mt10 mb20 ml40 mr40">
<%= render :partial => "managements/update_department_school", :locals => {:departments => departments, :edit_id => edit_id} %>
</div>
<span id="choose_courses_notice" class="color-red ml40"></span>
<div class="task-popup-submit clearfix ml25">
<a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl pop_close mr10">取消</a>
<a href="javascript:void(0);" onfocus='this.blur();' onclick="school_submit();" class="task-btn task-btn-blue fr" >确定</a>
</div>
<div class="cl"></div>
</div>
<script type="text/javascript">
$("#search_course_input").on('input',function(e){
throttle(search_courses, window, e);
});
function school_submit() {
var checkboxs = $("input[name='department_id']:checked");
if(checkboxs.length == 0) {
$("#choose_courses_notice").text("请选择部门");
} else{
$("#choose_courses_notice").text("");
$("#schools_list_form").submit();
hideModal();
}
}
var lastSearchCondition = '';
var count = 0;
function search_courses(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'managements', :action => 'update_department') %>'+'?search='+ e.target.value+'&department_id=<%= edit_id %>',
type:'get',
data: {is_observe:true},
success: function(data){ },
beforeSend: function(){ $(this).addClass('ajax-loading'); },
complete: function(){ $(this).removeClass('ajax-loading'); }
});
}
</script>

View File

@ -5,7 +5,7 @@
<% department.each do |department| %>
<ul class="courseSend" >
<li class="" style="display:inline-block">
<input name="department_id[]" id="search_school_<%= department.id %>" type="radio" value="<%= department.id %>" class="courseSendCheckbox magic-radio"/>
<input name="department_id" id="search_school_<%= department.id %>" type="radio" value="<%= department.id %>" class="courseSendCheckbox magic-radio"/>
<label for="search_school_<%= department.id %>"><%= truncate(department.name, :lendght => 25)%></label>
</li>
</ul>

View File

@ -0,0 +1,24 @@
<%= form_tag edit_departments_school_managements_path(:alter_dep_id => edit_id), :id => 'schools_list_form' %>
<div>
<div class="courseReferContainer" >
<% if !departments.empty? && !@search.nil? %>
<% departments.each do |department| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="department_id" id="search_school_<%= department.id %>" type="radio" value="<%= department.id %>" class="courseSendCheckbox magic-radio"/>
<label for="search_school_<%= department.id %>"><%= truncate(department.name, :lendght => 25)%></label>
</li>
</ul>
<% end %>
<% end %>
</div>
</div>
<div class="cl"></div>
<script>
$(function(){
var height=$(".courseReferContainer").height();
if (height>200){
$(".courseReferContainer").css({"height":"200px","overflow-y":"auto"});
}
})
</script>

View File

@ -6,7 +6,7 @@
<% schools.each do |school| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="school_id[]" id="search_school_<%= school.id %>" type="radio" value="<%= school.id %>" class="courseSendCheckbox magic-radio"/>
<input name="school_id" id="search_school_<%= school.id %>" type="radio" value="<%= school.id %>" class="courseSendCheckbox magic-radio"/>
<label for="search_school_<%= school.id %>"><%= truncate(school.name, :lendght => 25)%></label>
</li>
</ul>

View File

@ -0,0 +1 @@
$("#managements_departments_list").html("<%= j( render :partial => "managements/departments_list" ) %>")

View File

@ -1,4 +1,4 @@
<% if params[:search].nil? %>
<% if params[:is_observe].nil? %>
var htmlvalue = " <%= escape_javascript( render :partial => 'managements/all_department', :locals => {:department => @department, :edit_id => @edit_id}) %>";
pop_box_new(htmlvalue, 400, 260);
<% else %>

View File

@ -1,4 +1,4 @@
<% if params[:search].nil? %>
<% if params[:is_observe].nil? %>
var htmlvalue = " <%= escape_javascript( render :partial => 'managements/all_schools', :locals => {:schools => @schools, :edit_id => @edit_id}) %>";
pop_box_new(htmlvalue, 400, 260);
<% else %>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript( render :partial => 'managements/create_department') %>";
pop_box_new(htmlvalue, 400, 260);

View File

@ -3,7 +3,7 @@
<input class="fl task-form-20 task-height-30 ml35" id="shixun_Look_name" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" onkeyup="myFunction()">
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt2" onclick="$('#department_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2" id="clear_contents">清除</a>
<a href="#" class="task-btn task-btn-green fr mt6 mr30" >创建</a>
<%= link_to '创建',{:controller => 'managements', :action => 'create_departments'}, :remote => true, :class => "task-btn task-btn-green fr mt6 mr30" %>
<input name="sx_order" type="hidden"/>
</div>
<% end %>

View File

@ -126,7 +126,7 @@
}else{
type = 2;
}
alert(type);
// alert(type);
$.ajax({
url: "<%= trial_authorization_managements_path %>" +".js",
data: { search: iName, status: type}

View File

@ -0,0 +1,6 @@
<% if params[:is_observe].nil? %>
var htmlvalue = " <%= escape_javascript( render :partial => 'managements/update_department', :locals => {:departments => @departments, :edit_id => @edit_id }) %>";
pop_box_new(htmlvalue, 400, 260);
<% else %>
$("#schools_list").html("<%= escape_javascript(render :partial => 'managements/update_department_school', :locals => {:departments => @departments, :edit_id => @edit_id }) %>");
<% end %>

View File

@ -0,0 +1,5 @@
for(var i=0; i<$("#subject_shixun_<%= @school.id %>").nextAll().length; i++){
var index = parseInt($($("#subject_shixun_<%= @school.id %>").nextAll()[i]).children(":first").html());
$($("#subject_shixun_<%= @school.id %>").nextAll()[i]).children(":first").html(index - 1);
}
$("#subject_shixun_<%= @school.id %>").remove();

View File

@ -1,39 +1,39 @@
<div class="mh550">
<% if @user_experiences.blank? %>
<div class="edu-tab-con-box" style="text-align: center">
<img class="edu-nodata-img" src="/images/edu_user/edu-nodata.png"/>
<p class="edu-nodata-p mb30">您还没有获得过经验值哦~</p>
<% if @user_experiences.blank? %>
<div class="edu-tab-con-box" style="text-align: center">
<img class="edu-nodata-img" src="/images/edu_user/edu-nodata.png"/>
<p class="edu-nodata-p mb30">您还没有获得过经验值哦~</p>
</div>
<% else %>
<table class="edu-pop-table-all" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th width="15%">操作</th>
<th width="15%">变更</th>
<th width="55%">详情</th>
<th width="15%">操作时间</th>
</tr>
</thead>
<tbody>
<% @user_experiences.each do |exp| %>
<tr>
<td class="pl10">闯关</td>
<td>+ <%= exp.score %></td>
<% game = Game.where(:id => exp.container_id).first %>
<td><%= game ? "通过实训“#{game.challenge.shixun.name}”的第#{game.challenge.position}关获得的奖励" : "--" %></td>
<td><%= format_time exp.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="cl"></div>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul>
<%= pagination_links_full @experiences_pages, @experiences_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
<% else %>
<table class="edu-pop-table-all" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th width="15%">操作</th>
<th width="15%">变更</th>
<th width="55%">详情</th>
<th width="15%">操作时间</th>
</tr>
</thead>
<tbody>
<% @user_experiences.each do |exp| %>
<tr>
<td class="pl10">闯关</td>
<td>+ <%= exp.score %></td>
<% game = Game.where(:id => exp.container_id).first %>
<td><%= game ? "通过实训“#{game.challenge.shixun.name}”的第#{game.challenge.position}关获得的奖励" : "--" %></td>
<td><%= format_time exp.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="cl"></div>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul>
<%= pagination_links_full @experiences_pages, @experiences_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<% end %>
</div>
<% end %>

View File

@ -20,7 +20,7 @@
</li>
</ul>
<div class="new-tab-con new-tab-con-1 pt15 pl15 pr15 pb15 white_bg shadow_border" style="border-top: none;" id="growth_record_content">
<%= render :partial => "users/user_experience" %>
<%#= render :partial => "users/user_experience" %>
</div>
</div>
<style>body{background-color: #FFFFFF}</style><!--后续会删除-->

View File

@ -103,7 +103,7 @@
<!--<%#= link_to '编辑我的资料', my_account_path %>-->
<!--</p>-->
<p class="p2 font-12 mt12">
<p class="p2 font-12 mt5">
<i class="fa fa-eye font-12" aria-hidden="true"></i>
<% update_visiti_count @user %>
<span><%= @user.visits.to_i %></span> 次访问
@ -139,12 +139,14 @@
</div>
<% else %>
<div class="itnew">
<p class="p2 font-14 mt10 mb10">
<p class="p2 font-12 mt10 mb10">
<i class="fa fa-eye" aria-hidden="true"></i>
<span><%= @user.visits.to_i %></span> 次访问
</p>
<p class="sub clearfix">
<span class="font-14 ml10">经验值<%= link_to @user.experience %></span>
<span class="font-14 ml10 mr10">金币<%= link_to @user.grade %></span>
<a href="<%= feedback_path(@user, :host=> Setting.host_user) %>" class="fr font-14 ml10">给TA留言</a>
<% if(@user.watched_by?(User.current)) %>
<%= link_to "已关注",

View File

@ -222,6 +222,10 @@ RedmineApp::Application.routes.draw do
delete 'delete_applied_schools'
match 'new_major', :via => [:get, :post]
post 'insert_major'
match 'update_department',:via => [:get, :post]
post 'edit_departments_school'
get 'create_departments'
post 'add_department'
end
end
# Enable Grack support