Sha256: 7a7ce6d309a61960c3aa850e0d99ec67f2099ee6b6d6e019b7537a829d91de97

Contents?: true

Size: 656 Bytes

Versions: 28

Compression:

Stored size: 656 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  module ResourceVersionsConcern
    extend ActiveSupport::Concern

    included do
      helper Decidim::TraceabilityHelper
      helper_method :current_version, :versioned_resource

      private

      # Overwrite this method in your controller to define how to find the
      # versioned resource.
      def versioned_resource
        raise StandardError, "Not implemented"
      end

      def current_version
        return nil unless params[:id].to_i.positive?

        @current_version ||= versioned_resource.versions[params[:id].to_i - 1]
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
decidim-core-0.23.4 app/controllers/concerns/decidim/resource_versions_concern.rb
decidim-core-0.24.0.rc1 app/controllers/concerns/decidim/resource_versions_concern.rb
decidim-core-0.23.3 app/controllers/concerns/decidim/resource_versions_concern.rb
decidim-core-0.23.2 app/controllers/concerns/decidim/resource_versions_concern.rb
decidim-core-0.23.1 app/controllers/concerns/decidim/resource_versions_concern.rb
decidim-core-0.23.1.rc1 app/controllers/concerns/decidim/resource_versions_concern.rb
decidim-core-0.23.0 app/controllers/concerns/decidim/resource_versions_concern.rb
decidim-core-0.22.0 app/controllers/concerns/decidim/resource_versions_concern.rb