X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/4b33f145c7966710e537531261e04d2596159049..af3ffa21cede6f4e547a18999d764ec8ee07daa4:/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'