Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The rubygem partial displays the latest release date #4476

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion app/helpers/rubygems_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,16 @@ def show_all_versions_link?(rubygem)
rubygem.versions_count > 5 || rubygem.yanked_versions?
end

def latest_release_date(rubygem)
latest = latest_version(rubygem)
return version_date_tag(latest) if latest.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
latest_version(rubygem)&.number
end

def link_to_github(rubygem)
Expand Down Expand Up @@ -218,4 +225,10 @@ def copy_field_tag(name, value)
}
)
end

private

def latest_version(rubygem)
(rubygem.latest_version || rubygem.versions.last)
end
end
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