diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index f22adb2a..578bdc5e 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -14,7 +14,7 @@ class PagesController < ApplicationController
@item = Page.find_by_name('home')
if @item
- impressionist(@item)
+ delayed_impressionist(@item)
render_page
else
redirect_to '/admin/dashboards',:notice=>t(:need_home)
@@ -26,7 +26,7 @@ class PagesController < ApplicationController
#begin
@item = Item.first(:conditions => {:path => params[:page_name]})
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
- impressionist(@item)
+ delayed_impressionist(@item)
case @item.class.to_s
when 'Page'
if params[:clicked_field_name]
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 655a2090..fa052911 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,9 +1,15 @@
module ApplicationHelper
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
+
+ def delayed_impressionist(object)
+ Resque.enqueue_at(1.minute.from_now,DelayedImpressionist,object)
+ end
+
def check_user_role_enable(attribute_fields)
@user.attribute_values.collect{|t| attribute_fields.include?(t.attribute_field) }.include?(true) rescue false
end
+
def show_attribute_value(value)
if value.kind_of? Hash
result = []
diff --git a/app/jobs/delayed_impressionist.rb b/app/jobs/delayed_impressionist.rb
new file mode 100644
index 00000000..06072c45
--- /dev/null
+++ b/app/jobs/delayed_impressionist.rb
@@ -0,0 +1,7 @@
+class DelayedImpressionist
+ @queue = :low
+ def self.perform(object)
+ impressionist(object)
+ true
+ end
+end
\ No newline at end of file
diff --git a/app/models/item.rb b/app/models/item.rb
index 07da2c8f..5816aa92 100644
--- a/app/models/item.rb
+++ b/app/models/item.rb
@@ -26,7 +26,7 @@ class Item
after_save :rebuild_children_path, :if => "path_changed?"
def enabled_for_lang(lang)
- enabled_for.include?(lang)
+ enabled_for.include?(lang) rescue false
end
def self.find_by_name(item_name)
diff --git a/app/views/admin/user_actions/index.html.erb b/app/views/admin/user_actions/index.html.erb
index 74e4ea5f..a957e15d 100644
--- a/app/views/admin/user_actions/index.html.erb
+++ b/app/views/admin/user_actions/index.html.erb
@@ -1,8 +1,8 @@
- 時間 |
- 使用帳號 |
- 頁面 |
+ <%= I18n.t 'user_action.time' %> |
+ <%= I18n.t 'user_action.name' %> |
+ <%= I18n.t 'user_action.page' %> |
<% @user_actions.each do |user_action| %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 2bafb863..7dc10aaf 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -465,6 +465,10 @@ en:
url: URL
use_status: Use Statue
user: User
+ user_action:
+ time: Time
+ name: Account
+ page: Access Page and Action
users:
admin_change_password: You cannot change your own password here!
avatar: Profile Picture
diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml
index 96aa7c43..7dd3d89f 100644
--- a/config/locales/zh_tw.yml
+++ b/config/locales/zh_tw.yml
@@ -466,6 +466,10 @@ zh_tw:
url: 網址
use_status: 使用狀態
user: 使用者
+ user_action:
+ time: 時間
+ name: 使用帳號
+ page: 頁面
users:
admin_change_password: 您不能在此處修改自己的密碼!
avatar: 大頭貼照
diff --git a/config/resque.god b/config/resque.god
index f97571dc..9549f2a7 100644
--- a/config/resque.god
+++ b/config/resque.god
@@ -25,7 +25,7 @@ num_workers.times do |num|
end
w.env = {"QUEUE"=>queue, "RAILS_ENV"=>rails_env}
- w.start = "HOME=#{user_home} QUEUE=* RAILS_ENV=#{rails_env}" rake -f #{rails_root}/Rakefile resque:work
+ w.start = "HOME=#{user_home} QUEUE=* RAILS_ENV=#{rails_env} rake -f #{rails_root}/Rakefile resque:work"
w.uid = (rails_env == 'production' )? "root" : development_uid
w.gid = (rails_env == 'production' )? "root" : development_gid
diff --git a/config/resque_schedule.god b/config/resque_schedule.god
index d83c4910..696a2fd0 100644
--- a/config/resque_schedule.god
+++ b/config/resque_schedule.god
@@ -10,7 +10,7 @@ development_gid = ''
w.group = 'resque'
w.interval = 30.seconds
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
- w.start = "HOME= #{user_home} QUEUE=* RAILS_ENV=#{rails_env}" rake -f #{rails_root}/Rakefile resque:scheduler
+ w.start = "HOME= #{user_home} QUEUE=* RAILS_ENV=#{rails_env} rake -f #{rails_root}/Rakefile resque:scheduler"
w.uid = (rails_env == 'production' )? "root" : development_uid
w.gid = (rails_env == 'production' )? "root" : development_gid
diff --git a/lib/tasks/site.rake b/lib/tasks/site.rake
index c4e1d7fa..42aa5201 100644
--- a/lib/tasks/site.rake
+++ b/lib/tasks/site.rake
@@ -23,6 +23,9 @@ namespace :site do
# home_trans = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
design = Design.first
+ site = Site.first
+ site.design = design
+ site.save
theme = design.themes.first
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id )
diff --git a/patch/impressionist_delayed.diff b/patch/impressionist_delayed.diff
deleted file mode 100644
index 8427ce2a..00000000
--- a/patch/impressionist_delayed.diff
+++ /dev/null
@@ -1,83 +0,0 @@
-diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
-index a6535c5..a89f60e 100644
---- a/app/controllers/pages_controller.rb
-+++ b/app/controllers/pages_controller.rb
-@@ -7,7 +7,7 @@ class PagesController < ApplicationController
- @item = Page.find_by_name('home')
-
- if @item
-- impressionist(@item)
-+ delayed_impressionist(@item)
- render_page
- else
- render :text => t(:need_home)
-@@ -18,7 +18,7 @@ class PagesController < ApplicationController
- #begin
- @item = Item.first(:conditions => {:path => params[:page_name]})
- if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
-- impressionist(@item)
-+ delayed_impressionist(@item)
- case @item.class.to_s
- when 'Page'
- render_page unless save_from_no_lang_for_page
-diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
-index e20a0c2..b4aa12b 100644
---- a/app/helpers/application_helper.rb
-+++ b/app/helpers/application_helper.rb
-@@ -278,4 +278,8 @@ module ApplicationHelper
- end
- end
-
-+ def delayed_impressionist(object)
-+ Resque.enqueue_at(1.minute.from_now,DelayedImpressionist,object)
-+ end
-+
- end
-diff --git a/app/jobs/delayed_impressionist.rb b/app/jobs/delayed_impressionist.rb
-new file mode 100644
-index 0000000..65a4a6d
---- /dev/null
-+++ b/app/jobs/delayed_impressionist.rb
-@@ -0,0 +1,7 @@
-+class DelayedImpressionist
-+ @queue = :low
-+ def self.perform(object)
-+ impressionist(object)
-+ true
-+ end
-+end
-diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
-index 2fe0f71..72fe43b 100644
---- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
-+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
-@@ -53,7 +53,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
- else
- @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
- end
-- impressionist(@tag) if @tag
-+ delayed_impressionist(@tag) if @tag
- end
-
- end
-@@ -66,7 +66,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
- @bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
- if @bulletin and !@bulletin.disable? and !@bulletin.is_rejected
- if @bulletin.enabled_for_lang(I18n.locale.to_s)
-- impressionist(@bulletin)
-+ delayed_impressionist(@bulletin)
- get_categorys
- else
- render :text => "#{t('sys.can_not_display_due_to_no_context')}
".html_safe
-diff --git a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb
-index e1e98c7..90a079e 100644
---- a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb
-+++ b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb
-@@ -8,7 +8,7 @@ class Panel::PageContent::FrontEnd::PageContextsController < OrbitWidgetControll
- def index
- # @page_context = PageContext.where("page_id" => params[:page_id], :archived => false)
- @page_context = PageContext.first(conditions: { page_id: params[:page_id], :archived => false })
-- impressionist(@page_context)
-+ delayed_impressionist(@page_context)
-
- respond_to do |format|
- format.html # index.html.erb
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
index a0424ab1..be191fbf 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
@@ -19,10 +19,10 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
with(:frontend_search,true)
with(:available_lang).any_of([I18n.locale.to_s])
end
+
search_result = @search.results.collect{|result| result.id}
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(@page_num)
- render 'index'
end
def index
@@ -61,7 +61,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
else
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
end
- impressionist(@tag) if @tag
+ delayed_impressionist(@tag) if @tag
end
end
@@ -74,7 +74,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
@bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
if @bulletin and !@bulletin.disable? and !@bulletin.is_rejected
if @bulletin.enabled_for_lang(I18n.locale.to_s)
- impressionist(@bulletin)
+ delayed_impressionist(@bulletin)
get_categorys
else
render :text => "#{t('sys.can_not_display_due_to_no_context')}
".html_safe
diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb
index e84b020f..207b3a54 100644
--- a/vendor/built_in_modules/announcement/app/models/bulletin.rb
+++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb
@@ -108,7 +108,7 @@ class Bulletin
end
def enabled_for_lang(lang)
- eval("self.available_for_#{lang}")
+ eval("self.available_for_#{lang}") rescue false
end
def publish_month
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/search_result.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/search_result.html.erb
new file mode 100644
index 00000000..ce601ea3
--- /dev/null
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/search_result.html.erb
@@ -0,0 +1,40 @@
+<% # encoding: utf-8 %>
+
+<%= flash_messages %>
+
+<%= @page.title rescue nil %>
+
+
+
+ <%= content_tag (:th) do %>
+ <%= t('announcement.bulletin.category') %>
+ <% end if (!params[:search_query].blank? or params[:category_id].blank?)-%>
+ <%= t('announcement.bulletin.title') %> |
+ <%= t('announcement.bulletin.postdate') %> |
+
+
+ <% if !params[:name].blank?%>
+ <%= t("search.unit_get",:unit_name => params[:name],:item_num=>@bulletins.count) %>
+ <% end %>
+
+ <% if @bulletins.blank? and !params[:search_query].blank? %>
+ <%=render :partial => 'shared/search_not_found' %>
+ <% elsif !params[:search_query].blank? %>
+ <%= t("search.result_get",:search_word => params[:search_query],:item_num=>@bulletins.count) unless (@bulletins.count == 30) %>
+ <%= t("search.too_many",:search_word => params[:search_query],:exceed_num=>@bulletins.count) if (@bulletins.count ==30) %>
+ <% end %>
+
+ <% @bulletins.each do |post| %>
+
+ <%= post.bulletin_category.title rescue nil %> |
+ <%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
+ <%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
+ |
+ <%= display_date_time(post.postdate) %> |
+
+
+ <% end %>
+
+
+
+
diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml
index dd0a6329..89d62f7f 100644
--- a/vendor/built_in_modules/announcement/config/locales/en.yml
+++ b/vendor/built_in_modules/announcement/config/locales/en.yml
@@ -25,6 +25,7 @@ en:
file_name: File Name
frontend:
bulletins: Announcement front-end
+ search_result: Search result
link_name: Link Name
new_bulletin_category: New Bulletin Category
picture: Cover Picture
diff --git a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml
index 84635dbe..04d1fe25 100644
--- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml
+++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml
@@ -25,6 +25,7 @@ zh_tw:
file_name: 檔案名稱
frontend:
bulletins: 公告前台
+ search_result: 搜尋結果頁
link_name: 連結名稱
new_bulletin_category: 新增公告類別
picture: 刊頭圖片
diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb
index d17c34bb..8469cf54 100644
--- a/vendor/built_in_modules/announcement/init.rb
+++ b/vendor/built_in_modules/announcement/init.rb
@@ -12,6 +12,10 @@ module Announcement
update_info 'some update_info'
front_end do
+ app_page 'search_result' do
+ frontend_i18n "announcement.frontend.search_result"
+ end
+
app_page 'bulletins' do
frontend_i18n "announcement.frontend.bulletins"
style ["1","2","3"]
diff --git a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb
index e1e98c76..90a079e4 100644
--- a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb
+++ b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb
@@ -8,7 +8,7 @@ class Panel::PageContent::FrontEnd::PageContextsController < OrbitWidgetControll
def index
# @page_context = PageContext.where("page_id" => params[:page_id], :archived => false)
@page_context = PageContext.first(conditions: { page_id: params[:page_id], :archived => false })
- impressionist(@page_context)
+ delayed_impressionist(@page_context)
respond_to do |format|
format.html # index.html.erb