Class: WorkItems::Widgets::Base

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/models/work_items/widgets/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(work_item, widget_definition: nil) ⇒ Base

Returns a new instance of Base.



49
50
51
52
# File 'app/models/work_items/widgets/base.rb', line 49

def initialize(work_item, widget_definition: nil)
  @work_item = work_item
  @widget_definition = widget_definition
end

Instance Attribute Details

#widget_definitionObject (readonly)

Returns the value of attribute widget_definition.



54
55
56
# File 'app/models/work_items/widgets/base.rb', line 54

def widget_definition
  @widget_definition
end

#work_itemObject (readonly)

Returns the value of attribute work_item.



54
55
56
# File 'app/models/work_items/widgets/base.rb', line 54

def work_item
  @work_item
end

Class Method Details

.api_symbolObject



12
13
14
# File 'app/models/work_items/widgets/base.rb', line 12

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

.callback_classObject



24
25
26
27
28
29
30
31
32
# File 'app/models/work_items/widgets/base.rb', line 24

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

.process_quick_action_param(param_name, value) ⇒ Object



20
21
22
# File 'app/models/work_items/widgets/base.rb', line 20

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

.quick_action_commandsObject



16
17
18
# File 'app/models/work_items/widgets/base.rb', line 16

def self.quick_action_commands
  []
end

.sync_data_callback_classObject



34
35
36
37
38
# File 'app/models/work_items/widgets/base.rb', line 34

def self.sync_data_callback_class
  ::WorkItems::DataSync::Widgets.const_get(name.demodulize, false)
rescue NameError
  nil
end

.typeObject



8
9
10
# File 'app/models/work_items/widgets/base.rb', line 8

def self.type
  name.demodulize.underscore.to_sym
end

Instance Method Details

#sync_data_callback_classObject



40
41
42
# File 'app/models/work_items/widgets/base.rb', line 40

def sync_data_callback_class
  self.class.sync_data_callback_class
end

#typeObject



45
46
47
# File 'app/models/work_items/widgets/base.rb', line 45

def type
  self.class.type
end