Sha256: dca9cc72e229d3112cefef0581cf1f79b1f8de0f3ab65d773b42015cc9a92e67

Contents?: true

Size: 870 Bytes

Versions: 7

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Elections
    # This cell renders the navigation of a questionnaire step.
    class VotingStepNavigationCell < 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 button_continue_text
        t("decidim.elections.votes.voting_step.continue")
      end

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

      def next_step_dom_id
        last_step? ? "step-confirm" : "step-#{current_step_index + 1}"
      end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-elections-0.28.4 app/cells/decidim/elections/voting_step_navigation_cell.rb
decidim-elections-0.28.3 app/cells/decidim/elections/voting_step_navigation_cell.rb
decidim-elections-0.28.2 app/cells/decidim/elections/voting_step_navigation_cell.rb
decidim-elections-0.28.1 app/cells/decidim/elections/voting_step_navigation_cell.rb
decidim-elections-0.28.0 app/cells/decidim/elections/voting_step_navigation_cell.rb
decidim-elections-0.28.0.rc5 app/cells/decidim/elections/voting_step_navigation_cell.rb
decidim-elections-0.28.0.rc4 app/cells/decidim/elections/voting_step_navigation_cell.rb