Welcome to mirror list, hosted at ThFree Co, Russian Federation.

base.rb « widgets « work_items « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a3051f171583ba43a116e1179de8a6a27e101fec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# frozen_string_literal: true

module WorkItems
  module Widgets
    class Base
      def self.type
        name.demodulize.underscore.to_sym
      end

      def self.api_symbol
        "#{type}_widget".to_sym
      end

      def self.quick_action_commands
        []
      end

      def self.sync_params
        []
      end

      def self.process_quick_action_param(param_name, value)
        { param_name => value }
      end

      def self.process_sync_params(params)
        params
      end

      def self.callback_class
        WorkItems::Callbacks.const_get(name.demodulize, false)
      rescue NameError
        begin
          Issuable::Callbacks.const_get(name.demodulize, false)
        rescue NameError
          nil
        end
      end

      def type
        self.class.type
      end

      def initialize(work_item)
        @work_item = work_item
      end

      attr_reader :work_item
    end
  end
end