单位审查消息及其BUG修复
This commit is contained in:
parent
7f62de59e1
commit
7fbca5f260
|
@ -616,9 +616,14 @@ class AdminController < ApplicationController
|
|||
# 未审批tab页
|
||||
# status: 0 未审批; 1 已批阅; 2已更改; 3拒绝;
|
||||
def applied_schools
|
||||
# 更新消息状态
|
||||
if params[:flag]
|
||||
applied_message = AppliedMessage.where(:id => params[:applied_message_id]).first
|
||||
applied_message.update_attribute(:viewed, true)
|
||||
end
|
||||
|
||||
@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
|
||||
|
@ -655,7 +660,7 @@ class AdminController < ApplicationController
|
|||
applied_school.update_column('status', 1) unless applied_school.nil?
|
||||
school = applied_school.school
|
||||
school.update_attribute("province", applied_school.province)
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => 1, :viewed => true, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => 1, :viewed => 0, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
# School.create(:user_id => applied_school.user_id, :status => 1, :viewed => true, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
respond_to do |format|
|
||||
format.html{ redirect_to unapplied_schools_url }
|
||||
|
@ -663,8 +668,8 @@ class AdminController < ApplicationController
|
|||
end
|
||||
|
||||
# 单位审核:更改
|
||||
# REDO: 修改该字段
|
||||
# REDO: 同步修改使用了改名称的用户单位
|
||||
# 修改该字段
|
||||
# 同步修改使用了改名称的用户单位
|
||||
def edit_applied_schools
|
||||
aas = ApplyAddSchools.find(params[:applied_id])
|
||||
# aas.update_attribute(:name, params[:name])
|
||||
|
@ -672,7 +677,7 @@ class AdminController < ApplicationController
|
|||
school = School.find params[:school_id]
|
||||
begin
|
||||
aas.update_attribute(:status, 2)
|
||||
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => true, :applied_id => aas.id, :applied_type => "ApplyAddSchools", :name => school[0].name )
|
||||
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[0].id)
|
||||
if aas.school_id != school[0].id.to_i
|
||||
|
@ -707,15 +712,12 @@ class AdminController < ApplicationController
|
|||
end
|
||||
|
||||
# 单位审核:删除
|
||||
# REDO: destroy关联删除
|
||||
# REDO: 删除确认提示,是否删除
|
||||
# REDO: 给申请人发送消息
|
||||
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 )
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => 3, :viewed => 0, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
# 删除学校的用户
|
||||
users = UserExtensions.where("school_id = #{applied_school.school_id}")
|
||||
users.update_all(:school_id => nil)
|
||||
|
|
|
@ -108,6 +108,12 @@ class MyController < ApplicationController
|
|||
|
||||
# Edit user's account
|
||||
def account
|
||||
# 更新消息状态
|
||||
if params[:flag]
|
||||
applied_message = AppliedMessage.where(:id => params[:applied_message_id]).first
|
||||
applied_message.update_attribute(:viewed, true)
|
||||
end
|
||||
|
||||
@user = User.current
|
||||
|
||||
lg=@user.login
|
||||
|
|
|
@ -188,11 +188,12 @@ class SchoolController < ApplicationController
|
|||
user_extention.school_id = school.id
|
||||
user_extention.save!
|
||||
|
||||
# status=4 向管理员发送信息
|
||||
# 向管理员发送信息
|
||||
users = User.where(:admin => 1)
|
||||
users.each do |user|
|
||||
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 )
|
||||
AppliedMessage.create(:user_id => user.id, :status => 0, :applied_user_id => User.current.id, :viewed => 0, :applied_id => school.id, :applied_type => "ApplyAddSchools", :name => school.name )
|
||||
end
|
||||
|
||||
else
|
||||
data[:result] = 3
|
||||
end
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入名称搜索" class="mt10 mb10 course-search" />
|
||||
</div>
|
||||
<div id="schools_list">
|
||||
<% if !@search.nil? %>
|
||||
<%= render :partial => "admin/update_school_form", :locals => {:schools => schools, :edit_id => edit_id} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div>
|
||||
<%#= hidden_field_tag(:send_id, edit_id) %>
|
||||
<div class="courseReferContainer">
|
||||
<% if !schools.empty? %>
|
||||
<% if !schools.empty? && !@search.nil? %>
|
||||
<% schools.each do |school| %>
|
||||
<ul class="courseSend">
|
||||
<li class="" style="display:inline-block">
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<td class="center">
|
||||
<% user = User.where("id=?", apply.user_id).first %>
|
||||
<% unless user.nil? %>
|
||||
<%=link_to user.show_name, user_path(user),:target => '_blank' %>
|
||||
<%=link_to user.show_name, user_path(user),:target => '_blank', :class => "application-default-link" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
|
|
|
@ -79,9 +79,9 @@
|
|||
</div>
|
||||
|
||||
<div class="navHomepageNews" id="user_messages">
|
||||
<%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank", :title => "您的所有消息" %>
|
||||
<% if User.current.count_new_message.to_i >0 %>
|
||||
<div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %></div>
|
||||
<%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target => "_Blank", :title => "您的所有消息" %>
|
||||
<% if User.current.count_new_message.to_i > 0 %>
|
||||
<div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target => "_Blank" %></div>
|
||||
<% end %>
|
||||
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
|
||||
<div class="shadowbox_news undis" id="user_messages_list">
|
||||
|
|
|
@ -135,6 +135,34 @@
|
|||
<% content = '<span class="shadowbox_news_user">'+ma.author.show_name+' </span>提到了你:'+ma.subject.html_safe %>
|
||||
<li><%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == AppliedMessage %>
|
||||
<% if ma.applied_type == "ApplyAddSchools" && ma.status == 0 %>
|
||||
<li>
|
||||
<% content = '<span class="shadowbox_news_user">'+User.where("id=?", ma.applied_user_id).first.show_name+' </span>提交了申请:添加新的单位:'+"“"+ma.name+"”" %>
|
||||
<%= link_to content.html_safe, unapplied_schools_path(:flag => 1, :applied_message_id => ma.id), :title => "#{User.where("id=?", ma.applied_user_id).first.show_name}提交了申请:添加新的单位“#{ma.name}”", :target => '_blank' %>
|
||||
</li>
|
||||
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 1 %>
|
||||
<li>
|
||||
<span class="shadowbox_news_user">系统提示</span>
|
||||
<%= applied_school_tip(ma) %>
|
||||
<%= link_to "“"+ma.name+"”" + "的申请,已通过审核。谢谢!", { :controller=> "my",:action => "account",:flag => 1, :applied_message_id => ma.id }, :title => "“#{ma.name}”的申请,,已通过审核。谢谢!", :target => '_blank'%>
|
||||
“<%= ma.name %>” 的申请,已通过审核。谢谢!
|
||||
</a>
|
||||
</li>
|
||||
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 2 %>
|
||||
<li>
|
||||
<span class="shadowbox_news_user">系统提示</span>
|
||||
<%= applied_school_tip(ma) %>
|
||||
<%= link_to "“"+ma.applied.name+"”"+"的申请,因名称不符合规范,系统已将其更改为"+"“"+ma.name+"”"+"。谢谢!", { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "“#{ma.applied.name}”的申请,因名称不符合规范,系统已将其更改为“#{ma.name}”。谢谢!", :target => '_blank'%>
|
||||
</a>
|
||||
</li>
|
||||
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 3 %>
|
||||
<li>
|
||||
<span class="shadowbox_news_user">系统提示</span>
|
||||
<%= applied_school_tip(ma) %>
|
||||
<%= link_to "“"+ma.name+"”" + "的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!", { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!", :target => '_blank'%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue