Sha256: 5bb0fdccb80ee9ef84aca8c1b39a2a0d757f76de71c65488c2dc5d5371b951d3

Contents?: true

Size: 851 Bytes

Versions: 46

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Forms
    # This cell renders the navigation of a questionnaire step.
    class StepNavigationCell < Decidim::ViewModel
      include Decidim::LayoutHelper

      def current_step_index
        model
      end

      def first_step?
        current_step_index.zero?
      end

      def last_step?
        current_step_index + 1 == total_steps
      end

      def total_steps
        options[:total_steps]
      end

      def form
        options[:form]
      end

      def button_disabled?
        options[:button_disabled]
      end

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

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

      def current_step_dom_id
        "step-#{current_step_index}"
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-forms-0.27.9 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.8 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.7 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.6 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.26.10 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.26.9 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.5 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.26.8 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.4 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.3 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.26.7 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.26.5 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.2 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.1 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.26.4 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.0 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.26.3 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.0.rc2 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.27.0.rc1 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.26.2 app/cells/decidim/forms/step_navigation_cell.rb