Sha256: e5376397434da19f07d7b3a709be1a4ebfdd075c0f7a6134166e302e0cc40520
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
class Presentation::AssetsController < ActionController::Base # TODO: consider packaging a minifier so we get the perfect solution: a cached, minified bundle of assets caches_page :stylesheet, :javascript def stylesheet dir = asset_path(:stylesheets) sheet = params[:id].split(',').collect{ |id| File.read("#{dir}/#{id}.css") }.join("\n") respond_to do |type| type.css {render :text => sheet} end end # TODO: bundle unobtrusive javascripts that can add behavior. # - jquery vs prototype (i'll develop jquery, and wait for prototype contributions) # - ajax links with html response # - - inline # - - modal dialog # - ajax links with js response # - ajax links with no response # - inline editing # - "dirty" form awareness # - tabbed forms # - tooltips for extended information (e.g. column description or truncated field text) # - basic form validation # - - required fields # TODO: tests for ujs def javascript dir = asset_path(:javascripts) script = params[:id].split(',').collect{ |id| File.read("#{dir}/#{id}.js") }.join("\n") respond_to do |type| type.js {render :text => script} end end protected def asset_path(type) File.join(File.dirname(__FILE__), '..', '..', 'assets', type.to_s) end end
Version data entries
3 entries across 3 versions & 1 rubygems