Class: Action::User::Show

Inherits:
Object
  • Object
show all
Includes:
InchCI::Action
Defined in:
app/services/action/user/show.rb

Constant Summary collapse

LANGUAGES =
InchCI::Config::LANGUAGES
DEFAULT_TAB =
LANGUAGES.first

Instance Method Summary collapse

Methods included from InchCI::Action

#exposures, included

Constructor Details

#initialize(current_user, params) ⇒ Show

Returns a new instance of Show.


14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/action/user/show.rb', line 14

def initialize(current_user, params)
  if user = find_user(params)
    @user = UserPresenter.new(user)
    @languages = LANGUAGES
    @projects = find_projects(@user) #.map { |p| ProjectPresenter.new(p) }
    @projects_without_badges = @projects.select do |project|
      project.language == 'Ruby' &&
        project.default_branch.try(:latest_revision_id).nil?
    end
    @active_tab = params[:tab] || DEFAULT_TAB
  else
    raise "Not found: #{params}"
  end
end