Merge branch 'dev_shcool' into develop

This commit is contained in:
cxt 2016-08-01 14:03:58 +08:00
commit 18539b45de
3 changed files with 18 additions and 14 deletions

View File

@ -612,43 +612,44 @@ class AdminController < ApplicationController
end
end
# 获取申请的高校列表
# status: 0 未审批; 1 已批阅;
# 单位审核
# 未审批tab页
# status: 0 未审批; 1 已批阅; 2已更改 3拒绝
def applied_schools
@name = params[:name] || ""
condition = "#{@name.strip}".gsub(" ","")
@apply_status = ApplyAddSchools.where("status = 0 and name like '%#{condition}%'").order('created_at desc')
@apply_count = @apply_status.count
@apply_pages = Paginator.new @apply_count, 30, params['page'] || 1
@apply_status = paginateHelper @apply_status, 30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
# 单位审核
# 已审批tab页
def has_applied_schools
@name = params[:name] || ""
condition = "#{@name.strip}".gsub(" ","")
@has_apply_status = ApplyAddSchools.where("(status = 1 or status = 2) and name like '%#{condition}%'").order('created_at desc')
@has_apply_count = @has_apply_status.count
@has_apply_pages = Paginator.new @has_apply_count, 30, params['page'] || 1
@has_apply_status = paginateHelper @has_apply_status, 30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
# 批准未审批的高校
# 单位审核:批准
# 消息发送,发送对象为申请人
# status: 0表示未批准 status1表示已批准 status 2表示已更改 status 3表示已拒绝
# status: 0表示未批准 status1表示已批准 status 2表示已更改 status 3表示已拒绝
def approve_applied_schools
applied_school = ApplyAddSchools.find params[:id]
applied_school.update_column('status', 1) unless applied_school.nil?
@ -661,7 +662,7 @@ class AdminController < ApplicationController
end
end
# 更改申请的高校名称
# 单位审核:更改
# REDO: 修改该字段
# REDO: 同步修改使用了改名称的用户单位
def edit_applied_schools
@ -688,6 +689,7 @@ class AdminController < ApplicationController
redirect_to unapplied_schools_url
end
# 单位审核:更改功能搜索合法学校弹框
def all_schools
apply_schools = ApplyAddSchools.where("status = 0")
apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")"
@ -706,7 +708,7 @@ class AdminController < ApplicationController
end
end
# 删除申请的高校
# 单位审核:删除
# REDO: destroy关联删除
# REDO: 删除确认提示,是否删除
# REDO: 给申请人发送消息
@ -719,6 +721,8 @@ class AdminController < ApplicationController
user.update_column("school_id", nil)
end
applied_school.school.destroy
# 跳转当前页面
if params[:tip] == "unapplied"
redirect_to unapplied_schools_url
elsif params[:tip] == "applied"

View File

@ -26,7 +26,7 @@
<th style="width: 80px;">
单位名称
</th>
<th style="width: 30px;">
<th style="width: 35px;">
申请者
</th>
<th style="width: 95px;">
@ -59,8 +59,8 @@
<td class="name" title='<%=apply.name%>' >
<% unless apply.school_id.nil? %>
<% school_name = School.where("id=?", apply.school_id).first %>
<span title="双击可编辑" ondblclick = "show_edit_school_name('<%= apply.id %>');" id="apply_title_<%= apply.id %>"><%= school_name %></span>
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位名称" id="school_name_edit_<%=apply.id%>" onblur="edit_school_name('<%= edit_apply_name_school_path(apply.id)%>','<%= apply.id %>');"><%= school_name %></textarea>
<span title="双击可编辑" ondblclick = "show_edit_school_name('<%= apply.id %>');" id="apply_title_<%= apply.id %>"><%= school_name.name %></span>
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位名称" id="school_name_edit_<%=apply.id%>" onblur="edit_school_name('<%= edit_apply_name_school_path(apply.id)%>','<%= apply.id %>');"><%= school_name.name %></textarea>
<% end %>
</td>
<td class="center">

View File

@ -24,7 +24,7 @@
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
<li class="homepageNewsContent fl">
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank' title="<%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”"><%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”</a>
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank' title="<%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”"><%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”</a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
<% elsif ma.status == 3 %>