Class: Github::PullsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#after_sign_in_path_for, #api_authenticate!, #current_project, #expire_revision!, #followed_projects, #no_cache, #read_revision, #require_login, #return_or_cache_revision!, #revision, #save_current_project, #set_current_project, #unfurling?

Methods included from UrlHelper

#feature_path, #github_commit_range_url, #github_commit_url, #github_project_url, #github_url?, #goldmine_case_number_url, #link_to_project_feature, #new_release_url, #releases_path

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
# File 'app/controllers/github/pulls_controller.rb', line 3

def index
  @pulls = Github::PullRequest.order(created_at: :desc).preload(:project, :user)
  @labels = @pulls.flat_map(&:labels).uniq { |label| label["name"] }.sort_by { |label| label["name"] }
  @selected_labels = params.fetch(:only, "").split(/,\s*/)
  @selected_labels = @labels.map { |label| label["name"] } if @selected_labels.none?
  @selected_labels -= params.fetch(:except, "").split(/,\s*/)
  @title = "Pull Requests (#{@pulls.count})"
end