Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
redmine_contracts/lib/redmine_contracts/hooks/helper_issues_show_detail_after_setting_hook.rb
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
30 lines (28 sloc)
1.11 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RedmineContracts | |
module Hooks | |
class HelperIssuesShowDetailAfterSettingHook < Redmine::Hook::ViewListener | |
# Deliverable changes for the journal use the Deliverable subject | |
# instead of the id | |
# | |
# Context: | |
# * :detail => Detail about the journal change | |
# | |
def helper_issues_show_detail_after_setting(context = { }) | |
# This will be skipped in ChiliProject 2.x because | |
# acts_as_journalized overrides the prop_key with the label | |
# 'deliverable_id' becomes 'Deliverable' (i18n) | |
# | |
# register_on_journal_formatter is used for ChiliProject 2.x support | |
# TODO Later: Overwritting the caller is bad juju | |
if context[:detail].prop_key == 'deliverable_id' | |
context[:detail].reload | |
d = Deliverable.find_by_id(context[:detail].value) | |
context[:detail].value = d.title if d.present? && d.title.present? | |
d = Deliverable.find_by_id(context[:detail].old_value) | |
context[:detail].old_value = d.title if d.present? && d.title.present? | |
end | |
'' | |
end | |
end | |
end | |
end |