Sha256: 99c9853a2e0cebe3c7f667eec7e3bcd007e307c495d427f6bb21a60e5eff1ea7

Contents?: true

Size: 834 Bytes

Versions: 30

Compression:

Stored size: 834 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)

    if lti_options[:auto_launch].nil?
      lti_options[:auto_launch] = (@scope[:path] || '').include?(':organization_id')
    end

    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

30 entries across 30 versions & 1 rubygems

Version Path
panda_pal-5.6.2 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.1 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.6.0 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.11 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.10 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.9 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.8 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.7 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.6 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.5 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.4 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.3 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.2 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.1 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.0 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.0.beta10 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.0.beta9 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.0.beta8 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.0.beta7 lib/panda_pal/helpers/route_helper.rb
panda_pal-5.4.0.beta6 lib/panda_pal/helpers/route_helper.rb