diff --git a/Gemfile.lock b/Gemfile.lock
index 013c886d4e..070b32bbcb 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -71,10 +71,10 @@ GIT
GIT
remote: https://github.com/opf/openproject-translations.git
- revision: c5146cc45b62d11cc83329ce5e9ac6caf98f510e
+ revision: 48de77103ac4ce2e20b26e3867c00d7053eb13b9
branch: stable/5
specs:
- openproject-translations (5.0.15)
+ openproject-translations (5.0.16)
crowdin-api (~> 0.4.0)
mixlib-shellout (~> 2.1.0)
rails (~> 4.2.3)
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 698f67db17..0142dc64af 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -310,12 +310,12 @@ def find_repository
# Prepare checkout instructions
# available on all pages (even empty!)
- @instructions = ::Scm::CheckoutInstructionsService.new(@repository)
+ @path = params[:path] || ''
+ @instructions = ::Scm::CheckoutInstructionsService.new(@repository, path: @path)
# Asserts repository availability, or renders an appropriate error
@repository.scm.check_availability!
- @path = params[:path] || ''
@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip
@rev_to = params[:rev_to]
diff --git a/app/helpers/work_packages_helper.rb b/app/helpers/work_packages_helper.rb
index 30f8b5611f..1b722c68e9 100644
--- a/app/helpers/work_packages_helper.rb
+++ b/app/helpers/work_packages_helper.rb
@@ -44,6 +44,7 @@ module WorkPackagesHelper
# link_to_work_package(package, subject_only: true) # => This is the subject (as link)
# link_to_work_package(package, status: true) # => #6 New (if #id => true)
def link_to_work_package(package, options = {})
+ only_path = options.fetch(:only_path) { true }
if options[:subject_only]
options.merge!(type: false,
subject: true,
@@ -119,20 +120,28 @@ def link_to_work_package(package, options = {})
title = parts[:title].join(' ')
css_class = parts[:css_class].join(' ')
+ # Determine path or url
+ work_package_link =
+ if only_path
+ work_package_path(package)
+ else
+ work_package_url(package)
+ end
+
text = if options[:all_link]
link_text = [prefix, link].reject(&:empty?).join(' - ')
link_text = [link_text, suffix].reject(&:empty?).join(': ')
link_text = [hidden_link, link_text].reject(&:empty?).join('')
link_to(link_text.html_safe,
- work_package_path(package),
+ work_package_link,
title: title,
class: css_class)
else
link_text = [hidden_link, link].reject(&:empty?).join('')
html_link = link_to(link_text.html_safe,
- work_package_path(package),
+ work_package_link,
title: title,
class: css_class)
@@ -141,7 +150,7 @@ def link_to_work_package(package, options = {})
end.html_safe
end
- def work_package_quick_info(work_package)
+ def work_package_quick_info(work_package, only_path: true)
changed_dates = {}
journals = work_package.journals.where(['created_at >= ?', Date.today.to_time - 7.day])
@@ -159,7 +168,7 @@ def work_package_quick_info(work_package)
end
end
- link = link_to_work_package(work_package, status: true)
+ link = link_to_work_package(work_package, status: true, only_path: only_path)
link += " #{work_package.start_date.nil? ? '[?]' : work_package.start_date.to_s}"
link += changed_dates['start_date']
link += " – #{work_package.due_date.nil? ? '[?]' : work_package.due_date.to_s}"
@@ -168,10 +177,10 @@ def work_package_quick_info(work_package)
link
end
- def work_package_quick_info_with_description(work_package, lines = 3)
+ def work_package_quick_info_with_description(work_package, lines = 3, only_path: true)
description = truncated_work_package_description(work_package, lines)
- link = work_package_quick_info(work_package)
+ link = work_package_quick_info(work_package, only_path: only_path)
attributes = info_user_attributes(work_package)
diff --git a/app/services/scm/checkout_instructions_service.rb b/app/services/scm/checkout_instructions_service.rb
index 5a3da2ff32..47e2700907 100644
--- a/app/services/scm/checkout_instructions_service.rb
+++ b/app/services/scm/checkout_instructions_service.rb
@@ -30,18 +30,21 @@
##
# Implements a repository service for building checkout instructions if supported
class Scm::CheckoutInstructionsService
- attr_reader :repository, :user
+ attr_reader :repository, :user, :path
- def initialize(repository, user: User.current)
+ def initialize(repository, path: nil, user: User.current)
@repository = repository
@user = user
+ @path = path
end
##
# Retrieve the checkout URL using the repository vendor information
# It may additionally set a path parameter, if the repository supports subtree checkout
- def checkout_url(path = nil)
- repository.scm.checkout_url(repository, checkout_base_url, path)
+ def checkout_url(with_path = false)
+ repository.scm.checkout_url(repository,
+ checkout_base_url,
+ with_path ? @path : nil)
end
##
diff --git a/app/views/repositories/_repository_header.html.erb b/app/views/repositories/_repository_header.html.erb
index d77fde15c3..b68a82fb7f 100644
--- a/app/views/repositories/_repository_header.html.erb
+++ b/app/views/repositories/_repository_header.html.erb
@@ -40,7 +40,7 @@ See doc/COPYRIGHT.rdoc for more details.