hobo 1.3.0.RC4 → 1.3.0.pre10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. data/CHANGES.txt +234 -282
  2. data/Rakefile +3 -3
  3. data/VERSION +1 -1
  4. data/app/controllers/dev_controller.rb +2 -2
  5. data/bin/hobo +3 -3
  6. data/config/routes.rb +1 -1
  7. data/doctests/hobo/lifecycles.rdoctest +1 -0
  8. data/doctests/hobo/model.rdoctest +5 -0
  9. data/doctests/hobo/multi_model_forms.rdoctest +5 -4
  10. data/doctests/hobo/scopes.rdoctest +8 -11
  11. data/doctests/prepare_testapp.rb +1 -2
  12. data/hobo.gemspec +2 -2
  13. data/lib/generators/hobo/admin_subsite/admin_subsite_generator.rb +11 -5
  14. data/lib/generators/hobo/admin_subsite/templates/admin.css +2 -20
  15. data/lib/generators/hobo/admin_subsite/templates/admin_tag_injection.erb +1 -3
  16. data/lib/generators/hobo/admin_subsite/templates/controller.rb.erb +5 -5
  17. data/lib/generators/hobo/admin_subsite/templates/users_index.dryml +1 -3
  18. data/lib/generators/hobo/basic/basic_generator.rb +17 -0
  19. data/lib/generators/hobo/{assets → basic}/templates/application.css +0 -0
  20. data/lib/generators/hobo/{assets → basic}/templates/application.dryml.erb +1 -1
  21. data/lib/generators/hobo/{assets → basic}/templates/dryml-support.js +2 -2
  22. data/lib/generators/hobo/{assets → basic}/templates/en_injection.yml +0 -0
  23. data/lib/generators/hobo/{assets → basic}/templates/guest.rb +0 -0
  24. data/lib/generators/hobo/controller.rb +1 -6
  25. data/lib/generators/hobo/front_controller/front_controller_generator.rb +3 -2
  26. data/{app/views/dev → lib/generators/hobo/front_controller/templates}/summary.dryml +10 -7
  27. data/lib/generators/hobo/hints/hints_generator.rb +12 -0
  28. data/lib/generators/hobo/hints/templates/hints.rb.erb +5 -0
  29. data/lib/generators/hobo/hints/templates/model_injection.rb.erb +36 -0
  30. data/lib/generators/hobo/i18n/i18n_generator.rb +9 -1
  31. data/lib/generators/hobo/i18n/templates/app.en.yml +1 -1
  32. data/lib/generators/hobo/i18n/templates/app.es-DO.yml +24 -0
  33. data/lib/generators/hobo/i18n/templates/app.it.yml +1 -5
  34. data/lib/generators/hobo/i18n/templates/app.pt-PT.yml +0 -1
  35. data/lib/generators/hobo/i18n/templates/default_count_injection.rb +10 -0
  36. data/lib/generators/hobo/i18n/templates/hobo.en.yml +10 -26
  37. data/lib/generators/hobo/i18n/templates/{hobo.es.yml → hobo.es-DO.yml} +10 -27
  38. data/lib/generators/hobo/i18n/templates/hobo.it.yml +4 -20
  39. data/lib/generators/hobo/i18n/templates/hobo.pt-PT.yml +9 -25
  40. data/lib/generators/hobo/model.rb +13 -0
  41. data/lib/generators/hobo/model/USAGE +3 -2
  42. data/lib/generators/hobo/model/model_generator.rb +1 -2
  43. data/lib/generators/hobo/rapid/rapid_generator.rb +0 -2
  44. data/lib/generators/hobo/rapid/templates/hobo-rapid.js +93 -78
  45. data/lib/generators/hobo/rapid/templates/ie7-recalc.js +21 -21
  46. data/lib/generators/hobo/rapid/templates/lowpro.js +31 -31
  47. data/lib/generators/hobo/rapid/templates/reset.css +1 -1
  48. data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/clean.css +16 -17
  49. data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/rapid-ui.css +3 -3
  50. data/lib/generators/hobo/rapid/templates/themes/clean/views/clean.dryml +1 -1
  51. data/lib/generators/hobo/resource/resource_generator.rb +1 -1
  52. data/lib/generators/hobo/routes/router.rb +4 -4
  53. data/lib/generators/hobo/routes/routes_generator.rb +1 -12
  54. data/lib/generators/hobo/routes/templates/hobo_routes.rb.erb +1 -1
  55. data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +43 -88
  56. data/lib/generators/hobo/subsite.rb +5 -18
  57. data/lib/generators/hobo/subsite/subsite_generator.rb +1 -1
  58. data/lib/generators/hobo/subsite/templates/controller.rb.erb +1 -1
  59. data/lib/generators/hobo/subsite_taglib/templates/taglib.dryml.erb +2 -2
  60. data/lib/generators/hobo/test_framework/test_framework_generator.rb +7 -7
  61. data/lib/generators/hobo/user_controller/templates/controller.rb.erb +3 -8
  62. data/lib/generators/hobo/user_mailer/templates/activation.erb +2 -2
  63. data/lib/generators/hobo/user_mailer/templates/forgot_password.erb +2 -2
  64. data/lib/generators/hobo/user_mailer/templates/invite.erb +2 -2
  65. data/lib/generators/hobo/user_mailer/templates/mailer.rb.erb +17 -10
  66. data/lib/generators/hobo/user_mailer/user_mailer_generator.rb +1 -1
  67. data/lib/generators/hobo/user_model/USAGE +9 -2
  68. data/lib/generators/hobo/user_model/user_model_generator.rb +1 -2
  69. data/lib/hobo.rb +7 -13
  70. data/lib/hobo/controller.rb +14 -21
  71. data/lib/hobo/controller/authentication_support.rb +23 -1
  72. data/lib/hobo/controller/model.rb +53 -48
  73. data/lib/hobo/controller/{user_base.rb → user.rb} +36 -47
  74. data/lib/hobo/engine.rb +11 -25
  75. data/lib/hobo/extensions/action_controller/hobo_methods.rb +1 -25
  76. data/lib/hobo/extensions/active_model/translation.rb +1 -1
  77. data/lib/hobo/extensions/active_record/{associations/collection.rb → association_collection.rb} +3 -12
  78. data/lib/hobo/extensions/active_record/{associations/proxy.rb → association_proxy.rb} +7 -6
  79. data/lib/hobo/extensions/active_record/association_reflection.rb +19 -0
  80. data/lib/hobo/extensions/active_record/hobo_methods.rb +1 -1
  81. data/lib/hobo/extensions/active_record/scopes.rb +31 -0
  82. data/lib/hobo/extensions/array.rb +1 -13
  83. data/lib/hobo/helper.rb +6 -27
  84. data/lib/hobo/helper/translations.rb +90 -39
  85. data/lib/hobo/model.rb +20 -72
  86. data/lib/hobo/model/lifecycles.rb +11 -12
  87. data/lib/hobo/model/lifecycles/lifecycle.rb +4 -12
  88. data/lib/hobo/model/lifecycles/transition.rb +0 -1
  89. data/lib/hobo/model/permissions.rb +3 -2
  90. data/lib/hobo/model/scopes/apply_scopes.rb +1 -1
  91. data/lib/hobo/model/scopes/automatic_scopes.rb +80 -78
  92. data/lib/hobo/model/{user_base.rb → user.rb} +7 -9
  93. data/lib/hobo/rapid/generators/rapid/cards.dryml.erb +2 -2
  94. data/lib/hobo/rapid/generators/rapid/forms.dryml.erb +4 -5
  95. data/lib/hobo/rapid/generators/rapid/pages.dryml.erb +27 -26
  96. data/lib/hobo/rapid/helper.rb +5 -10
  97. data/lib/hobo/rapid/taglibs/rapid.dryml +1 -1
  98. data/lib/hobo/rapid/taglibs/rapid_core.dryml +42 -72
  99. data/lib/hobo/rapid/taglibs/rapid_document_tags.dryml +2 -2
  100. data/lib/hobo/rapid/taglibs/rapid_editing.dryml +16 -36
  101. data/lib/hobo/rapid/taglibs/rapid_forms.dryml +49 -87
  102. data/lib/hobo/rapid/taglibs/rapid_generics.dryml +2 -2
  103. data/lib/hobo/rapid/taglibs/rapid_i18n.dryml +75 -50
  104. data/lib/hobo/rapid/taglibs/rapid_lifecycles.dryml +5 -7
  105. data/lib/hobo/rapid/taglibs/rapid_navigation.dryml +2 -2
  106. data/lib/hobo/rapid/taglibs/rapid_pages.dryml +7 -8
  107. data/lib/hobo/rapid/taglibs/rapid_plus.dryml +43 -66
  108. data/lib/hobo/rapid/taglibs/rapid_summary.dryml +45 -16
  109. data/lib/hobo/rapid/taglibs/rapid_translations.dryml +36 -0
  110. data/lib/hobo/rapid/taglibs/rapid_user_pages.dryml +8 -8
  111. data/lib/hobo/routes.rb +23 -22
  112. data/lib/hobo/view_hints.rb +101 -0
  113. data/test/irt/generators/admin_subsite.irt +1 -1
  114. data/test/irt/generators/{assets.irt → basic.irt} +2 -2
  115. data/test/irt/generators/front_controller.irt +4 -2
  116. data/test/irt/generators/partials/_subsite_taglib_variables.rb +1 -1
  117. data/test/irt/generators/subsite.irt +1 -1
  118. data/test/permissions/test_permissions.rb +103 -103
  119. metadata +108 -69
  120. data/lib/generators/hobo/admin_subsite/USAGE +0 -25
  121. data/lib/generators/hobo/admin_subsite/templates/application.dryml +0 -1
  122. data/lib/generators/hobo/assets/USAGE +0 -5
  123. data/lib/generators/hobo/assets/assets_generator.rb +0 -18
  124. data/lib/generators/hobo/assets/templates/dryml_taglibs_initializer.rb +0 -1
  125. data/lib/generators/hobo/controller/USAGE +0 -3
  126. data/lib/generators/hobo/i18n/USAGE +0 -3
  127. data/lib/generators/hobo/i18n/templates/app.de.yml +0 -30
  128. data/lib/generators/hobo/i18n/templates/app.es.yml +0 -31
  129. data/lib/generators/hobo/i18n/templates/app.fr.yml +0 -26
  130. data/lib/generators/hobo/i18n/templates/app.nb.yml +0 -25
  131. data/lib/generators/hobo/i18n/templates/app.ru.yml +0 -24
  132. data/lib/generators/hobo/i18n/templates/hobo.de.yml +0 -204
  133. data/lib/generators/hobo/i18n/templates/hobo.fr.yml +0 -195
  134. data/lib/generators/hobo/i18n/templates/hobo.nb.yml +0 -198
  135. data/lib/generators/hobo/i18n/templates/hobo.ru.yml +0 -200
  136. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/100-ACD3E6-DBE1E5-H.png +0 -0
  137. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/100-DBE1E5-FCFEF5-H.png +0 -0
  138. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/300-3B5F87-ACD3E6-H.png +0 -0
  139. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/spinner.gif +0 -0
  140. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/stylesheets/clean-sidemenu.css +0 -81
  141. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/views/clean-sidemenu.dryml +0 -30
  142. data/lib/generators/hobo/resource/USAGE +0 -39
  143. data/lib/generators/hobo/subsite/USAGE +0 -24
  144. data/lib/generators/hobo/subsite_taglib/USAGE +0 -4
  145. data/lib/generators/hobo/test_framework/USAGE +0 -2
  146. data/lib/generators/hobo/user_controller/USAGE +0 -3
  147. data/lib/generators/hobo/user_mailer/USAGE +0 -2
  148. data/lib/generators/hobo/user_resource/USAGE +0 -10
  149. data/lib/hobo/extensions/action_view/translation_helper.rb +0 -25
  150. data/lib/hobo/extensions/active_record/associations/reflection.rb +0 -23
  151. data/lib/hobo/extensions/active_record/associations/scope.rb +0 -35
  152. data/lib/hobo/extensions/active_record/relation_with_origin.rb +0 -32
  153. data/lib/hobo/extensions/i18n.rb +0 -17
  154. data/lib/hobo/helper/translations/normalizer.rb +0 -39
  155. data/lib/hobo/model/view_hints.rb +0 -123
@@ -0,0 +1,13 @@
1
+ require 'generators/hobo_support/model'
2
+ module Generators
3
+ module Hobo
4
+ Model = classy_module do
5
+ include Generators::HoboSupport::Model
6
+
7
+ def generate_hint_file
8
+ invoke 'hobo:hints', [name]
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -10,10 +10,11 @@ Examples:
10
10
  Model: app/models/account.rb
11
11
  Test: test/unit/account_test.rb
12
12
  Fixtures: test/fixtures/accounts.yml
13
+ Viewhints: app/viewhints/account_hints.rb
13
14
 
14
15
  $ rails generate hobo:model post title:string body:text published:boolean
15
16
 
16
17
  creates a Post model with a string title, text body, and published flag.
17
18
 
18
- After the model is created, and the fields are specified, use hobo:migration
19
- to create the migrations incrementally.
19
+ After the model is created, and the fields are specified, use hobo:migration
20
+ to create the migrations incrementally.
@@ -1,11 +1,10 @@
1
1
  require 'rails/generators/active_record'
2
- require 'generators/hobo_support/model'
3
2
 
4
3
  module Hobo
5
4
  class ModelGenerator < ActiveRecord::Generators::Base
6
5
  source_root File.expand_path('../templates', __FILE__)
7
6
 
8
- include Generators::HoboSupport::Model
7
+ include Generators::Hobo::Model
9
8
 
10
9
  end
11
10
  end
@@ -16,8 +16,6 @@ module Hobo
16
16
  copy_file "hobo-rapid.css", "public/stylesheets/hobo-rapid.css"
17
17
  directory "themes/clean/public","public/hobothemes/clean"
18
18
  directory "themes/clean/views", "app/views/taglibs/themes/clean"
19
- directory "themes/clean-sidemenu/public","public/hobothemes/clean-sidemenu"
20
- directory "themes/clean-sidemenu/views", "app/views/taglibs/themes/clean-sidemenu"
21
19
  end
22
20
 
23
21
  end
@@ -16,7 +16,7 @@ var Hobo = {
16
16
  searchRequest: null,
17
17
  uidCounter: 0,
18
18
  ipeOldValues: {},
19
- spinnerMinTime: 500, // milliseconds
19
+ spinnerMinTime: 500, // milliseconds
20
20
 
21
21
  uid: function() {
22
22
  Hobo.uidCounter += 1
@@ -34,7 +34,6 @@ var Hobo = {
34
34
  var params = Hobo.fieldSetParam(el, val)
35
35
  var p = el.getAttribute("hobo-ajax-params")
36
36
  if (p) params = params + "&" + p
37
- params = params + '&_method=PUT'
38
37
 
39
38
  var opts = Object.merge(options || {}, { params: params, message: el.getAttribute("hobo-ajax-message")})
40
39
  Hobo.ajaxRequest(Hobo.putUrl(el), updates, opts)
@@ -54,7 +53,7 @@ var Hobo = {
54
53
  i += 1
55
54
  }
56
55
  })
57
- params.push("page_path=" + encodeURIComponent(hoboPagePath))
56
+ params.push("page_path=" + hoboPagePath)
58
57
  }
59
58
 
60
59
  if (resultUpdates) {
@@ -89,7 +88,7 @@ var Hobo = {
89
88
  if (typeof(formAuthToken) != "undefined") {
90
89
  params.push(formAuthToken.name + "=" + formAuthToken.value)
91
90
  }
92
-
91
+
93
92
  updateParams = Hobo.ajaxUpdateParams(updates, options.resultUpdate)
94
93
  if (updateParams != "") { params.push(updateParams) }
95
94
 
@@ -103,7 +102,7 @@ var Hobo = {
103
102
  }
104
103
 
105
104
  if (options.message != false) Hobo.showSpinner(options.message, options.spinnerNextTo)
106
-
105
+
107
106
  var complete = function() {
108
107
  if (options.message != false) Hobo.hideSpinner();
109
108
  if (options.onComplete) options.onComplete.apply(this, arguments)
@@ -112,7 +111,7 @@ var Hobo = {
112
111
  }
113
112
  var success = function() {
114
113
  if (options.onSuccess) options.onSuccess.apply(this, arguments)
115
- if (form && options.resetForm) form.reset();
114
+ if (form && options.resetForm) form.reset();
116
115
  }
117
116
  if (options.method && options.method.toLowerCase() == "put") {
118
117
  delete options.method
@@ -155,7 +154,7 @@ var Hobo = {
155
154
  }
156
155
  }
157
156
  },
158
-
157
+
159
158
  onFieldEditComplete: function(el, newValue) {
160
159
  el = $(el)
161
160
  var oldValue = Hobo.ipeOldValues[el.id]
@@ -207,7 +206,7 @@ var Hobo = {
207
206
  el.innerHTML = editable_text
208
207
  }
209
208
  if (el.innerHTML.gsub("&nbsp;", " ") == blank_message) {
210
- el.innerHTML = ""
209
+ el.innerHTML = ""
211
210
  } else {
212
211
  Hobo.ipeOldValues[el.id] = el.innerHTML
213
212
  }
@@ -228,7 +227,7 @@ var Hobo = {
228
227
  var clear = function() { Hobo.hide(search_results_panel); el.clear() }
229
228
 
230
229
  // Close window on [Escape]
231
- Event.observe(el, 'keypress', function(ev) {
230
+ Event.observe(el, 'keypress', function(ev) {
232
231
  if (ev.keyCode == 27) clear()
233
232
  });
234
233
 
@@ -258,12 +257,11 @@ var Hobo = {
258
257
 
259
258
 
260
259
  putUrl: function(el) {
261
- /* we used to append _method=put here, but it doesn't work in Rails 3 */
262
260
  var spec = Hobo.modelSpecForElement(el)
263
- return urlBase + "/" + Hobo.pluralise(spec.name) + "/" + spec.id
261
+ return urlBase + "/" + Hobo.pluralise(spec.name) + "/" + spec.id + "?_method=PUT"
264
262
  },
265
263
 
266
-
264
+
267
265
  urlForId: function(id) {
268
266
  var spec = Hobo.parseModelSpec(id)
269
267
  var url = urlBase + "/" + Hobo.pluralise(spec.name)
@@ -271,7 +269,7 @@ var Hobo = {
271
269
  return url
272
270
  },
273
271
 
274
-
272
+
275
273
  fieldSetParam: function(el, val) {
276
274
  var spec = Hobo.modelSpecForElement(el)
277
275
  var res = spec.name + '[' + spec.field + ']=' + encodeURIComponent(val)
@@ -284,8 +282,8 @@ var Hobo = {
284
282
 
285
283
  fadeObjectElement: function(el) {
286
284
  var fadeEl = Hobo.objectElementFor(el)
287
- new Effect.Fade(fadeEl, { duration: 0.5, afterFinish: function (ef) {
288
- ef.element.remove()
285
+ new Effect.Fade(fadeEl, { duration: 0.5, afterFinish: function (ef) {
286
+ ef.element.remove()
289
287
  } });
290
288
  Hobo.showEmptyMessageAfterLastRemove(fadeEl)
291
289
  },
@@ -332,13 +330,13 @@ var Hobo = {
332
330
  new Effect.Appear(empty, {delay:0.3})
333
331
  }
334
332
  },
335
-
333
+
336
334
 
337
335
  getClassData: function(el, name) {
338
336
  var match = el.className.match(new RegExp("(^| )" + name + "::(\\S+)($| )"))
339
337
  return match && match[2]
340
338
  },
341
-
339
+
342
340
 
343
341
  getModelId: function(el) {
344
342
  return Hobo.getClassData(el, 'model')
@@ -444,7 +442,24 @@ var Hobo = {
444
442
 
445
443
  return window.location.href.sub(/(\?.*|$)/, "?" + params.toQueryString())
446
444
  },
447
-
445
+
446
+
447
+ fixSectionGroup: function(e) {
448
+ rows = e.childElements().map(function(e, i) {
449
+ cells = e.childElements().map(function(e, i) {
450
+ return e.outerHTML.sub("<DIV", "<td valign='top'").sub(/<\/DIV>$/i, "</td>")
451
+ }).join('')
452
+
453
+ var attrs = e.outerHTML.match(/<DIV([^>]+)/)[1]
454
+ return "<tr" + attrs + ">" + cells + "</tr>"
455
+ }).join("\n")
456
+
457
+ var attrs = e.outerHTML.match(/<DIV([^>]+)/)[1]
458
+
459
+ var table= "<table cellpadding='0' cellspacing='0' border='0' style='border-collapse: collapse; border-spacing: 0'" + attrs + ">" +
460
+ rows + "</table>"
461
+ e.outerHTML = table
462
+ },
448
463
 
449
464
  makeHtmlEditor: function(textarea) {
450
465
  // do nothing - plugins can overwrite this method
@@ -485,8 +500,8 @@ Ajax.InPlaceEditor.prototype.enterEditMode = function(evt) {
485
500
  // Fix Safari in-place-editor bug
486
501
  Ajax.InPlaceEditor.prototype.removeForm = function() {
487
502
  if (!this._form) return;
488
-
489
- if (this._form.parentNode) { try { Element.remove(this._form); } catch (e) {}}
503
+
504
+ if (this._form.parentNode) { try { Element.remove(this._form); } catch (e) {}}
490
505
  this._form = null;
491
506
  this._controls = { };
492
507
  }
@@ -507,7 +522,7 @@ Element.Methods.$$ = function(e, css) {
507
522
 
508
523
 
509
524
  HoboBehavior = Class.create({
510
-
525
+
511
526
  initialize: function(mainSelector, features) {
512
527
  this.mainSelector = mainSelector
513
528
  this.features = features
@@ -516,10 +531,10 @@ HoboBehavior = Class.create({
516
531
  document.observe("dom:loaded", features.initialize);
517
532
  }
518
533
  },
519
-
534
+
520
535
  addEvents: function(parentSelector, events) {
521
536
  var self = this
522
-
537
+
523
538
  for (selector in events) {
524
539
  fullSelector = parentSelector + ' ' + selector
525
540
  var rhs = events[selector]
@@ -529,9 +544,9 @@ HoboBehavior = Class.create({
529
544
  this.addEvents(fullSelector, rhs)
530
545
  }
531
546
  }
532
-
547
+
533
548
  },
534
-
549
+
535
550
  addBehavior: function(selector, handler) {
536
551
  var self = this
537
552
  behavior = {}
@@ -541,12 +556,12 @@ HoboBehavior = Class.create({
541
556
  }
542
557
  Event.addBehavior(behavior)
543
558
  }
544
-
559
+
545
560
  })
546
561
 
547
562
 
548
563
  HoboInputMany = {
549
-
564
+
550
565
  events: {
551
566
  "> li > div.buttons": {
552
567
  ".add-item:click": 'addOne',
@@ -556,21 +571,17 @@ HoboInputMany = {
556
571
 
557
572
  initialize: function(ev) {
558
573
  /* the second clause should be sufficient, but it isn't in IE7. See bug 603 */
559
- Element.select(ev.target, ".input-many-template").each(function (templ) {
560
- templ.select("input:hidden,select:hidden,textarea:hidden,button:hidden").each(function(input) {
561
- if(!input.disabled) {
562
- input.disabled = true;
563
- input.addClassName("input_many_template_input");
564
- }
565
- })
574
+ Element.select(ev.target, ".input-many-template input:hidden, .input-many-template select:hidden, .input-many-template textarea:hidden, .input-many-template button:hidden").each(function(input) {
575
+ if(!input.disabled) {
576
+ input.disabled = true;
577
+ input.addClassName("input_many_template_input");
578
+ }
566
579
  });
567
580
 
568
581
  // disable all elements inside our template, and mark them so we can find them later.
569
- Element.select(ev.target, ".input-many-template").each(function (templ) {
570
- templ.select("input:enabled,select:enabled,textarea:enabled,button:enabled").each(function(input) {
571
- input.disabled = true;
572
- input.addClassName("input_many_template_input");
573
- });
582
+ Element.select(ev.target, ".input-many-template input:enabled, .input-many-template select:enabled, .input-many-template textarea:enabled, .input-many-template button:enabled").each(function(input) {
583
+ input.disabled = true;
584
+ input.addClassName("input_many_template_input");
574
585
  });
575
586
 
576
587
  Element.select(ev.target, ".sortable-input-many").each(function(el) {
@@ -587,12 +598,12 @@ HoboInputMany = {
587
598
 
588
599
  createSortable: function() {
589
600
  Sortable.create(this.id, {
590
- constraint: 'vertical',
591
- handle: 'ordering-handle',
592
- overlap: 'vertical',
601
+ constraint: 'vertical',
602
+ handle: 'ordering-handle',
603
+ overlap: 'vertical',
593
604
  scroll: 'window',
594
605
  onUpdate: function(list) {
595
- HoboInputMany.fixIndices.call(list);
606
+ HoboInputMany.fixIndices.call(list);
596
607
  }
597
608
  });
598
609
  },
@@ -607,7 +618,7 @@ HoboInputMany = {
607
618
  var id_sub = id_prefix + '_' + new_index.toString();
608
619
  var class_re = RegExp(RegExp.escape(name_prefix)+ "\[\-?[0-9]+\]");
609
620
  var class_sub = name_sub;
610
-
621
+
611
622
  return function() {
612
623
  if(this.name) {
613
624
  this.name = this.name.replace(name_re, name_sub);
@@ -634,9 +645,9 @@ HoboInputMany = {
634
645
  return Number(this.id.match(/_([-0-9]+)$/)[1]);
635
646
  },
636
647
 
637
- /* For some reason, select() and down() and all those useful functions aren't working for us. Roll our own replacement.
648
+ /* For some reason, select() and down() and all those useful functions aren't working for us. Roll our own replacement.
638
649
 
639
- this: element to recurse on.
650
+ this: element to recurse on.
640
651
  klass: class to filter on
641
652
  f: function to invoke
642
653
  */
@@ -680,7 +691,7 @@ HoboInputMany = {
680
691
  Event.stop(ev);
681
692
  var ul = el.up('ul.input-many'), li = el.up('li.input-many-li');
682
693
 
683
- if(li.id.search(/_-1$/)>=0 && ul.immediateDescendants().length>2) {
694
+ if(li.id.search(/_-1$/ && ul.immediateDescendants().length>2)>=0) {
684
695
  /* if(console) console.log("IE7 messed up again (bug 605)"); */
685
696
  return;
686
697
  }
@@ -726,7 +737,7 @@ HoboInputMany = {
726
737
  li.childWithClass("buttons").childWithClass("remove-item").removeClassName("hidden");
727
738
  li.childWithClass("buttons").childWithClass("add-item").addClassName("hidden");
728
739
  }
729
-
740
+
730
741
  return;
731
742
  },
732
743
 
@@ -746,10 +757,10 @@ HoboInputMany = {
746
757
  // rename everybody from me onwards
747
758
  var i=this.getIndex.call(li)
748
759
  var n=li.next();
749
- for(; n; i+=1, n=n.next()) {
760
+ for(; n; i+=1, n=n.next()) {
750
761
  var name_updater = this.getNameUpdater.call(ul, i);
751
762
  HoboInputMany.recurse_elements_with_class.call(n, null, function(el) {name_updater.call(el);});
752
- }
763
+ }
753
764
 
754
765
  // adjust +/- buttons on the button element as appropriate
755
766
  var last=ul.childElements()[ul.childElements().length-1];
@@ -772,7 +783,7 @@ HoboInputMany = {
772
783
 
773
784
  new Effect.BlindUp(li, { duration: 0.3, afterFinish: function (ef) {
774
785
  ul.fire("rapid:change")
775
- li.remove()
786
+ li.remove()
776
787
  } });
777
788
 
778
789
  }
@@ -780,7 +791,7 @@ HoboInputMany = {
780
791
 
781
792
 
782
793
  }
783
-
794
+
784
795
  new HoboBehavior("ul.input-many", HoboInputMany);
785
796
 
786
797
 
@@ -792,7 +803,7 @@ SelectManyInput = Behavior.create({
792
803
  },
793
804
 
794
805
  addOne : function() {
795
- var select = this.element.down('select')
806
+ var select = this.element.down('select')
796
807
  var selected = select.options[select.selectedIndex]
797
808
  if ($F(select) != "") {
798
809
  var newItem = $(DOM.Builder.fromHTML(this.element.down('.item-proto').innerHTML.strip()))
@@ -816,13 +827,13 @@ SelectManyInput = Behavior.create({
816
827
 
817
828
  removeOne : function(el) {
818
829
  var element = this.element
819
- new Effect.BlindUp(el,
830
+ new Effect.BlindUp(el,
820
831
  { duration: 0.3,
821
- afterFinish: function (ef) {
822
- ef.element.remove()
832
+ afterFinish: function (ef) {
833
+ ef.element.remove()
823
834
  element.fire("rapid:remove", { element: el })
824
835
  element.fire("rapid:change", { element: el })
825
- } } )
836
+ } } )
826
837
  var label = el.down('span').innerHTML
827
838
  var optgroup = element.down("optgroup[label="+label+"]")
828
839
  var option = new Element("option", {value:optgroup.readAttribute("alt")})
@@ -835,7 +846,7 @@ SelectManyInput = Behavior.create({
835
846
  },
836
847
 
837
848
  hiddenField: function(item) {
838
- return item.down('input[type=hidden]')
849
+ return item.down('input[type=hidden]')
839
850
  //return item.getElementsByClassName("hidden-field")[0]
840
851
  }
841
852
 
@@ -844,7 +855,7 @@ SelectManyInput = Behavior.create({
844
855
 
845
856
  NameManyInput = Object.extend(SelectManyInput, {
846
857
  addOne : function() {
847
- var select = this.element.down('select')
858
+ var select = this.element.down('select')
848
859
  var selected = select.options[select.selectedIndex]
849
860
  if (selected.value != "") {
850
861
  var newItem = $(DOM.Builder.fromHTML(this.element.down('.item-proto').innerHTML.strip()))
@@ -858,10 +869,10 @@ NameManyInput = Object.extend(SelectManyInput, {
858
869
  }
859
870
  })
860
871
 
861
-
872
+
862
873
  AutocompleteBehavior = Behavior.create({
863
874
  initialize : function() {
864
- this.minChars = parseInt(Hobo.getClassData(this.element, "min-chars"));
875
+ this.minChars = parseInt(Hobo.getClassData(this.element, "min-chars"));
865
876
  var match = this.element.className.match(/complete-on::([\S]+)/)
866
877
  var target = match[1].split('::')
867
878
  var typedId = target[0]
@@ -870,9 +881,9 @@ AutocompleteBehavior = Behavior.create({
870
881
  var spec = Hobo.parseModelSpec(typedId)
871
882
  var url = urlBase + "/" + Hobo.pluralise(spec.name) + "/complete_" + completer
872
883
  var parameters = spec.id ? "id=" + spec.id : ""
873
- this.autocompleter = new Ajax.Autocompleter(this.element,
874
- this.element.next('.completions-popup'),
875
- url,
884
+ this.autocompleter = new Ajax.Autocompleter(this.element,
885
+ this.element.next('.completions-popup'),
886
+ url,
876
887
  {paramName:'query', method:'get', parameters: parameters, minChars: this.minChars,
877
888
  afterUpdateElement: this.afterUpdateElement});
878
889
  },
@@ -882,7 +893,7 @@ AutocompleteBehavior = Behavior.create({
882
893
  this.element.value = '';
883
894
  this.element.removeClassName("nil-value");
884
895
  }
885
- if(this.minChars==0) {
896
+ if(this.minChars==0) {
886
897
  this.autocompleter.activate();
887
898
  }
888
899
  },
@@ -890,13 +901,17 @@ AutocompleteBehavior = Behavior.create({
890
901
  afterUpdateElement: function(input, li) {
891
902
  input.fire("rapid:autocomplete-assigned");
892
903
  }
893
-
904
+
894
905
  })
895
906
 
896
907
 
897
908
 
898
909
  Event.addBehavior.reassignAfterAjax = true;
899
910
  Event.addBehavior({
911
+
912
+ 'div.section-group' : function() {
913
+ if (Prototype.Browser.IE) Hobo.fixSectionGroup(this);
914
+ },
900
915
 
901
916
  'div.select-many.input' : SelectManyInput(),
902
917
 
@@ -908,7 +923,7 @@ Event.addBehavior({
908
923
  var paramName = this.getAttribute('name')
909
924
  var params = {}
910
925
  var remove = [ 'page' ]
911
- if ($F(this) == '') {
926
+ if ($F(this) == '') {
912
927
  remove.push(paramName)
913
928
  } else {
914
929
  params[paramName] = $F(this)
@@ -938,10 +953,10 @@ Event.addBehavior({
938
953
  if (Hobo.makeInPlaceHtmlEditor) {
939
954
  Hobo.makeInPlaceHtmlEditor(this)
940
955
  } else {
941
- var options = {
956
+ var options = {
942
957
  rows: 2, handleLineBreaks: false, okButton: true, cancelLink: true, okText: "Save", submitOnBlur: false
943
958
  }
944
- var ipe = Hobo._makeInPlaceEditor(this, options)
959
+ var ipe = Hobo._makeInPlaceEditor(this, options)
945
960
  ipe.getText = function() {
946
961
  // Be careful! we're not calling unescapeHTML() here!
947
962
  return this.element.innerHTML
@@ -955,7 +970,7 @@ Event.addBehavior({
955
970
  Hobo.ajaxSetFieldForElement(el, $F(el))
956
971
  }
957
972
  },
958
-
973
+
959
974
  "input.live-search[type=search]" : function(e) {
960
975
  var element = this
961
976
  new Form.Element.Observer(element, 1.0, function() { Hobo.doSearch(element) })
@@ -965,23 +980,23 @@ Event.addBehavior({
965
980
  });
966
981
 
967
982
  ElementSet = Class.create(Enumerable, {
968
-
983
+
969
984
  initialize: function(array) {
970
985
  this.items = array
971
986
  },
972
-
987
+
973
988
  _each: function(fn) {
974
989
  return this.items.each(fn)
975
990
  },
976
-
991
+
977
992
  selectChildren: function(selector) {
978
993
  return new ElementSet(this.items.invoke('selectChildren', selector).pluck('items').flatten())
979
994
  },
980
-
995
+
981
996
  child: function(selector) {
982
997
  return this.selectChildren(selector).first()
983
998
  },
984
-
999
+
985
1000
  select: function(selector) {
986
1001
  return new ElementSet(this.items.invoke('select', selector).flatten())
987
1002
  },
@@ -993,11 +1008,11 @@ ElementSet = Class.create(Enumerable, {
993
1008
  }
994
1009
  return null
995
1010
  },
996
-
1011
+
997
1012
  size: function() {
998
1013
  return this.items.length
999
1014
  },
1000
-
1015
+
1001
1016
  first: function() {
1002
1017
  return this.items.first()
1003
1018
  },
@@ -1005,7 +1020,7 @@ ElementSet = Class.create(Enumerable, {
1005
1020
  last: function() {
1006
1021
  return this.items.last()
1007
1022
  }
1008
-
1023
+
1009
1024
  })
1010
1025
 
1011
1026
  Element.addMethods({