From 8e5cb8a36eaea1b32e1226828d8b5e02cdae52ad Mon Sep 17 00:00:00 2001 From: Ippei Ukai Date: Thu, 9 Feb 2012 18:34:56 +0900 Subject: [PATCH] possible for changesets to have different project and hence different repository. --- app/views/issues/_changesets.rhtml | 4 ++- app/views/issues/_changesets_github.rhtml | 9 ------ app/views/issues/_changesets_original.rhtml | 10 ------- .../settings/_changesets_github_settings.erb | 2 +- init.rb | 2 +- lib/issue_changesets_listener.rb | 30 ------------------- 6 files changed, 5 insertions(+), 52 deletions(-) delete mode 100644 app/views/issues/_changesets_github.rhtml delete mode 100644 app/views/issues/_changesets_original.rhtml delete mode 100644 lib/issue_changesets_listener.rb diff --git a/app/views/issues/_changesets.rhtml b/app/views/issues/_changesets.rhtml index e3e3382..7bb9d5d 100644 --- a/app/views/issues/_changesets.rhtml +++ b/app/views/issues/_changesets.rhtml @@ -1 +1,3 @@ -<%= call_hook(:view_issue_show_changesets, :changesets => changesets) %> \ No newline at end of file +<% changesets.each do |changeset| %> +<%= call_hook(:view_issue_show_changeset, :changeset => changeset) %> +<% end %> \ No newline at end of file diff --git a/app/views/issues/_changesets_github.rhtml b/app/views/issues/_changesets_github.rhtml deleted file mode 100644 index d219ae5..0000000 --- a/app/views/issues/_changesets_github.rhtml +++ /dev/null @@ -1,9 +0,0 @@ -<% changesets.each do |changeset| %> -
-

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

-
- <%= textilizable(changeset, :comments) %> -
-
-<% end %> \ No newline at end of file diff --git a/app/views/issues/_changesets_original.rhtml b/app/views/issues/_changesets_original.rhtml deleted file mode 100644 index b93eb41..0000000 --- a/app/views/issues/_changesets_original.rhtml +++ /dev/null @@ -1,10 +0,0 @@ -<% changesets.each do |changeset| %> -
-

<%= link_to_revision(changeset, changeset.project, - :text => "#{l(:label_revision)} #{changeset.format_identifier}") %>
- <%= authoring(changeset.committed_on, changeset.author) %>

-
- <%= textilizable(changeset, :comments) %> -
-
-<% end %> \ No newline at end of file diff --git a/app/views/settings/_changesets_github_settings.erb b/app/views/settings/_changesets_github_settings.erb index 4100d30..899b78f 100644 --- a/app/views/settings/_changesets_github_settings.erb +++ b/app/views/settings/_changesets_github_settings.erb @@ -3,7 +3,7 @@ <% Project.all().each do |proj| %>

- <%= text_field_tag "settings[#{proj.identifier}]", @settings[proj.identifier], :size => 70 %> + <%= text_field_tag "settings[#{proj.identifier}]", @settings[proj.identifier], :size => 70 %>

<% end %> \ No newline at end of file diff --git a/init.rb b/init.rb index 333e431..a3e8812 100644 --- a/init.rb +++ b/init.rb @@ -1,6 +1,6 @@ require 'redmine' -require 'issue_changesets_listener' +require 'issue_changeset_listener' Redmine::Plugin.register :redmine_issue_changesets_view_link_github do name 'Redmine Issue Changesets View Link Github plugin' diff --git a/lib/issue_changesets_listener.rb b/lib/issue_changesets_listener.rb deleted file mode 100644 index 13318e1..0000000 --- a/lib/issue_changesets_listener.rb +++ /dev/null @@ -1,30 +0,0 @@ -class IssueChangesetsListener < Redmine::Hook::ViewListener - - def view_issue_show_changesets(context) - projects_github = Setting.plugin_redmine_issue_changesets_view_link_github - - github_repo = nil - github_repo = projects_github[context[:changesets].first.project.identifier] unless projects_github.blank? || context[:changesets].blank? - -puts Setting.plugin_redmine_issue_changesets_view_link_github -puts github_repo - - unless github_repo.blank? - url_for_github_commit = lambda do |revision| - "https://github.com/%s/commit/%s" % [github_repo, revision] - end - context[:controller].send(:render_to_string, { - :partial => "changesets_github", - :locals => context.merge({:url_for_revision=>url_for_github_commit}) - }) - else - context[:controller].send(:render_to_string, { - :partial => "changesets_original", - :locals => context - }) - end - - - end - -end \ No newline at end of file