From 069a6dfa9152dc61042bc3385651e9a81c8d3392 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 12 Sep 2013 21:39:27 +0300 Subject: [PATCH] Compare link for branches --- app/helpers/compare_helper.rb | 1 + app/views/projects/branches/_branch.html.haml | 4 ++++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/app/helpers/compare_helper.rb b/app/helpers/compare_helper.rb index e1dd89d..ea2540b 100644 --- a/app/helpers/compare_helper.rb +++ b/app/helpers/compare_helper.rb @@ -3,6 +3,7 @@ module CompareHelper params[:from].present? && params[:to].present? && @repository.branch_names.include?(params[:from]) && @repository.branch_names.include?(params[:to]) && + params[:from] != params[:to] && !@refs_are_same end diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index 026948a..b839252 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -13,6 +13,10 @@ = link_to archive_project_repository_path(@project, ref: branch.name), class: 'btn grouped btn-small' do %i.icon-download-alt Download + = link_to project_compare_index_path(@project, from: branch.name, to: branch.name), class: 'btn grouped btn-small', title: "Compare" do + %i.icon-copy + Compare + - if can?(current_user, :admin_project, @project) && branch.name != @repository.root_ref = link_to project_branch_path(@project, branch.name), class: 'btn grouped btn-small remove-row', method: :delete, confirm: 'Removed branch cannot be restored. Are you sure?', remote: true do %i.icon-trash -- libgit2 0.21.2