Sha256: 7a0c9b0b9491c47eaa7b32da3d79965c89dc6125649c1627eb04c78a341e698b

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Decidim
  # This cell renders specific _partials_ for the `terms_of_service` 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_of_service"),
        body: t("required_review.body", scope: "decidim.pages.terms_of_service")
      }
    end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-core-0.28.5 app/cells/decidim/tos_page_cell.rb
decidim-core-0.28.4 app/cells/decidim/tos_page_cell.rb
decidim-core-0.28.3 app/cells/decidim/tos_page_cell.rb
decidim-core-0.28.2 app/cells/decidim/tos_page_cell.rb
decidim-core-0.28.1 app/cells/decidim/tos_page_cell.rb
decidim-core-0.28.0 app/cells/decidim/tos_page_cell.rb
decidim-core-0.28.0.rc5 app/cells/decidim/tos_page_cell.rb
decidim-core-0.28.0.rc4 app/cells/decidim/tos_page_cell.rb