summaryrefslogtreecommitdiffstats
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 923dff581..3a40fd2e2 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -153,6 +153,13 @@ module ApplicationHelper
end
end
+ # Generates a link to a version
+ def link_to_version(version, options = {})
+ return '' unless version && version.is_a?(Version)
+ options = {:title => format_date(version.effective_date)}.merge(options)
+ link_to_if version.visible?, format_version_name(version), version_path(version), options
+ end
+
# Helper that formats object for html or text rendering
def format_object(object, html=true, &block)
if block_given?
@@ -174,7 +181,7 @@ module ApplicationHelper
when 'Project'
html ? link_to_project(object) : object.to_s
when 'Version'
- html ? link_to(object.name, version_path(object)) : object.to_s
+ html ? link_to_version(object) : object.to_s
when 'TrueClass'
l(:general_text_Yes)
when 'FalseClass'
@@ -236,7 +243,7 @@ module ApplicationHelper
end
def format_version_name(version)
- if version.project == @project
+ if !version.shared? || version.project == @project
h(version)
else
h("#{version.project} - #{version}")