1 # Provides a link to the document on the platform
2 class IssuesPublicationHook < Redmine::Hook::ViewListener
4 def view_issues_show_details_bottom(context)
5 # TODO: złapać wyjątek konwersji
6 if context[:issue].tracker_id == Setting.plugin_redmine_publications['tracker'].to_i
7 result = "<tr><td><b>Publication(s):</b></td><td>"
8 names = context[:issue].publication_names {|name| "<span>" + name + "</span>"}
9 result << names.join(', ')
10 result << "</td></tr>"
14 def controller_issues_edit_before_save(context)
15 if context[:issue].tracker_id == Setting.plugin_redmine_publications['tracker'].to_i
16 pub_field = context[:params][:publications]
17 context[:issue].publication_names = pub_field.split(',').map { |n| n.strip }
21 render_on :view_issues_form_details_bottom, :partial => 'issue_form_pub'