Class: Gitlab::BlamePresenter
- Inherits:
-
View::Presenter::Simple
- Object
- View::Presenter::Simple
- Gitlab::BlamePresenter
- 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
Constants included from AvatarsHelper
AvatarsHelper::DEFAULT_AVATAR_PATH
Instance Method Summary collapse
- #commit_data(commit, previous_path = nil) ⇒ Object
- #first_line ⇒ Object
- #groups ⇒ Object
- #groups_commit_data ⇒ Object
-
#initialize(blame, **attributes) ⇒ BlamePresenter
constructor
A new instance of BlamePresenter.
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, #download_links, #edit_in_new_fork_notice, #edit_in_new_fork_notice_action, #edit_in_new_fork_notice_now, #fork_modal_options, #on_top_of_branch?, #patch_branch_name, #path_breadcrumbs, #relative_url_root, #selected_branch, #tree_edit_branch, #tree_icon, #tree_join, #vue_file_list_data, #web_ide_button_data
Methods included from WebIdeButtonHelper
#can_collaborate?, #can_create_mr_from_fork?, #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?, #can_modify_blob_with_web_ide?, #contribution_options, #copy_blob_source_button, #copy_file_path_button, #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, #editing_preview_title, #encode_ide_path, #fork_and_edit_path, #fork_path_for_current_user, #gitignore_names, #gitlab_ci_ymls, #ide_edit_path, #ide_fork_and_edit_path, #ide_merge_request_path, #leave_edit_message, #licenses_for_select, #open_raw_blob_button, #parent_dir_raw_path, #readable_blob, #ref_project, #sanitize_svg_data, #vue_blob_app_data, #vue_blob_header_app_data
Methods included from ApplicationHelper
#active_when, #add_issuable_stylesheet, #add_page_specific_style, #add_page_startup_api_call, #add_work_items_stylesheet, #admin_section?, #asset_to_string, #autocomplete_data_sources, #bluesky_url, #body_data, #body_data_page, #client_class_list, #client_js_flags, #collapsed_super_sidebar?, community_forum, #community_forum, #conditional_link_to, #current_action?, #current_controller?, #discord_url, #dispensable_render, #dispensable_render_if_exists, #edited_time_ago_with_tooltip, #error_css, #external_storage_url_or_path, #extra_config, #gitlab_config, #gitlab_ui_form_for, #gitlab_ui_form_with, #hexdigest, #hidden_resource_icon, #instance_review_permitted?, #last_commit, #linkedin_name, #linkedin_url, #locale_path, #mastodon_url, #outdated_browser?, #page_class, #page_filter_path, #page_startup_api_calls, #partial_exists?, #path_to_key, #project_data, promo_host, #promo_host, #promo_url, promo_url, #read_only_message, #registry_config, #render_if_exists, #show_callout?, #show_last_push_widget?, #sign_in_with_redirect?, #simple_sanitize, #static_objects_external_storage_enabled?, #support_url, #system_message_class, #template_exists?, #time_ago_with_tooltip, #twitter_url
Methods included from ViteHelper
#universal_path_to_stylesheet, #universal_stylesheet_link_tag, #vite_enabled?, #vite_hmr_http_url, #vite_hmr_websocket_url, #vite_page_entrypoint_paths
Methods included from CommitsHelper
#cherry_pick_projects_data, #commit_author_link, #commit_blob, #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_tag_link, #commit_tags_links, #commit_to_html, #commits_breadcrumbs, #conditionally_paginate_diff_files, #diff_mode_swap_button, #link_to_browse_code, #local_committed_date
Methods included from BlameHelper
#age_map_class, #age_map_duration, #blame_pages_streaming_url, #entire_blame_path
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, #topic_icon, #user_avatar, #user_avatar_without_link
Methods included from View::Presenter::Base
#__subject__, #can?, #declarative_policy_delegate, #is_a?, #path_with_line_numbers, #present, #url_builder, #web_path, #web_url
Methods included from Allowable
Methods included from Routing
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_line ⇒ Object
31 32 33 |
# File 'app/presenters/gitlab/blame_presenter.rb', line 31 def first_line blame.first_line end |
#groups ⇒ Object
35 36 37 |
# File 'app/presenters/gitlab/blame_presenter.rb', line 35 def groups @groups ||= blame.groups end |
#groups_commit_data ⇒ Object
43 44 45 |
# File 'app/presenters/gitlab/blame_presenter.rb', line 43 def groups_commit_data groups.each { |group| group[:commit_data] = commit_data(group[:commit]) } end |