Sha256: fbd50e59c52f11609f3cec58d7a9378336a1f221473b14b9542b2aa997dcdb1a

Contents?: true

Size: 1.02 KB

Versions: 37

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Decidim
  # This cell renders specific _partials_ for the `terms_and_conditions` StaticPage
  # the `model` is the partial to render
  # - :announcement, the TOS updated announcement when redirected to the TOS page.
  # - :sticky_form, the Accept updated TOS form in the TOS page.
  # - :refuse_btn_modal, the Modal with info when refusing the updated TOS.
  class TosPageCell < Decidim::ViewModel
    include Decidim::SanitizeHelper
    include Cell::ViewModel::Partial

    delegate :current_user, to: :controller, prefix: false

    def show
      return if model.nil?
      return unless current_user
      return if current_user.tos_accepted?

      render model
    end

    private

    def announcement
      {
        title: t("required_review.title", scope: "decidim.pages.terms_and_conditions"),
        body: t("required_review.body", scope: "decidim.pages.terms_and_conditions")
      }
    end

    def announcement_options
      {
        callout_class: "warning"
      }
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

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