Skip to content

Commit

Permalink
The rubygem partial displays the latest release date
Browse files Browse the repository at this point in the history
  • Loading branch information
heyapricot committed Feb 26, 2024
1 parent 926b8b5 commit 82f3095
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/helpers/rubygems_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ def show_all_versions_link?(rubygem)
rubygem.versions_count > 5 || rubygem.yanked_versions?
end

def latest_release_date(rubygem)
return version_date_tag(rubygem.latest_version) if rubygem.latest_version.present?

tag.small("- #{nice_date_for(rubygem.updated)}", class: "gem__version__date") if rubygem.respond_to?(:updated) && rubygem.updated.present?
end

def latest_version_number(rubygem)
return rubygem.version if rubygem.respond_to?(:version)
(rubygem.latest_version || rubygem.versions.last)&.number
Expand Down
1 change: 1 addition & 0 deletions app/views/rubygems/_rubygem.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<h2 class="gems__gem__name">
<%= rubygem.name %>
<span class="gems__gem__version"><%= latest_version_number(rubygem) %></span>
<%= latest_release_date(rubygem) %>
</h2>
<p class="gems__gem__desc t-text"><%= short_info(rubygem) %></p>
</span>
Expand Down
1 change: 1 addition & 0 deletions lib/elastic_searcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def ui_source
summary
description
downloads
updated
version]
end
end

0 comments on commit 82f3095

Please sign in to comment.