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() }, data: { body: content_holder.html() },
success: function(json) { success: function(json) {
$(selector).attr("contenteditable",false) $(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); //content_holder.effect('highlight', {'color': '#0f0'}, 3000);
}, },
error: function() { 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.effect('highlight', {'color': '#f00'}, 3000);
content_holder.html(content); content_holder.html(content);
} }

View File

@ -204,4 +204,12 @@ module ApplicationHelper
is_manager? || is_admin? is_manager? || is_admin?
end 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 end

View File

@ -34,10 +34,10 @@ class Asset
protected protected
def set_key def set_key
if title.new_record? if title && title.new_record?
title.key = 'title' title.key = 'title'
end end
if description.new_record? if description && description.new_record?
description.key = 'description' description.key = 'description'
end end
end end

View File

@ -160,13 +160,13 @@ class Bulletin
protected protected
def set_key def set_key
if title.new_record? if title && title.new_record?
title.key = 'title' title.key = 'title'
end end
if subtitle.new_record? if subtitle && subtitle.new_record?
subtitle.key = 'subtitle' subtitle.key = 'subtitle'
end end
if text.new_record? if text && text.new_record?
text.key = 'text' text.key = 'text'
end end
end end

View File

@ -29,10 +29,10 @@ class BulletinFile
protected protected
def set_key def set_key
if filetitle.new_record? if filetitle && filetitle.new_record?
filetitle.key = 'filetitle' filetitle.key = 'filetitle'
end end
if description.new_record? if description && description.new_record?
description.key = 'description' description.key = 'description'
end end
end end

View File

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

View File

@ -5,7 +5,7 @@
</li> </li>
<li> <li>
<b><%= t('announcement.postdate') %></b> <b><%= t('announcement.postdate') %></b>
<%= @bulletin.postdate %> <%= display_date_time(@bulletin.postdate) %>
</li> </li>
<li> <li>
<b><%= t('announcement.title') %></b> <b><%= t('announcement.title') %></b>
@ -42,7 +42,7 @@
</li> </li>
<li> <li>
<b><%= t('announcement.最後修改時間') %></b> <b><%= t('announcement.最後修改時間') %></b>
<%= @bulletin.updated_at %> <%= display_date(@bulletin.updated_at) %>
</li> </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) %> <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) %> <%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
</td> </td>
<td><%= post.postdate %></td> <td><%= display_date_time(post.postdate) %></td>
</tr> </tr>
<% end %> <% end %>

View File

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

View File

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

View File

@ -160,13 +160,13 @@ class NewsBulletin
protected protected
def set_key def set_key
if title.new_record? if title && title.new_record?
title.key = 'title' title.key = 'title'
end end
if subtitle.new_record? if subtitle && subtitle.new_record?
subtitle.key = 'subtitle' subtitle.key = 'subtitle'
end end
if text.new_record? if text && text.new_record?
text.key = 'text' text.key = 'text'
end end
end end

View File

@ -29,10 +29,10 @@ class NewsBulletinFile
protected protected
def set_key def set_key
if filetitle.new_record? if filetitle && filetitle.new_record?
filetitle.key = 'filetitle' filetitle.key = 'filetitle'
end end
if description.new_record? if description && description.new_record?
description.key = 'description' description.key = 'description'
end end
end end

View File

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

View File

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

View File

@ -22,7 +22,7 @@
<%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %> <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
<%= post.subtitle[I18n.locale].html_safe %> <%= post.subtitle[I18n.locale].html_safe %>
</td> </td>
<td><%= post.postdate %></td> <td><%= display_date(post.postdate) %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@ -3,9 +3,10 @@
<div class="info"> <div class="info">
<div class="info1"> <div class="info1">
<span class="pull-right"><%= dislpay_view_count(@news_bulletin) %></span> <span class="pull-right"><%= dislpay_view_count(@news_bulletin) %></span>
<span class="date"><%= @news_bulletin.postdate %></span> <span class="date"><%= display_date(@news_bulletin.postdate) %></span>
&nbsp;|&nbsp; <% unit = @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue nil %>
<a href="" class="unit"><%= @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue '' %></a> <%= " | " if unit %>
<a href="" class="unit"><%= unit %></a>
</div> </div>
</div> </div>
<div class="news_image"> <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' %> <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
<%= post.subtitle[I18n.locale].html_safe %> <%= post.subtitle[I18n.locale].html_safe %>
</td> </td>
<td><%= post.postdate %></td> <td><%= display_date(post.postdate) %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@ -18,6 +18,6 @@
<%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %> <%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %>
<%end -%> <%end -%>
</td> </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> <td><%= User.find(page_context.create_user_id).name %></td>
</tr> </tr>

View File

@ -10,6 +10,6 @@
</div> </div>
</td> </td>
<td><%= view_page_context.version %></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> <td><%= User.find(view_page_context.create_user_id).name %></td>
</tr> </tr>

View File

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

View File

@ -69,10 +69,10 @@ class WebLink
protected protected
def set_key def set_key
if name.new_record? if name && name.new_record?
name.key = 'name' name.key = 'name'
end end
if context.new_record? if context && context.new_record?
context.key = 'context' context.key = 'context'
end end
end end

View File

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

View File

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

View File

@ -38,10 +38,11 @@ module Impressionist
end end
def update_impressionist_counter_cache def update_impressionist_counter_cache
cache_options = self.class.impressionist_counter_cache_options # cache_options = self.class.impressionist_counter_cache_options
column_name = cache_options[:column_name].to_sym # column_name = cache_options[:column_name].to_sym
count = cache_options[:unique] ? impressionist_count(:filter => :ip_address) : impressionist_count # count = cache_options[:unique] ? impressionist_count(:filter => :ip_address) : impressionist_count
update_attribute(column_name, count) # update_attribute(column_name, count)
update_attribute(column_name, self.send(cache_options[:column_name]) + 1)
end end
# OLD METHODS - DEPRECATE IN V0.5 # OLD METHODS - DEPRECATE IN V0.5