Project

General

Profile

Defect #41880 » 0001-WIP.patch

Marius BĂLTEANU, 2024-12-10 00:55

View differences:

app/views/activities/_activities.html.erb
<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.plugins_event_types[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 %>
lib/redmine/activity.rb
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
......
# 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
......
@@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
end
(3-3/3)