From d6178ec7dd2a1be954ddf9b2380274d858cc4eb6 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 29 Jul 2016 21:45:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/school_controller.rb | 2 +- app/models/applied_message.rb | 3 ++- app/views/admin/applied_schools.html.erb | 2 +- app/views/admin/has_applied_schools.html.erb | 2 +- app/views/users/_user_message_applied.html.erb | 10 ++++++---- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index b927b1108..037fdd411 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -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, :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 else data[:result] = 3 diff --git a/app/models/applied_message.rb b/app/models/applied_message.rb index c008a2284..2e8891fcd 100644 --- a/app/models/applied_message.rb +++ b/app/models/applied_message.rb @@ -1,6 +1,7 @@ class AppliedMessage < ActiveRecord::Base # status: 0表示未批准; status:1表示已批准; 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 :user has_many :message_alls, :class_name => 'MessageAll', :as =>:message, :dependent => :destroy diff --git a/app/views/admin/applied_schools.html.erb b/app/views/admin/applied_schools.html.erb index 507cb7c49..518624b5f 100644 --- a/app/views/admin/applied_schools.html.erb +++ b/app/views/admin/applied_schools.html.erb @@ -59,7 +59,7 @@ <% user = User.where("id=?", apply.user_id).first %> <% unless user.nil? %> - <%= user.login %> + <%=link_to user.show_name, user_path(user) %> <% end %> diff --git a/app/views/admin/has_applied_schools.html.erb b/app/views/admin/has_applied_schools.html.erb index 555dce689..286edbd19 100644 --- a/app/views/admin/has_applied_schools.html.erb +++ b/app/views/admin/has_applied_schools.html.erb @@ -65,7 +65,7 @@ <% user = User.where("id=?", apply.user_id).first %> <% unless user.nil? %> - <%= user.login %> + <%=link_to user.show_name, user_path(user) %> <% end %> diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index b2735f32a..d52e4c2c8 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -1,6 +1,7 @@ <% if ma.class == AppliedMessage %> <% if ma.applied_type == "ApplyAddSchools" %> + <% if ma.status == 1 || ma.status == 2 || ma.status == 3 || ma.status == 4 %> + <% end %> <% elsif ma && ma.applied_type == "AppliedProject" %>