diff --git a/app/assets/javascripts/lib/contenteditable.js.erb b/app/assets/javascripts/lib/contenteditable.js.erb
index 515be3e6d..40c19dd35 100644
--- a/app/assets/javascripts/lib/contenteditable.js.erb
+++ b/app/assets/javascripts/lib/contenteditable.js.erb
@@ -40,11 +40,11 @@ $(".nav-tabs").find(".icons-pencil").click(function(){
data: { body: content_holder.html() },
success: function(json) {
$(selector).attr("contenteditable",false)
- alert("<%= I18n.t("admin.contenteditable.update_done") %>");
+ alert("<%= I18n.t('admin.contenteditable.update_done') %>");
//content_holder.effect('highlight', {'color': '#0f0'}, 3000);
},
error: function() {
- alert("<%= I18n.t("admin.contenteditable.update_failed") %>");
+ alert("<%= I18n.t('admin.contenteditable.update_failed') %>");
//content_holder.effect('highlight', {'color': '#f00'}, 3000);
content_holder.html(content);
}
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8f6513922..26dbddc47 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -204,4 +204,12 @@ module ApplicationHelper
is_manager? || is_admin?
end
+ def display_date_time(object)
+ object.strftime("%Y-%m-%d %H:%M:%S")
+ end
+
+ def display_date(object)
+ object.strftime("%Y-%m-%d")
+ end
+
end
diff --git a/app/models/asset.rb b/app/models/asset.rb
index 22c4ae2da..e20fcb9e7 100644
--- a/app/models/asset.rb
+++ b/app/models/asset.rb
@@ -34,10 +34,10 @@ class Asset
protected
def set_key
- if title.new_record?
+ if title && title.new_record?
title.key = 'title'
end
- if description.new_record?
+ if description && description.new_record?
description.key = 'description'
end
end
diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb
index 0bf7de641..589da3208 100644
--- a/vendor/built_in_modules/announcement/app/models/bulletin.rb
+++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb
@@ -160,13 +160,13 @@ class Bulletin
protected
def set_key
- if title.new_record?
+ if title && title.new_record?
title.key = 'title'
end
- if subtitle.new_record?
+ if subtitle && subtitle.new_record?
subtitle.key = 'subtitle'
end
- if text.new_record?
+ if text && text.new_record?
text.key = 'text'
end
end
diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb
index c4d60b9b8..a30ec1311 100644
--- a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb
+++ b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb
@@ -29,10 +29,10 @@ class BulletinFile
protected
def set_key
- if filetitle.new_record?
+ if filetitle && filetitle.new_record?
filetitle.key = 'filetitle'
end
- if description.new_record?
+ if description && description.new_record?
description.key = 'description'
end
end
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb
index 423e35ba5..8f879e795 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb
@@ -60,8 +60,8 @@
-
<%= bulletin.postdate %> |
- <%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %> |
+ <%= display_date_time(bulletin.postdate) %> |
+ <%= (bulletin.deadline) ? display_date_time(bulletin.deadline ): t('bulletin.no_deadline') %> |
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb
index 68634b9a7..d8921677d 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb
@@ -5,7 +5,7 @@
<%= t('announcement.postdate') %>
- <%= @bulletin.postdate %>
+ <%= display_date_time(@bulletin.postdate) %>
<%= t('announcement.title') %>
@@ -42,7 +42,7 @@
<%= t('announcement.最後修改時間') %>
- <%= @bulletin.updated_at %>
+ <%= display_date(@bulletin.updated_at) %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb
index 6937a6c30..4ba18b51e 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb
@@ -22,7 +22,7 @@
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
|
- <%= post.postdate %> |
+ <%= display_date_time(post.postdate) %> |
<% end %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb
index 37373ae97..2ece4b023 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb
@@ -2,10 +2,11 @@
<%= @bulletin.title[I18n.locale] %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb
index daadc3675..450e7617e 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb
@@ -15,7 +15,7 @@
<%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %> |
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
- <%= post.postdate %> |
+ <%= display_date_time(post.postdate) %> |
<% end %>
diff --git a/vendor/built_in_modules/news/app/models/news_bulletin.rb b/vendor/built_in_modules/news/app/models/news_bulletin.rb
index 83bb784b4..f9d2ca0e8 100644
--- a/vendor/built_in_modules/news/app/models/news_bulletin.rb
+++ b/vendor/built_in_modules/news/app/models/news_bulletin.rb
@@ -160,13 +160,13 @@ class NewsBulletin
protected
def set_key
- if title.new_record?
+ if title && title.new_record?
title.key = 'title'
end
- if subtitle.new_record?
+ if subtitle && subtitle.new_record?
subtitle.key = 'subtitle'
end
- if text.new_record?
+ if text && text.new_record?
text.key = 'text'
end
end
diff --git a/vendor/built_in_modules/news/app/models/news_bulletin_file.rb b/vendor/built_in_modules/news/app/models/news_bulletin_file.rb
index a75dc01fc..40495cb47 100644
--- a/vendor/built_in_modules/news/app/models/news_bulletin_file.rb
+++ b/vendor/built_in_modules/news/app/models/news_bulletin_file.rb
@@ -29,10 +29,10 @@ class NewsBulletinFile
protected
def set_key
- if filetitle.new_record?
+ if filetitle && filetitle.new_record?
filetitle.key = 'filetitle'
end
- if description.new_record?
+ if description && description.new_record?
description.key = 'description'
end
end
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb
index bdd19082c..2313f35fa 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb
@@ -61,8 +61,8 @@
|
- <%= news_bulletin.postdate %> |
- <%= (news_bulletin.deadline) ? news_bulletin.deadline : t('news_bulletin.no_deadline') %> |
+ <%= display_date(news_bulletin.postdate) %> |
+ <%= (news_bulletin.deadline) ? display_date(news_bulletin.deadline) : t('news_bulletin.no_deadline') %> |
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb
index 1868c8fbc..ce64e41fa 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb
@@ -5,7 +5,7 @@
<%= t('news.postdate') %>
- <%= @news_bulletin.postdate %>
+ <%= display_date(@news_bulletin.postdate) %>
<%= t('news.title') %>
@@ -42,7 +42,7 @@
<%= t('news.最後修改時間') %>
- <%= @news_bulletin.updated_at %>
+ <%= display_date(@news_bulletin.updated_at) %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb
index 4c2292a61..322b64c02 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb
@@ -22,7 +22,7 @@
<%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
<%= post.subtitle[I18n.locale].html_safe %>
|
- <%= post.postdate %> |
+ <%= display_date(post.postdate) %> |
<% end %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
index e1c07e3bf..df391c548 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
@@ -3,9 +3,10 @@
diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb
index d345f0375..4eab719a0 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb
@@ -18,7 +18,7 @@
<%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
<%= post.subtitle[I18n.locale].html_safe %>
-
<%= post.postdate %> |
+ <%= display_date(post.postdate) %> |
<% end %>
diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb
index 036cb6e04..ea8303c25 100644
--- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb
+++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb
@@ -18,6 +18,6 @@
<%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %>
<%end -%>
- <%= page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %> |
+ <%= display_date_time(page_context) %> |
<%= User.find(page_context.create_user_id).name %> |
\ No newline at end of file
diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb
index 7035a700c..38d83b294 100644
--- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb
+++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb
@@ -10,6 +10,6 @@
<%= view_page_context.version %> |
- <%= view_page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %> |
+ <%= display_date(view_page_context.updated_at) %> |
<%= User.find(view_page_context.create_user_id).name %> |
\ No newline at end of file
diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/show.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/show.html.erb
index a75bcc8c5..0c681faf6 100644
--- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/show.html.erb
+++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/show.html.erb
@@ -21,7 +21,7 @@
<%= t('page_content.最後修改時間') %>
- <%= @page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
+ <%= display_date(@page_context.updated_at) %>
diff --git a/vendor/built_in_modules/web_resource/app/models/web_link.rb b/vendor/built_in_modules/web_resource/app/models/web_link.rb
index 9bd06f055..4143c38bf 100644
--- a/vendor/built_in_modules/web_resource/app/models/web_link.rb
+++ b/vendor/built_in_modules/web_resource/app/models/web_link.rb
@@ -69,10 +69,10 @@ class WebLink
protected
def set_key
- if name.new_record?
+ if name && name.new_record?
name.key = 'name'
end
- if context.new_record?
+ if context && context.new_record?
context.key = 'context'
end
end
diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb
index e37346161..1eba06465 100644
--- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb
+++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb
@@ -13,7 +13,7 @@
<%= t('announcement.postdate') %>
- <%= @bulletin.postdate %>
+ <%= display_date(@bulletin.postdate) %>
<%= t('announcement.title') %>
@@ -50,7 +50,7 @@
<%= t('announcement.最後修改時間') %>
- <%= @bulletin.updated_at %>
+ <%= display_date(@bulletin.updated_at) %>
diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb
index a3381e5c7..7e7f2c95e 100644
--- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb
+++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb
@@ -13,7 +13,7 @@
<%= t('announcement.postdate') %>
- <%= @bulletin.postdate %>
+ <%= display_date(@bulletin.postdate) %>
<%= t('announcement.title') %>
@@ -50,7 +50,7 @@
<%= t('announcement.最後修改時間') %>
- <%= @bulletin.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
+ <%= display_date_time(@bulletin.updated_at) %>
diff --git a/vendor/impressionist/app/models/impressionist/impressionable.rb b/vendor/impressionist/app/models/impressionist/impressionable.rb
index f5cbd3b07..60d2a62a8 100644
--- a/vendor/impressionist/app/models/impressionist/impressionable.rb
+++ b/vendor/impressionist/app/models/impressionist/impressionable.rb
@@ -38,10 +38,11 @@ module Impressionist
end
def update_impressionist_counter_cache
- cache_options = self.class.impressionist_counter_cache_options
- column_name = cache_options[:column_name].to_sym
- count = cache_options[:unique] ? impressionist_count(:filter => :ip_address) : impressionist_count
- update_attribute(column_name, count)
+ # cache_options = self.class.impressionist_counter_cache_options
+ # column_name = cache_options[:column_name].to_sym
+ # count = cache_options[:unique] ? impressionist_count(:filter => :ip_address) : impressionist_count
+ # update_attribute(column_name, count)
+ update_attribute(column_name, self.send(cache_options[:column_name]) + 1)
end
# OLD METHODS - DEPRECATE IN V0.5