Method: Formbuilder::Views::Form#actions

Defined in:
lib/formbuilder/views/form.rb

#actionsObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/formbuilder/views/form.rb', line 33

def actions
  opts = {}

  unless first_page?
    opts[:go_back_text] = "Back to page #{previous_page}"
    opts[:go_back_html] = { href: url_for(params.merge(page: previous_page)) }
  end

  if last_page?
    opts[:continue_text] = 'Preview and Submit'
  else
    opts[:continue_text] = 'Next page'
  end

  div(class: 'form-actions') {
    if opts[:go_back_text]
      a.button opts[:go_back_text], opts[:go_back_html]
    end

    button.button.primary opts[:continue_text]
  }
end