Class: Warb::Components::FlowButton

Inherits:
Button show all
Defined in:
lib/warb/components/flow_button.rb

Constant Summary collapse

BUTTON_TYPE =
'flow'

Instance Attribute Summary collapse

Attributes inherited from Button

#index, #sub_type

Instance Method Summary collapse

Methods inherited from Button

#initialize

Methods inherited from Component

#initialize

Constructor Details

This class inherits a constructor from Warb::Components::Button

Instance Attribute Details

#flow_action_dataObject

Returns the value of attribute flow_action_data.



8
9
10
# File 'lib/warb/components/flow_button.rb', line 8

def flow_action_data
  @flow_action_data
end

#flow_tokenObject

Returns the value of attribute flow_token.



8
9
10
# File 'lib/warb/components/flow_button.rb', line 8

def flow_token
  @flow_token
end

Instance Method Details

#to_hObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/warb/components/flow_button.rb', line 10

def to_h
  button_payload = super

  token = flow_token || @params[:flow_token]
  data  = flow_action_data || @params[:flow_action_data]

  action = {}
  action[:flow_token] = token if token
  action[:flow_action_data] = data if data

  button_payload[:parameters] = [{ type: 'action', action: action }]

  button_payload
end