X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/2e4974b1f5600a3a446d5b0844a8d63d9fb5fbb3..d154270c884fe196fb56fa3123183c3408a45ecc:/redmine/redmine_publications/lib/issue_publication_hook.rb?ds=sidebyside diff --git a/redmine/redmine_publications/lib/issue_publication_hook.rb b/redmine/redmine_publications/lib/issue_publication_hook.rb index 4cfc3ba5..9c972339 100644 --- a/redmine/redmine_publications/lib/issue_publication_hook.rb +++ b/redmine/redmine_publications/lib/issue_publication_hook.rb @@ -1,15 +1,21 @@ # Provides a link to the document on the platform class IssuesPublicationHook < Redmine::Hook::ViewListener + def view_issues_show_details_bottom(context) - result = "Source File(s):" - names = context[:issue].source_files.map {|name| "" + name + ""} - result << names.join(', ') - result + "" + # TODO: złapać wyjątek konwersji + if context[:issue].tracker_id == Setting.plugin_redmine_publications['tracker'].to_i + result = "Publication(s):" + names = context[:issue].publication_names {|name| "" + name + ""} + result << names.join(', ') + result << "" + end end def controller_issues_edit_before_save(context) - pub_field = context[:params][:issue_source_files] - context[:issue].source_files = pub_field + if context[:issue].tracker_id == Setting.plugin_redmine_publications['tracker'].to_i + pub_field = context[:params][:publications] + context[:issue].publication_names = pub_field.split(',').map { |n| n.strip } + end end render_on :view_issues_form_details_bottom, :partial => 'issue_form_pub'