Class: PlatformsController

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

Instance Method Summary collapse

Instance Method Details

#indexObject


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

def index
  @platforms = Project.popular_platforms
end

#showObject


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

def show
  find_platform
  scope = Project.platform(@platform_name).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)
  @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)

  @color = @platform.color

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

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