diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 0b165b7c5..dcbd1f38b 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -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表示未批准; status:1表示已批准; status: 2表示已更改; status: 3表示已拒绝 + # status: 0表示未批准; status:1表示已批准; 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" diff --git a/app/views/admin/has_applied_schools.html.erb b/app/views/admin/has_applied_schools.html.erb index 5be3517c8..1b6341fb3 100644 --- a/app/views/admin/has_applied_schools.html.erb +++ b/app/views/admin/has_applied_schools.html.erb @@ -26,7 +26,7 @@ 单位名称 - + 申请者 @@ -59,8 +59,8 @@ <% unless apply.school_id.nil? %> <% school_name = School.where("id=?", apply.school_id).first %> - <%= school_name %> - + <%= school_name.name %> + <% end %> diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index e543f6cee..fbe422242 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -24,7 +24,7 @@ 系统提示 ">您添加新的高校(单位):
  • - <%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>” + “<%= ma.applied.name %>”的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”
  • <%= time_tag(ma.created_at).html_safe %>
  • <% elsif ma.status == 3 %>