rails 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (76) hide show
  1. data/CHANGELOG +152 -10
  2. data/README +30 -5
  3. data/Rakefile +18 -13
  4. data/bin/rails +1 -11
  5. data/{lib/rails_info.rb → builtin/rails_info/rails/info.rb} +25 -8
  6. data/builtin/{controllers/rails_info_controller.rb → rails_info/rails/info_controller.rb} +2 -2
  7. data/configs/databases/mysql.yml +47 -0
  8. data/configs/databases/oracle.yml +30 -0
  9. data/configs/databases/postgresql.yml +44 -0
  10. data/configs/databases/sqlite2.yml +16 -0
  11. data/configs/databases/sqlite3.yml +16 -0
  12. data/configs/lighttpd.conf +11 -5
  13. data/configs/routes.rb +5 -2
  14. data/environments/development.rb +3 -2
  15. data/environments/environment.rb +5 -8
  16. data/environments/production.rb +1 -2
  17. data/environments/test.rb +1 -1
  18. data/fresh_rakefile +2 -2
  19. data/html/500.html +1 -1
  20. data/html/index.html +3 -3
  21. data/html/javascripts/application.js +2 -0
  22. data/html/javascripts/controls.js +95 -30
  23. data/html/javascripts/dragdrop.js +161 -21
  24. data/html/javascripts/effects.js +310 -211
  25. data/html/javascripts/prototype.js +228 -28
  26. data/lib/code_statistics.rb +1 -1
  27. data/lib/commands/console.rb +3 -1
  28. data/lib/commands/plugin.rb +113 -70
  29. data/lib/commands/process/reaper.rb +1 -1
  30. data/lib/commands/process/spawner.rb +33 -4
  31. data/lib/commands/runner.rb +1 -1
  32. data/lib/commands/server.rb +3 -1
  33. data/lib/commands/servers/lighttpd.rb +41 -9
  34. data/lib/console_app.rb +27 -0
  35. data/lib/console_with_helpers.rb +23 -0
  36. data/lib/dispatcher.rb +8 -8
  37. data/lib/fcgi_handler.rb +22 -4
  38. data/lib/initializer.rb +107 -38
  39. data/lib/rails_generator/commands.rb +17 -7
  40. data/lib/rails_generator/generators/applications/app/app_generator.rb +30 -18
  41. data/lib/rails_generator/generators/components/integration_test/USAGE +14 -0
  42. data/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +16 -0
  43. data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +10 -0
  44. data/lib/rails_generator/generators/components/mailer/USAGE +1 -1
  45. data/lib/rails_generator/generators/components/migration/USAGE +1 -1
  46. data/lib/rails_generator/generators/components/model/USAGE +3 -1
  47. data/lib/rails_generator/generators/components/model/model_generator.rb +16 -0
  48. data/lib/rails_generator/generators/components/model/templates/migration.rb +11 -0
  49. data/lib/rails_generator/generators/components/model/templates/unit_test.rb +1 -1
  50. data/lib/rails_generator/generators/components/plugin/USAGE +3 -1
  51. data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +1 -0
  52. data/lib/rails_generator/generators/components/plugin/templates/Rakefile +1 -1
  53. data/lib/rails_generator/generators/components/plugin/templates/install.rb +1 -0
  54. data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +1 -1
  55. data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +4 -0
  56. data/lib/rails_generator/generators/components/scaffold/templates/style.css +4 -4
  57. data/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +1 -1
  58. data/lib/rails_generator/generators/components/session_migration/USAGE +1 -1
  59. data/lib/rails_generator/options.rb +2 -2
  60. data/lib/rails_version.rb +1 -1
  61. data/lib/ruby_version_check.rb +17 -0
  62. data/lib/tasks/databases.rake +141 -139
  63. data/lib/tasks/documentation.rake +73 -68
  64. data/lib/tasks/framework.rake +86 -58
  65. data/lib/tasks/log.rake +9 -0
  66. data/lib/tasks/misc.rake +2 -17
  67. data/lib/tasks/pre_namespace_aliases.rake +46 -0
  68. data/lib/tasks/statistics.rake +9 -8
  69. data/lib/tasks/testing.rake +81 -29
  70. data/lib/tasks/tmp.rake +30 -0
  71. data/lib/test_help.rb +1 -0
  72. data/lib/webrick_server.rb +6 -8
  73. metadata +284 -271
  74. data/bin/process/spinner +0 -3
  75. data/configs/database.yml +0 -85
  76. data/lib/tasks/javascripts.rake +0 -6
@@ -0,0 +1,30 @@
1
+ # Oracle/OCI 8i, 9, 10g
2
+ #
3
+ # Requires Ruby/OCI8:
4
+ # http://rubyforge.org/projects/ruby-oci8/
5
+ #
6
+ # Specify your database using any valid connection syntax, such as a
7
+ # tnsnames.ora service name, or a sql connect url string of the form:
8
+ #
9
+ # //host:[port][/service name]
10
+
11
+ development:
12
+ adapter: oracle
13
+ database: <%= app_name %>_development
14
+ username: <%= app_name %>
15
+ password:
16
+
17
+ # Warning: The database defined as 'test' will be erased and
18
+ # re-generated from your development database when you run 'rake'.
19
+ # Do not set this db to the same as development or production.
20
+ test:
21
+ adapter: oracle
22
+ database: <%= app_name %>_test
23
+ username: <%= app_name %>
24
+ password:
25
+
26
+ production:
27
+ adapter: oracle
28
+ database: <%= app_name %>_production
29
+ username: <%= app_name %>
30
+ password:
@@ -0,0 +1,44 @@
1
+ # PostgreSQL versions 7.4 - 8.1
2
+ #
3
+ # Get the C bindings:
4
+ # gem install postgres
5
+ # or use the pure-Ruby bindings on Windows:
6
+ # gem install postgres-pr
7
+ development:
8
+ adapter: postgresql
9
+ database: <%= app_name %>_development
10
+ username: <%= app_name %>
11
+ password:
12
+
13
+ # Connect on a TCP socket. Omitted by default since the client uses a
14
+ # domain socket that doesn't need configuration. Windows does not have
15
+ # domain sockets, so uncomment these lines.
16
+ #host: localhost
17
+ #port: 5432
18
+
19
+ # Schema search path. The server defaults to $user,public
20
+ #schema_search_path: myapp,sharedapp,public
21
+
22
+ # Character set encoding. The server defaults to sql_ascii.
23
+ #encoding: UTF8
24
+
25
+ # Minimum log levels, in increasing order:
26
+ # debug5, debug4, debug3, debug2, debug1,
27
+ # info, notice, warning, error, log, fatal, or panic
28
+ # The server defaults to notice.
29
+ #min_messages: warning
30
+
31
+ # Warning: The database defined as 'test' will be erased and
32
+ # re-generated from your development database when you run 'rake'.
33
+ # Do not set this db to the same as development or production.
34
+ test:
35
+ adapter: postgresql
36
+ database: <%= app_name %>_test
37
+ username: <%= app_name %>
38
+ password:
39
+
40
+ production:
41
+ adapter: postgresql
42
+ database: <%= app_name %>_production
43
+ username: <%= app_name %>
44
+ password:
@@ -0,0 +1,16 @@
1
+ # SQLite version 2.x
2
+ # gem install sqlite-ruby
3
+ development:
4
+ adapter: sqlite
5
+ database: db/development.sqlite2
6
+
7
+ # Warning: The database defined as 'test' will be erased and
8
+ # re-generated from your development database when you run 'rake'.
9
+ # Do not set this db to the same as development or production.
10
+ test:
11
+ adapter: sqlite
12
+ database: db/test.sqlite2
13
+
14
+ production:
15
+ adapter: sqlite
16
+ database: db/production.sqlite2
@@ -0,0 +1,16 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+
7
+ # Warning: The database defined as 'test' will be erased and
8
+ # re-generated from your development database when you run 'rake'.
9
+ # Do not set this db to the same as development or production.
10
+ test:
11
+ adapter: sqlite3
12
+ database: db/test.sqlite3
13
+
14
+ production:
15
+ adapter: sqlite3
16
+ database: db/production.sqlite3
@@ -5,10 +5,10 @@ server.port = 3000
5
5
 
6
6
  server.modules = ( "mod_rewrite", "mod_accesslog", "mod_fastcgi" )
7
7
  server.error-handler-404 = "/dispatch.fcgi"
8
- server.document-root = "public/"
8
+ server.document-root = CWD + "/public/"
9
9
 
10
- server.errorlog = "log/lighttpd.error.log"
11
- accesslog.filename = "log/lighttpd.access.log"
10
+ server.errorlog = CWD + "/log/lighttpd.error.log"
11
+ accesslog.filename = CWD + "/log/lighttpd.access.log"
12
12
 
13
13
  url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
14
14
 
@@ -19,8 +19,8 @@ fastcgi.server = ( ".fcgi" =>
19
19
  (
20
20
  "min-procs" => 1,
21
21
  "max-procs" => 1,
22
- "socket" => "log/fcgi.socket",
23
- "bin-path" => "public/dispatch.fcgi",
22
+ "socket" => CWD + "/tmp/sockets/fcgi.socket",
23
+ "bin-path" => CWD + "/public/dispatch.fcgi",
24
24
  "bin-environment" => ( "RAILS_ENV" => "development" )
25
25
  )
26
26
  )
@@ -38,3 +38,9 @@ mimetype.assign = (
38
38
  ".swf" => "application/x-shockwave-flash",
39
39
  ".txt" => "text/plain"
40
40
  )
41
+
42
+ # Making sure file uploads above 64k always work when using IE or Safari
43
+ # For more information, see http://trac.lighttpd.net/trac/ticket/360
44
+ $HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
45
+ server.max-keep-alive-requests = 0
46
+ }
@@ -1,11 +1,14 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
- # Add your own custom routes here.
3
2
  # The priority is based upon order of creation: first created -> highest priority.
4
3
 
5
- # Here's a sample route:
4
+ # Sample of regular route:
6
5
  # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7
6
  # Keep in mind you can assign values other than :controller and :action
8
7
 
8
+ # Sample of named route:
9
+ # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
10
+ # This route can be invoked with purchase_url(:id => product.id)
11
+
9
12
  # You can have the root of your site routed by hooking up ''
10
13
  # -- just remember to delete public/index.html.
11
14
  # map.connect '', :controller => "welcome"
@@ -3,10 +3,10 @@
3
3
  # In the development environment your application's code is reloaded on
4
4
  # every request. This slows down response time but is perfect for development
5
5
  # since you don't have to restart the webserver when you make code changes.
6
- config.cache_classes = false
6
+ config.cache_classes = false
7
7
 
8
8
  # Log error messages when you accidentally call methods on nil.
9
- config.whiny_nils = true
9
+ config.whiny_nils = true
10
10
 
11
11
  # Enable the breakpoint server that script/breakpointer connects to
12
12
  config.breakpoint_server = true
@@ -14,6 +14,7 @@ config.breakpoint_server = true
14
14
  # Show full error reports and disable caching
15
15
  config.action_controller.consider_all_requests_local = true
16
16
  config.action_controller.perform_caching = false
17
+ config.action_view.debug_rjs = true
17
18
 
18
19
  # Don't care if the mailer can't send
19
20
  config.action_mailer.raise_delivery_errors = false
@@ -21,12 +21,13 @@ Rails::Initializer.run do |config|
21
21
  # config.log_level = :debug
22
22
 
23
23
  # Use the database for sessions instead of the file system
24
- # (create the session table with 'rake create_sessions_table')
24
+ # (create the session table with 'rake db:sessions:create')
25
25
  # config.action_controller.session_store = :active_record_store
26
26
 
27
- # Enable page/fragment caching by setting a file-based store
28
- # (remember to create the caching directory and make it readable to the application)
29
- # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache"
27
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
28
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
29
+ # like if you have constraints or database-specific column types
30
+ # config.active_record.schema_format = :sql
30
31
 
31
32
  # Activate observers that should always be running
32
33
  # config.active_record.observers = :cacher, :garbage_collector
@@ -34,10 +35,6 @@ Rails::Initializer.run do |config|
34
35
  # Make Active Record use UTC-base instead of local time
35
36
  # config.active_record.default_timezone = :utc
36
37
 
37
- # Use Active Record's schema dumper instead of SQL when creating the test database
38
- # (enables use of different database adapters for development and test environments)
39
- # config.active_record.schema_format = :ruby
40
-
41
38
  # See Rails::Configuration for more options
42
39
  end
43
40
 
@@ -5,8 +5,7 @@
5
5
  config.cache_classes = true
6
6
 
7
7
  # Use a different logger for distributed setups
8
- # config.logger = SyslogLogger.new
9
-
8
+ # config.logger = SyslogLogger.new
10
9
 
11
10
  # Full error reports are disabled and caching is turned on
12
11
  config.action_controller.consider_all_requests_local = false
@@ -7,7 +7,7 @@
7
7
  config.cache_classes = true
8
8
 
9
9
  # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
10
+ config.whiny_nils = true
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.action_controller.consider_all_requests_local = true
@@ -1,5 +1,5 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/switchtower.rake, and they will automatically be available to Rake.
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
4
  require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
5
 
@@ -7,4 +7,4 @@ require 'rake'
7
7
  require 'rake/testtask'
8
8
  require 'rake/rdoctask'
9
9
 
10
- require 'tasks/rails'
10
+ require 'tasks/rails'
@@ -2,7 +2,7 @@
2
2
  "http://www.w3.org/TR/html4/loose.dtd">
3
3
  <html>
4
4
  <body>
5
- <h1>Application error (Apache)</h1>
5
+ <h1>Application error</h1>
6
6
  <p>Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code) in public/500.html</p>
7
7
  </body>
8
8
  </html>
@@ -183,7 +183,7 @@
183
183
  <script type="text/javascript">
184
184
  function about() {
185
185
  if (Element.empty('about-content')) {
186
- new Ajax.Updater('about-content', 'rails_info/properties', {
186
+ new Ajax.Updater('about-content', 'rails/info/properties', {
187
187
  method: 'get',
188
188
  onFailure: function() {Element.classNames('about-content').add('failure')},
189
189
  onComplete: function() {new Effect.BlindDown('about-content', {duration: 0.25})}
@@ -230,8 +230,8 @@
230
230
  <h3>Browse the documentation</h3>
231
231
  <ul class="links">
232
232
  <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
233
- <li><a href="http://www.ruby-doc.org/stdlib/">Ruby standard library</a></li>
234
- <li><a href="http://www.ruby-doc.org/core/">Ruby core</a></li>
233
+ <li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
234
+ <li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
235
235
  </ul>
236
236
  </li>
237
237
  </ul>
@@ -0,0 +1,2 @@
1
+ // Place your application-specific JavaScript functions and classes here
2
+ // This file is automatically included by javascript_include_tag :defaults
@@ -141,8 +141,8 @@ Autocompleter.Base.prototype = {
141
141
  return;
142
142
  }
143
143
  else
144
- if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN)
145
- return;
144
+ if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
145
+ (navigator.appVersion.indexOf('AppleWebKit') > 0 && event.keyCode == 0)) return;
146
146
 
147
147
  this.changed = true;
148
148
  this.hasFocus = true;
@@ -152,6 +152,12 @@ Autocompleter.Base.prototype = {
152
152
  setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
153
153
  },
154
154
 
155
+ activate: function() {
156
+ this.changed = false;
157
+ this.hasFocus = true;
158
+ this.getUpdatedChoices();
159
+ },
160
+
155
161
  onHover: function(event) {
156
162
  var element = Event.findElement(event, 'LI');
157
163
  if(this.index != element.autocompleteIndex)
@@ -221,8 +227,13 @@ Autocompleter.Base.prototype = {
221
227
  this.options.updateElement(selectedElement);
222
228
  return;
223
229
  }
224
-
225
- var value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
230
+ var value = '';
231
+ if (this.options.select) {
232
+ var nodes = document.getElementsByClassName(this.options.select, selectedElement) || [];
233
+ if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
234
+ } else
235
+ value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
236
+
226
237
  var lastTokenPos = this.findLastToken();
227
238
  if (lastTokenPos != -1) {
228
239
  var newValue = this.element.value.substr(0, lastTokenPos + 1);
@@ -305,7 +316,7 @@ Autocompleter.Base.prototype = {
305
316
  Ajax.Autocompleter = Class.create();
306
317
  Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), {
307
318
  initialize: function(element, update, url, options) {
308
- this.baseInitialize(element, update, options);
319
+ this.baseInitialize(element, update, options);
309
320
  this.options.asynchronous = true;
310
321
  this.options.onComplete = this.onComplete.bind(this);
311
322
  this.options.defaultParams = this.options.parameters || null;
@@ -448,7 +459,9 @@ Ajax.InPlaceEditor.prototype = {
448
459
  this.element = $(element);
449
460
 
450
461
  this.options = Object.extend({
462
+ okButton: true,
451
463
  okText: "ok",
464
+ cancelLink: true,
452
465
  cancelText: "cancel",
453
466
  savingText: "Saving...",
454
467
  clickToEditText: "Click to edit",
@@ -470,8 +483,10 @@ Ajax.InPlaceEditor.prototype = {
470
483
  formClassName: 'inplaceeditor-form',
471
484
  highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor,
472
485
  highlightendcolor: "#FFFFFF",
473
- externalControl: null,
474
- ajaxOptions: {}
486
+ externalControl: null,
487
+ submitOnBlur: false,
488
+ ajaxOptions: {},
489
+ evalScripts: false
475
490
  }, options || {});
476
491
 
477
492
  if(!this.options.formId && this.element.id) {
@@ -536,16 +551,22 @@ Ajax.InPlaceEditor.prototype = {
536
551
  this.form.appendChild(br);
537
552
  }
538
553
 
539
- okButton = document.createElement("input");
540
- okButton.type = "submit";
541
- okButton.value = this.options.okText;
542
- this.form.appendChild(okButton);
554
+ if (this.options.okButton) {
555
+ okButton = document.createElement("input");
556
+ okButton.type = "submit";
557
+ okButton.value = this.options.okText;
558
+ okButton.className = 'editor_ok_button';
559
+ this.form.appendChild(okButton);
560
+ }
543
561
 
544
- cancelLink = document.createElement("a");
545
- cancelLink.href = "#";
546
- cancelLink.appendChild(document.createTextNode(this.options.cancelText));
547
- cancelLink.onclick = this.onclickCancel.bind(this);
548
- this.form.appendChild(cancelLink);
562
+ if (this.options.cancelLink) {
563
+ cancelLink = document.createElement("a");
564
+ cancelLink.href = "#";
565
+ cancelLink.appendChild(document.createTextNode(this.options.cancelText));
566
+ cancelLink.onclick = this.onclickCancel.bind(this);
567
+ cancelLink.className = 'editor_cancel';
568
+ this.form.appendChild(cancelLink);
569
+ }
549
570
  },
550
571
  hasHTMLLineBreaks: function(string) {
551
572
  if (!this.options.handleLineBreaks) return false;
@@ -561,24 +582,34 @@ Ajax.InPlaceEditor.prototype = {
561
582
  } else {
562
583
  text = this.getText();
563
584
  }
585
+
586
+ var obj = this;
564
587
 
565
588
  if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) {
566
589
  this.options.textarea = false;
567
590
  var textField = document.createElement("input");
591
+ textField.obj = this;
568
592
  textField.type = "text";
569
593
  textField.name = "value";
570
594
  textField.value = text;
571
595
  textField.style.backgroundColor = this.options.highlightcolor;
596
+ textField.className = 'editor_field';
572
597
  var size = this.options.size || this.options.cols || 0;
573
598
  if (size != 0) textField.size = size;
599
+ if (this.options.submitOnBlur)
600
+ textField.onblur = this.onSubmit.bind(this);
574
601
  this.editField = textField;
575
602
  } else {
576
603
  this.options.textarea = true;
577
604
  var textArea = document.createElement("textarea");
605
+ textArea.obj = this;
578
606
  textArea.name = "value";
579
607
  textArea.value = this.convertHTMLLineBreaks(text);
580
608
  textArea.rows = this.options.rows;
581
609
  textArea.cols = this.options.cols || 40;
610
+ textArea.className = 'editor_field';
611
+ if (this.options.submitOnBlur)
612
+ textArea.onblur = this.onSubmit.bind(this);
582
613
  this.editField = textArea;
583
614
  }
584
615
 
@@ -629,19 +660,26 @@ Ajax.InPlaceEditor.prototype = {
629
660
  // to be displayed indefinitely
630
661
  this.onLoading();
631
662
 
632
- new Ajax.Updater(
633
- {
634
- success: this.element,
635
- // don't update on failure (this could be an option)
636
- failure: null
637
- },
638
- this.url,
639
- Object.extend({
640
- parameters: this.options.callback(form, value),
641
- onComplete: this.onComplete.bind(this),
642
- onFailure: this.onFailure.bind(this)
643
- }, this.options.ajaxOptions)
644
- );
663
+ if (this.options.evalScripts) {
664
+ new Ajax.Request(
665
+ this.url, Object.extend({
666
+ parameters: this.options.callback(form, value),
667
+ onComplete: this.onComplete.bind(this),
668
+ onFailure: this.onFailure.bind(this),
669
+ asynchronous:true,
670
+ evalScripts:true
671
+ }, this.options.ajaxOptions));
672
+ } else {
673
+ new Ajax.Updater(
674
+ { success: this.element,
675
+ // don't update on failure (this could be an option)
676
+ failure: null },
677
+ this.url, Object.extend({
678
+ parameters: this.options.callback(form, value),
679
+ onComplete: this.onComplete.bind(this),
680
+ onFailure: this.onFailure.bind(this)
681
+ }, this.options.ajaxOptions));
682
+ }
645
683
  // stop the event to avoid a page refresh in Safari
646
684
  if (arguments.length > 1) {
647
685
  Event.stop(arguments[0]);
@@ -723,6 +761,33 @@ Ajax.InPlaceEditor.prototype = {
723
761
  }
724
762
  };
725
763
 
764
+ Ajax.InPlaceCollectionEditor = Class.create();
765
+ Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype);
766
+ Object.extend(Ajax.InPlaceCollectionEditor.prototype, {
767
+ createEditField: function() {
768
+ if (!this.cached_selectTag) {
769
+ var selectTag = document.createElement("select");
770
+ var collection = this.options.collection || [];
771
+ var optionTag;
772
+ collection.each(function(e,i) {
773
+ optionTag = document.createElement("option");
774
+ optionTag.value = (e instanceof Array) ? e[0] : e;
775
+ if(this.options.value==optionTag.value) optionTag.selected = true;
776
+ optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e));
777
+ selectTag.appendChild(optionTag);
778
+ }.bind(this));
779
+ this.cached_selectTag = selectTag;
780
+ }
781
+
782
+ this.editField = this.cached_selectTag;
783
+ if(this.options.loadTextURL) this.loadExternalText();
784
+ this.form.appendChild(this.editField);
785
+ this.options.callback = function(form, value) {
786
+ return "value=" + encodeURIComponent(value);
787
+ }
788
+ }
789
+ });
790
+
726
791
  // Delayed observer, like Form.Element.Observer,
727
792
  // but waits for delay after last key input
728
793
  // Ideal for live-search fields
@@ -747,4 +812,4 @@ Form.Element.DelayedObserver.prototype = {
747
812
  this.timer = null;
748
813
  this.callback(this.element, $F(this.element));
749
814
  }
750
- };
815
+ };