Class: Projects::CompareController

Inherits:
ApplicationController show all
Includes:
DiffHelper
Defined in:
app/controllers/projects/compare_controller.rb

Instance Method Summary collapse

Methods included from DiffHelper

#commit_for_diff, #diff_file_html_data, #diff_hard_limit_enabled?, #diff_line_content, #diff_options, #diff_view, #editable_diff?, #generate_line_code, #inline_diff_btn, #line_comments, #mark_inline_diffs, #organize_comments, #parallel_diff_btn, #safe_diff_files, #submodule_link, #unfold_bottom_class, #unfold_class

Methods inherited from ApplicationController

#redirect_back_or_default

Methods included from PageLayoutHelper

#blank_container, #container_class, #fluid_layout, #header_title, #nav, #page_card_attributes, #page_card_meta_tags, #page_description, #page_image, #page_title, #sidebar

Methods included from GitlabRoutingHelper

#activity_project_path, #edit_project_path, #edit_project_url, #issue_path, #issue_url, #merge_request_path, #merge_request_url, #milestone_path, #project_builds_path, #project_commits_path, #project_files_path, #project_path, #project_pipelines_path, #project_snippet_url, #project_url, #runner_path, #runners_path, #toggle_subscription_path

Methods included from Gitlab::GonHelper

#add_gon_variables

Methods included from Gitlab::CurrentSettings

#current_application_settings, #fake_application_settings

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Projects::ApplicationController

Instance Method Details

#createObject


29
30
31
32
# File 'app/controllers/projects/compare_controller.rb', line 29

def create
  redirect_to namespace_project_compare_path(@project.namespace, @project,
                                             params[:from], params[:to])
end

#indexObject


12
13
# File 'app/controllers/projects/compare_controller.rb', line 12

def index
end

#showObject


15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/projects/compare_controller.rb', line 15

def show
  compare = CompareService.new.
    execute(@project, @head_ref, @project, @base_ref, diff_options)

  if compare
    @commits = Commit.decorate(compare.commits, @project)
    @commit = @project.commit(@head_ref)
    @base_commit = @project.merge_base_commit(@base_ref, @head_ref)
    @diffs = compare.diffs(diff_options)
    @diff_refs = [@base_commit, @commit]
    @line_notes = []
  end
end