[Git][noosfero/noosfero][master] 2 commits: compact-profile: use abbreviated date

Rodrigo Souto gitlab at mg.gitlab.com
Mon Apr 10 14:15:13 BRT 2017


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
05deef7f by Rodrigo Souto at 2017-03-27T11:04:34-03:00
compact-profile: use abbreviated date

- - - - -
40c9530a by Rodrigo Souto at 2017-04-10T17:15:02+00:00
Merge branch 'abbreviated-date' into 'master'

compact-profile: use abbreviated date

See merge request !1151
- - - - -


2 changed files:

- app/helpers/dates_helper.rb
- app/views/search/_compact_profile.html.erb


Changes:

=====================================
app/helpers/dates_helper.rb
=====================================
--- a/app/helpers/dates_helper.rb
+++ b/app/helpers/dates_helper.rb
@@ -14,8 +14,11 @@ module DatesHelper
   end
 
   # formats a date for displaying.
-  def show_date(date, use_numbers = false, year = true, left_time = false)
-    if date && use_numbers
+  def show_date(date, use_numbers = false, year = true, left_time = false, abbreviated = false)
+    if date && abbreviated
+      date_format = year ? _('%{month_name} %{year}') : _('%{month_name} %{day}')
+      date_format % { :day => date.day, :month_name => month_name(date.month, true), :year => date.year }
+    elsif date && use_numbers
       date_format = year ? _('%{month}/%{day}/%{year}') : _('%{month}/%{day}')
       date_format % { :day => date.day, :month => date.month, :year => date.year }
     elsif date && left_time


=====================================
app/views/search/_compact_profile.html.erb
=====================================
--- a/app/views/search/_compact_profile.html.erb
+++ b/app/views/search/_compact_profile.html.erb
@@ -1,5 +1,5 @@
 <% filter_label = profile.send(@order + '_label') %>
-<% filter_label += show_date(profile.created_at) if @order == 'more_recent' %>
+<% filter_label += show_date(profile.created_at, false, true, false, true) if @order == 'more_recent' %>
 <li class="search-profile-item">
   <%= profile_image_link profile, theme_option(:profile_list_imgs_size) || :portrait, 'div', filter_label %>
 </li>



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/0a7e88cf7708588c779788f6200e02cd450e06a8...40c9530a09f05f8567a2bdfa6ba95bb99a0112fe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170410/aee4684f/attachment-0001.html>


More information about the Noosfero-dev mailing list