单位审核bug的修复

This commit is contained in:
daiao 2016-08-01 13:56:37 +08:00
parent 4004e30216
commit 5272f20de8
3 changed files with 18 additions and 14 deletions

View File

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

View File

@ -26,7 +26,7 @@
<th style="width: 80px;"> <th style="width: 80px;">
单位名称 单位名称
</th> </th>
<th style="width: 30px;"> <th style="width: 35px;">
申请者 申请者
</th> </th>
<th style="width: 95px;"> <th style="width: 95px;">
@ -59,8 +59,8 @@
<td class="name" title='<%=apply.name%>' > <td class="name" title='<%=apply.name%>' >
<% unless apply.school_id.nil? %> <% unless apply.school_id.nil? %>
<% school_name = School.where("id=?", apply.school_id).first %> <% 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> <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 %></textarea> <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 %> <% end %>
</td> </td>
<td class="center"> <td class="center">

View File

@ -24,7 +24,7 @@
<span class="newsBlue homepageNewsPublisher">系统提示</span> <span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span> <span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
<li class="homepageNewsContent fl"> <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>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
<% elsif ma.status == 3 %> <% elsif ma.status == 3 %>