Sha256: 0591e6b92090f29e3effa86440f963ef12293d0d0cc449dd5d69bae3c6eada26

Contents?: true

Size: 1.04 KB

Versions: 17

Compression:

Stored size: 1.04 KB

Contents

module Routing
  module ItsfBackendResourceConcern
    extend ActiveSupport::Concern
    # Using this method instead of resources, adds member routes for pages added in the
    # itsf_backend configuration.
    # 
    def backend_resources(*args, &block)
      resources(*args, &block)

      # additional_member_actions = (Itsf::Backend::Configuration.default_resource_pages - [:show])

      # if additional_member_actions.any?
      #   resources_name = args.first
      #   resources resources_name, only: [] do
      #     member do
      #       additional_member_actions.each do |action|
      #         get action
      #       end
      #     end
      #   end
      # end

      additional_resource_route_blocks = Itsf::Backend::Configuration.additional_resource_route_blocks
      if additional_resource_route_blocks.any?
        resources_name = args.first
        additional_resource_route_blocks.each do |route_block|
          resources resources_name, only: [] do
            route_block.call(self)
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
itsf_backend-5.0.0.pre app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-4.2.3 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-4.2.2 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-4.2.1 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-4.2.0 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-4.0.1 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-4.0.0 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-3.1.1 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-3.1.0 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-3.0.7 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-3.0.6 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-3.0.5 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-3.0.4 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-3.0.3 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-3.0.2 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-3.0.1 app/concerns/routing/itsf_backend_resource_concern.rb
itsf_backend-3.0.0 app/concerns/routing/itsf_backend_resource_concern.rb