Sha256: 5be05c632eaf130f322f8c8dcd8e737f351d26a95c20b617a5f31c2b2136a116

Contents?: true

Size: 888 Bytes

Versions: 5

Compression:

Stored size: 888 Bytes

Contents

module ActionDispatch::Routing
  class Mapper

    def mount_push_type(options = {})
      opts = {
        path:   '/push_type',
        home:   PushType.config.home_slug,
        actions: {
          node: 'front_end#node'
        }
      }.deep_merge!(options)

      # Mount the PushType engine at the specified path.
      mount PushType::Core::Engine => opts[:path]

      # Use a Dragonfly endpoint to provide better URLs for accessing assets
      get 'media/*file_uid' => Dragonfly.app.endpoint { |params, app|
        file_name = [ params[:file_uid], params[:format] ].join('.')
        asset = PushType::Asset.find_by_file_uid! file_name
        asset.media params[:style]
      }, as: 'media'

      # A catch-all root for the nodes
      get '*permalink' => opts[:actions][:node], as: 'node'
      root to: opts[:actions][:node], permalink: opts[:home]
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
push_type_core-0.3.3 lib/push_type/rails/routes.rb
push_type_core-0.3.1 lib/push_type/rails/routes.rb
push_type_core-0.2.1 lib/push_type/rails/routes.rb
push_type_core-0.2.0 lib/push_type/rails/routes.rb
push_type_core-0.2.0.beta2 lib/push_type/rails/routes.rb