From 05faefb301fc63599a347f87a197837680560a1b Mon Sep 17 00:00:00 2001 From: Manson Wang Date: Tue, 19 Nov 2013 15:28:47 +0800 Subject: [PATCH] NKUT footer displaying number of visitors and last update time --- app/assets/javascripts/kernel.js | 2 ++ app/controllers/pages_controller.rb | 5 +++++ app/views/layouts/page_layout.html.erb | 1 + 3 files changed, 8 insertions(+) diff --git a/app/assets/javascripts/kernel.js b/app/assets/javascripts/kernel.js index 364f08aa2..009d6e645 100644 --- a/app/assets/javascripts/kernel.js +++ b/app/assets/javascripts/kernel.js @@ -38,6 +38,8 @@ $(document).ready(function() { } } }) + + $('.page_footer').append($('#last_update_date')[0]); }); // Ad Banner FX code [end] diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 999fdbce2..2fdfd7b61 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -2,6 +2,7 @@ class PagesController < ApplicationController include ApplicationHelper before_filter :get_item, :only => [:index_from_link, :show_from_link] before_filter :check_frontend_open, :only => [:index,:show] + before_filter :get_last_update_date, :only => [:index,:show] # caches_page :index def index @@ -214,4 +215,8 @@ class PagesController < ApplicationController return false end end + + def get_last_update_date + @last_update_date = t(:total_visitors)+' : '+ Impression.count.to_s+' | '+t(:update_at)+' : '+Bulletin.order_by(:updated_at.desc).limit(1).first[:updated_at].to_s + end end diff --git a/app/views/layouts/page_layout.html.erb b/app/views/layouts/page_layout.html.erb index 83e575094..e197ef076 100644 --- a/app/views/layouts/page_layout.html.erb +++ b/app/views/layouts/page_layout.html.erb @@ -41,5 +41,6 @@ } <% end %> +