diff --git a/app/assets/stylesheets/modules/stats.css b/app/assets/stylesheets/modules/stats.css index b2bdbd1fe2f..0dfda9fad31 100644 --- a/app/assets/stylesheets/modules/stats.css +++ b/app/assets/stylesheets/modules/stats.css @@ -47,7 +47,7 @@ .stat__count { font-size: 24px; } } -.stats__graph__heading { +.stats__heading { margin-bottom: 42px; font-weight: 600; font-size: 18px; @@ -205,3 +205,32 @@ @-moz-document url-prefix() { .stats__graph__gem__count { top: 8px; } } + +.stats__table { + width: 100%; + border-collapse: separate; + border-spacing: 30px 15px; + border-left: 3%; +} + +.stats__table__row { + height: 30px; + width: 100%; } + +.stats__table__column { + /* Size table columns to contents. */ + width: 1%; + white-space: nowrap; + + font-weight: 400; + text-align: right; + vertical-align: middle; } + + @media (max-width: 709px) { + .stats__table__column { + font-size: 13px; } } + @media (min-width: 710px) { + .stats__table__column { + font-size: 15px; } } + +.stats__table__column a { color: black; } diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 912ee7afaa5..7d63ad54697 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -5,5 +5,6 @@ def index @number_of_downloads = GemDownload.total_count @most_downloaded = Rubygem.by_downloads.limit(10).includes(:gem_download).to_a @most_downloaded_count = @most_downloaded.first && @most_downloaded.first.gem_download.count + @recent_uploads = Version.recent_uploads(10) end end diff --git a/app/models/version.rb b/app/models/version.rb index fe6b248de01..5c9c82b7818 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -157,6 +157,13 @@ def self.just_updated(limit = 5) .limit(limit) end + def self.recent_uploads(limit) + joins(:rubygem) + .indexed + .by_created_at + .limit(limit) + end + def self.published(limit) indexed.by_built_at.limit(limit) end diff --git a/app/views/stats/index.html.erb b/app/views/stats/index.html.erb index 8ecb659f519..6a84d9abbe6 100644 --- a/app/views/stats/index.html.erb +++ b/app/views/stats/index.html.erb @@ -15,17 +15,39 @@ -
| + <%= link_to version.rubygem.name, rubygem_path(version.rubygem) %> + | ++ <%= link_to version.number, rubygem_version_path(version.rubygem, version.slug) %> + | ++ |
|---|