Remove Commits#compare, add CompareController
This commit is contained in:
parent
5a5d214de4
commit
169f16fb32
6 changed files with 53 additions and 21 deletions
|
@ -45,18 +45,6 @@ class CommitsController < ApplicationController
|
|||
# end
|
||||
# end
|
||||
|
||||
def compare
|
||||
result = Commit.compare(project, params[:from], params[:to])
|
||||
|
||||
@commits = result[:commits]
|
||||
@commit = result[:commit]
|
||||
@diffs = result[:diffs]
|
||||
@refs_are_same = result[:same]
|
||||
@line_notes = []
|
||||
|
||||
@commits = CommitDecorator.decorate(@commits)
|
||||
end
|
||||
|
||||
def patch
|
||||
@commit = project.commit(params[:id])
|
||||
|
||||
|
|
22
app/controllers/compare_controller.rb
Normal file
22
app/controllers/compare_controller.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
class CompareController < ApplicationController
|
||||
before_filter :project
|
||||
layout "project"
|
||||
|
||||
# Authorize
|
||||
before_filter :add_project_abilities
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_code_access!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
def show
|
||||
result = Commit.compare(project, params[:from], params[:to])
|
||||
|
||||
@commits = result[:commits]
|
||||
@commit = result[:commit]
|
||||
@diffs = result[:diffs]
|
||||
@refs_are_same = result[:same]
|
||||
@line_notes = []
|
||||
|
||||
@commits = CommitDecorator.decorate(@commits)
|
||||
end
|
||||
end
|
23
app/views/compare/_head.html.haml
Normal file
23
app/views/compare/_head.html.haml
Normal file
|
@ -0,0 +1,23 @@
|
|||
%ul.nav.nav-tabs
|
||||
%li= render partial: 'shared/ref_switcher', locals: {destination: 'commits'}
|
||||
%li{class: "#{'active' if current_page?(project_commits_path(@project)) }"}
|
||||
= link_to project_commits_path(@project) do
|
||||
Commits
|
||||
%li{class: "#{'active' if current_page?(compare_project_commits_path(@project)) }"}
|
||||
= link_to compare_project_commits_path(@project) do
|
||||
Compare
|
||||
%li{class: "#{branches_tab_class}"}
|
||||
= link_to project_repository_path(@project) do
|
||||
Branches
|
||||
%span.badge= @project.repo.branch_count
|
||||
|
||||
%li{class: "#{'active' if current_page?(tags_project_repository_path(@project)) }"}
|
||||
= link_to tags_project_repository_path(@project) do
|
||||
Tags
|
||||
%span.badge= @project.repo.tag_count
|
||||
|
||||
- if current_page?(project_commits_path(@project)) && current_user.private_token
|
||||
%li.right
|
||||
%span.rss-icon
|
||||
= link_to project_commits_path(@project, :atom, { private_token: current_user.private_token, ref: @ref }), title: "Feed" do
|
||||
= image_tag "rss_ui.png", title: "feed"
|
Loading…
Add table
Add a link
Reference in a new issue