Class: LanguagesController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



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

def index
  @languages = Project.popular_languages(:facet_limit => 160)
end

#showObject



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

def show
  find_language

  scope = Project.language(@language).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)
  @color = Languages::Language[@language].try(:color)
  @watched = scope.most_watched.limit(5)
  @dependend = scope.most_dependents.limit(5).includes(:github_repository)
  @popular = scope.order('projects.rank DESC').limit(5).includes(:github_repository)

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

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