Sha256: a1f428e61955f4beabbc9b3d092b7603b8a4f67f37b6f551349c9207237f9ddc

Contents?: true

Size: 1.03 KB

Versions: 14

Compression:

Stored size: 1.03 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_args
      args = {
        callout_class: "warning",
        announcement: {
          title: t("required_review.title", scope: "decidim.pages.terms_and_conditions"),
          body: t("required_review.body", scope: "decidim.pages.terms_and_conditions")
        }
      }
      args
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
decidim-core-0.18.1 app/cells/decidim/tos_page_cell.rb
decidim-core-0.17.2 app/cells/decidim/tos_page_cell.rb
decidim-core-0.18.0 app/cells/decidim/tos_page_cell.rb
decidim-core-0.17.1 app/cells/decidim/tos_page_cell.rb
decidim-core-0.16.1 app/cells/decidim/tos_page_cell.rb
decidim-core-0.17.0 app/cells/decidim/tos_page_cell.rb
decidim-core-0.16.0 app/cells/decidim/tos_page_cell.rb
decidim-core-0.15.2 app/cells/decidim/tos_page_cell.rb
decidim-core-0.15.1 app/cells/decidim/tos_page_cell.rb
decidim-core-0.15.0 app/cells/decidim/tos_page_cell.rb
decidim-core-0.14.4 app/cells/decidim/tos_page_cell.rb
decidim-core-0.14.3 app/cells/decidim/tos_page_cell.rb
decidim-core-0.14.2 app/cells/decidim/tos_page_cell.rb
decidim-core-0.14.1 app/cells/decidim/tos_page_cell.rb