Sha256: 223e4b4d83b0f0cb7d935d7fd4b1e171c12f64348352238b4355dcf8631e211b

Contents?: true

Size: 1009 Bytes

Versions: 6

Compression:

Stored size: 1009 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Forms
    # This cell renders the navigation of a questionnaire step.
    class StepNavigationCell < Decidim::ViewModel
      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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-forms-0.29.1 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.29.0 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.29.0.rc4 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.29.0.rc3 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.29.0.rc2 app/cells/decidim/forms/step_navigation_cell.rb
decidim-forms-0.29.0.rc1 app/cells/decidim/forms/step_navigation_cell.rb