Project

General

Profile

Defect #41880 » 0001-WIP.patch

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

View differences:

app/views/activities/_activities.html.erb
4 4
<dl>
5 5
<% sort_activity_events(events_by_day[day]).each do |e, in_group| -%>
6 6
  <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 %>">
7
  <%= activity_event_type_icon e.event_type %>
7
  <%= activity_event_type_icon e.event_type, plugin: Redmine::Activity.plugins_event_types[e.activity_provider_options.keys[0]] %>
8 8
  <%= avatar(e.event_author) if e.respond_to?(:event_author) %>
9 9
  <span class="time"><%= format_time(e.event_datetime, false) %></span>
10 10
  <%= content_tag('span', e.project, :class => 'project') if @project.nil? || @project != e.project %>
lib/redmine/activity.rb
19 19

  
20 20
module Redmine
21 21
  module Activity
22
    mattr_accessor :available_event_types, :default_event_types, :providers
22
    mattr_accessor :available_event_types, :default_event_types, :plugins_event_types, :providers
23 23

  
24 24
    @@available_event_types = []
25 25
    @@default_event_types = []
26
    @@plugins_event_types = {}
26 27
    @@providers = Hash.new {|h, k| h[k]=[]}
27 28

  
28 29
    class << self
......
32 33

  
33 34
      # Registers an activity provider
34 35
      def register(event_type, options={})
35
        options.assert_valid_keys(:class_name, :default)
36
        options.assert_valid_keys(:class_name, :default, :plugin)
36 37

  
37 38
        event_type = event_type.to_s
38 39
        providers = options[:class_name] || event_type.classify
......
40 41

  
41 42
        @@available_event_types << event_type unless @@available_event_types.include?(event_type)
42 43
        @@default_event_types << event_type unless options[:default] == false
44
        @@plugins_event_types = { event_type => options[:plugin].to_s } unless options[:plugin].nil?
43 45
        @@providers[event_type] += providers
44 46
      end
45 47

  
46 48
      def delete(event_type)
47 49
        @@available_event_types.delete event_type
48 50
        @@default_event_types.delete event_type
51
        @@plugins_event_types.delete(event_type)
49 52
        @@providers.delete(event_type)
50 53
      end
51 54
    end
(3-3/3)