Class: KeywordsController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



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

def index
  @keywords = Project.popular_keywords(:facet_limit => 160)
end

#showObject



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

def show
  find_keyword

  @created = Project.keyword(@keyword).few_versions.order('projects.created_at DESC').limit(5).includes(:github_repository)
  @updated = Project.keyword(@keyword).many_versions.order('projects.latest_release_published_at DESC').limit(5).includes(:github_repository)
  @watched = Project.keyword(@keyword).most_watched.limit(5)
  @popular = Project.keyword(@keyword).order('projects.rank DESC').limit(5).includes(:github_repository)
  @dependend = Project.keyword(@keyword).most_dependents.limit(5).includes(:github_repository)

  facets = Project.facets(filters: {keywords_array: @keyword}, :facet_limit => 10)

  @languages = facets[:languages][:terms]
  @platforms = facets[:platforms][:terms]
  @licenses = facets[:licenses][:terms].reject{ |t| t.term.downcase == 'other' }
end