Skip to content

Commit

Permalink
add link to repository on associated revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
nodecarter committed Jun 25, 2013
1 parent d9738c8 commit adfb6b2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
13 changes: 12 additions & 1 deletion app/overrides/issues/_changesets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@
:virtual_path => 'issues/_changesets',
:name => 'branches_for_assoc',
:insert_after => 'code:contains("link_to_revision")',
:text => ' <%= changeset_branches(changeset, Setting.plugin_redmine_undev_git[:max_branches_in_assoc].to_i) %>')
:text => <<INCLUDES
<%= changeset_branches(changeset, Setting.plugin_redmine_undev_git[:max_branches_in_assoc].to_i) %>
<%= link_to h(changeset.repository.name),
{ :controller => 'repositories',
:action => 'show',
:id => @project,
:repository_id => changeset.repository.identifier_param,
:rev => nil,
:path => nil },
:class => 'repository' %>
INCLUDES
)
3 changes: 2 additions & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
name 'Redmine UndevGit plugin'
description 'Git repository with remote repositories and hooks support'
author 'Denis Diachkov, Vladimir Kiselev, Danil Tashkinov'
version '0.2.0'
author_url 'https://github.com/Undev'
version '0.2.1'
url 'https://github.com/Undev/redmine_undev_git'

requires_redmine :version_or_higher => '2.1'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require File.expand_path('../../test_helper', __FILE__)
require File.expand_path('../../../test_helper', __FILE__)
require 'issues_controller'

class IssuesControllerTest < ActionController::TestCase
class RedmineUndevGit::IssuesControllerTest < ActionController::TestCase
fixtures :projects,
:users,
:roles,
Expand Down Expand Up @@ -46,8 +46,24 @@ def test_show_branches_in_associated_revisions
get :show, :id => 1
assert_response :success

assert_select 'div#issue-changesets a', {:text => /fakebranch/} do |links|
assert_select 'div#issue-changesets a', { :text => /fakebranch/ } do |links|
assert_equal max_branches, links.length
end
end

def test_show_repo_name_in_associated_revisions
changeset = @repository.changesets.last
branches = %w[fakebranch]
changeset.update_attribute :branches, branches
@issue.changesets << changeset

get :show, :id => 1
assert_response :success

assert_select 'div#issue-changesets a', { :text => /#{@repository.name}/ } do |links|
assert_equal 1, links.length
assert_match "/projects/ecookbook/repository/#{@repository.identifier_param}",
links[0].attributes['href']
end
end
end

0 comments on commit adfb6b2

Please sign in to comment.