bhf 0.8.0 → 0.8.2

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 (119) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +1 -1
  4. data/VERSION +1 -1
  5. data/app/assets/images/bhf/pictos.png +0 -0
  6. data/app/assets/images/bhf/pictos_2x.png +0 -0
  7. data/app/assets/javascripts/bhf/application.js +153 -116
  8. data/app/assets/javascripts/bhf/classes/ArrayFields.js +1 -1
  9. data/app/assets/javascripts/bhf/classes/MultipleFields.js +2 -2
  10. data/app/assets/javascripts/bhf/classes/PlatformHelper.js +6 -11
  11. data/app/assets/javascripts/bhf/classes/{AjaxEdit.js → QuickEdit.js} +9 -9
  12. data/app/assets/javascripts/bhf/classes/{AjaxEditStack.js → QuickEditStack.js} +4 -20
  13. data/app/assets/javascripts/bhf/mootools-core-1.5.0-full-compat.js +1 -0
  14. data/app/assets/javascripts/bhf/mootools_ujs.js +11 -11
  15. data/app/assets/stylesheets/bhf/application.css.sass +86 -48
  16. data/app/controllers/bhf/application_controller.rb +8 -4
  17. data/app/controllers/bhf/embed_entries_controller.rb +2 -6
  18. data/app/controllers/bhf/entries_controller.rb +13 -16
  19. data/app/controllers/bhf/pages_controller.rb +14 -13
  20. data/app/helpers/bhf/application_helper.rb +6 -6
  21. data/app/helpers/bhf/entries_helper.rb +4 -2
  22. data/app/helpers/bhf/pages_helper.rb +0 -4
  23. data/app/views/bhf/entries/_form.haml +7 -4
  24. data/app/views/bhf/entries/show.haml +3 -4
  25. data/app/views/bhf/form/belongs_to/_radio.haml +28 -0
  26. data/app/views/bhf/form/belongs_to/_select.haml +21 -0
  27. data/app/views/bhf/form/belongs_to/_static.haml +1 -0
  28. data/app/views/bhf/{entries/form → form}/column/_array.haml +0 -0
  29. data/app/views/bhf/{entries/form → form}/column/_boolean.haml +0 -0
  30. data/app/views/bhf/{entries/form → form}/column/_date.haml +0 -0
  31. data/app/views/bhf/{entries/form → form}/column/_hash.haml +0 -0
  32. data/app/views/bhf/{entries/form → form}/column/_mappin.haml +0 -0
  33. data/app/views/bhf/{entries/form → form}/column/_markdown.haml +0 -0
  34. data/app/views/bhf/{entries/form → form}/column/_multiple_fields.haml +0 -0
  35. data/app/views/bhf/{entries/form → form}/column/_number.haml +0 -0
  36. data/app/views/bhf/{entries/form → form}/column/_paperclip.haml +0 -0
  37. data/app/views/bhf/{entries/form → form}/column/_password.haml +0 -0
  38. data/app/views/bhf/{entries/form → form}/column/_static.haml +0 -0
  39. data/app/views/bhf/{entries/form → form}/column/_string.haml +0 -0
  40. data/app/views/bhf/{entries/form → form}/column/_text.haml +0 -0
  41. data/app/views/bhf/{entries/form → form}/column/_wysiwyg.haml +0 -0
  42. data/app/views/bhf/form/embeds_many/_static.haml +26 -0
  43. data/app/views/bhf/form/embeds_one/_static.haml +2 -0
  44. data/app/views/bhf/form/has_and_belongs_to_many/_check_box.haml +22 -0
  45. data/app/views/bhf/form/has_and_belongs_to_many/_static.haml +1 -0
  46. data/app/views/bhf/form/has_many/_static.haml +26 -0
  47. data/app/views/bhf/form/has_one/_static.haml +2 -0
  48. data/app/views/bhf/helper/_definition_item.haml +1 -1
  49. data/app/views/bhf/helper/_frontend_edit.haml +1 -1
  50. data/app/views/bhf/pages/_platform.haml +39 -16
  51. data/app/views/bhf/{pages/macro → table}/belongs_to/_default.haml +1 -1
  52. data/app/views/bhf/table/column/_array.haml +1 -0
  53. data/app/views/bhf/table/column/_boolean.haml +1 -0
  54. data/app/views/bhf/table/column/_date.haml +1 -0
  55. data/app/views/bhf/table/column/_extern_link.haml +2 -0
  56. data/app/views/bhf/table/column/_file.haml +1 -0
  57. data/app/views/bhf/table/column/_hash.haml +1 -0
  58. data/app/views/bhf/table/column/_image.haml +1 -0
  59. data/app/views/bhf/table/column/_number.haml +1 -0
  60. data/app/views/bhf/table/column/_paperclip.haml +5 -0
  61. data/app/views/bhf/table/column/_primary_key.haml +1 -0
  62. data/app/views/bhf/table/column/_string.haml +1 -0
  63. data/app/views/bhf/table/column/_text.haml +1 -0
  64. data/app/views/bhf/table/embeds_many/_default.haml +1 -0
  65. data/app/views/bhf/table/embeds_one/_default.haml +1 -0
  66. data/app/views/bhf/table/has_and_belongs_to_many/_default.haml +1 -0
  67. data/app/views/bhf/table/has_many/_default.haml +2 -0
  68. data/app/views/bhf/{pages/macro → table}/has_one/_default.haml +1 -1
  69. data/bhf.gemspec +60 -59
  70. data/config/locales/de.yml +8 -8
  71. data/config/locales/en.yml +7 -7
  72. data/lib/bhf.rb +26 -21
  73. data/lib/bhf/action_view/form_builder.rb +36 -0
  74. data/lib/bhf/action_view/form_options.rb +30 -0
  75. data/lib/bhf/active_record/base.rb +58 -0
  76. data/lib/bhf/mongoid/document.rb +135 -137
  77. data/lib/bhf/platform/attribute/abstract.rb +52 -0
  78. data/lib/bhf/platform/attribute/column.rb +78 -0
  79. data/lib/bhf/platform/attribute/reflection.rb +68 -0
  80. data/lib/bhf/platform/base.rb +333 -0
  81. data/lib/bhf/{pagination.rb → platform/pagination.rb} +1 -1
  82. data/lib/bhf/{settings.rb → settings/base.rb} +14 -11
  83. data/lib/bhf/settings/platform.rb +20 -0
  84. data/lib/bhf/settings/yaml_parser.rb +84 -0
  85. data/lib/rails/generators/bhf/templates/initializer.rb +1 -1
  86. metadata +58 -57
  87. data/app/views/bhf/entries/form/belongs_to/_account_scope.haml +0 -2
  88. data/app/views/bhf/entries/form/belongs_to/_radio.haml +0 -8
  89. data/app/views/bhf/entries/form/belongs_to/_select.haml +0 -7
  90. data/app/views/bhf/entries/form/belongs_to/_static.haml +0 -1
  91. data/app/views/bhf/entries/form/embeds_many/_static.haml +0 -12
  92. data/app/views/bhf/entries/form/embeds_one/_static.haml +0 -12
  93. data/app/views/bhf/entries/form/has_and_belongs_to_many/_account_scope.haml +0 -2
  94. data/app/views/bhf/entries/form/has_and_belongs_to_many/_check_box.haml +0 -5
  95. data/app/views/bhf/entries/form/has_and_belongs_to_many/_static.haml +0 -1
  96. data/app/views/bhf/entries/form/has_many/_static.haml +0 -12
  97. data/app/views/bhf/entries/form/has_one/_account_scope.haml +0 -2
  98. data/app/views/bhf/entries/form/has_one/_static.haml +0 -9
  99. data/app/views/bhf/pages/macro/column/_array.haml +0 -1
  100. data/app/views/bhf/pages/macro/column/_boolean.haml +0 -1
  101. data/app/views/bhf/pages/macro/column/_date.haml +0 -1
  102. data/app/views/bhf/pages/macro/column/_extern_link.haml +0 -2
  103. data/app/views/bhf/pages/macro/column/_file.haml +0 -1
  104. data/app/views/bhf/pages/macro/column/_hash.haml +0 -1
  105. data/app/views/bhf/pages/macro/column/_image.haml +0 -2
  106. data/app/views/bhf/pages/macro/column/_number.haml +0 -1
  107. data/app/views/bhf/pages/macro/column/_paperclip.haml +0 -6
  108. data/app/views/bhf/pages/macro/column/_primary_key.haml +0 -1
  109. data/app/views/bhf/pages/macro/column/_string.haml +0 -1
  110. data/app/views/bhf/pages/macro/column/_text.haml +0 -1
  111. data/app/views/bhf/pages/macro/embeds_many/_default.haml +0 -1
  112. data/app/views/bhf/pages/macro/embeds_one/_default.haml +0 -1
  113. data/app/views/bhf/pages/macro/has_and_belongs_to_many/_default.haml +0 -1
  114. data/app/views/bhf/pages/macro/has_many/_default.haml +0 -2
  115. data/lib/bhf/active_record/active_record.rb +0 -59
  116. data/lib/bhf/data.rb +0 -169
  117. data/lib/bhf/form.rb +0 -36
  118. data/lib/bhf/platform.rb +0 -308
  119. data/lib/bhf/settings_parser.rb +0 -84
@@ -10,7 +10,7 @@ var ArrayFields = new Class({
10
10
  var template = elem.getElement('input').clone().erase('value');
11
11
  var currentNr = 0;
12
12
 
13
- new Element('span.add_field', {text: '+'})
13
+ new Element('span.plus_button.qe_button.default_form_align', {text: '+'})
14
14
  .inject(elem)
15
15
  .addEvent('click', function(e){
16
16
  var newInput = template.clone();
@@ -21,7 +21,7 @@ var MultipleFields = new Class({
21
21
 
22
22
  elem.set('type', 'hidden');
23
23
 
24
- new Element('span.add_field', {text: '+'})
24
+ new Element('span.plus_button.qe_button.default_form_align', {text: '+'})
25
25
  .inject(elem, 'after')
26
26
  .addEvent('click', function(e){
27
27
  this.addField(elem, template);
@@ -45,6 +45,6 @@ var MultipleFields = new Class({
45
45
  });
46
46
  elem.set('value', values.join(this.options.spliter));
47
47
  }.bind(this))
48
- .inject(elem.getParent('.input').getElement('.add_field'), 'before');
48
+ .inject(elem.getParent('.input').getElement('.plus_button'), 'before');
49
49
  }
50
50
  });
@@ -23,7 +23,7 @@ var PlatformHelper = new Class({
23
23
  if (hidden_search) {
24
24
  hidden_search.destroy();
25
25
  }
26
- new Request.HTML({
26
+ var request = new Request.HTML({
27
27
  method: 'get',
28
28
  url: e.target.get('action'),
29
29
  onFailure: function(){
@@ -31,7 +31,7 @@ var PlatformHelper = new Class({
31
31
  },
32
32
  onSuccess: function(a, b, html){
33
33
  scope.innerHTML = html;
34
- _this.fireEvent('searchSuccess')
34
+ _this.fireEvent('searchSuccess', [request])
35
35
  }
36
36
  }).send({data: e.target});
37
37
  });
@@ -45,15 +45,10 @@ var PlatformHelper = new Class({
45
45
  this.removeClass('clicked');
46
46
  }.bind(this), 1500);
47
47
  });
48
- scope.getElements('.delete').addEvent('click', function(e){
49
- e.target.addEvents({
50
- 'ajax:success': function(html){
51
- this.getParent('tr').dispose();
52
- },
53
- 'ajax:failure': function(html){
54
- alert(Locale.get('Notifications.failure'));
55
- }
56
- });
48
+ scope.getElements('.js_delete').addEvent('mouseenter', function(){
49
+ this.getParent('tr').addClass('background_delete');
50
+ }).addEvent('mouseleave', function(){
51
+ this.getParent('tr').removeClass('background_delete');
57
52
  });
58
53
  }
59
54
  });
@@ -1,4 +1,4 @@
1
- var AjaxEdit = new Class({
1
+ var QuickEdit = new Class({
2
2
  version: 0.2,
3
3
 
4
4
  options: {
@@ -13,9 +13,9 @@ var AjaxEdit = new Class({
13
13
  this.holder = new Element('div.quick_edit_holder');
14
14
  },
15
15
 
16
- startEdit: function(element, wrapElement){
17
- this.wrapElement = wrapElement ? wrapElement : element;
18
- this.newEntry = this.wrapElement.hasClass('add_field');
16
+ startEdit: function(element){
17
+ this.linkElem = element;
18
+ this.newEntry = this.linkElem.hasClass('js_add_field');
19
19
 
20
20
  this.fireEvent('startRequest');
21
21
  this.currentRequest = new Request.HTML({
@@ -33,7 +33,7 @@ var AjaxEdit = new Class({
33
33
  nextElem.addClass('hide');
34
34
  }
35
35
 
36
- window.fireEvent('quickEditReady', [this.holder]);
36
+ window.fireEvent('quickEditFormInject', [this.holder]);
37
37
  }.bind(this)
38
38
  }).send();
39
39
  },
@@ -51,7 +51,7 @@ var AjaxEdit = new Class({
51
51
  }.bind(this),
52
52
  onFailure: function(invalidForm){
53
53
  this.injectForm(invalidForm.response);
54
- window.fireEvent('quickEditReady', [this.holder]);
54
+ window.fireEvent('quickEditFormInject', [this.holder]);
55
55
  }.bind(this),
56
56
  onSuccess: function(json){
57
57
  if ( ! eventNames.contains('successAndNext')) {
@@ -60,11 +60,11 @@ var AjaxEdit = new Class({
60
60
  eventNames.each(function(eventName){
61
61
  this.fireEvent(eventName, [json]);
62
62
  }.bind(this));
63
- this.fireEvent('save');
63
+ this.fireEvent('save', [eventNames, this.linkElem, json]);
64
64
  }.bind(this)
65
65
  }).send({data: form});
66
66
  },
67
-
67
+
68
68
  disableButtons: function(){
69
69
  this.holder.getElements('.open, .cancel, .save_and_next, .save').set('disabled', 'disabled');
70
70
  },
@@ -82,7 +82,7 @@ var AjaxEdit = new Class({
82
82
 
83
83
  this.holder.getElements('.open').addEvent('click', function(e){
84
84
  e.preventDefault();
85
- Turbolinks.visit((this.wrapElement.getElement('a') || this.wrapElement).get('href'));
85
+ Turbolinks.visit((this.linkElem.getElement('a') || this.linkElem).get('href'));
86
86
  }.bind(this));
87
87
  this.holder.getElements('.cancel').addEvent('click', function(e){
88
88
  e.preventDefault();
@@ -1,4 +1,4 @@
1
- var AjaxEditStack = new Class({
1
+ var QuickEditStack = new Class({
2
2
  version: 0.1,
3
3
 
4
4
  options: {
@@ -15,7 +15,7 @@ var AjaxEditStack = new Class({
15
15
  var qi = this.bricksIndex;
16
16
  var qe = this.bricksArray[qi];
17
17
  if ( ! qe) {
18
- qe = new AjaxEdit(editOptions);
18
+ qe = new QuickEdit(editOptions);
19
19
  this.bricksArray.push(qe);
20
20
  }
21
21
 
@@ -28,24 +28,8 @@ var AjaxEditStack = new Class({
28
28
  }
29
29
  });
30
30
 
31
- qe.addEvents({
32
- startRequest: function(){
33
- this.wrapElement.addClass('live_edit');
34
- setTimeout(function(){
35
- this.wrapElement.addClass('live_edit');
36
- }.bind(this), 10);
37
- },
38
- closed: function(){
39
- this.wrapElement.addClass('animate');
40
- setTimeout(function(){
41
- this.wrapElement.removeClass('live_edit');
42
- }.bind(this));
43
- setTimeout(function(){
44
- this.wrapElement.removeClass('animate');
45
- }.bind(this), 600);
46
- }
47
- });
48
- qe.startEdit(link, linkParent);
31
+ qe.addEvents(this.options.permanentQuickEditEvents);
32
+ qe.startEdit(link);
49
33
  },
50
34
  addStack: function(){
51
35
  this.bricksIndex = this.bricksIndex + 1;
@@ -6029,6 +6029,7 @@ var Request = this.Request = new Class({
6029
6029
  }, this);
6030
6030
 
6031
6031
  this.fireEvent('request');
6032
+ this.url = url;
6032
6033
  xhr.send(data);
6033
6034
  if (!this.options.async) this.onStateChange();
6034
6035
  else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this);
@@ -17,18 +17,18 @@ provides:
17
17
  ...
18
18
  */
19
19
 
20
- window.addEvent('domready', function(){
20
+ (function($){
21
+ var domReadyCallback = function(){
22
+ rails.csrf = {
23
+ token: rails.getCsrf('token'),
24
+ param: rails.getCsrf('param')
25
+ };
21
26
 
22
- rails.csrf = {
23
- token: rails.getCsrf('token'),
24
- param: rails.getCsrf('param')
27
+ rails.applyEvents();
25
28
  };
26
-
27
- // rails.applyEvents();
28
- });
29
+ window.addEvent('domready', domReadyCallback);
30
+ document.addEventListener('page:load', domReadyCallback);
29
31
 
30
- (function($){
31
-
32
32
  window.rails = {
33
33
  /**
34
34
  * If el is passed as argument, events will only be applied to
@@ -37,7 +37,7 @@ window.addEvent('domready', function(){
37
37
  applyEvents: function(el){
38
38
  el = $(el || document.body);
39
39
  var apply = function(selector, action, callback){
40
- el.getElements(selector).addEvent(action, callback);
40
+ el.addEvent(action + ':relay(' + selector + ')', callback);
41
41
  };
42
42
 
43
43
  apply('form[data-remote="true"]', 'submit', rails.handleRemote);
@@ -157,4 +157,4 @@ window.addEvent('domready', function(){
157
157
 
158
158
  });
159
159
 
160
- })(document.id);
160
+ })(document.id);
@@ -126,6 +126,7 @@ header
126
126
  border-color: transparent
127
127
  background: transparent
128
128
 
129
+
129
130
  .font_size_bigger
130
131
  font-size: 1.2em
131
132
 
@@ -209,7 +210,7 @@ header
209
210
  .group
210
211
  margin-top: 0
211
212
  margin-bottom: 10px
212
- margin-left: 20px
213
+ margin-left: 14px
213
214
  padding: 0
214
215
  button
215
216
  border: none
@@ -239,6 +240,8 @@ header
239
240
  float: right
240
241
  margin-top: 10px
241
242
  margin-right: 10px
243
+ &.cancel:hover
244
+ background: $r1
242
245
  &.save
243
246
  margin-right: 16px
244
247
 
@@ -377,6 +380,9 @@ table.data_table
377
380
  &.live_edit td
378
381
  background: $b2
379
382
  border-bottom-color: $b2
383
+ &.background_delete td
384
+ background: $r1
385
+ border-bottom-color: $r1
380
386
  &.dragged
381
387
  td
382
388
  opacity: 0.4
@@ -460,6 +466,10 @@ table.data_table
460
466
  min-height: 20px
461
467
  padding-top: 5px
462
468
 
469
+ .quick_edit_holder
470
+ .error_explanation
471
+ margin-left: 0
472
+
463
473
  form
464
474
  .node
465
475
  display: table-row
@@ -482,7 +492,24 @@ form
482
492
  color: $g6
483
493
  .field_with_errors
484
494
  color: $r1
495
+ .select_input
496
+ .quick_edit.js_edit_field,
497
+ .qe_delete.js_delete
498
+ margin-left: 10px
499
+ .plus_button
500
+ margin-left: 20px
501
+ .icon.edit
502
+ position: relative
503
+ top: -2px
504
+ background-position: 0 -150px
505
+ &.live_edit,
506
+ &:hover
507
+ background-position: 0 -200px
508
+
485
509
  .input
510
+ input[type="file"]
511
+ display: block
512
+ padding: 3px 0 6px 0
486
513
  input[type="password"],
487
514
  input[type="text"],
488
515
  .uploaded_image,
@@ -551,52 +578,12 @@ form
551
578
  color: $b1
552
579
  .warning
553
580
  font-weight: bold
554
- .add_field,
555
- .relation .quick_edit
556
- color: $b1
557
- text-decoration: none
558
- border: 2px solid $b1
559
- background: white
560
- padding: 3px 4px
561
- border-radius: 4px
562
- margin-left: -6px
563
- display: inline-block
564
- margin-bottom: 8px
565
- &:hover
566
- color: white
567
- background-color: $b1
568
- &.live_edit
569
- color: white
570
- background-color: $b2
571
- border-color: $b2
572
- &.animate
573
- +transition-duration(.3)
574
- .add_field
575
- font-size: 20px
576
- font-weight: bold
577
- padding: 0 8px 6px 8px
578
- line-height: 20px
579
- cursor: pointer
580
- .relation
581
- li
582
- &:hover
583
- .delete
584
- opacity: 1
585
- +transition-duration(0.5)
586
- .delete
587
- opacity: 0
588
- font-size: 20px
589
- font-weight: bold
590
- padding: 0 8px 6px 8px
591
- line-height: 20px
592
- &:hover
593
- color: $r1
594
581
 
595
582
  input[type="submit"]
596
583
  margin-right: 20px
597
584
  input[type="submit"].alt_button
598
585
  background: $w1
599
- color: $b1
586
+ color: $g5
600
587
  font-weight: normal
601
588
  +transition-duration(0)
602
589
  &:active,
@@ -605,15 +592,14 @@ form
605
592
  .cancel
606
593
  color: $g5
607
594
  &:hover
608
- color: $g6
609
- text-decoration: underline
595
+ color: $r1
610
596
  .info
611
597
  font-style: italic
612
598
  font-size: 12px
613
599
  color: $g6
614
600
  a
615
601
  text-decoration: underline
616
-
602
+
617
603
  .error_explanation
618
604
  margin-left: 20px
619
605
  label
@@ -623,6 +609,57 @@ form
623
609
  &:hover
624
610
  color: $orange
625
611
 
612
+ .qe_button
613
+ text-decoration: none
614
+ background: white
615
+ padding: 3px 6px
616
+ border-radius: 4px
617
+ display: inline-block
618
+ margin-bottom: 8px
619
+ &:hover
620
+ color: white
621
+ background-color: $b1
622
+ &.live_edit
623
+ color: white
624
+ background-color: $b2
625
+ border-color: $b2
626
+ &.animate
627
+ +transition-duration(.3)
628
+ &.plus_button
629
+ font-size: 20px
630
+ font-weight: bold
631
+ padding: 0 8px 6px 8px
632
+ line-height: 20px
633
+ cursor: pointer
634
+
635
+ .default_form_align
636
+ margin-left: -6px
637
+
638
+ a
639
+ &[href='null'],
640
+ &[href='']
641
+ opacity: 0.3
642
+ pointer-events: none
643
+
644
+ .relation
645
+ margin-left: -6px
646
+ input
647
+ margin-right: 5px
648
+ li:hover
649
+ .qe_delete
650
+ opacity: 1
651
+ //+transition-duration(0.5)
652
+ .qe_delete
653
+ opacity: 0
654
+
655
+ .qe_delete
656
+ font-size: 20px
657
+ font-weight: bold
658
+ padding: 0 8px 6px 8px
659
+ line-height: 20px
660
+ &:hover
661
+ color: $r1
662
+
626
663
 
627
664
  footer
628
665
  padding: 20px 0 60px 0
@@ -971,7 +1008,7 @@ input[type="submit"].alt_button,
971
1008
  z-index: 4000
972
1009
  +border-bottom-radius(4)
973
1010
  background: $b1 image-url('bhf/ajax_loader.gif') no-repeat center 16px
974
- +box-shadow(0, 1, 4)
1011
+ +box-shadow(0, 3, 8, #333)
975
1012
  +transition-duration(0.6)
976
1013
  &.loading
977
1014
  height: 100px
@@ -1072,7 +1109,8 @@ input[type="submit"].alt_button,
1072
1109
  border: 1px solid transparent
1073
1110
  &:hover
1074
1111
  border-color: $g4
1075
-
1112
+ &:active
1113
+ border-color: $b2
1076
1114
 
1077
1115
  .wmd-spacer
1078
1116
  width: 1px
@@ -1139,4 +1177,4 @@ input[type="submit"].alt_button,
1139
1177
  @media screen and (-webkit-min-device-pixel-ratio: 1.5), screen and (min--moz-device-pixel-ratio: 1.5), screen and (min-device-pixel-ratio: 1.5)
1140
1178
  .icon
1141
1179
  background-image: image-url('bhf/pictos_2x.png')
1142
- background-size: 440px 152px
1180
+ background-size: 440px 260px
@@ -1,6 +1,6 @@
1
1
  class Bhf::ApplicationController < ActionController::Base
2
2
 
3
- before_filter :init_time, :check_admin_account, :setup_current_account, :load_config, :set_title, :set_areas
3
+ before_filter :init_time, :check_admin_account, :setup_current_account, :load_settings, :set_title, :set_areas
4
4
 
5
5
  helper_method :current_account
6
6
  layout 'bhf/application'
@@ -50,8 +50,9 @@ class Bhf::ApplicationController < ActionController::Base
50
50
  end
51
51
  end
52
52
 
53
- def load_config
54
- @settings = Bhf::SettingsParser::parse(get_account_roles(params[:bhf_area]), params[:bhf_area])
53
+ def load_settings
54
+ yaml_parser = Bhf::Settings::YAMLParser.new(get_account_roles(params[:bhf_area]), params[:bhf_area])
55
+ @settings = Bhf::Settings::Base.new(yaml_parser.settings_hash, current_account)
55
56
  end
56
57
 
57
58
  def set_title
@@ -95,7 +96,10 @@ class Bhf::ApplicationController < ActionController::Base
95
96
  def init_time
96
97
  @start_time = Time.now
97
98
  end
98
-
99
+
100
+ def find_platform(platform_name)
101
+ Bhf::Platform::Base.new(@settings.find_platform_settings(platform_name))
102
+ end
99
103
 
100
104
  def redirect_back_or_default(default, msg)
101
105
  redirect_to(params[:return_to] || default, flash: msg)