Sha256: dc3bec32a2aacf6d5f063660bed2689ff7379bd9b1dd23b861e631c267993809

Contents?: true

Size: 659 Bytes

Versions: 7

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    # Exposes CollaborativeDraft versions so users can see how a CollaborativeDraft
    # has been updated through time.
    class VersionsController < Decidim::Proposals::ApplicationController
      helper Decidim::TraceabilityHelper
      helper_method :current_version, :item

      private

      def item
        @item ||= CollaborativeDraft.where(component: current_component).find(params[:collaborative_draft_id])
      end

      def current_version
        return nil if params[:id].to_i < 1
        @current_version ||= item.versions[params[:id].to_i - 1]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-proposals-0.15.2 app/controllers/decidim/proposals/versions_controller.rb
decidim-proposals-0.15.1 app/controllers/decidim/proposals/versions_controller.rb
decidim-proposals-0.15.0 app/controllers/decidim/proposals/versions_controller.rb
decidim-proposals-0.14.4 app/controllers/decidim/proposals/versions_controller.rb
decidim-proposals-0.14.3 app/controllers/decidim/proposals/versions_controller.rb
decidim-proposals-0.14.2 app/controllers/decidim/proposals/versions_controller.rb
decidim-proposals-0.14.1 app/controllers/decidim/proposals/versions_controller.rb