Class: Decidim::Forms::StepNavigationCell

Inherits:
ViewModel
  • Object
show all
Defined in:
app/cells/decidim/forms/step_navigation_cell.rb

Overview

This cell renders the navigation of a questionnaire step.

Instance Method Summary collapse

Instance Method Details

#button_disabled?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/cells/decidim/forms/step_navigation_cell.rb', line 27

def button_disabled?
  options[:button_disabled]
end

#confirm_dataObject



43
44
45
46
47
48
49
# File 'app/cells/decidim/forms/step_navigation_cell.rb', line 43

def confirm_data
  { data: {
    confirm: t("decidim.forms.step_navigation.show.are_you_sure"),
    disable: true,
    data: "survey-buttons"
  } }
end

#current_step_dom_idObject



39
40
41
# File 'app/cells/decidim/forms/step_navigation_cell.rb', line 39

def current_step_dom_id
  "step-#{current_step_index}"
end

#current_step_indexObject



7
8
9
# File 'app/cells/decidim/forms/step_navigation_cell.rb', line 7

def current_step_index
  model
end

#first_step?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/cells/decidim/forms/step_navigation_cell.rb', line 11

def first_step?
  current_step_index.zero?
end

#formObject



23
24
25
# File 'app/cells/decidim/forms/step_navigation_cell.rb', line 23

def form
  options[:form]
end

#last_step?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/cells/decidim/forms/step_navigation_cell.rb', line 15

def last_step?
  current_step_index + 1 == total_steps
end

#next_step_dom_idObject



35
36
37
# File 'app/cells/decidim/forms/step_navigation_cell.rb', line 35

def next_step_dom_id
  "step-#{current_step_index + 1}"
end

#previous_step_dom_idObject



31
32
33
# File 'app/cells/decidim/forms/step_navigation_cell.rb', line 31

def previous_step_dom_id
  "step-#{current_step_index - 1}"
end

#total_stepsObject



19
20
21
# File 'app/cells/decidim/forms/step_navigation_cell.rb', line 19

def total_steps
  options[:total_steps]
end