add more date format for index

This commit is contained in:
manson 2014-09-12 11:02:56 +08:00
parent cd2865c6b8
commit 18f9611d0a
2 changed files with 41 additions and 4 deletions

View File

@ -14,7 +14,20 @@ class AnnouncementsController < ApplicationController
"title" => a.title, "title" => a.title,
"subtitle" => a.subtitle, "subtitle" => a.subtitle,
"statuses" => statuses, "statuses" => statuses,
"postdate" => a.postdate.strftime("%b %d, %Y at %I:%M %p"), "postdate" => a.postdate.strftime("%b %d, %Y at %I:%M %p"),
"date" => a.postdate.strftime("%F"),
"year" => a.postdate.strftime("%Y"),
"month" => a.postdate.strftime("%b"),
"month-num" => a.postdate.strftime("%m"),
"week" => a.postdate.strftime("%A"),
"week-num" => a.postdate.strftime("%u"),
"day" => a.postdate.strftime("%d"),
"hour" => a.postdate.strftime("%H"),
"minute" => a.postdate.strftime("%M"),
"second" => a.postdate.strftime("%S"),
"meridian" => a.postdate.strftime("%p"),
"link_to_show" => OrbitHelper.url_to_show(a.to_param), "link_to_show" => OrbitHelper.url_to_show(a.to_param),
"img_src" => a.image.thumb.url || "http://placehold.it/100x100", "img_src" => a.image.thumb.url || "http://placehold.it/100x100",
"more" => t(:more_plus) "more" => t(:more_plus)
@ -44,7 +57,20 @@ class AnnouncementsController < ApplicationController
"title" => a.title, "title" => a.title,
"subtitle" => a.subtitle, "subtitle" => a.subtitle,
"statuses" => statuses, "statuses" => statuses,
"postdate" => a.postdate.strftime("%d"), "postdate" => a.postdate.strftime("%d"),
"date" => a.postdate.strftime("%F"),
"year" => a.postdate.strftime("%Y"),
"month" => a.postdate.strftime("%b"),
"month-num" => a.postdate.strftime("%m"),
"week" => a.postdate.strftime("%A"),
"week-num" => a.postdate.strftime("%u"),
"day" => a.postdate.strftime("%d"),
"hour" => a.postdate.strftime("%H"),
"minute" => a.postdate.strftime("%M"),
"second" => a.postdate.strftime("%S"),
"meridian" => a.postdate.strftime("%p"),
"link_to_show" => OrbitHelper.widget_item_url(a.to_param), "link_to_show" => OrbitHelper.widget_item_url(a.to_param),
"img_src" => a.image.thumb.url || "http://placehold.it/100x100", "img_src" => a.image.thumb.url || "http://placehold.it/100x100",
} }
@ -71,10 +97,20 @@ class AnnouncementsController < ApplicationController
"title" => a.title, "title" => a.title,
"subtitle" => a.subtitle, "subtitle" => a.subtitle,
"statuses" => statuses, "statuses" => statuses,
"week" => a.postdate.strftime("%A"),
"day" => a.postdate.strftime("%d"), "postdate" => a.postdate.strftime("%d"),
"month" => a.postdate.strftime("%b"), "date" => a.postdate.strftime("%F"),
"year" => a.postdate.strftime("%Y"), "year" => a.postdate.strftime("%Y"),
"month" => a.postdate.strftime("%b"),
"month-num" => a.postdate.strftime("%m"),
"week" => a.postdate.strftime("%A"),
"week-num" => a.postdate.strftime("%u"),
"day" => a.postdate.strftime("%d"),
"hour" => a.postdate.strftime("%H"),
"minute" => a.postdate.strftime("%M"),
"second" => a.postdate.strftime("%S"),
"meridian" => a.postdate.strftime("%p"),
"link_to_show" => OrbitHelper.widget_item_url(a.to_param), "link_to_show" => OrbitHelper.widget_item_url(a.to_param),
"img_src" => a.image.thumb.url || "http://placehold.it/100x100", "img_src" => a.image.thumb.url || "http://placehold.it/100x100",
} }

View File

@ -286,8 +286,9 @@
<!-- Form Actions --> <!-- Form Actions -->
<div class="form-actions"> <div class="form-actions">
<%= get_referer_url[:action] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %> <%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= request.referer %>"> <input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn', type: :button %> <%= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn', type: :button %>
<%= link_to t('cancel'), admin_announcements_path, :class=>"btn" %> <%= link_to t('cancel'), admin_announcements_path, :class=>"btn" %>
</div> </div>