Sha256: b8ff09e1e58ac06057f7b2ff2cdeccb80c4be7bdd59b6c2c407c09d7dfa70cdf

Contents?: true

Size: 828 Bytes

Versions: 4

Compression:

Stored size: 828 Bytes

Contents

# -*- encoding : utf-8 -*-
module Blacklight::Marc
  class Routes

    def initialize(router, options)
      @router = router
      @options = options
    end

    def draw
      route_sets.each do |r|
        self.send(r)
      end
    end

    protected

    def add_routes &blk
      @router.instance_exec(@options, &blk)
    end

    def route_sets
      (@options[:only] || default_route_sets) - (@options[:except] || [])
    end

    def default_route_sets
      [:catalog]
    end

    module RouteSets
      def catalog
        add_routes do |options|
          # Catalog stuff.
          get 'catalog/:id/librarian_view', :to => "catalog#librarian_view", :as => "librarian_view_catalog"
          get "catalog/endnote", :as => "endnote_catalog"
          
        end
      end
   end
   
  include RouteSets
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-marc-5.10.0 lib/blacklight/marc/routes.rb
blacklight-marc-5.5.0 lib/blacklight/marc/routes.rb
blacklight-marc-5.4.0 lib/blacklight/marc/routes.rb
blacklight-marc-5.0.0 lib/blacklight/marc/routes.rb