管理员界面单位申请

This commit is contained in:
daiao 2016-07-29 21:45:52 +08:00
parent 3251890c91
commit d6178ec7dd
5 changed files with 11 additions and 8 deletions

View File

@ -191,7 +191,7 @@ class SchoolController < ApplicationController
# status=4 向管理员发送信息 # status=4 向管理员发送信息
users = User.where(:admin => 1) users = User.where(:admin => 1)
users.each do |user| users.each do |user|
AppliedMessage.create(:user_id => user.id, :status => 4, :viewed => true, :applied_id => school.id, :applied_type => "ApplyAddSchools", :name => school.name ) 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 )
end end
else else
data[:result] = 3 data[:result] = 3

View File

@ -1,6 +1,7 @@
class AppliedMessage < ActiveRecord::Base class AppliedMessage < ActiveRecord::Base
# status: 0表示未批准 status1表示已批准 status 2表示已拒绝 # status: 0表示未批准 status1表示已批准 status 2表示已拒绝
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id, :name belongs_to :applied ,:polymorphic => true attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id, :name
belongs_to :applied ,:polymorphic => true
belongs_to :apply_add_schools belongs_to :apply_add_schools
belongs_to :user belongs_to :user
has_many :message_alls, :class_name => 'MessageAll', :as =>:message, :dependent => :destroy has_many :message_alls, :class_name => 'MessageAll', :as =>:message, :dependent => :destroy

View File

@ -59,7 +59,7 @@
<td class="center"> <td class="center">
<% user = User.where("id=?", apply.user_id).first %> <% user = User.where("id=?", apply.user_id).first %>
<% unless user.nil? %> <% unless user.nil? %>
<%= user.login %> <%=link_to user.show_name, user_path(user) %>
<% end %> <% end %>
</td> </td>
<td class="center"> <td class="center">

View File

@ -65,7 +65,7 @@
<td class="center"> <td class="center">
<% user = User.where("id=?", apply.user_id).first %> <% user = User.where("id=?", apply.user_id).first %>
<% unless user.nil? %> <% unless user.nil? %>
<%= user.login %> <%=link_to user.show_name, user_path(user) %>
<% end %> <% end %>
</td> </td>
<td class="center"> <td class="center">

View File

@ -1,6 +1,7 @@
<% if ma.class == AppliedMessage %> <% if ma.class == AppliedMessage %>
<!--申请加入项目--> <!--申请加入项目-->
<% if ma.applied_type == "ApplyAddSchools" %> <% if ma.applied_type == "ApplyAddSchools" %>
<% if ma.status == 1 || ma.status == 2 || ma.status == 3 || ma.status == 4 %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"> <li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.user), :width => "30", :height => "30"), user_path(ma.user), :target => '_blank' %></a> <a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.user), :width => "30", :height => "30"), user_path(ma.user), :target => '_blank' %></a>
@ -10,21 +11,21 @@
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> <%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<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'><%= ma.name %>的申请,已通过</a> <a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank' title="<%= ma.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 == 2 %> <% elsif ma.status == 2 %>
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> <%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<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'><%= 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 %>
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> <%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<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">
<%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" } %> <%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" }, :title => "#{ma.name}的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料" %>
</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 == 4 %> <% elsif ma.status == 4 %>
@ -32,12 +33,13 @@
<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'> <a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'>
<%= User.where("id=?", ma.user_id).first.login %>提交了申请:添加新的单位“<%= ma.name %>”</a> <%= link_to User.where("id=?", ma.applied_user_id).first.show_name + "提交了申请:添加新的单位“#{ma.name}”", unapplied_schools_path(), :title => "#{User.where("id=?", ma.applied_user_id).first.show_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>
<% end %> <% end %>
</li> </li>
</ul> </ul>
<% end %>
<% elsif ma && ma.applied_type == "AppliedProject" %> <% elsif ma && ma.applied_type == "AppliedProject" %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"> <li class="homepageNewsPortrait fl">