fix design index bug when start start from blank DB.

add delay impressionist.
add several i18n vars
This commit is contained in:
Matt K. Fu committed 2013-05-23 12:07:43 +08:00
1 parent 37aa950028
commit 54a35b30be
18 files changed
+83 -96

No files matched your search

+2 -2
View File
@@ -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]
+6
View File
@@ -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 = []
+7
View File
@@ -0,0 +1,7 @@
class DelayedImpressionist
@queue = :low
def self.perform(object)
impressionist(object)
true
end
end
+1 -1
View File
@@ -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)
+3 -3
View File
@@ -1,8 +1,8 @@
<table class="table">
<tr>
<th>時間</th>
<th>使用帳號</th>
<th>頁面</th>
<th><%= I18n.t 'user_action.time' %></th>
<th><%= I18n.t 'user_action.name' %></th>
<th><%= I18n.t 'user_action.page' %></th>
</tr>
<% @user_actions.each do |user_action| %>