summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2024-12-10 21:59:58 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2024-12-10 21:59:58 +0000
commit3a1357fcf08aefda1ef9e314d152fad5cf9e0cb3 (patch)
tree7ad026e79c425273780a9276be4a1265948e877a
parent90f62d8f497385100b7ae3122fe2306033047acd (diff)
downloadredmine-3a1357fcf08aefda1ef9e314d152fad5cf9e0cb3.tar.gz
redmine-3a1357fcf08aefda1ef9e314d152fad5cf9e0cb3.zip
Allows passing plugin parameter when registering activities from a plugin in order to look for the icon in plugin default icons file (#41880).
git-svn-id: https://svn.redmine.org/redmine/trunk@23377 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/views/activities/_activities.html.erb2
-rw-r--r--lib/redmine/activity.rb11
2 files changed, 10 insertions, 3 deletions
diff --git a/app/views/activities/_activities.html.erb b/app/views/activities/_activities.html.erb
index 6e830ed72..21ec1fb28 100644
--- a/app/views/activities/_activities.html.erb
+++ b/app/views/activities/_activities.html.erb
@@ -4,7 +4,7 @@
<dl>
<% sort_activity_events(events_by_day[day]).each do |e, in_group| -%>
<dt class="<%= e.event_type %> icon icon-<%= e.event_type %> <%= "grouped" if in_group %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
- <%= activity_event_type_icon e.event_type %>
+ <%= activity_event_type_icon e.event_type, plugin: Redmine::Activity.plugin_name(e.activity_provider_options.keys[0]) %>
<%= avatar(e.event_author) if e.respond_to?(:event_author) %>
<span class="time"><%= format_time(e.event_datetime, false) %></span>
<%= content_tag('span', e.project, :class => 'project') if @project.nil? || @project != e.project %>
diff --git a/lib/redmine/activity.rb b/lib/redmine/activity.rb
index 36663db6b..826b81c9e 100644
--- a/lib/redmine/activity.rb
+++ b/lib/redmine/activity.rb
@@ -19,10 +19,11 @@
module Redmine
module Activity
- mattr_accessor :available_event_types, :default_event_types, :providers
+ mattr_accessor :available_event_types, :default_event_types, :plugins_event_types, :providers
@@available_event_types = []
@@default_event_types = []
+ @@plugins_event_types = {}
@@providers = Hash.new {|h, k| h[k]=[]}
class << self
@@ -32,7 +33,7 @@ module Redmine
# Registers an activity provider
def register(event_type, options={})
- options.assert_valid_keys(:class_name, :default)
+ options.assert_valid_keys(:class_name, :default, :plugin)
event_type = event_type.to_s
providers = options[:class_name] || event_type.classify
@@ -40,14 +41,20 @@ module Redmine
@@available_event_types << event_type unless @@available_event_types.include?(event_type)
@@default_event_types << event_type unless options[:default] == false
+ @@plugins_event_types = { event_type => options[:plugin].to_s } unless options[:plugin].nil?
@@providers[event_type] += providers
end
def delete(event_type)
@@available_event_types.delete event_type
@@default_event_types.delete event_type
+ @@plugins_event_types.delete(event_type)
@@providers.delete(event_type)
end
+
+ def plugin_name(event_type)
+ @@plugins_event_types[event_type]
+ end
end
end
end