Sha256: 2e36749f979c6de30b5cf18b6abd355847a601cd723b3a8cbf1e0e5e5703313f

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 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
      resource_locator(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

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.27.4 app/cells/decidim/versions_list_cell.rb
decidim-core-0.27.3 app/cells/decidim/versions_list_cell.rb
decidim-core-0.27.2 app/cells/decidim/versions_list_cell.rb
decidim-core-0.27.1 app/cells/decidim/versions_list_cell.rb
decidim-core-0.27.0 app/cells/decidim/versions_list_cell.rb
decidim-core-0.27.0.rc2 app/cells/decidim/versions_list_cell.rb
decidim-core-0.27.0.rc1 app/cells/decidim/versions_list_cell.rb