From 2eaa6e27321b2ce19dd2228333a394bc73c0b252 Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Thu, 14 Nov 2019 13:45:38 +0800 Subject: [PATCH] FIX --- app/controllers/homes_controller.rb | 2 ++ app/views/homes/_dynamic_new.html.erb | 13 +++++++++++++ app/views/homes/_dynamic_news.html.erb | 15 --------------- app/views/homes/index.html.erb | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 app/views/homes/_dynamic_new.html.erb delete mode 100644 app/views/homes/_dynamic_news.html.erb diff --git a/app/controllers/homes_controller.rb b/app/controllers/homes_controller.rb index e407600ae..a36f38d9c 100644 --- a/app/controllers/homes_controller.rb +++ b/app/controllers/homes_controller.rb @@ -13,6 +13,8 @@ class HomesController < ApplicationController @first_companies_group = Array(@companies.slice(0, 5)) @second_companies_group = Array(@companies.slice(5, 8)) @third_companies_group = Array(@companies.slice(13, 5)) + + fresh_when :last_modified => @home.updated_at.utc, :etag => [@home, @companies, @partners, @slide_wall, @first_companies_group, @second_companies_group, @third_companies_group] end def partners diff --git a/app/views/homes/_dynamic_new.html.erb b/app/views/homes/_dynamic_new.html.erb new file mode 100644 index 000000000..f43f6ad18 --- /dev/null +++ b/app/views/homes/_dynamic_new.html.erb @@ -0,0 +1,13 @@ + +
+
+

<%= h dynamic_new.title %>

+

<%= h dynamic_new.simple_intruduce %>

+

+ 行业动态 + <%= format_time(dynamic_new.created_at) %> +

+
+ +
+
diff --git a/app/views/homes/_dynamic_news.html.erb b/app/views/homes/_dynamic_news.html.erb deleted file mode 100644 index 6254c3f2e..000000000 --- a/app/views/homes/_dynamic_news.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<% dynamic_news&.each do |dynamic_new| %> - -
-
-

<%= h dynamic_new.title %>

-

<%= h dynamic_new.simple_intruduce %>

-

- 行业动态 - <%= format_time(dynamic_new.created_at) %> -

-
- -
-
-<% end %> diff --git a/app/views/homes/index.html.erb b/app/views/homes/index.html.erb index 3e1a00118..c4f56fd8f 100644 --- a/app/views/homes/index.html.erb +++ b/app/views/homes/index.html.erb @@ -23,7 +23,7 @@ 更多>>

- <%= render :partial => 'dynamic_news', :locals => {:dynamic_news => @dynamic_news}%> + <%= render :partial => 'dynamic_new', :collection => @dynamic_news %>