Sha256: 69c656f8e6117c77c947bcf35e473e2edaa85c933eb64246950937b69365486f

Contents?: true

Size: 1.56 KB

Versions: 24

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

module Decidim
  class VersionCell < Decidim::ViewModel
    include Decidim::TraceabilityHelper
    include Decidim::SanitizeHelper

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

    def current_version
      model
    end

    def versioned_resource
      options[:versioned_resource]
    end

    def versions_path
      options[:versions_path].call
    end

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

    def i18n_version_number
      i18n("version_number")
    end

    def i18n_back_to_resource
      i18n("back_to_resource")
    end

    def i18n_version_number_out_of_total
      i18n("version_number_out_of_total", current_version: index, total_count: versioned_resource.versions.count)
    end

    def i18n_show_all_versions
      i18n("show_all_versions")
    end

    def i18n_version_author
      i18n("version_author")
    end

    def i18n_version_created_at
      i18n("version_created_at")
    end

    def i18n(string, params = {})
      t(
        string,
        params.merge(
          scope: i18n_scope,
          default: t(
            string,
            params.merge(
              scope: default_i18n_scope
            )
          )
        )
      )
    end

    def i18n_scope
      options[:i18n_scope]
    end

    def default_i18n_scope
      "decidim.version.show"
    end

    def index
      options[:index]
    end

    def resource_path
      resource_locator(versioned_resource).path(filter_link_params)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
decidim-core-0.26.0 app/cells/decidim/version_cell.rb
decidim-core-0.26.0.rc2 app/cells/decidim/version_cell.rb
decidim-core-0.26.0.rc1 app/cells/decidim/version_cell.rb
decidim-core-0.25.2 app/cells/decidim/version_cell.rb
decidim-core-0.25.1 app/cells/decidim/version_cell.rb
decidim-core-0.25.0 app/cells/decidim/version_cell.rb
decidim-core-0.25.0.rc4 app/cells/decidim/version_cell.rb
decidim-core-0.25.0.rc3 app/cells/decidim/version_cell.rb
decidim-core-0.25.0.rc2 app/cells/decidim/version_cell.rb
decidim-core-0.25.0.rc1 app/cells/decidim/version_cell.rb
decidim-core-0.24.3 app/cells/decidim/version_cell.rb
decidim-core-0.23.6 app/cells/decidim/version_cell.rb
decidim-core-0.24.2 app/cells/decidim/version_cell.rb
decidim-core-0.23.5 app/cells/decidim/version_cell.rb
decidim-core-0.24.1 app/cells/decidim/version_cell.rb
decidim-core-0.24.0 app/cells/decidim/version_cell.rb
decidim-core-0.24.0.rc2 app/cells/decidim/version_cell.rb
decidim-core-0.23.4 app/cells/decidim/version_cell.rb
decidim-core-0.24.0.rc1 app/cells/decidim/version_cell.rb
decidim-core-0.23.3 app/cells/decidim/version_cell.rb