单位审核bug修复
This commit is contained in:
parent
5272f20de8
commit
fc1fc0bd7d
|
@ -713,17 +713,23 @@ class AdminController < ApplicationController
|
|||
def delete_applied_schools
|
||||
applied_school = ApplyAddSchools.find(params[:id])
|
||||
applied_school.update_attribute(:status, 3)
|
||||
# 未审批删除
|
||||
if params[:tip] == "unapplied"
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => 3, :viewed => true, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
# 删除学校的用户
|
||||
users = UserExtensions.where("school_id = #{applied_school.school_id}")
|
||||
users.each do |user|
|
||||
user.update_column("school_id", nil)
|
||||
end
|
||||
applied_school.school.destroy
|
||||
|
||||
# 跳转当前页面
|
||||
if params[:tip] == "unapplied"
|
||||
redirect_to unapplied_schools_url
|
||||
# 已审批删除
|
||||
elsif params[:tip] == "applied"
|
||||
users = UserExtensions.where("school_id = #{applied_school.school_id}")
|
||||
users.each do |user|
|
||||
user.update_column("school_id", nil)
|
||||
end
|
||||
applied_school.destroy
|
||||
redirect_to applied_schools_url
|
||||
end
|
||||
end
|
||||
|
|
|
@ -191,7 +191,7 @@ class SchoolController < ApplicationController
|
|||
# status=4 向管理员发送信息
|
||||
users = User.where(:admin => 1)
|
||||
users.each do |user|
|
||||
AppliedMessage.create(:user_id => user.id, :status => 4, :applied_user_id => User.current.id, :viewed => true, :applied_id => school.id, :applied_type => "ApplyAddSchools", :name => school.name )
|
||||
AppliedMessage.create(:user_id => user.id, :status => 0, :applied_user_id => User.current.id, :viewed => true, :applied_id => school.id, :applied_type => "ApplyAddSchools", :name => school.name )
|
||||
end
|
||||
else
|
||||
data[:result] = 3
|
||||
|
|
|
@ -4,13 +4,5 @@ class ApplyAddSchools < ActiveRecord::Base
|
|||
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied
|
||||
belongs_to :school
|
||||
|
||||
after_create :send_massage
|
||||
|
||||
#给系统所有管理发送消息
|
||||
def send_massage
|
||||
users = User.where(:admin => 1)
|
||||
users.each do |user|
|
||||
self.applied_messages << AppliedMessage.new(:user_id => user.id, :viewed => false, :status => false)
|
||||
end
|
||||
end
|
||||
#after_create :send_massage
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<th style="width: 30px;">
|
||||
申请者
|
||||
</th>
|
||||
<th style="width: 75px;">
|
||||
<th style="width: 85px;">
|
||||
地区
|
||||
</th>
|
||||
<th style="width: 75px;">
|
||||
|
@ -67,7 +67,7 @@
|
|||
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
|
||||
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
||||
</span>
|
||||
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:50px; height:18px; display: none">
|
||||
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:55px; height:18px; display: none">
|
||||
<option value="北京">北京</option>
|
||||
<option value="上海">上海</option>
|
||||
<option value="广东">广东</option>
|
||||
|
@ -104,7 +104,7 @@
|
|||
<option value="台湾">台湾</option>
|
||||
<option value="海外">海外</option>
|
||||
</select>
|
||||
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:50px; height:18px; display: none"></select>
|
||||
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:55px; height:18px; display: none"></select>
|
||||
</td>
|
||||
<td class="center">
|
||||
<span title="双击可编辑" ondblclick = "show_edit_school_address('<%= apply.id %>');" id="apply_address_<%= apply.id %>"><%= apply.address %></span>
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
|
||||
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
||||
</span>
|
||||
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:50px; height:18px; display: none">
|
||||
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:55px; height:18px; display: none">
|
||||
<option value="北京">北京</option>
|
||||
<option value="上海">上海</option>
|
||||
<option value="广东">广东</option>
|
||||
|
@ -110,7 +110,7 @@
|
|||
<option value="台湾">台湾</option>
|
||||
<option value="海外">海外</option>
|
||||
</select>
|
||||
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:50px; height:18px; display: none"></select>
|
||||
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:55px; height:18px; display: none"></select>
|
||||
</td>
|
||||
<td class="center">
|
||||
<span title="双击可编辑" ondblclick = "show_edit_school_address('<%= apply.id %>');" id="apply_address_<%= apply.id %>"><%= apply.address %></span>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<% if ma.class == AppliedMessage %>
|
||||
<!--申请加入项目-->
|
||||
<% if ma.applied_type == "ApplyAddSchools" %>
|
||||
<% if ma.status == 1 || ma.status == 2 || ma.status == 3 || ma.status == 4 %>
|
||||
<% if ma.status == 1 || ma.status == 2 || ma.status == 3 || ma.status == 0 %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);">
|
||||
<% if ma.status == 1 || ma.status == 2 || ma.status == 3 %>
|
||||
<%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
|
||||
<% elsif ma.status == 4 %>
|
||||
<% elsif ma.status == 0 %>
|
||||
<%= link_to image_tag(url_to_avatar(ma.user), :width => "30", :height => "30"), user_path(ma.user), :target => '_blank' %>
|
||||
<% end %>
|
||||
</a>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<%= link_to "“"+ma.name+"”" + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" }, :title => "“#{ma.name}”的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", :target => '_blank'%>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
<% elsif ma.status == 4 %>
|
||||
<% elsif ma.status == 0 %>
|
||||
<%=link_to User.where("id=?", ma.applied_user_id).first.show_name, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>"> 申请了单位:</span>
|
||||
<li class="homepageNewsContent fl">
|
||||
|
|
Loading…
Reference in New Issue