Sha256: f13b060e07d49ce9f69adaaf6c0339ddca51d51d32650b708534124d4b4334cc

Contents?: true

Size: 740 Bytes

Versions: 6

Compression:

Stored size: 740 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class VersionsListCell < Decidim::ViewModel
    def versioned_resource
      model
    end

    def resource_title
      decidim_escape_translated(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

6 entries across 6 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/cells/decidim/versions_list_cell.rb
decidim-core-0.29.0 app/cells/decidim/versions_list_cell.rb
decidim-core-0.29.0.rc4 app/cells/decidim/versions_list_cell.rb
decidim-core-0.29.0.rc3 app/cells/decidim/versions_list_cell.rb
decidim-core-0.29.0.rc2 app/cells/decidim/versions_list_cell.rb
decidim-core-0.29.0.rc1 app/cells/decidim/versions_list_cell.rb