hobo 1.3.0.pre19 → 1.3.0.pre20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/CHANGES.txt +282 -234
  2. data/VERSION +1 -1
  3. data/lib/generators/hobo/admin_subsite/templates/controller.rb.erb +5 -5
  4. data/lib/generators/hobo/assets/templates/dryml-support.js +2 -2
  5. data/lib/generators/hobo/i18n/templates/hobo.it.yml +1 -1
  6. data/lib/generators/hobo/rapid/templates/hobo-rapid.js +64 -64
  7. data/lib/generators/hobo/rapid/templates/ie7-recalc.js +21 -21
  8. data/lib/generators/hobo/rapid/templates/lowpro.js +31 -31
  9. data/lib/generators/hobo/rapid/templates/reset.css +1 -1
  10. data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/clean.css +15 -15
  11. data/lib/generators/hobo/rapid/templates/themes/clean/public/stylesheets/rapid-ui.css +3 -3
  12. data/lib/generators/hobo/rapid/templates/themes/clean/views/clean.dryml +1 -1
  13. data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +15 -14
  14. data/lib/generators/hobo/subsite/templates/controller.rb.erb +1 -1
  15. data/lib/generators/hobo/user_controller/templates/controller.rb.erb +2 -2
  16. data/lib/hobo.rb +1 -0
  17. data/lib/hobo/controller.rb +6 -6
  18. data/lib/hobo/controller/authentication_support.rb +1 -1
  19. data/lib/hobo/controller/model.rb +10 -10
  20. data/lib/hobo/controller/user.rb +6 -6
  21. data/lib/hobo/engine.rb +6 -0
  22. data/lib/hobo/extensions/action_view/translation_helper.rb +20 -0
  23. data/lib/hobo/extensions/active_model/translation.rb +1 -1
  24. data/lib/hobo/extensions/i18n.rb +16 -0
  25. data/lib/hobo/helper.rb +2 -2
  26. data/lib/hobo/helper/translations.rb +61 -80
  27. data/lib/hobo/model/lifecycles/lifecycle.rb +5 -1
  28. data/lib/hobo/model/lifecycles/transition.rb +1 -0
  29. data/lib/hobo/rapid/generators/rapid/cards.dryml.erb +2 -2
  30. data/lib/hobo/rapid/generators/rapid/forms.dryml.erb +2 -2
  31. data/lib/hobo/rapid/generators/rapid/pages.dryml.erb +7 -7
  32. data/lib/hobo/rapid/taglibs/rapid.dryml +1 -1
  33. data/lib/hobo/rapid/taglibs/rapid_core.dryml +8 -8
  34. data/lib/hobo/rapid/taglibs/rapid_document_tags.dryml +2 -2
  35. data/lib/hobo/rapid/taglibs/rapid_forms.dryml +9 -9
  36. data/lib/hobo/rapid/taglibs/rapid_generics.dryml +1 -1
  37. data/lib/hobo/rapid/taglibs/rapid_i18n.dryml +0 -17
  38. data/lib/hobo/rapid/taglibs/rapid_lifecycles.dryml +5 -5
  39. data/lib/hobo/rapid/taglibs/rapid_navigation.dryml +1 -1
  40. data/lib/hobo/rapid/taglibs/rapid_plus.dryml +6 -6
  41. data/lib/hobo/rapid/taglibs/rapid_user_pages.dryml +8 -8
  42. data/test/permissions/test_permissions.rb +103 -103
  43. metadata +15 -14
  44. data/lib/hobo/rapid/taglibs/rapid_translations.dryml +0 -36
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0.pre19
1
+ 1.3.0.pre20
@@ -1,13 +1,13 @@
1
1
  class <%= subsite_name %>::<%= subsite_name %>SiteController < ApplicationController
2
2
 
3
3
  hobo_controller
4
-
4
+
5
5
  before_filter :admin_required
6
-
6
+
7
7
  private
8
-
8
+
9
9
  def admin_required
10
10
  redirect_to home_page unless current_user.administrator?
11
- end
12
-
11
+ end
12
+
13
13
  end
@@ -1,5 +1,5 @@
1
1
  Event.addBehavior({
2
- 'body:click' : function(event) {
2
+ 'body:click' : function(event) {
3
3
  if (event.shiftKey && event.altKey) {
4
4
  Dryml.click(event)
5
5
  Event.stop(event)
@@ -122,7 +122,7 @@ var Dryml = {
122
122
  },
123
123
 
124
124
  removeMenu: function() {
125
- if (Dryml.menu) {
125
+ if (Dryml.menu) {
126
126
  $("dryml-menu-style").remove()
127
127
  Dryml.menu.remove()
128
128
  Dryml.menu = null
@@ -52,7 +52,7 @@ it:
52
52
  remember_me: "Ricorda i miei dati"
53
53
  login: "Identificazione"
54
54
  signup: "Iscrizione"
55
- forgot_password: &forgot_password "Parola Chiave dimentivata?"
55
+ forgot_password: &forgot_password "Parola Chiave dimenticata?"
56
56
 
57
57
  signup:
58
58
  title: "Iscrizione"
@@ -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
@@ -88,7 +88,7 @@ var Hobo = {
88
88
  if (typeof(formAuthToken) != "undefined") {
89
89
  params.push(formAuthToken.name + "=" + formAuthToken.value)
90
90
  }
91
-
91
+
92
92
  updateParams = Hobo.ajaxUpdateParams(updates, options.resultUpdate)
93
93
  if (updateParams != "") { params.push(updateParams) }
94
94
 
@@ -102,7 +102,7 @@ var Hobo = {
102
102
  }
103
103
 
104
104
  if (options.message != false) Hobo.showSpinner(options.message, options.spinnerNextTo)
105
-
105
+
106
106
  var complete = function() {
107
107
  if (options.message != false) Hobo.hideSpinner();
108
108
  if (options.onComplete) options.onComplete.apply(this, arguments)
@@ -111,7 +111,7 @@ var Hobo = {
111
111
  }
112
112
  var success = function() {
113
113
  if (options.onSuccess) options.onSuccess.apply(this, arguments)
114
- if (form && options.resetForm) form.reset();
114
+ if (form && options.resetForm) form.reset();
115
115
  }
116
116
  if (options.method && options.method.toLowerCase() == "put") {
117
117
  delete options.method
@@ -154,7 +154,7 @@ var Hobo = {
154
154
  }
155
155
  }
156
156
  },
157
-
157
+
158
158
  onFieldEditComplete: function(el, newValue) {
159
159
  el = $(el)
160
160
  var oldValue = Hobo.ipeOldValues[el.id]
@@ -206,7 +206,7 @@ var Hobo = {
206
206
  el.innerHTML = editable_text
207
207
  }
208
208
  if (el.innerHTML.gsub("&nbsp;", " ") == blank_message) {
209
- el.innerHTML = ""
209
+ el.innerHTML = ""
210
210
  } else {
211
211
  Hobo.ipeOldValues[el.id] = el.innerHTML
212
212
  }
@@ -227,7 +227,7 @@ var Hobo = {
227
227
  var clear = function() { Hobo.hide(search_results_panel); el.clear() }
228
228
 
229
229
  // Close window on [Escape]
230
- Event.observe(el, 'keypress', function(ev) {
230
+ Event.observe(el, 'keypress', function(ev) {
231
231
  if (ev.keyCode == 27) clear()
232
232
  });
233
233
 
@@ -261,7 +261,7 @@ var Hobo = {
261
261
  return urlBase + "/" + Hobo.pluralise(spec.name) + "/" + spec.id + "?_method=PUT"
262
262
  },
263
263
 
264
-
264
+
265
265
  urlForId: function(id) {
266
266
  var spec = Hobo.parseModelSpec(id)
267
267
  var url = urlBase + "/" + Hobo.pluralise(spec.name)
@@ -269,7 +269,7 @@ var Hobo = {
269
269
  return url
270
270
  },
271
271
 
272
-
272
+
273
273
  fieldSetParam: function(el, val) {
274
274
  var spec = Hobo.modelSpecForElement(el)
275
275
  var res = spec.name + '[' + spec.field + ']=' + encodeURIComponent(val)
@@ -282,8 +282,8 @@ var Hobo = {
282
282
 
283
283
  fadeObjectElement: function(el) {
284
284
  var fadeEl = Hobo.objectElementFor(el)
285
- new Effect.Fade(fadeEl, { duration: 0.5, afterFinish: function (ef) {
286
- ef.element.remove()
285
+ new Effect.Fade(fadeEl, { duration: 0.5, afterFinish: function (ef) {
286
+ ef.element.remove()
287
287
  } });
288
288
  Hobo.showEmptyMessageAfterLastRemove(fadeEl)
289
289
  },
@@ -330,13 +330,13 @@ var Hobo = {
330
330
  new Effect.Appear(empty, {delay:0.3})
331
331
  }
332
332
  },
333
-
333
+
334
334
 
335
335
  getClassData: function(el, name) {
336
336
  var match = el.className.match(new RegExp("(^| )" + name + "::(\\S+)($| )"))
337
337
  return match && match[2]
338
338
  },
339
-
339
+
340
340
 
341
341
  getModelId: function(el) {
342
342
  return Hobo.getClassData(el, 'model')
@@ -442,8 +442,8 @@ var Hobo = {
442
442
 
443
443
  return window.location.href.sub(/(\?.*|$)/, "?" + params.toQueryString())
444
444
  },
445
-
446
-
445
+
446
+
447
447
  fixSectionGroup: function(e) {
448
448
  rows = e.childElements().map(function(e, i) {
449
449
  cells = e.childElements().map(function(e, i) {
@@ -456,7 +456,7 @@ var Hobo = {
456
456
 
457
457
  var attrs = e.outerHTML.match(/<DIV([^>]+)/)[1]
458
458
 
459
- var table= "<table cellpadding='0' cellspacing='0' border='0' style='border-collapse: collapse; border-spacing: 0'" + attrs + ">" +
459
+ var table= "<table cellpadding='0' cellspacing='0' border='0' style='border-collapse: collapse; border-spacing: 0'" + attrs + ">" +
460
460
  rows + "</table>"
461
461
  e.outerHTML = table
462
462
  },
@@ -500,8 +500,8 @@ Ajax.InPlaceEditor.prototype.enterEditMode = function(evt) {
500
500
  // Fix Safari in-place-editor bug
501
501
  Ajax.InPlaceEditor.prototype.removeForm = function() {
502
502
  if (!this._form) return;
503
-
504
- if (this._form.parentNode) { try { Element.remove(this._form); } catch (e) {}}
503
+
504
+ if (this._form.parentNode) { try { Element.remove(this._form); } catch (e) {}}
505
505
  this._form = null;
506
506
  this._controls = { };
507
507
  }
@@ -522,7 +522,7 @@ Element.Methods.$$ = function(e, css) {
522
522
 
523
523
 
524
524
  HoboBehavior = Class.create({
525
-
525
+
526
526
  initialize: function(mainSelector, features) {
527
527
  this.mainSelector = mainSelector
528
528
  this.features = features
@@ -531,10 +531,10 @@ HoboBehavior = Class.create({
531
531
  document.observe("dom:loaded", features.initialize);
532
532
  }
533
533
  },
534
-
534
+
535
535
  addEvents: function(parentSelector, events) {
536
536
  var self = this
537
-
537
+
538
538
  for (selector in events) {
539
539
  fullSelector = parentSelector + ' ' + selector
540
540
  var rhs = events[selector]
@@ -544,9 +544,9 @@ HoboBehavior = Class.create({
544
544
  this.addEvents(fullSelector, rhs)
545
545
  }
546
546
  }
547
-
547
+
548
548
  },
549
-
549
+
550
550
  addBehavior: function(selector, handler) {
551
551
  var self = this
552
552
  behavior = {}
@@ -556,12 +556,12 @@ HoboBehavior = Class.create({
556
556
  }
557
557
  Event.addBehavior(behavior)
558
558
  }
559
-
559
+
560
560
  })
561
561
 
562
562
 
563
563
  HoboInputMany = {
564
-
564
+
565
565
  events: {
566
566
  "> li > div.buttons": {
567
567
  ".add-item:click": 'addOne',
@@ -598,12 +598,12 @@ HoboInputMany = {
598
598
 
599
599
  createSortable: function() {
600
600
  Sortable.create(this.id, {
601
- constraint: 'vertical',
602
- handle: 'ordering-handle',
603
- overlap: 'vertical',
601
+ constraint: 'vertical',
602
+ handle: 'ordering-handle',
603
+ overlap: 'vertical',
604
604
  scroll: 'window',
605
605
  onUpdate: function(list) {
606
- HoboInputMany.fixIndices.call(list);
606
+ HoboInputMany.fixIndices.call(list);
607
607
  }
608
608
  });
609
609
  },
@@ -618,7 +618,7 @@ HoboInputMany = {
618
618
  var id_sub = id_prefix + '_' + new_index.toString();
619
619
  var class_re = RegExp(RegExp.escape(name_prefix)+ "\[\-?[0-9]+\]");
620
620
  var class_sub = name_sub;
621
-
621
+
622
622
  return function() {
623
623
  if(this.name) {
624
624
  this.name = this.name.replace(name_re, name_sub);
@@ -645,9 +645,9 @@ HoboInputMany = {
645
645
  return Number(this.id.match(/_([-0-9]+)$/)[1]);
646
646
  },
647
647
 
648
- /* 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.
649
649
 
650
- this: element to recurse on.
650
+ this: element to recurse on.
651
651
  klass: class to filter on
652
652
  f: function to invoke
653
653
  */
@@ -737,7 +737,7 @@ HoboInputMany = {
737
737
  li.childWithClass("buttons").childWithClass("remove-item").removeClassName("hidden");
738
738
  li.childWithClass("buttons").childWithClass("add-item").addClassName("hidden");
739
739
  }
740
-
740
+
741
741
  return;
742
742
  },
743
743
 
@@ -757,10 +757,10 @@ HoboInputMany = {
757
757
  // rename everybody from me onwards
758
758
  var i=this.getIndex.call(li)
759
759
  var n=li.next();
760
- for(; n; i+=1, n=n.next()) {
760
+ for(; n; i+=1, n=n.next()) {
761
761
  var name_updater = this.getNameUpdater.call(ul, i);
762
762
  HoboInputMany.recurse_elements_with_class.call(n, null, function(el) {name_updater.call(el);});
763
- }
763
+ }
764
764
 
765
765
  // adjust +/- buttons on the button element as appropriate
766
766
  var last=ul.childElements()[ul.childElements().length-1];
@@ -783,7 +783,7 @@ HoboInputMany = {
783
783
 
784
784
  new Effect.BlindUp(li, { duration: 0.3, afterFinish: function (ef) {
785
785
  ul.fire("rapid:change")
786
- li.remove()
786
+ li.remove()
787
787
  } });
788
788
 
789
789
  }
@@ -791,7 +791,7 @@ HoboInputMany = {
791
791
 
792
792
 
793
793
  }
794
-
794
+
795
795
  new HoboBehavior("ul.input-many", HoboInputMany);
796
796
 
797
797
 
@@ -803,7 +803,7 @@ SelectManyInput = Behavior.create({
803
803
  },
804
804
 
805
805
  addOne : function() {
806
- var select = this.element.down('select')
806
+ var select = this.element.down('select')
807
807
  var selected = select.options[select.selectedIndex]
808
808
  if ($F(select) != "") {
809
809
  var newItem = $(DOM.Builder.fromHTML(this.element.down('.item-proto').innerHTML.strip()))
@@ -827,13 +827,13 @@ SelectManyInput = Behavior.create({
827
827
 
828
828
  removeOne : function(el) {
829
829
  var element = this.element
830
- new Effect.BlindUp(el,
830
+ new Effect.BlindUp(el,
831
831
  { duration: 0.3,
832
- afterFinish: function (ef) {
833
- ef.element.remove()
832
+ afterFinish: function (ef) {
833
+ ef.element.remove()
834
834
  element.fire("rapid:remove", { element: el })
835
835
  element.fire("rapid:change", { element: el })
836
- } } )
836
+ } } )
837
837
  var label = el.down('span').innerHTML
838
838
  var optgroup = element.down("optgroup[label="+label+"]")
839
839
  var option = new Element("option", {value:optgroup.readAttribute("alt")})
@@ -846,7 +846,7 @@ SelectManyInput = Behavior.create({
846
846
  },
847
847
 
848
848
  hiddenField: function(item) {
849
- return item.down('input[type=hidden]')
849
+ return item.down('input[type=hidden]')
850
850
  //return item.getElementsByClassName("hidden-field")[0]
851
851
  }
852
852
 
@@ -855,7 +855,7 @@ SelectManyInput = Behavior.create({
855
855
 
856
856
  NameManyInput = Object.extend(SelectManyInput, {
857
857
  addOne : function() {
858
- var select = this.element.down('select')
858
+ var select = this.element.down('select')
859
859
  var selected = select.options[select.selectedIndex]
860
860
  if (selected.value != "") {
861
861
  var newItem = $(DOM.Builder.fromHTML(this.element.down('.item-proto').innerHTML.strip()))
@@ -869,10 +869,10 @@ NameManyInput = Object.extend(SelectManyInput, {
869
869
  }
870
870
  })
871
871
 
872
-
872
+
873
873
  AutocompleteBehavior = Behavior.create({
874
874
  initialize : function() {
875
- this.minChars = parseInt(Hobo.getClassData(this.element, "min-chars"));
875
+ this.minChars = parseInt(Hobo.getClassData(this.element, "min-chars"));
876
876
  var match = this.element.className.match(/complete-on::([\S]+)/)
877
877
  var target = match[1].split('::')
878
878
  var typedId = target[0]
@@ -881,9 +881,9 @@ AutocompleteBehavior = Behavior.create({
881
881
  var spec = Hobo.parseModelSpec(typedId)
882
882
  var url = urlBase + "/" + Hobo.pluralise(spec.name) + "/complete_" + completer
883
883
  var parameters = spec.id ? "id=" + spec.id : ""
884
- this.autocompleter = new Ajax.Autocompleter(this.element,
885
- this.element.next('.completions-popup'),
886
- url,
884
+ this.autocompleter = new Ajax.Autocompleter(this.element,
885
+ this.element.next('.completions-popup'),
886
+ url,
887
887
  {paramName:'query', method:'get', parameters: parameters, minChars: this.minChars,
888
888
  afterUpdateElement: this.afterUpdateElement});
889
889
  },
@@ -893,7 +893,7 @@ AutocompleteBehavior = Behavior.create({
893
893
  this.element.value = '';
894
894
  this.element.removeClassName("nil-value");
895
895
  }
896
- if(this.minChars==0) {
896
+ if(this.minChars==0) {
897
897
  this.autocompleter.activate();
898
898
  }
899
899
  },
@@ -901,14 +901,14 @@ AutocompleteBehavior = Behavior.create({
901
901
  afterUpdateElement: function(input, li) {
902
902
  input.fire("rapid:autocomplete-assigned");
903
903
  }
904
-
904
+
905
905
  })
906
906
 
907
907
 
908
908
 
909
909
  Event.addBehavior.reassignAfterAjax = true;
910
910
  Event.addBehavior({
911
-
911
+
912
912
  'div.section-group' : function() {
913
913
  if (Prototype.Browser.IE) Hobo.fixSectionGroup(this);
914
914
  },
@@ -923,7 +923,7 @@ Event.addBehavior({
923
923
  var paramName = this.getAttribute('name')
924
924
  var params = {}
925
925
  var remove = [ 'page' ]
926
- if ($F(this) == '') {
926
+ if ($F(this) == '') {
927
927
  remove.push(paramName)
928
928
  } else {
929
929
  params[paramName] = $F(this)
@@ -953,10 +953,10 @@ Event.addBehavior({
953
953
  if (Hobo.makeInPlaceHtmlEditor) {
954
954
  Hobo.makeInPlaceHtmlEditor(this)
955
955
  } else {
956
- var options = {
956
+ var options = {
957
957
  rows: 2, handleLineBreaks: false, okButton: true, cancelLink: true, okText: "Save", submitOnBlur: false
958
958
  }
959
- var ipe = Hobo._makeInPlaceEditor(this, options)
959
+ var ipe = Hobo._makeInPlaceEditor(this, options)
960
960
  ipe.getText = function() {
961
961
  // Be careful! we're not calling unescapeHTML() here!
962
962
  return this.element.innerHTML
@@ -970,7 +970,7 @@ Event.addBehavior({
970
970
  Hobo.ajaxSetFieldForElement(el, $F(el))
971
971
  }
972
972
  },
973
-
973
+
974
974
  "input.live-search[type=search]" : function(e) {
975
975
  var element = this
976
976
  new Form.Element.Observer(element, 1.0, function() { Hobo.doSearch(element) })
@@ -980,23 +980,23 @@ Event.addBehavior({
980
980
  });
981
981
 
982
982
  ElementSet = Class.create(Enumerable, {
983
-
983
+
984
984
  initialize: function(array) {
985
985
  this.items = array
986
986
  },
987
-
987
+
988
988
  _each: function(fn) {
989
989
  return this.items.each(fn)
990
990
  },
991
-
991
+
992
992
  selectChildren: function(selector) {
993
993
  return new ElementSet(this.items.invoke('selectChildren', selector).pluck('items').flatten())
994
994
  },
995
-
995
+
996
996
  child: function(selector) {
997
997
  return this.selectChildren(selector).first()
998
998
  },
999
-
999
+
1000
1000
  select: function(selector) {
1001
1001
  return new ElementSet(this.items.invoke('select', selector).flatten())
1002
1002
  },
@@ -1008,11 +1008,11 @@ ElementSet = Class.create(Enumerable, {
1008
1008
  }
1009
1009
  return null
1010
1010
  },
1011
-
1011
+
1012
1012
  size: function() {
1013
1013
  return this.items.length
1014
1014
  },
1015
-
1015
+
1016
1016
  first: function() {
1017
1017
  return this.items.first()
1018
1018
  },
@@ -1020,7 +1020,7 @@ ElementSet = Class.create(Enumerable, {
1020
1020
  last: function() {
1021
1021
  return this.items.last()
1022
1022
  }
1023
-
1023
+
1024
1024
  })
1025
1025
 
1026
1026
  Element.addMethods({