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).
Classes and Modules
Module ScaffoldingExtensions::ActionControllerModule ScaffoldingExtensions::ActionControllerHelper
Module ScaffoldingExtensions::ActiveRecord
Module ScaffoldingExtensions::CampingController
Module ScaffoldingExtensions::CampingHelper
Module ScaffoldingExtensions::Controller
Module ScaffoldingExtensions::DataMapper
Module ScaffoldingExtensions::Helper
Module ScaffoldingExtensions::JQueryHelper
Module ScaffoldingExtensions::MetaActionController
Module ScaffoldingExtensions::MetaActiveRecord
Module ScaffoldingExtensions::MetaCampingController
Module ScaffoldingExtensions::MetaController
Module ScaffoldingExtensions::MetaDataMapper
Module ScaffoldingExtensions::MetaModel
Module ScaffoldingExtensions::MetaOverridable
Module ScaffoldingExtensions::MetaRamazeController
Module ScaffoldingExtensions::MetaSequel
Module ScaffoldingExtensions::MetaSinatraController
Module ScaffoldingExtensions::Model
Module ScaffoldingExtensions::Overridable
Module ScaffoldingExtensions::PrototypeHelper
Module ScaffoldingExtensions::RamazeController
Module ScaffoldingExtensions::Sequel
Module ScaffoldingExtensions::SinatraController
Module ScaffoldingExtensions::SinatraHelper
Class ScaffoldingExtensions::RackController
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
Takes two options, :only and :except. If :only is given, :except is ignored. Either can contain model classes or underscored model name strings.
# 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
The stylesheet for the autocompleting text box, or the empty string if auto_complete_skip_style is true.
# File lib/scaffolding_extensions.rb, line 72 72: def auto_complete_css 73: auto_complete_skip_style ? '' : AUTO_COMPLETE_CSS 74: end
The javascript library to use (defaults to JQuery, can be set to ‘Prototype’)
# 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