Sha256: 62ab55c96ecf5b57f632349e1a08cb7d9aa104a434449b565c27cd14b7a5057e

Contents?: true

Size: 793 Bytes

Versions: 7

Compression:

Stored size: 793 Bytes

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_scope
      options[:i18n_scope]
    end

    def version_path
      options[:version_path]
    end

    def total
      @total ||= versions.count
    end

    def reverse_ordered_versions
      @reverse_ordered_versions ||= relation? ? versions.reverse_order : versions.reverse
    end

    def relation?
      versions.is_a?(ActiveRecord::Relation)
    end

    delegate :versions, to: :versioned_resource
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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