Class: Gitlab::BlamePresenter

Inherits:
View::Presenter::Simple show all
Includes:
ActionView::Context, ActionView::Helpers::TranslationHelper, ActionView::Helpers::UrlHelper, ApplicationHelper, AvatarsHelper, BlameHelper, CommitsHelper, IconsHelper, TreeHelper
Defined in:
app/presenters/gitlab/blame_presenter.rb

Defined Under Namespace

Classes: CommitData

Constant Summary

Constants included from IconsHelper

IconsHelper::DEFAULT_ICON_SIZE

Constants included from TreeHelper

TreeHelper::FILE_LIMIT

Instance Attribute Summary

Attributes included from View::Presenter::Base

#subject

Instance Method Summary collapse

Methods included from IconsHelper

#audit_icon, #boolean_to_icon, #custom_icon, #external_snippet_icon, #file_type_icon_class, #icon, #loading_icon, #spinner, #sprite_file_icons_path, #sprite_icon, #sprite_icon_path, #visibility_level_icon

Methods included from TreeHelper

#breadcrumb_data_attributes, #can_edit_tree?, #commit_in_fork_help, #commit_in_single_accessible_branch, #directory_download_links, #edit_in_new_fork_notice, #edit_in_new_fork_notice_action, #edit_in_new_fork_notice_now, #fast_project_blob_path, #fast_project_tree_path, #flatten_tree, #on_top_of_branch?, #path_breadcrumbs, #relative_url_root, #render_tree, #selected_branch, #tree_content_data, #tree_edit_branch, #tree_edit_project, #tree_icon, #tree_join, #up_dir_path, #vue_file_list_data

Methods included from ApplicationHelper

#active_when, #add_page_startup_api_call, #admin_section?, #asset_to_string, #autocomplete_data_sources, #body_data, #body_data_page, #client_class_list, #client_js_flags, #collapsed_sidebar?, #conditional_link_to, #contact_sales_url, #current_action?, #current_controller?, #edited_time_ago_with_tooltip, #external_storage_url_or_path, #extra_config, #gitlab_config, #hexdigest, #last_commit, #linkedin_url, #locale_path, #outdated_browser?, #page_class, #page_filter_path, #page_startup_api_calls, #partial_exists?, #path_to_key, #project_data, #promo_host, #promo_url, #read_only_message, #registry_config, #render_if_exists, #show_callout?, #show_last_push_widget?, #simple_sanitize, #static_objects_external_storage_enabled?, #stylesheet_link_tag_defer, #support_url, #system_message_class, #template_exists?, #time_ago_with_tooltip, #truncate_first_line, #twitter_url

Methods included from StartupCssHelper

#use_startup_css?

Methods included from CommitsHelper

#cherry_pick_commit_link, #commit_author_link, #commit_branch_link, #commit_branches_links, #commit_committer_link, #commit_default_branch, #commit_signature_badge_classes, #commit_tag_link, #commit_tags_links, #commit_to_html, #commits_breadcrumbs, #link_to_browse_code, #revert_commit_link

Methods included from BlameHelper

#age_map_class, #age_map_duration

Methods included from AvatarsHelper

#author_avatar, #avatar_icon_for, #avatar_icon_for_email, #avatar_icon_for_user, #default_avatar, #gravatar_icon, #group_icon, #project_icon, #user_avatar, #user_avatar_without_link

Methods included from View::Presenter::Base

#can?, #declarative_policy_delegate, #is_a?, #present, #url_builder, #web_path, #web_url

Methods included from Allowable

#can?

Methods included from Routing

add_helpers, includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

#initialize(subject, **attributes) ⇒ BlamePresenter

Returns a new instance of BlamePresenter.


25
26
27
28
29
30
# File 'app/presenters/gitlab/blame_presenter.rb', line 25

def initialize(subject, **attributes)
  super

  @commits = {}
  precalculate_data_by_commit!
end

Instance Method Details

#commit_data(commit) ⇒ Object


36
37
38
# File 'app/presenters/gitlab/blame_presenter.rb', line 36

def commit_data(commit)
  @commits[commit.id] ||= get_commit_data(commit)
end

#groupsObject


32
33
34
# File 'app/presenters/gitlab/blame_presenter.rb', line 32

def groups
  @groups ||= blame.groups
end