Sha256: c1982aad54ed3eb9a43699520246590595523a8190f03c3b6e6914e550f6cee5

Contents?: true

Size: 853 Bytes

Versions: 7

Compression:

Stored size: 853 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class VersionsListItemCell < Decidim::ViewModel
    include Decidim::LayoutHelper

    def version
      model
    end

    def versioned_resource
      options[:versioned_resource]
    end

    def index
      total - options[:index]
    end

    def total
      options[:total]
    end

    def version_path
      options[:version_path].call(index)
    end

    def i18n_version_index
      i18n("version_index", index:, total:)
    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_item.show"
    end

    def html_options
      @html_options ||= options[:html_options] || {}
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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