Skip to content

Commit

Permalink
Merge pull request #2176 from MushroomObserver/jdc-license-created_at
Browse files Browse the repository at this point in the history
Update display of license dates
  • Loading branch information
JoeCohen committed Jun 11, 2024
2 parents bd4e528 + e46e657 commit 7e43aba
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 22 deletions.
8 changes: 2 additions & 6 deletions app/helpers/licenses_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

# helpers for show License view
module LicensesHelper
def license_updated_at(license)
if license.updated_at
license.updated_at.strftime("%Y-%m-%d %H:%M:%S")
else
"nil"
end
def license_date(date)
date.strftime("%Y-%m-%d %H:%M:%S")
end

def license_table_header
Expand Down
4 changes: 2 additions & 2 deletions app/views/controllers/licenses/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
{ target: "_blank", rel: "noopener noreferrer" }) %></b>
</p>
<p><%= :DEPRECATED.t %>: <b><%= @license.deprecated.to_s %></b></p>
<p><%= :CREATED.t %>: <b><%= license_updated_at(@license) %></b></p>
<p><%= :UPDATED.t %>: <b><%= license_updated_at(@license) %></b></p>
<p><%= :CREATED.t %>: <b><%= license_date(@license.created_at) %></b></p>
<p><%= :UPDATED.t %>: <b><%= license_date(@license.updated_at) %></b></p>
</div>
4 changes: 3 additions & 1 deletion test/fixtures/licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
# in a fixture on the opposite side of the association.
# See http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

DEFAULTS: &DEFAULTS
created_at: 2010-07-10 20:00:00

ccnc25:
display_name: Creative Commons Non-commercial v2.5
url: https://creativecommons.org/licenses/by-nc-sa/2.5/
deprecated: true
updated_at: nil

ccnc30:
display_name: Creative Commons Non-commercial v3.0
Expand Down
13 changes: 0 additions & 13 deletions test/helpers/licenses_helper_test.rb

This file was deleted.

0 comments on commit 7e43aba

Please sign in to comment.