scaffolding_extensions 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. data/LICENSE +19 -0
  2. data/README +144 -0
  3. data/contrib/scaffold_associations_tree/README +9 -0
  4. data/contrib/scaffold_associations_tree/bullet.gif +0 -0
  5. data/contrib/scaffold_associations_tree/minus.gif +0 -0
  6. data/contrib/scaffold_associations_tree/plus.gif +0 -0
  7. data/contrib/scaffold_associations_tree/scaffold_associations_tree.css +20 -0
  8. data/contrib/scaffold_associations_tree/scaffold_associations_tree.js +57 -0
  9. data/contrib/scaffold_auto_complete_style/README +8 -0
  10. data/contrib/scaffold_auto_complete_style/auto_complete.css +23 -0
  11. data/contrib/scaffold_form_focus/README +12 -0
  12. data/contrib/scaffold_form_focus/scaffold_form_focus.js +21 -0
  13. data/contrib/scaffold_jquery_autocomplete/README +8 -0
  14. data/contrib/scaffold_jquery_autocomplete/jquery.ui.se_autocomplete.css +22 -0
  15. data/contrib/scaffold_jquery_autocomplete/jquery.ui.se_autocomplete.js +121 -0
  16. data/doc/advanced.txt +154 -0
  17. data/doc/camping.txt +25 -0
  18. data/doc/controller_spec.txt +20 -0
  19. data/doc/conversion.txt +102 -0
  20. data/doc/model_spec.txt +54 -0
  21. data/doc/ramaze.txt +20 -0
  22. data/doc/sinatra.txt +20 -0
  23. data/doc/testing.txt +12 -0
  24. data/lib/scaffolding_extensions.rb +89 -0
  25. data/lib/scaffolding_extensions/controller.rb +79 -0
  26. data/lib/scaffolding_extensions/controller/action_controller.rb +116 -0
  27. data/lib/scaffolding_extensions/controller/camping.rb +150 -0
  28. data/lib/scaffolding_extensions/controller/ramaze.rb +116 -0
  29. data/lib/scaffolding_extensions/controller/sinatra.rb +183 -0
  30. data/lib/scaffolding_extensions/helper.rb +304 -0
  31. data/lib/scaffolding_extensions/jquery_helper.rb +58 -0
  32. data/lib/scaffolding_extensions/meta_controller.rb +337 -0
  33. data/lib/scaffolding_extensions/meta_model.rb +571 -0
  34. data/lib/scaffolding_extensions/model.rb +30 -0
  35. data/lib/scaffolding_extensions/model/active_record.rb +184 -0
  36. data/lib/scaffolding_extensions/model/ardm.rb +47 -0
  37. data/lib/scaffolding_extensions/model/data_mapper.rb +190 -0
  38. data/lib/scaffolding_extensions/overridable.rb +67 -0
  39. data/lib/scaffolding_extensions/prototype_helper.rb +59 -0
  40. data/scaffolds/edit.rhtml +12 -0
  41. data/scaffolds/habtm.rhtml +24 -0
  42. data/scaffolds/index.rhtml +6 -0
  43. data/scaffolds/layout.rhtml +82 -0
  44. data/scaffolds/list.rhtml +13 -0
  45. data/scaffolds/listtable.rhtml +46 -0
  46. data/scaffolds/manage.rhtml +15 -0
  47. data/scaffolds/merge.rhtml +23 -0
  48. data/scaffolds/new.rhtml +5 -0
  49. data/scaffolds/search.rhtml +11 -0
  50. data/scaffolds/show.rhtml +19 -0
  51. data/test/scaffolding_extensions_test.rb +44 -0
  52. metadata +106 -0
data/doc/advanced.txt ADDED
@@ -0,0 +1,154 @@
1
+ Here are some advanced features of the plugin:
2
+
3
+ == scaffold_session_value
4
+
5
+ You can define this attribute in your model to control access to the model's
6
+ objects based on a session variable. For example, if you want to limit a users
7
+ access via the scaffold to only objects that match his id, you can set the
8
+ following in the model:
9
+
10
+ class Car < ActiveRecord::Base
11
+ @scaffold_session_value = :user_id
12
+ end
13
+
14
+ Make sure that the session value is set to :user_id when the user logs in:
15
+
16
+ session[:user_id] = User.id
17
+
18
+ Then, the user will only be able to see cars where car.user_id is equal to
19
+ session[:user_id]. Any cars the user creates via the scaffolded forms will
20
+ have user_id set correctly.
21
+
22
+ You should make sure that :user_id is not in the @scaffold_fields for the model
23
+ (which it will be by default).
24
+
25
+ == Eager loading
26
+
27
+ You can eagerly load associations when loading multiple model objects, via
28
+ @scaffold_include. Here's an example scaffold_name (for an accounting entry):
29
+
30
+ def scaffold_name
31
+ "#{date.strftime('%Y-%m-%d')}-#{reference}-#{entity.name if entity}-#{debit_account.name if debit_account}-#{credit_account.name if credit_account}-#{money_amount}"
32
+ end
33
+
34
+ Without @scaffold_include, this will cause 3 queries for each model object
35
+ that calls scaffold_name. However, if you add @scaffold_include to eagerly
36
+ load the associations, there won't be any additionally queries:
37
+
38
+ @scaffold_include = [:entity, :credit_account, :debit_account]
39
+
40
+ == Autocompleting
41
+
42
+ Autocompleting is easy to set up in the model via:
43
+
44
+ @scaffold_use_auto_complete = true
45
+
46
+ Any time the scaffold would use a select box to show a group of objects, it
47
+ will instead use an autocompleting text box, allowing you to easily support a
48
+ much greater number of objects (select boxes aren't good for collections with
49
+ thousands of objects). If the model doesn't have an SQL column named "name",
50
+ you'll need to specify how to construct the SQL query for the object via:
51
+
52
+ @scaffold_auto_complete_options = {:sql_name=>'LOWER(name)',
53
+ :format_string=>:substring, :search_operator=>'LIKE',
54
+ :results_limit=>10, :phrase_modifier=>:downcase}
55
+
56
+ The defaults are shown. You'll most likely need to change the :sql_name. If
57
+ you are using PostgreSQL, you'll probably want to include:
58
+
59
+ {:sql_name=>'name', :search_operator=>'ILIKE', :phrase_modifier=>:to_s}
60
+
61
+ PostgreSQL can do case insensitive searching via ILIKE, and there is no reason
62
+ to force the attribute or the search phrase to lowercase.
63
+
64
+ You can get quite advanced, incorporating other tables if you use
65
+ @scaffold_include. Here's an example from an accounting application:
66
+
67
+ @scaffold_select_order = 'entries.date DESC, entities.name, accounts.name, debit_accounts_entries.name, entries.amount'
68
+ @scaffold_include = [:entity, :credit_account, :debit_account]
69
+ @scaffold_auto_complete_options = {:sql_name=>"reference || date::TEXT || entities.name || accounts.name || debit_accounts_entries.name || entries.amount::TEXT", :search_operator=>'ILIKE', :phrase_modifier=>:to_s}
70
+
71
+ Note how :sql_name can pull in data from multiple tables, since they are
72
+ specified via @scaffold_include. Note that the syntax might be database
73
+ specific (the accounting applation only supports PostreSQL).
74
+
75
+ Autocompleting currently requires the Prototype library (prototype.js,
76
+ effects.js, and controls.js).
77
+
78
+ == Customization
79
+
80
+ Scaffolding Extensions is extremely customizable. The database layer is split
81
+ from the presentation layer, and most of the interface between them has support
82
+ for overriding based on either the association or action given.
83
+
84
+ For example, if you want different fields shown on the show page than on the
85
+ edit page (to make certain fields read only), you can define:
86
+
87
+ @scaffold_show_fields = [:name, :amount]
88
+ @scaffold_edit_fields = [:name]
89
+
90
+ Each of the different pages (e.g. new, browse, search, etc.) can have a
91
+ different @scaffold_fields, @scaffold_select_order, or @scaffold_include via
92
+ the above method. You can also override any of those variables for a given
93
+ association displayed on the edit page. For example, let's say you have an
94
+ Employee model which belongs_to a Position model. When you bring up the edit
95
+ page for the employee, you will have a select box with all of the positions
96
+ shown by default (with the currently associated position selected by default).
97
+ This select box by default uses the @scaffold_select_order and
98
+ @scaffold_include of the Position model, but you can override it just for its
99
+ appearance on the employee's edit page via:
100
+
101
+ class Employee < ActiveRecord::Base
102
+ @scaffold_position_select_order_association = ...
103
+ @scaffold_position_include_association = ...
104
+ end
105
+
106
+ You can even change how the find is performed by defining a class method:
107
+
108
+ class Employee < ActiveRecord::Base
109
+ def self.scaffold_position_association_find_objects(options)
110
+ # This will be called to get the collection of positions
111
+ # for the select box. The object on the edit page is in
112
+ # options[:object], in case you want to use that
113
+ # to filter the selection of possible objects
114
+ end
115
+ end
116
+
117
+ This barely scratches the surface of customization possibilities, see the RDoc
118
+ for details on which methods can be customized in this manner.
119
+
120
+ == has_and_belongs_to_many scaffolding
121
+
122
+ Scaffolding Extensions scaffolds all has_and_belongs_to_many associations via
123
+ links on the edit page. You can limit which associations are scaffolded via
124
+ the model's @scaffold_habtm_associations. By default, habtm scaffolding is
125
+ enabled via a separate page with two select boxes, one choosing objects not
126
+ currently associated that can be added, and the other showing currently
127
+ associated objects that removed from the association.
128
+
129
+ It is possible to change this to scaffold habtm associations on the edit page
130
+ via a couple of Ajax enabled controls. This is set with
131
+ the model's @scaffold_habtm_with_ajax variable. With that variable set,
132
+ directly under the main edit form for the model will be select boxes with
133
+ possible objects to associate (or autocompleting text boxes if the
134
+ association's model uses autocompleting), as well as a button that adds those
135
+ objects to the association via Ajax. There is also a list of currently
136
+ associated objects that can be removed from the associated via Ajax. This
137
+ allows for quick modification of habtm associations.
138
+
139
+ HABTM Ajax functionality currently requires the Prototype library
140
+ (prototype.js).
141
+
142
+ == merge scaffolding
143
+
144
+ By default, Scaffolding Extensions will produce a merge scaffold for every
145
+ model. Merging object A into object B will take all of the has_many and
146
+ has_and_belongs_to_many association objects for object A and will instead
147
+ associated them with object B. It will then delete object B. This can be used
148
+ to fix issues caused by database denormalization.
149
+
150
+ == search scaffolding
151
+
152
+ By default, Scaffolding Extensions will produce a simple search scaffold for
153
+ every model. It will allow searching by substring for columns of type :text or
154
+ :string, and exact matches for other columns.
data/doc/camping.txt ADDED
@@ -0,0 +1,25 @@
1
+ Camping doesn't have a defined folder structure for models, so
2
+ scaffold_all_models shouldn't be used unless you pass the :only option, which
3
+ gives a list of models to scaffold.
4
+
5
+ To use this plugin after installing the gem:
6
+
7
+ require 'scaffolding_extensions'
8
+
9
+ If you want to use it without installing the gem, add this before requiring
10
+ it:
11
+
12
+ $:.unshift('scaffolding_extensions/lib')
13
+
14
+ To use the plugin, inside your app's Controllers module, you need to define
15
+ a subclass of scaffold_R, and call one of the scaffold methods inside of it.
16
+ For example:
17
+
18
+ Camping.goes :Cse
19
+ module Cse::Controllers
20
+ class Admin < scaffold_R("/admin")
21
+ scaffold_all_models :only=>[Model1, Model2, Model3]
22
+ end
23
+ end
24
+
25
+ The path given to scaffold_R will be the root of the plugin.
@@ -0,0 +1,20 @@
1
+ To work with Scaffolding Extensions, the controller class needs to define the
2
+ following methods:
3
+
4
+ Instance Methods
5
+ ----------------
6
+ scaffold_flash
7
+ scaffold_method_not_allowed
8
+ scaffold_redirect_to(url)
9
+ scaffold_render_template(action, options = {}, render_options = {})
10
+ scaffold_request_action
11
+ scaffold_request_env
12
+ scaffold_request_id
13
+ scaffold_request_method
14
+ scaffold_request_param(v)
15
+ scaffold_session
16
+ scaffold_url(action, options = {})
17
+
18
+ Class Methods
19
+ -------------
20
+ scaffolding_setup_helper
@@ -0,0 +1,102 @@
1
+ Conversion from an svn revision prior to 90 to the current version of
2
+ Scaffolding Extensions can be very easy or fairly tedious, depending on how
3
+ much you relied on the implementation of the older version.
4
+
5
+ Here's a list of things to check and fix, in the order of expected use:
6
+
7
+ - @scaffold_fields is now a list of symbols and not a list of strings. Other
8
+ variables that let you choose from fields or associations also take symbols
9
+ instead of strings, such as @scaffold_associations, @scaffold_column_types,
10
+ and @scaffold_column_options_hash. Variables that are used directly in the SQL
11
+ string, such as @scaffold_select_order, are still strings.
12
+
13
+ - The scaffold templates no longer set the title of the page in an h1 tag.
14
+ Now, that is done by the layout. The title of the page is stored in
15
+ @scaffold_title, and if you use a custom layout, you should incorporate that.
16
+
17
+ - The scaffold method has fewer options and now takes the model class. The
18
+ only options available are :except and :only. So instead of "scaffold :album",
19
+ you use "scaffold Album". It automatically scaffolds all habtm associations
20
+ for the model (though you can override that with the model's
21
+ @scaffold_habtm_associations). You can no longer scaffold without a suffix, and
22
+ the suffix used is set by the class's @scaffold_name (defaulting to
23
+ name.underscore).
24
+
25
+ - The scaffold_habtm method no longer has options and now takes the model
26
+ class and the association as a symbol. So instead of
27
+ "scaffold_habtm :album, :artist" you use "scaffold_habtm Album, :artists".
28
+ scaffold_habtm no longer scaffolds both ways, so you'll need two separate calls
29
+ if you want it scaffolded in both directions.
30
+
31
+ - The scaffold_all_models method only accepts a hash and not a list of models
32
+ to scaffold. Keys of the hash (other than :except and :only) should be
33
+ model classes, defining options for each model. :except and :only take lists
34
+ of models instead of symbols. options for each model can only be :except and
35
+ :only.
36
+
37
+ - The scaffolded pages no longer set variables such as @artist and @artists or
38
+ variables like @scaffold_action. Now, they use the generic @scaffold_object and
39
+ @scaffold_objects for holding model objects. Variables that will definitely be
40
+ defined are @scaffold_suffix, @scaffold_class, and @scaffold_options.
41
+
42
+ - Overriding defaults for ActiveRecord classes is now done through
43
+ "::ActiveRecord::Base::SCAFFOLD_OPTIONS[option_name]", and the option names
44
+ have changed. Names for instance variables inside the class should still work.
45
+ See the RDoc for details.
46
+
47
+ - Setting auto_complete_skip_style is now a singleton option and not a
48
+ per-model options. It is set with
49
+ "ScaffoldingExtensions.auto_complete_skip_style = true".
50
+
51
+ - Scaffolded methods are no longer prefixed with _ and then aliased. If you
52
+ want to override a method but still call it later, alias it manually and
53
+ overwrite it to call the aliased version.
54
+
55
+ - There is no ability to generate code, as eval is no longer used. All dynamic
56
+ methods are created with define_method. This makes debugging much easier, and
57
+ should make things quite a bit faster.
58
+
59
+ - If you set the scaffold_fields by using a method instead of an instance
60
+ variable, you'll have problems. Switch to using instance variables for
61
+ @scaffold_fields, @scaffold_select_order, etc.. If you want to override them
62
+ for specific cases (scaffold_new_fields), it is ok to use a function for that,
63
+ though I would still recommend using a variable (@scaffold_new_fields).
64
+
65
+ - If you called methods such as scaffold_new_fields or
66
+ scaffold_browse_select_order, you'll need to change those to
67
+ scaffold_fields(:new) and scaffold_select_order(:browse).
68
+
69
+ - scaffold_fields, scaffold_select_order, and scaffold_include methods all
70
+ take an argument now, specifying the action being used, though to make things
71
+ easier the argument has a default (:default).
72
+
73
+ - all_models is now a method of ScaffoldExtensions, not of ActiveRecord::Base,
74
+ and it returns model classes, not model name strings.
75
+
76
+ - render_#{suffix}_scaffold is no longer called, now just
77
+ scaffold_render_template is used.
78
+
79
+ - All methods adding by Scaffolding Extensions start with scaffold. If you
80
+ used a method added by Scaffolding Extensions that didn't start with
81
+ scaffold, it has definitely been renamed.
82
+
83
+ - It is no longer possible to use scaffold_associations_path or
84
+ scaffold_habtm_ajax_path for the model as those are now inline templates.
85
+
86
+ - Rails' form tag helpers are no longer used, so setting some options (such as
87
+ :size for a text area) no longer works. You must specify html options (such as
88
+ :cols and :rows) instead.
89
+
90
+ - Fields named "password" are no longer set to be of input type password by
91
+ default (that can be changed via @scaffold_column_types).
92
+
93
+ I recommend searching for "scaffold" inside all of your application's files,
94
+ and making sure every usage conforms to the current version's API.
95
+
96
+ If you can't upgrade to the new version of the plugin and you want to use the
97
+ old version, use the following svn revision depending on the version of Rails
98
+ you are using:
99
+
100
+ Rails 2.0: svn revision 89
101
+ Rails 1.2: svn revision 81
102
+ Rails 1.1: svn revision 61
@@ -0,0 +1,54 @@
1
+ To work with Scaffolding Extensions, the model class needs to define the
2
+ following methods:
3
+
4
+ Instance Methods
5
+ ----------------
6
+ scaffold_error_messages
7
+ scaffold_id
8
+ scaffold_name
9
+ scaffold_name_with_id
10
+ scaffold_value(field)
11
+
12
+ Class Methods
13
+ -------------
14
+ scaffold_add_associated_objects(association, object, options, *associated_object_ids)
15
+ scaffold_associated_human_name(association)
16
+ scaffold_associated_name(association)
17
+ scaffold_associated_objects(association, object, options)
18
+ scaffold_association_find_object(association, id, options)
19
+ scaffold_association_find_objects(association, options)
20
+ scaffold_association_list_class
21
+ scaffold_association_type(association)
22
+ scaffold_association_use_auto_complete(association)
23
+ scaffold_associations
24
+ scaffold_auto_complete_associations
25
+ scaffold_auto_complete_find(phrase, options = {})
26
+ scaffold_browse_find_objects(options)
27
+ scaffold_column_name(column_name)
28
+ scaffold_column_options(column_name)
29
+ scaffold_column_type(column_name)
30
+ scaffold_destroy(object)
31
+ scaffold_field_id(field)
32
+ scaffold_field_wrapper
33
+ scaffold_fields(action)
34
+ scaffold_find_object(action, id, options)
35
+ scaffold_find_objects(action, options)
36
+ scaffold_form_wrapper
37
+ scaffold_habtm_associations
38
+ scaffold_habtm_with_ajax
39
+ scaffold_human_name
40
+ scaffold_load_associations_with_ajax
41
+ scaffold_merge_records(from, to, options)
42
+ scaffold_name
43
+ scaffold_new_associated_object_values(association, record)
44
+ scaffold_new_object(attributes, options)
45
+ scaffold_remove_associated_objects(association, object, options, *associated_object_ids)
46
+ scaffold_save(action, object)
47
+ scaffold_search(options)
48
+ scaffold_search_null_options
49
+ scaffold_search_object(attributes = {})
50
+ scaffold_show_association_links?(association)
51
+ scaffold_table_class(type)
52
+ scaffold_unassociated_objects(association, object, options)
53
+ scaffold_update_attributes(attributes, object)
54
+ scaffold_use_auto_complete
data/doc/ramaze.txt ADDED
@@ -0,0 +1,20 @@
1
+ To use this plugin after installing the gem:
2
+
3
+ require 'scaffolding_extensions'
4
+
5
+ If you want to use it without installing the gem, add this before requiring
6
+ it:
7
+
8
+ $:.unshift('scaffolding_extensions/lib')
9
+
10
+ If your models are not located in model/, it is easiest to let Scaffolding
11
+ Extensions know about them manually (this is only necessary if you are using
12
+ scaffold_all_models without :only):
13
+
14
+ ScaffoldingExtensions.all_models = [Model1, Model2, Model3]
15
+
16
+ You should add this code after your models have been loaded but before your
17
+ controllers have been loaded.
18
+
19
+ Also, note that Scaffolding Extensions uses the :Erubis engine in Ramaze,
20
+ so you must have Erubis installed to use it.
data/doc/sinatra.txt ADDED
@@ -0,0 +1,20 @@
1
+ Sinatra doesn't have a defined folder structure for models, so
2
+ scaffold_all_models shouldn't be used unless you pass the :only option, which
3
+ gives a list of models to scaffold.
4
+
5
+ Sinatra has a defined structure for plugins. To use it, put the plugin in the
6
+ vendor directory of your application and it should be picked up automatically.
7
+ Note that if you doing something Sinatra doesn't like (such as using ruby-style
8
+ to deploy the Sinatra application, or just changing $0), this probably won't
9
+ work, so you need to require it manually.
10
+
11
+ To use the plugin if installing the gem:
12
+
13
+ require 'scaffolding_extensions'
14
+
15
+ To use the plugin, just call one of the root level scaffold methods with the
16
+ path at which you want the plugin mounted:
17
+
18
+ scaffold '/admin', Model1
19
+ scaffold_habtm '/admin', Model1, :things
20
+ scaffold_all_models '/admin', :only=>[Model1, Model2, Model3]
data/doc/testing.txt ADDED
@@ -0,0 +1,12 @@
1
+ If you are using Rails and want some basic generic tests, looking the test
2
+ folder for details on the Rails testing helper methods (e.g.
3
+ test_scaffold_all_models).
4
+
5
+ There is an automated test suite that tests the plugin against all supported
6
+ web frameworks and ORMs. You can get it via svn at:
7
+
8
+ svn://code.jeremyevans.net/scaffolding_extensions_test
9
+
10
+ It requires the ruby-sytle, hpricot, and mongrel gems, and does black box
11
+ testing of the plugin by running a web crawler against a running application
12
+ that uses the plugin.
@@ -0,0 +1,89 @@
1
+ require 'set'
2
+
3
+ # This is the base module for the plugin. It has some constants that can be
4
+ # changed:
5
+ #
6
+ # * TEMPLATE_DIR - the directory with the scaffold templates
7
+ # * DEFAULT_METHODS - the default methods added by the scaffolding
8
+ #
9
+ # If you include the contents of auto_complete.css in your stylesheet, set
10
+ # "auto_complete_skip_style = true", so the stylesheet isn't added for every
11
+ # autocompleting text box.
12
+ #
13
+ # Scaffolding Extensions attempts to determine which framework/ORM you are
14
+ # using and load the support for it (if it is supported).
15
+ module ScaffoldingExtensions
16
+ AUTO_COMPLETE_CSS = <<-END
17
+ <style type='text/css'>
18
+ div.auto_complete {
19
+ width: 350px;
20
+ background: #fff;
21
+ }
22
+ div.auto_complete ul {
23
+ border:1px solid #888;
24
+ margin:0;
25
+ padding:0;
26
+ width:100%;
27
+ list-style-type:none;
28
+ }
29
+ div.auto_complete ul li {
30
+ margin:0;
31
+ padding:3px;
32
+ }
33
+ div.auto_complete ul li.selected {
34
+ background-color: #ffb;
35
+ }
36
+ div.auto_complete ul strong.highlight {
37
+ color: #800;
38
+ margin:0;
39
+ padding:0;
40
+ }
41
+ </style>
42
+ END
43
+ ROOT = File.dirname(File.dirname(__FILE__))
44
+ TEMPLATE_DIR = File.join(ROOT, "scaffolds")
45
+ DEFAULT_METHODS = [:manage, :show, :delete, :edit, :new, :search, :merge, :browse]
46
+ MODEL_SUPERCLASSES = []
47
+
48
+ @auto_complete_skip_style = false
49
+
50
+ class << self
51
+ attr_accessor :auto_complete_skip_style
52
+ attr_writer :all_models, :model_files
53
+
54
+ def all_models
55
+ return @all_models if @all_models
56
+ possible_models = model_files.collect{|file|File.basename(file).sub(/\.rb\z/, '')}.collect{|m| m.camelize.constantize}
57
+ possible_models.reject{|m| MODEL_SUPERCLASSES.reject{|klass| !m.ancestors.include?(klass)}.length == 0}
58
+ end
59
+
60
+ # The stylesheet for the autocompleting text box, or the empty string
61
+ # if auto_complete_skip_style is true.
62
+ def auto_complete_css
63
+ auto_complete_skip_style ? '' : AUTO_COMPLETE_CSS
64
+ end
65
+
66
+ # The javascript library to use (defaults to Prototype)
67
+ def javascript_library=(jslib)
68
+ require "scaffolding_extensions/#{jslib.downcase}_helper"
69
+ ScaffoldingExtensions::Helper.send(:include, const_get("#{jslib}Helper"))
70
+ end
71
+ end
72
+ end
73
+
74
+ require 'scaffolding_extensions/controller'
75
+ require 'scaffolding_extensions/helper'
76
+ require 'scaffolding_extensions/meta_controller'
77
+ require 'scaffolding_extensions/meta_model'
78
+ require 'scaffolding_extensions/model'
79
+ require 'scaffolding_extensions/overridable'
80
+
81
+ require 'scaffolding_extensions/controller/action_controller' if defined? ActionController::Base
82
+ require 'scaffolding_extensions/controller/camping' if defined? Camping::Controllers
83
+ require 'scaffolding_extensions/controller/ramaze' if defined? Ramaze::Controller
84
+ require 'scaffolding_extensions/controller/sinatra' if defined? Sinatra
85
+
86
+ require 'scaffolding_extensions/model/active_record' if defined? ActiveRecord::Base
87
+ require 'scaffolding_extensions/model/data_mapper' if defined? DataMapper::Base
88
+
89
+ ScaffoldingExtensions.javascript_library = 'Prototype'