Class: LicensesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/licenses_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject


2
3
4
# File 'app/controllers/licenses_controller.rb', line 2

def index
  @licenses = Project.popular_licenses(:facet_limit => 150)
end

#showObject


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/licenses_controller.rb', line 6

def show
  find_license
  scope = Project.license(@license.id).maintained
  @created = scope.few_versions.order('projects.created_at DESC').limit(5).includes(:github_repository)
  @updated = scope.many_versions.order('projects.latest_release_published_at DESC').limit(5).includes(:github_repository)
  @popular = scope.order('projects.rank DESC').limit(5).includes(:github_repository)
  @watched = scope.most_watched.limit(5)
  @dependend = scope.most_dependents.limit(5).includes(:github_repository)

  facets = Project.facets(filters: {normalized_licenses: @license.id}, :facet_limit => 10)

  @languages = facets[:languages][:terms]
  @platforms = facets[:platforms][:terms]
  @keywords = facets[:keywords][:terms]
end