Sha256: 0e431e95dd80fccdaee7d1ee50ee93583e6f2fa19b3d6941d23b0132857574e8

Contents?: true

Size: 827 Bytes

Versions: 19

Compression:

Stored size: 827 Bytes

Contents

module PandaPal::Helpers::RouteHelper
  def lti_nav(options, *rest, &block)
    base_path = Rails.application.routes.named_routes[:panda_pal].path.spec
    raise LtiNavigationInUse.new('PandaPal must be mounted before defining lti_nav routes') if base_path.blank?

    nav, to = options.first
    options[:to] = to
    options.delete nav
    path = "#{base_path}/#{nav.to_s}"

    lti_options = options.delete(:lti_options) || {}
    lti_options[:auto_launch] = options.delete(:auto_launch)
    lti_options[:auto_launch] = true if lti_options[:auto_launch].nil? && (@scope[:path] || '').include?(':organization_id')

    lti_options[:route_helper_key] = path.split('/').reject(&:empty?).join('_')
    post(path, options.dup, &block)
    get(path, options.dup, &block)
    PandaPal::stage_navigation(nav, lti_options)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
panda_pal-5.8.4 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.8.3 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.8.2 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.8.1 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.8.0 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.12 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.7.0.beta2 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.7.0.beta1 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.11 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.10 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.9 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.8 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.7 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.7.beta2 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.7.beta1 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.6 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.5 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.4 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.3 lib/panda_pal/helpers/route_helper.rb