Class: Presentation::AssetsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/presentation/assets_controller.rb

Instance Method Summary collapse

Instance Method Details

#javascriptObject

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



28
29
30
31
32
33
34
35
# File 'app/controllers/presentation/assets_controller.rb', line 28

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

#stylesheetObject



5
6
7
8
9
10
11
12
# File 'app/controllers/presentation/assets_controller.rb', line 5

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