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.3.0 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.2.2 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.2.2.beta1 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.2.1 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.2.0 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.2.0.beta2 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.2.0.beta1 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.13 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.12 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.11 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.10 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.9 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.8 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.7 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.6 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.5 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.4 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.3.beta.2 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.3.beta.1 lib/coalescing_panda/route_helpers.rb
coalescing_panda-5.1.3 lib/coalescing_panda/route_helpers.rb