Sha256: b7433eb568db386711ca3c45f0ab04730de6eaf912c4eac938a1d55dace725d1

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Decidim
  class VersionsListCell < Decidim::ViewModel
    include Decidim::SanitizeHelper

    def versioned_resource
      model
    end

    def resource_title
      decidim_html_escape(translated_attribute(versioned_resource.title))
    end

    def resource_path
      Decidim::ResourceLocatorPresenter.new(versioned_resource).path
    end

    def i18n_changes_title
      i18n("changes_at_title", title: resource_title)
    end

    def i18n_versions_title
      i18n("title")
    end

    def i18n_versions_count
      i18n("number_of_versions")
    end

    def i18n_back_to_resource
      i18n("back_to_resource")
    end

    def i18n(string, **params)
      t(string, **params, scope: i18n_scope, default: t(string, **params, scope: default_i18n_scope))
    end

    def i18n_scope
      options[:i18n_scope]
    end

    def default_i18n_scope
      "decidim.versions_list.show"
    end

    def version_path
      options[:version_path]
    end

    delegate :versions, to: :versioned_resource
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/cells/decidim/versions_list_cell.rb
decidim-core-0.27.8 app/cells/decidim/versions_list_cell.rb
decidim-core-0.27.7 app/cells/decidim/versions_list_cell.rb
decidim-core-0.27.6 app/cells/decidim/versions_list_cell.rb
decidim-core-0.27.5 app/cells/decidim/versions_list_cell.rb