Class: Gitlab::BlamePresenter

Inherits:
View::Presenter::Simple show all
Includes:
ActionView::Context, ActionView::Helpers::TranslationHelper, 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 CommitsHelper

CommitsHelper::DEFAULT_SHA

Constants included from BlameHelper

BlameHelper::BODY_FONT_SIZE, BlameHelper::CODE_LINE_HEIGHT, BlameHelper::CODE_PADDING, BlameHelper::COMMIT_BLOCK_HEIGHT_EXP, BlameHelper::COMMIT_LINE_HEIGHT, BlameHelper::COMMIT_PADDING

Constants included from AvatarsHelper

AvatarsHelper::DEFAULT_AVATAR_PATH

Instance Method Summary collapse

Methods included from IconsHelper

#audit_icon, #boolean_to_icon, #custom_icon, #external_snippet_icon, #file_type_icon_class, #gl_loading_icon, #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, #flatten_tree, #fork_modal_options, #on_top_of_branch?, #patch_branch_name, #path_breadcrumbs, #relative_url_root, #selected_branch, #tree_edit_branch, #tree_edit_project, #tree_icon, #tree_join, #up_dir_path, #vue_file_list_data, #web_ide_button_data

Methods included from WebIdeButtonHelper

#can_collaborate?, #can_create_mr_from_fork?, #can_push_code?, #edit_url, #fork?, #gitpod_url, #needs_to_fork?, #project_fork, #project_to_use, #readable_blob?, #show_edit_button?, #show_gitpod_button?, #show_pipeline_editor_button?, #show_web_ide_button?, #web_ide_url

Methods included from BlobHelper

#blob_editor_paths, #blob_icon, #blob_raw_path, #blob_raw_url, #blob_render_error_options, #blob_render_error_reason, #can_modify_blob?, #contribution_options, #copy_blob_source_button, #copy_file_path_button, #delete_blob_link, #dockerfile_names, #download_blob_button, #edit_blob_button, #edit_blob_fork_params, #edit_blob_path, #edit_button_tag, #edit_disabled_button_tag, #edit_fork_button_tag, #edit_link_tag, #edit_modify_file_fork_params, #editing_ci_config?, #editing_preview_title, #encode_ide_path, #fork_and_edit_path, #fork_path_for_current_user, #gitignore_names, #gitlab_ci_ymls, #human_access, #ide_edit_path, #ide_fork_and_edit_path, #ide_merge_request_path, #leave_edit_message, #licenses_for_select, #metrics_dashboard_ymls, #modify_file_button, #open_raw_blob_button, #parent_dir_raw_path, #readable_blob, #ref_project, #replace_blob_link, #sanitize_svg_data, #show_suggest_pipeline_creation_celebration?, #suggest_pipeline_commit_cookie_name

Methods included from ApplicationHelper

#active_when, #add_page_specific_style, #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, #current_action?, #current_controller?, #dispensable_render, #dispensable_render_if_exists, #edited_time_ago_with_tooltip, #external_storage_url_or_path, #extra_config, #gitlab_config, #gitlab_ui_form_for, #hexdigest, #instance_review_permitted?, #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_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 CommitsHelper

#cherry_pick_projects_data, #commit_author_link, #commit_branch_link, #commit_branches_links, #commit_committer_avatar, #commit_committer_link, #commit_default_branch, #commit_options_dropdown_data, #commit_partial_cache_key, #commit_path_template, #commit_signature_badge_classes, #commit_tag_link, #commit_tags_links, #commit_to_html, #commits_breadcrumbs, #conditionally_paginate_diff_files, #diff_mode_swap_button, #link_to_browse_code

Methods included from BlameHelper

#age_map_class, #age_map_duration, #intrinsic_row_css

Methods included from AvatarsHelper

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

Methods included from View::Presenter::Base

#__subject__, #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(blame, **attributes) ⇒ BlamePresenter

Returns a new instance of BlamePresenter.


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

def initialize(blame, **attributes)
  super

  @commits = {}
  precalculate_data_by_commit!
end

Instance Method Details

#commit_data(commit, previous_path = nil) ⇒ Object


39
40
41
# File 'app/presenters/gitlab/blame_presenter.rb', line 39

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

#first_lineObject


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

def first_line
  blame.first_line
end

#groupsObject


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

def groups
  @groups ||= blame.groups
end