Class: Playbook::Forms::Builder::ActionArea

Inherits:
Object
  • Object
show all
Defined in:
lib/playbook/forms/builder/action_area.rb

Instance Method Summary collapse

Constructor Details

#initialize(view_context, submit_default_value) ⇒ ActionArea

Returns a new instance of ActionArea.



7
8
9
10
# File 'lib/playbook/forms/builder/action_area.rb', line 7

def initialize(view_context, submit_default_value)
  self.view_context = view_context
  self.submit_default_value = submit_default_value
end

Instance Method Details

#button(_value = nil, props:) ⇒ Object



19
20
21
22
23
# File 'lib/playbook/forms/builder/action_area.rb', line 19

def button(_value = nil, props:)
  view_context.(:li) do
    view_context.pb_rails("button", props: props)
  end
end

#submit(value = nil, props: {}) ⇒ Object



12
13
14
15
16
17
# File 'lib/playbook/forms/builder/action_area.rb', line 12

def submit(value = nil, props: {})
  props[:type] ||= "submit"
  props[:text] ||= value || submit_default_value

  button(value, props: props)
end