Sha256: 6ece7956a0b6162c02f8a6371de6209000142d42bc517b8db52ceb3e1879ef18

Contents?: true

Size: 888 Bytes

Versions: 14

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#show'
        }
      }.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

14 entries across 14 versions & 1 rubygems

Version Path
push_type_core-0.9.5 lib/push_type/rails/routes.rb
push_type_core-0.9.3 lib/push_type/rails/routes.rb
push_type_core-0.9.2 lib/push_type/rails/routes.rb
push_type_core-0.9.1 lib/push_type/rails/routes.rb
push_type_core-0.9.0 lib/push_type/rails/routes.rb
push_type_core-0.9.0.beta.4 lib/push_type/rails/routes.rb
push_type_core-0.9.0.beta.3 lib/push_type/rails/routes.rb
push_type_core-0.9.0.beta.2 lib/push_type/rails/routes.rb
push_type_core-0.8.2 lib/push_type/rails/routes.rb
push_type_core-0.8.1 lib/push_type/rails/routes.rb
push_type_core-0.8.0 lib/push_type/rails/routes.rb
push_type_core-0.8.0.beta.3 lib/push_type/rails/routes.rb
push_type_core-0.8.0.beta.2 lib/push_type/rails/routes.rb
push_type_core-0.8.0.beta.1 lib/push_type/rails/routes.rb