Changes for dat and time format

Impression bug when some i18n missing in impressionable object
JS bug in ad_banner edit title
This commit is contained in:
Christophe Vilayphiou 2012-05-18 19:42:36 +08:00
parent e1bd5d8c8d
commit 4d33c7a56d
24 changed files with 57 additions and 46 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -60,8 +60,8 @@
</ul>
</div>
</td>
<td><%= bulletin.postdate %></td>
<td><%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %></td>
<td><%= display_date_time(bulletin.postdate) %></td>
<td><%= (bulletin.deadline) ? display_date_time(bulletin.deadline ): t('bulletin.no_deadline') %></td>
<td>
<div class="label-group">
<div class="label-td">

View File

@ -5,7 +5,7 @@
</li>
<li>
<b><%= t('announcement.postdate') %></b>
<%= @bulletin.postdate %>
<%= display_date_time(@bulletin.postdate) %>
</li>
<li>
<b><%= t('announcement.title') %></b>
@ -42,7 +42,7 @@
</li>
<li>
<b><%= t('announcement.最後修改時間') %></b>
<%= @bulletin.updated_at %>
<%= display_date(@bulletin.updated_at) %>
</li>

View File

@ -22,7 +22,7 @@
<td><%= 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) %>
</td>
<td><%= post.postdate %></td>
<td><%= display_date_time(post.postdate) %></td>
</tr>
<% end %>

View File

@ -2,10 +2,11 @@
<h1 class="h1"><%= @bulletin.title[I18n.locale] %></h1>
<div class="info">
<div class="info1">
<span class="date"><%= @bulletin.postdate %></span>
&nbsp;|&nbsp;
<a href="" class="unit"><%= User.find(@bulletin.create_user_id).sub_roles.collect{|t| t.key}.join(" ") rescue '' %></a>
<span><%= dislpay_view_count(@bulletin) %></span>
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
<% unit = User.find(@bulletin.create_user_id).sub_roles.collect{|t| t.key}.join(" ") rescue nil %>
<%= " | " if unit %>
<a href="" class="unit"><%= unit %></a>
</div>
</div>
<div class="news_image">

View File

@ -15,7 +15,7 @@
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
</td>
<td><%= post.postdate %></td>
<td><%= display_date_time(post.postdate) %></td>
</tr>
<% end %>

View File

@ -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

View File

@ -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

View File

@ -61,8 +61,8 @@
</ul>
</div>
</td>
<td><%= news_bulletin.postdate %></td>
<td><%= (news_bulletin.deadline) ? news_bulletin.deadline : t('news_bulletin.no_deadline') %></td>
<td><%= display_date(news_bulletin.postdate) %></td>
<td><%= (news_bulletin.deadline) ? display_date(news_bulletin.deadline) : t('news_bulletin.no_deadline') %></td>
<td>
<div class="label-group">
<div class="label-td">

View File

@ -5,7 +5,7 @@
</li>
<li>
<b><%= t('news.postdate') %></b>
<%= @news_bulletin.postdate %>
<%= display_date(@news_bulletin.postdate) %>
</li>
<li>
<b><%= t('news.title') %></b>
@ -42,7 +42,7 @@
</li>
<li>
<b><%= t('news.最後修改時間') %></b>
<%= @news_bulletin.updated_at %>
<%= display_date(@news_bulletin.updated_at) %>
</li>

View File

@ -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 %>
</td>
<td><%= post.postdate %></td>
<td><%= display_date(post.postdate) %></td>
</tr>
<% end %>
</tbody>

View File

@ -3,9 +3,10 @@
<div class="info">
<div class="info1">
<span class="pull-right"><%= dislpay_view_count(@news_bulletin) %></span>
<span class="date"><%= @news_bulletin.postdate %></span>
&nbsp;|&nbsp;
<a href="" class="unit"><%= @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue '' %></a>
<span class="date"><%= display_date(@news_bulletin.postdate) %></span>
<% unit = @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue nil %>
<%= " | " if unit %>
<a href="" class="unit"><%= unit %></a>
</div>
</div>
<div class="news_image">

View File

@ -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 %>
</td>
<td><%= post.postdate %></td>
<td><%= display_date(post.postdate) %></td>
</tr>
<% end %>
</tbody>

View File

@ -18,6 +18,6 @@
<%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %>
<%end -%>
</td>
<td><%= page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %></td>
<td><%= display_date_time(page_context) %></td>
<td><%= User.find(page_context.create_user_id).name %></td>
</tr>

View File

@ -10,6 +10,6 @@
</div>
</td>
<td><%= view_page_context.version %></td>
<td><%= view_page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %></td>
<td><%= display_date(view_page_context.updated_at) %></td>
<td><%= User.find(view_page_context.create_user_id).name %></td>
</tr>

View File

@ -21,7 +21,7 @@
</li>
<li>
<b><%= t('page_content.最後修改時間') %></b>
<%= @page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
<%= display_date(@page_context.updated_at) %>
</li>

View File

@ -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

View File

@ -13,7 +13,7 @@
</li>
<li>
<b><%= t('announcement.postdate') %></b>
<%= @bulletin.postdate %>
<%= display_date(@bulletin.postdate) %>
</li>
<li>
<b><%= t('announcement.title') %></b>
@ -50,7 +50,7 @@
</li>
<li>
<b><%= t('announcement.最後修改時間') %></b>
<%= @bulletin.updated_at %>
<%= display_date(@bulletin.updated_at) %>
</li>

View File

@ -13,7 +13,7 @@
</li>
<li>
<b><%= t('announcement.postdate') %></b>
<%= @bulletin.postdate %>
<%= display_date(@bulletin.postdate) %>
</li>
<li>
<b><%= t('announcement.title') %></b>
@ -50,7 +50,7 @@
</li>
<li>
<b><%= t('announcement.最後修改時間') %></b>
<%= @bulletin.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
<%= display_date_time(@bulletin.updated_at) %>
</li>

View File

@ -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