Commit 069a6dfa9152dc61042bc3385651e9a81c8d3392
1 parent
6f037b9f
Exists in
master
and in
4 other branches
Compare link for branches
Showing
2 changed files
with
5 additions
and
0 deletions
Show diff stats
app/helpers/compare_helper.rb
| @@ -3,6 +3,7 @@ module CompareHelper | @@ -3,6 +3,7 @@ module CompareHelper | ||
| 3 | params[:from].present? && params[:to].present? && | 3 | params[:from].present? && params[:to].present? && |
| 4 | @repository.branch_names.include?(params[:from]) && | 4 | @repository.branch_names.include?(params[:from]) && |
| 5 | @repository.branch_names.include?(params[:to]) && | 5 | @repository.branch_names.include?(params[:to]) && |
| 6 | + params[:from] != params[:to] && | ||
| 6 | !@refs_are_same | 7 | !@refs_are_same |
| 7 | end | 8 | end |
| 8 | 9 |
app/views/projects/branches/_branch.html.haml
| @@ -13,6 +13,10 @@ | @@ -13,6 +13,10 @@ | ||
| 13 | = link_to archive_project_repository_path(@project, ref: branch.name), class: 'btn grouped btn-small' do | 13 | = link_to archive_project_repository_path(@project, ref: branch.name), class: 'btn grouped btn-small' do |
| 14 | %i.icon-download-alt | 14 | %i.icon-download-alt |
| 15 | Download | 15 | Download |
| 16 | + = link_to project_compare_index_path(@project, from: branch.name, to: branch.name), class: 'btn grouped btn-small', title: "Compare" do | ||
| 17 | + %i.icon-copy | ||
| 18 | + Compare | ||
| 19 | + | ||
| 16 | - if can?(current_user, :admin_project, @project) && branch.name != @repository.root_ref | 20 | - if can?(current_user, :admin_project, @project) && branch.name != @repository.root_ref |
| 17 | = 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 | 21 | = 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 |
| 18 | %i.icon-trash | 22 | %i.icon-trash |