diff --git a/app/views/issues/_changeset_github.rhtml b/app/views/issues/_changeset_github.rhtml new file mode 100644 index 0000000..fc42e32 --- /dev/null +++ b/app/views/issues/_changeset_github.rhtml @@ -0,0 +1,7 @@ +
+

<% link_to(url_for_revision) do %><%="#{l(:label_revision)} #{changeset.format_identifier}" %><% end %>
+ <%= authoring(changeset.committed_on, changeset.author) %>

+
+ <%= textilizable(changeset, :comments) %> +
+
diff --git a/lib/issue_changeset_listener.rb b/lib/issue_changeset_listener.rb new file mode 100644 index 0000000..df6f686 --- /dev/null +++ b/lib/issue_changeset_listener.rb @@ -0,0 +1,22 @@ +class IssueChangesetListener < Redmine::Hook::ViewListener + + def view_issue_show_changeset(context) + changeset = context[:changeset] + + projects_github = Setting.plugin_redmine_issue_changesets_view_link_github + github_repo = nil + github_repo = projects_github[changeset.project.identifier] unless projects_github.blank? + + unless github_repo.blank? + url = "https://github.com/%s/commit/%s" % [github_repo, changeset.identifier] + else + rev = changeset.respond_to?(:identifier) ? revision.identifier : revision + url = url_for({:controller => 'repositories', :action => 'revision', :id => project.identifier, :rev => rev}) + end + context[:controller].send(:render_to_string, { + :partial => "changeset_github", + :locals => context.merge({:url_for_revision=>url}) + }) + end + +end \ No newline at end of file