Sha256: 09ff49aef7e81450a6ecf7d00146fdccbadde1c3ea435679b320b3952b23f7ca

Contents?: true

Size: 1009 Bytes

Versions: 2

Compression:

Stored size: 1009 Bytes

Contents

class EngineAssets::AssetsController < ApplicationController
  unloadable # deprecated?

  layout        nil
  before_filter :expire, :set_headers
  after_filter  :cache

  def show
    flat_file = EngineAssets::PublicLocator.locate(File.join(controller_name, [params[:path], params[:format]].join('.')))
    if(flat_file)
      # TODO: consider sending IO, rather than rendering
      render(:file => flat_file)
    else
      begin
        # TODO:
        #   * consider removing the engine_assets dir to get:
        #     /javascripts/path/file.js.erb
        #   * consider (resourceful):
        #     /path/file.js.erb
        render(:template => File.join('engine_assets', controller_name, params[:path]), :layout => false)
      rescue ActionView::MissingTemplate
        head :not_found
      end
    end
  end


  private

  def expire
    # TODO
    # expire_page :controller => self, :action => "all"
  end

  def cache
    cache_page
  end

  def set_headers
    # optionally override
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
engine-assets-0.6.0.pre1 app/controllers/engine_assets/assets_controller.rb
engine-assets-0.5.1 app/controllers/engine_assets/assets_controller.rb