Sha256: a87361e6acb3f37cde3ba158d1024a2ad885af7c86cfd3d60e810e8ac0aa7646
Contents?: true
Size: 985 Bytes
Versions: 13
Compression:
Stored size: 985 Bytes
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim # This module exposes a helper method to access the resource that is linked # to the current item, via the `included_in` parameter, and its associated # resource locator. module LinkedResourceReference extend ActiveSupport::Concern included do helper_method :linked_resource, :located_linked_resource end private def linked_resource @linked_resource ||= (GlobalID::Locator.locate(params[:included_in]) if params[:included_in]) end def located_linked_resource @located_linked_resource ||= if linked_resource.is_a?(Decidim::Budgets::Project) Decidim::ResourceLocatorPresenter.new([linked_resource.budget, linked_resource]) else Decidim::ResourceLocatorPresenter.new(linked_resource) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems