From 1f5c90185a7fccefd3af4256f32c11f3bb0bd5b8 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Fri, 11 Mar 2016 13:14:32 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E3=80=8A=E9=A1=B6=E9=83=A8?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2=E2=80=9C=E5=88=86=E6=9E=90=E2=80=9D=E6=8A=A5?=
=?UTF-8?q?404=E9=94=99=E8=AF=AF=E3=80=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../welcome/_search_all_results.html.erb | 26 ++++++++++++++-----
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/app/views/welcome/_search_all_results.html.erb b/app/views/welcome/_search_all_results.html.erb
index 4ed9fba33..51835106b 100644
--- a/app/views/welcome/_search_all_results.html.erb
+++ b/app/views/welcome/_search_all_results.html.erb
@@ -38,10 +38,19 @@
<%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description %>
- 教师:<%= User.find(item.tea_id).realname %>
- 授课时间:<%= item.time.to_s + item.term%>
- 更新时间:<%= format_date(item.updated_at)%>
- <%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%>
+ <%= course_teacher = User.where("id = ?", item.tea_id).first if item.tea_id? %>
+ <% if course_teacher.nil? %>
+ 教师:无
+ 授课时间:<%= item.time.to_s + item.term%>
+ 更新时间:<%= format_date(item.updated_at)%>
+ 单位:无
+ <%= else %>
+ 教师:<%= User.find(item.tea_id).realname %>
+ 授课时间:<%= item.time.to_s + item.term%>
+ 更新时间:<%= format_date(item.updated_at)%>
+ <%= course_teacher.user_extensions.occupation.present? ? '单位:'+ course_teacher.user_extensions.occupation : ''%>
+ <% end %>
+
@@ -56,7 +65,8 @@
<%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %>资源
- 发布者:<%= User.find(item.author_id).login%>(<%= User.find(item.author_id).realname%>)
+ <%= item_author = User.where("id = ?", item.author_id).first if item.author_id? %>
+ 发布者:<%= item_author.nil? ? '无' : item_author.login%>(<%= item_author.realname unless item_author.nil? %>)
发布时间:<%= format_date(item.created_on)%>
下载次数:<%= item.downloads%>次
@@ -76,7 +86,8 @@
<%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description%>
- 管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %>更新时间:<%= date_format_local( Project.find(item.id).updated_on) %>
+ <%= project_admin = User.where("id = ?", item.user_id).first if item.user_id? %>
+ 管理人员:<%= project_admin.nil? ? '无' : project_admin.login %>更新时间:<%= date_format_local( Project.find(item.id).updated_on) %>
@@ -92,7 +103,8 @@
<%= item.try(:highlight).try(:content) ? item.highlight.content[0].html_safe : item.content.html_safe%>
- 发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %>更新时间:<%= format_date( item.updated_at) %>
+ <%= memo_author = User.where("id = ?", item.author_id).first if item.author_id? %>
+ 发帖人:<%= memo_author.nil? ? '无' : memo_author.login %>更新时间:<%= format_date( item.updated_at) %>