Module ScaffoldingExtensions

  1. lib/scaffolding_extensions/controller/action_controller.rb
  2. lib/scaffolding_extensions/controller/camping.rb
  3. lib/scaffolding_extensions/controller/ramaze.rb
  4. lib/scaffolding_extensions/controller/sinatra.rb
  5. lib/scaffolding_extensions/controller/rack.rb
  6. lib/scaffolding_extensions/jquery_helper.rb
  7. lib/scaffolding_extensions/meta_controller.rb
  8. lib/scaffolding_extensions/overridable.rb
  9. lib/scaffolding_extensions/prototype_helper.rb
  10. lib/scaffolding_extensions/controller.rb
  11. lib/scaffolding_extensions/helper.rb
  12. lib/scaffolding_extensions.rb
  13. show all

This is the base module for the plugin. It has some constants that can be changed:

  • TEMPLATE_DIR - the directory with the scaffold templates
  • DEFAULT_METHODS - the default methods added by the scaffolding

If you include the contents of auto_complete.css in your stylesheet, set “auto_complete_skip_style = true”, so the stylesheet isn’t added for every autocompleting text box.

Scaffolding Extensions attempts to determine which framework/ORM you are using and load the support for it (if it is supported).

Constants

AUTO_COMPLETE_CSS = <<-END <style type='text/css'> div.auto_complete { width: 350px; background: #fff; } div.auto_complete ul { border:1px solid #888; margin:0; padding:0; width:100%; list-style-type:none; } div.auto_complete ul li { margin:0; padding:3px; } div.auto_complete ul li.selected { background-color: #ffb; } div.auto_complete ul strong.highlight { color: #800; margin:0; padding:0; } </style> END
ROOT = File.dirname(File.dirname(__FILE__))
TEMPLATE_DIR = File.join(ROOT, "scaffolds")
DEFAULT_METHODS = [:manage, :show, :delete, :edit, :new, :search, :merge, :browse]
MODEL_SUPERCLASSES = []

Attributes

all_models [W]
auto_complete_skip_style [RW]
model_files [W]

Public class methods

all_models (options={})

Takes two options, :only and :except. If :only is given, :except is ignored. Either can contain model classes or underscored model name strings.

[show source]
    # File lib/scaffolding_extensions.rb, line 57
57:     def all_models(options={})
58:       return @all_models if @all_models
59:       if options[:only]
60:         Array(options[:only]).collect{|f| f.is_a?(String) ? f.camelize.constantize : f}
61:       else
62:         string_except, except = Array(options[:except]).partition{|f| f.is_a?(String)}
63:         model_files.collect{|file|File.basename(file).sub(/\.rb\z/, '')}.
64:          reject{|f| string_except.include?(f)}.
65:          map{|f| f.camelize.constantize}.
66:          reject{|m| except.include?(m) || !MODEL_SUPERCLASSES.any?{|klass| m.ancestors.include?(klass)}}
67:       end
68:     end
auto_complete_css ()

The stylesheet for the autocompleting text box, or the empty string if auto_complete_skip_style is true.

[show source]
    # File lib/scaffolding_extensions.rb, line 72
72:     def auto_complete_css
73:       auto_complete_skip_style ? '' : AUTO_COMPLETE_CSS
74:     end
javascript_library= (jslib)

The javascript library to use (defaults to JQuery, can be set to ‘Prototype’)

[show source]
    # File lib/scaffolding_extensions.rb, line 77
77:     def javascript_library=(jslib)
78:       require "scaffolding_extensions/#{jslib.downcase}_helper"
79:       ScaffoldingExtensions::Helper.send(:include, const_get("#{jslib}Helper"))
80:     end