Sha256: 9d8d8547b5132f11a2adfc268bc220dbeded0100dc6ea09934a38dd765db4380

Contents?: true

Size: 959 Bytes

Versions: 128

Compression:

Stored size: 959 Bytes

Contents

module CoalescingPanda
  module RouteHelpers
    def lti_nav(nav, *rest, &block)
      base_path = Rails.application.routes.named_routes[:coalescing_panda].path.spec
      raise LtiNavigationInUse.new('CoalescingPanda must be mounted before defining lti_nav routes') if base_path.blank?
      valid_options = [:course, :user, :account, :editor_button, :external_tool]
      if rest.empty? && nav.is_a?(Hash)
        options = nav
        nav, to = options.find {|name, _| valid_options.include? name}
        options[:to] = to
        options.delete(nav)
      else
        options = rest.pop || {}
      end
      lti_options = options.delete(:lti_options) || {}
      path = "#{base_path}/#{nav.to_s}"
      lti_options[:url] = path.split('/').reject(&:empty?).join('_')
      post path, options, &block
      get path, options, &block
      CoalescingPanda::register_navigation(nav)
      CoalescingPanda::lti_navigation(nav, lti_options)
    end
  end
end

Version data entries

128 entries across 128 versions & 1 rubygems

Version Path
coalescing_panda-5.1.2 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.0 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.10 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.9 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.8 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.7 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.6 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.4 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.3 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.2 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.1 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.0 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.0.beta.2 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.0.0.beta.1 lib/coalescing_panda/route_helpers.rb
coalescing_panda-4.8.0.beta.1 lib/coalescing_panda/route_helpers.rb
coalescing_panda-1.1.21.1 lib/coalescing_panda/route_helpers.rb
coalescing_panda-1.1.21 lib/coalescing_panda/route_helpers.rb
coalescing_panda-1.1.20 lib/coalescing_panda/route_helpers.rb
coalescing_panda-4.7.0 lib/coalescing_panda/route_helpers.rb
coalescing_panda-4.6.1 lib/coalescing_panda/route_helpers.rb