From 79bb8ad5be673d5b5233f102ce1fbafb2c05637a Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Fri, 13 Dec 2013 13:35:03 +0100 Subject: [PATCH] Fixes work package anchor --- .../work_package_activity_provider.rb | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/app/models/activity/work_package_activity_provider.rb b/app/models/activity/work_package_activity_provider.rb index c3927c5c0b..ab47993ea1 100644 --- a/app/models/activity/work_package_activity_provider.rb +++ b/app/models/activity/work_package_activity_provider.rb @@ -68,30 +68,21 @@ class Activity::WorkPackageActivityProvider < Activity::BaseActivityProvider end def event_path(event, activity) - Rails.application.routes.url_helpers.work_package_path(*url_helper_parameter(event)) + Rails.application.routes.url_helpers.work_package_path(event['journable_id'], + anchor: notes_anchor(event)) end def event_url(event, activity) - Rails.application.routes.url_helpers.work_package_url(*url_helper_parameter(event), + Rails.application.routes.url_helpers.work_package_url(event['journable_id'], + anchor: notes_anchor(event), host: ::Setting.host_name) end private - def url_helper_parameter(event) + def notes_anchor(event) version = event['version'].to_i - anchor = event['version'].to_i - 1 - parameters = [event['journable_id']] - parameters << { anchor: "note-#{anchor}" } if version > 1 - parameters - end - - def types_table - @types_table = Arel::Table.new(:types) - end - - def statuses_table - @statuses_table = Arel::Table.new(:statuses) + (version > 1) ? "note-#{version - 1}" : "" end end