bhf 0.10.12 → 0.10.13

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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -1
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/bhf/application.js +26 -26
  5. data/app/assets/javascripts/bhf/classes/Ajaxify.js +4 -4
  6. data/app/assets/javascripts/bhf/classes/ArrayFields.js +3 -3
  7. data/app/assets/javascripts/bhf/classes/FormHelper.js +4 -4
  8. data/app/assets/javascripts/bhf/classes/MultipleFields.js +2 -2
  9. data/app/assets/javascripts/bhf/classes/PlatformHelper.js +2 -2
  10. data/app/assets/javascripts/bhf/classes/QuickEdit.js +18 -18
  11. data/app/assets/javascripts/bhf/classes/QuickEditStack.js +3 -3
  12. data/app/assets/javascripts/bhf/classes/Request_bhf.js +2 -3
  13. data/app/assets/javascripts/bhf/classes/Setlatlng.js +8 -9
  14. data/app/assets/javascripts/bhf/locales/Locale.de-DE.js +0 -1
  15. data/app/assets/javascripts/bhf/mootools_ujs.js +81 -26
  16. data/app/assets/stylesheets/bhf/application.css.sass +1 -1
  17. data/app/controllers/bhf/embed_entries_controller.rb +3 -3
  18. data/app/controllers/bhf/entries_controller.rb +17 -15
  19. data/app/controllers/bhf/pages_controller.rb +3 -3
  20. data/app/helpers/bhf/application_helper.rb +2 -2
  21. data/app/helpers/bhf/entries_helper.rb +6 -6
  22. data/app/helpers/bhf/frontend_helper.rb +3 -3
  23. data/app/helpers/bhf/pages_helper.rb +5 -5
  24. data/app/views/bhf/entries/_form.html.haml +4 -4
  25. data/app/views/bhf/entries/_validation_errors.html.haml +1 -1
  26. data/app/views/bhf/entries/edit.html.haml +1 -1
  27. data/app/views/bhf/entries/new.html.haml +1 -1
  28. data/app/views/bhf/form/belongs_to/_radio.html.haml +5 -5
  29. data/app/views/bhf/form/belongs_to/_select.html.haml +3 -3
  30. data/app/views/bhf/form/column/_boolean.html.haml +1 -1
  31. data/app/views/bhf/form/column/_date.html.haml +1 -1
  32. data/app/views/bhf/form/column/_hash.html.haml +1 -1
  33. data/app/views/bhf/form/column/_hidden.html.haml +1 -1
  34. data/app/views/bhf/form/column/_markdown.html.haml +1 -1
  35. data/app/views/bhf/form/column/_multiple_fields.html.haml +1 -1
  36. data/app/views/bhf/form/column/_number.html.haml +1 -1
  37. data/app/views/bhf/form/column/_paperclip.html.haml +3 -3
  38. data/app/views/bhf/form/column/_password.html.haml +1 -1
  39. data/app/views/bhf/form/column/_static.html.haml +1 -1
  40. data/app/views/bhf/form/column/_string.html.haml +1 -1
  41. data/app/views/bhf/form/column/_text.html.haml +1 -1
  42. data/app/views/bhf/form/column/_wysiwyg.html.haml +1 -1
  43. data/app/views/bhf/form/embeds_many/_static.html.haml +3 -3
  44. data/app/views/bhf/form/has_and_belongs_to_many/_check_box.html.haml +3 -3
  45. data/app/views/bhf/form/has_and_belongs_to_many/_static.html.haml +1 -1
  46. data/app/views/bhf/form/has_many/_static.html.haml +1 -1
  47. data/app/views/bhf/helper/_field_errors.html.haml +1 -1
  48. data/app/views/bhf/helper/_flash.html.haml +1 -1
  49. data/app/views/bhf/helper/_frontend_edit.html.haml +1 -1
  50. data/app/views/bhf/helper/_info.html.haml +1 -1
  51. data/app/views/bhf/helper/_node.html.haml +1 -1
  52. data/app/views/bhf/pages/_platform.html.haml +2 -2
  53. data/app/views/bhf/pages/_search.html.haml +2 -4
  54. data/app/views/bhf/pages/show.html.haml +1 -1
  55. data/app/views/bhf/table/column/_array.html.haml +1 -1
  56. data/app/views/bhf/table/column/_boolean.html.haml +1 -1
  57. data/app/views/bhf/table/column/_date.html.haml +1 -1
  58. data/app/views/bhf/table/column/_empty.html.haml +1 -1
  59. data/app/views/bhf/table/column/_extern_link.html.haml +1 -1
  60. data/app/views/bhf/table/column/_file.html.haml +1 -1
  61. data/app/views/bhf/table/column/_hash.html.haml +1 -1
  62. data/app/views/bhf/table/column/_image.html.haml +1 -1
  63. data/app/views/bhf/table/column/_number.html.haml +1 -1
  64. data/app/views/bhf/table/column/_paperclip.html.haml +1 -1
  65. data/app/views/bhf/table/column/_primary_key.html.haml +1 -1
  66. data/app/views/bhf/table/column/_string.html.haml +1 -1
  67. data/app/views/bhf/table/column/_text.html.haml +1 -1
  68. data/app/views/bhf/table/column/{_thumbmail.haml → _thumbnail.html.haml} +0 -0
  69. data/app/views/bhf/table/column/_type.html.haml +1 -1
  70. data/app/views/bhf/table/embeds_many/_default.html.haml +1 -1
  71. data/app/views/bhf/table/embeds_one/_default.html.haml +1 -1
  72. data/app/views/bhf/table/has_and_belongs_to_many/_default.html.haml +1 -1
  73. data/app/views/bhf/table/has_many/_default.html.haml +1 -1
  74. data/app/views/bhf/table/has_one/_default.html.haml +1 -1
  75. data/app/views/layouts/bhf/application.haml +4 -5
  76. data/app/views/layouts/bhf/quick_edit.haml +1 -1
  77. data/bhf.gemspec +5 -6
  78. data/config/locales/de.yml +2 -2
  79. data/config/locales/en.yml +2 -2
  80. data/config/locales/pt.yml +2 -2
  81. data/config/routes.rb +5 -5
  82. data/lib/bhf/action_view/form_builder.rb +3 -3
  83. data/lib/bhf/action_view/form_options.rb +5 -5
  84. data/lib/bhf/active_record/base.rb +5 -5
  85. data/lib/bhf/mongoid/document.rb +8 -8
  86. data/lib/bhf/platform/attribute/abstract.rb +12 -12
  87. data/lib/bhf/platform/attribute/column.rb +4 -4
  88. data/lib/bhf/platform/attribute/reflection.rb +11 -11
  89. data/lib/bhf/platform/base.rb +14 -14
  90. data/lib/bhf/platform/pagination.rb +3 -3
  91. data/lib/bhf/settings/base.rb +4 -4
  92. data/lib/bhf/settings/platform.rb +4 -4
  93. data/lib/bhf/settings/yaml_parser.rb +1 -1
  94. data/lib/bhf.rb +5 -5
  95. data/lib/rails/generators/bhf/templates/initializer.rb +3 -3
  96. data/test/database.yml +2 -2
  97. data/test/test_helper.rb +4 -4
  98. metadata +4 -5
  99. data/Getting_Started.md +0 -32
@@ -1,4 +1,4 @@
1
- - data_source ||= field.link ? field.link.get_objects : field.reflection.klass.all
1
+ - data_source ||= field.link ? field.link.get_objects : field.reflection.klass.all
2
2
  = reflection_node f, field do
3
3
  .quick_edit_block
4
4
  %ul.relation.quick_edit_inject
@@ -17,6 +17,6 @@
17
17
  = link_to '{to_bhf_s}', edit_entry_path(field.link.name, '{object_id}'), class: 'js_edit_field qe_button quick_edit'
18
18
  - if field.link && ! field.link.hide_delete
19
19
  = link_to '×'.html_safe, entry_path(field.link.name, '{object_id}'), method: :delete, class: 'qe_delete js_delete', remote: true, data: {confirm: t('bhf.helpers.promts.confirm', platform_title: field.link.title_singular)}
20
-
20
+
21
21
  - if field.link && ! field.link.hide_create
22
- = link_to '+', new_entry_path(field.link.name), class: 'js_add_field plus_button qe_button quick_edit default_form_align'
22
+ = link_to '+', new_entry_path(field.link.name), class: 'js_add_field plus_button qe_button quick_edit default_form_align'
@@ -1 +1 @@
1
- = render partial: 'bhf/form/has_many/static', locals: {ref_objects: f.object.send(field.reflection.name), field: field, f: f}
1
+ = render partial: 'bhf/form/has_many/static', locals: {ref_objects: f.object.send(field.reflection.name), field: field, f: f}
@@ -23,4 +23,4 @@
23
23
  = link_to '×'.html_safe, entry_path(field.link.name, '{object_id}'), method: :delete, class: 'qe_delete js_delete', remote: true, data: {confirm: t('bhf.helpers.promts.confirm', platform_title: field.link.title_singular)}
24
24
 
25
25
  - if ! is_one && field.link && ! field.link.hide_create
26
- = link_to '+', new_entry_path(field.link.name), class: 'js_add_field plus_button qe_button quick_edit default_form_align'
26
+ = link_to '+', new_entry_path(field.link.name), class: 'js_add_field plus_button qe_button quick_edit default_form_align'
@@ -1,4 +1,4 @@
1
1
  - if f.field_has_errors?(field)
2
2
  %ul.errors
3
3
  - f.field_errors(field).each do |error|
4
- %li= error
4
+ %li= error
@@ -3,4 +3,4 @@
3
3
  #flash_massages.show
4
4
  %ul
5
5
  - f.each do |type, msg|
6
- %li{class: type}= msg.to_s.html_safe
6
+ %li{class: type}= msg.to_s.html_safe
@@ -1,4 +1,4 @@
1
1
  - link_title = t('bhf.helpers.entry.edit', platform_title: object.to_bhf_s)
2
2
 
3
3
  = link_to bhf.edit_entry_url(platform_name, object, {return_to: request.original_url}.merge(area ? {bhf_area: area} : {})), class: 'bhf_edit', data: {:'no-turbolink' => true}, title: link_title do
4
- = block ? block : link_title
4
+ = block ? block : link_title
@@ -1,2 +1,2 @@
1
1
  - unless info.blank?
2
- %p.info= info.html_safe
2
+ %p.info= info.html_safe
@@ -3,4 +3,4 @@
3
3
  .input
4
4
  = input
5
5
  = render partial: 'bhf/helper/field_errors', locals: {f: f, field: field.name}
6
- = render partial: 'bhf/helper/info', locals: {info: field.info}
6
+ = render partial: 'bhf/helper/info', locals: {info: field.info}
@@ -69,7 +69,7 @@
69
69
  - unless platform.hide_edit
70
70
  = link_to edit_t(platform), edit_link, class: 'icon edit'
71
71
  - unless platform.hide_delete
72
- = link_to delete_t(platform), entry_path(platform.name, object), method: :delete, remote: true, class: 'icon delete js_delete', data: {confirm: t('bhf.helpers.promts.confirm', platform_title: platform.title_singular.titleize)}
72
+ = link_to delete_t(platform), entry_path(platform.name, object), method: :delete, remote: true, class: 'icon delete js_delete', data: {type: :json, confirm: t('bhf.helpers.promts.confirm', platform_title: platform.title_singular.titleize)}
73
73
  - else
74
74
  %td.no_entries{colspan: platform.columns_count}
75
75
  = t 'bhf.pagination.info', name_zero: platform.title.titleize, count: 0
@@ -96,4 +96,4 @@
96
96
  - unless platform.hide_edit
97
97
  = link_to edit_t(platform), edit_link, class: 'icon edit'
98
98
  - unless platform.hide_delete
99
- = link_to delete_t(platform), entry_path(platform.name, '{object_id}'), method: :delete, remote: true, class: 'icon delete js_delete', data: {confirm: t('bhf.helpers.promts.confirm', platform_title: platform.title_singular.titleize)}
99
+ = link_to delete_t(platform), entry_path(platform.name, '{object_id}'), method: :delete, remote: true, class: 'icon delete js_delete', data: {type: :json, confirm: t('bhf.helpers.promts.confirm', platform_title: platform.title_singular.titleize)}
@@ -1,10 +1,10 @@
1
1
  = form_for platform.name, html: {method: :get, class: :search} do |f|
2
2
  - p = params[platform.name]
3
3
  = f.fields_for :search do |s|
4
-
4
+
5
5
  - if platform.scopes
6
6
  = f.select :scope, options_from_collection_for_select(platform.scopes, :value, :name, (p && p[:scope])), {}, class: 'js_submit_form_on_change'
7
-
7
+
8
8
  %p.info= platform.pagination.info platform
9
9
 
10
10
  - if platform.search_field?
@@ -20,5 +20,3 @@
20
20
  = f.hidden_field :per_page, value: get_value(:per_page, p)
21
21
  = f.hidden_field :order, value: get_value(:order, p)
22
22
  = f.hidden_field :direction, value: get_value(:direction, p)
23
-
24
-
@@ -1,2 +1,2 @@
1
1
  - @platforms.each do |platform|
2
- .platform= render partial: 'platform', locals: {platform: platform}
2
+ .platform= render partial: 'platform', locals: {platform: platform}
@@ -2,4 +2,4 @@
2
2
  - if column_value.is_a?(String)
3
3
  = column_value
4
4
  - else
5
- = column_value[0..5].join(', ')
5
+ = column_value[0..5].join(', ')
@@ -1,2 +1,2 @@
1
1
  = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
- = t("bhf.helpers.boolean.#{!!column_value}")
2
+ = t("bhf.helpers.boolean.#{!!column_value}")
@@ -2,4 +2,4 @@
2
2
  - if column_value.is_a?(String)
3
3
  = column_value
4
4
  - else
5
- = l(column_value, format: :short)
5
+ = l(column_value, format: :short)
@@ -1,2 +1,2 @@
1
1
  = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
- = ' '.html_safe
2
+ = ' '.html_safe
@@ -1,2 +1,2 @@
1
1
  = link_to column_value, title: column_value, target: '_blank' do
2
- %strong= t('bhf.helpers.link', link: column_value).html_safe
2
+ %strong= t('bhf.helpers.link', link: column_value).html_safe
@@ -1 +1 @@
1
- = link_to column_value, column_value
1
+ = link_to column_value, column_value
@@ -1,2 +1,2 @@
1
1
  = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
- = column_value.inspect
2
+ = column_value.inspect
@@ -1,2 +1,2 @@
1
1
  = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
- = image_tag column_value, alt: column_value, class: 'preview_image'
2
+ = image_tag column_value, alt: column_value, class: 'preview_image'
@@ -1,2 +1,2 @@
1
1
  = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
- = column_value
2
+ = column_value
@@ -3,4 +3,4 @@
3
3
  - if type_is_image?(file.content_type)
4
4
  = image_tag find_smallest_size_url_for_file(file), alt: column_value, class: 'preview_image'
5
5
  - else
6
- = file.original_filename
6
+ = file.original_filename
@@ -1,2 +1,2 @@
1
1
  = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
- %strong= column_value
2
+ %strong= column_value
@@ -1,2 +1,2 @@
1
1
  = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
- = column_value
2
+ = column_value
@@ -1,2 +1,2 @@
1
1
  = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
- = sanitize(column_value.to_s, tags: %w(strong em))
2
+ = sanitize(column_value.to_s, tags: %w(strong em))
@@ -1,2 +1,2 @@
1
1
  = content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
2
- = column_value.sub(object.class.base_class.to_s,'').titleize
2
+ = column_value.sub(object.class.base_class.to_s, '').titleize
@@ -1 +1 @@
1
- = render partial: 'bhf/table/has_many/default', locals: {column_value: column_value, object: object, link: link, add_quick_link: add_quick_link}
1
+ = render partial: 'bhf/table/has_many/default', locals: {column_value: column_value, object: object, link: link, add_quick_link: add_quick_link}
@@ -1 +1 @@
1
- = render partial: 'bhf/table/has_one/default', locals: {column_value: column_value, object: object, link: link, add_quick_link: add_quick_link}
1
+ = render partial: 'bhf/table/has_one/default', locals: {column_value: column_value, object: object, link: link, add_quick_link: add_quick_link}
@@ -1 +1 @@
1
- = render partial: 'bhf/table/has_many/default', locals: {column_value: column_value, object: object, link: link, add_quick_link: add_quick_link}
1
+ = render partial: 'bhf/table/has_many/default', locals: {column_value: column_value, object: object, link: link, add_quick_link: add_quick_link}
@@ -2,4 +2,4 @@
2
2
  - if column_value.is_a?(String)
3
3
  = column_value
4
4
  - else
5
- = column_value.collect(&:to_bhf_s).join(', ')
5
+ = column_value.collect(&:to_bhf_s).join(', ')
@@ -3,4 +3,4 @@
3
3
  - if column_value.is_a?(String)
4
4
  = column_value
5
5
  - else
6
- = column_value.to_bhf_s
6
+ = column_value.to_bhf_s
@@ -3,11 +3,12 @@
3
3
  %head
4
4
  %meta{charset: 'utf-8'}
5
5
  %title= @title
6
+ = csrf_meta_tags
6
7
  %link{href: "/favicon.ico?#{@app_title.to_s.downcase}", rel: 'icon', type: 'image/x-icon'}
7
8
  - Bhf.configuration.css.each do |css|
8
9
  = stylesheet_link_tag css
9
10
  %body
10
-
11
+
11
12
  = render partial: 'bhf/helper/flash', locals: {flash: flash}
12
13
  %header
13
14
  %h1
@@ -15,12 +16,12 @@
15
16
  - "logo_#{params[:bhf_area]}_bhf.svg"
16
17
  - else
17
18
  - Rails.application.assets.find_asset('logo_bhf.png') ? 'logo_bhf.png' : 'logo_bhf.svg'
18
-
19
+
19
20
  = link_to image_tag(logo), @root_link ? @root_link : main_app.root_url, data: {no_turbolink: true}
20
21
 
21
22
  - if @areas && @areas.length > 1
22
23
  = select_tag :area_select, options_from_collection_for_select(@areas, 'path', 'name', main_app.bhf_path(params[:bhf_area])), class: 'icon'
23
-
24
+
24
25
  - if @settings && @settings.pages.any?
25
26
  %nav
26
27
  %ul{class: ('shrink_space' if @settings.pages.count > 7)}
@@ -38,5 +39,3 @@
38
39
 
39
40
  - Bhf.configuration.js.each do |js|
40
41
  = javascript_include_tag js, data: {turbolinks_eval: false}
41
-
42
-
@@ -6,4 +6,4 @@
6
6
  .button.group
7
7
  %button.save{class: ('create' if @object.new_record?)}= @object.new_record? ? t('bhf.quick_edit.buttons.create') : t('bhf.quick_edit.buttons.save')
8
8
  - unless @object.new_record?
9
- %button.save_and_next.icon{title: t('bhf.quick_edit.buttons.save_and_next')}= t('bhf.quick_edit.buttons.save_and_next')
9
+ %button.save_and_next.icon{title: t('bhf.quick_edit.buttons.save_and_next')}= t('bhf.quick_edit.buttons.save_and_next')
data/bhf.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: bhf 0.10.12 ruby lib
5
+ # stub: bhf 0.10.13 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bhf"
9
- s.version = "0.10.12"
9
+ s.version = "0.10.13"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Anton Pawlik"]
14
- s.date = "2015-10-05"
14
+ s.date = "2015-10-27"
15
15
  s.description = "A simple to use Rails-Engine-Gem that offers an admin interface for trusted user. Easy integratable and highly configurable and agnostic. Works with ActiveRecord and Mongoid."
16
16
  s.email = "anton.pawlik@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -21,7 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.files = [
22
22
  "Gemfile",
23
23
  "Gemfile.lock",
24
- "Getting_Started.md",
25
24
  "LICENSE.txt",
26
25
  "README.md",
27
26
  "Rakefile",
@@ -129,7 +128,7 @@ Gem::Specification.new do |s|
129
128
  "app/views/bhf/table/column/_primary_key.html.haml",
130
129
  "app/views/bhf/table/column/_string.html.haml",
131
130
  "app/views/bhf/table/column/_text.html.haml",
132
- "app/views/bhf/table/column/_thumbmail.haml",
131
+ "app/views/bhf/table/column/_thumbnail.html.haml",
133
132
  "app/views/bhf/table/column/_type.html.haml",
134
133
  "app/views/bhf/table/embeds_many/_default.html.haml",
135
134
  "app/views/bhf/table/embeds_one/_default.html.haml",
@@ -168,7 +167,7 @@ Gem::Specification.new do |s|
168
167
  ]
169
168
  s.homepage = "http://antpaw.github.io/bhf"
170
169
  s.licenses = ["MIT"]
171
- s.rubygems_version = "2.2.2"
170
+ s.rubygems_version = "2.4.8"
172
171
  s.summary = "A simple to use Rails-Engine-Gem that offers an admin interface for trusted user."
173
172
 
174
173
  if s.respond_to? :specification_version then
@@ -50,7 +50,7 @@ de:
50
50
  save: Speichern
51
51
  create: Erstellen
52
52
  save_and_next: Speichern und weiter zum nächsten Eintrag gehen
53
-
53
+
54
54
  pagination:
55
55
  previous_label: « Vorheriges
56
56
  next_label: Nächstes »
@@ -83,4 +83,4 @@ de:
83
83
  error: "%{model} Fehler"
84
84
  destory:
85
85
  success: "%{model} wurde erfolgreich gelöscht"
86
- error: "%{model} Fehler"
86
+ error: "%{model} Fehler"
@@ -58,7 +58,7 @@ en:
58
58
  save: Save
59
59
  create: Create
60
60
  save_and_next: Save and go to the next entry
61
-
61
+
62
62
  pagination:
63
63
  previous_label: « Previous
64
64
  next_label: Next »
@@ -94,4 +94,4 @@ en:
94
94
  error: "%{model} error"
95
95
  destory:
96
96
  success: "%{model} was deleted successfully"
97
- error: "%{model} error"
97
+ error: "%{model} error"
@@ -58,7 +58,7 @@ pt:
58
58
  save: Salvar
59
59
  create: Criar
60
60
  save_and_next: Salvar e ir para o próximo registro
61
-
61
+
62
62
  pagination:
63
63
  previous_label: « Anterior
64
64
  next_label: Próximo »
@@ -94,4 +94,4 @@ pt:
94
94
  error: "Erro ao atualizar %{model}"
95
95
  destory:
96
96
  success: "%{model} deletado com sucesso"
97
- error: "Erro ao deletar %{model}"
97
+ error: "Erro ao deletar %{model}"
data/config/routes.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  Bhf::Engine.routes.draw do
2
-
2
+
3
3
  root to: 'application#index'
4
-
4
+
5
5
  get 'page/:page', to: 'pages#show', as: :page
6
-
6
+
7
7
  scope ':platform' do
8
8
  resources :entries, except: [:index] do
9
9
  put :sort, on: :collection
10
10
  post :duplicate, on: :member
11
-
11
+
12
12
  resources :embed_entries, except: [:index], as: :embed
13
13
  end
14
14
  end
15
-
15
+
16
16
  end
@@ -24,13 +24,13 @@ module Bhf::ActionView
24
24
  object.send(ref_name).include?(obj)
25
25
  end
26
26
  end
27
-
27
+
28
28
  html = hidden_field_tag("#{mm}[#{ref_name}][#{bhf_primary_key}]", '', extra_html_attrs.merge(id: "hidden_#{mm}_#{ref_name}_#{bhf_primary_key}"))
29
29
  html = html+' '+check_box_tag("#{mm}[#{ref_name}][#{bhf_primary_key}]", bhf_primary_key, checked, extra_html_attrs)
30
30
  html = html+' '+label_tag("#{mm}_#{ref_name}_#{bhf_primary_key}", obj.to_bhf_s) unless hide_label
31
-
31
+
32
32
  html
33
33
  end
34
34
 
35
35
  end
36
- end
36
+ end
@@ -1,6 +1,6 @@
1
1
  module Bhf::ActionView
2
2
  module FormOptions
3
-
3
+
4
4
  def option_groups_from_collection_for_select_with_html_attrs(collection, group_method, group_label_method, option_key_method, option_value_method, selected_key, html_attrs)
5
5
  collection.map do |group|
6
6
  option_tags = options_from_collection_for_select_with_html_attrs(
@@ -9,11 +9,11 @@ module Bhf::ActionView
9
9
  content_tag(:optgroup, option_tags, label: group.send(group_label_method))
10
10
  end.join.html_safe
11
11
  end
12
-
12
+
13
13
  def options_from_collection_for_select_with_html_attrs(collection, value_method, text_method, selected, html_attrs)
14
14
  options = collection.map do |element|
15
15
  [
16
- value_for_collection(element, text_method), value_for_collection(element, value_method), option_html_attributes(element),
16
+ value_for_collection(element, text_method), value_for_collection(element, value_method), option_html_attributes(element),
17
17
  html_attrs.call(element)
18
18
  ]
19
19
  end
@@ -22,9 +22,9 @@ module Bhf::ActionView
22
22
  selected: extract_values_from_collection(collection, value_method, selected),
23
23
  disabled: extract_values_from_collection(collection, value_method, disabled)
24
24
  }
25
-
25
+
26
26
  options_for_select(options, select_deselect)
27
27
  end
28
28
 
29
29
  end
30
- end
30
+ end
@@ -2,7 +2,7 @@ module Bhf::ActiveRecord
2
2
  module Base
3
3
 
4
4
  extend ActiveSupport::Concern
5
-
5
+
6
6
  def to_bhf_s
7
7
  return title if self.respond_to? :title
8
8
  return name if self.respond_to? :name
@@ -40,19 +40,19 @@ module Bhf::ActiveRecord
40
40
 
41
41
  where(where_statement.join(' OR '))
42
42
  end
43
-
43
+
44
44
  def bhf_attribute_method?(column_name)
45
45
  column_names.include?(column_name)
46
46
  end
47
-
47
+
48
48
  def bhf_primary_key
49
49
  primary_key
50
50
  end
51
-
51
+
52
52
  def bhf_embedded?
53
53
  false
54
54
  end
55
55
  end
56
-
56
+
57
57
  end
58
58
  end
@@ -1,6 +1,6 @@
1
1
  module Bhf::Mongoid
2
2
  module Document
3
-
3
+
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  class Field
@@ -63,7 +63,7 @@ module Bhf::Mongoid
63
63
  end
64
64
  c
65
65
  end
66
-
66
+
67
67
  def reflections
68
68
  c = {}
69
69
  relations.each do |key, meta|
@@ -72,23 +72,23 @@ module Bhf::Mongoid
72
72
  end
73
73
  c
74
74
  end
75
-
75
+
76
76
  def bhf_attribute_method?(column_name)
77
77
  attribute_method?(column_name)
78
78
  end
79
-
79
+
80
80
  def bhf_primary_key
81
81
  '_id'
82
82
  end
83
-
83
+
84
84
  def order(a)
85
85
  order_by(a)
86
86
  end
87
-
87
+
88
88
  def reorder(a)
89
89
  order_by(a)
90
90
  end
91
-
91
+
92
92
  def bhf_default_search(search_params)
93
93
  return self if (search_term = search_params['text']).blank?
94
94
 
@@ -115,7 +115,7 @@ module Bhf::Mongoid
115
115
  next unless meta.macro == :embedded_in
116
116
  parent = meta.class_name.constantize
117
117
  parent = parent.find(parent_id) rescue nil
118
-
118
+
119
119
  if parent
120
120
  return block.call(parent, meta) if block_given?
121
121
  return parent
@@ -1,41 +1,41 @@
1
1
  module Bhf::Platform::Attribute
2
2
  class Abstract
3
-
3
+
4
4
  attr_reader :name, :title, :info
5
-
5
+
6
6
  def initialize(options)
7
7
  @name = options[:name]
8
8
  @title = options[:title]
9
9
  @info = options[:info]
10
-
10
+
11
11
  @options_form_type = options[:form_type].to_sym if options[:form_type]
12
12
  @options_display_type = options[:display_type].to_sym if options[:display_type]
13
13
  @options_show_type = options[:show_type].to_sym if options[:show_type]
14
-
14
+
15
15
  @link_platform_settings = options[:link] unless options[:link].blank?
16
16
  end
17
-
17
+
18
18
  def macro
19
19
  :column
20
20
  end
21
-
21
+
22
22
  def form_type
23
23
  @options_form_type || @name
24
24
  end
25
-
25
+
26
26
  def display_type
27
27
  @options_display_type || @name
28
28
  end
29
-
29
+
30
30
  def show_type
31
31
  @options_show_type || display_type || @name
32
32
  end
33
-
33
+
34
34
  def link
35
35
  return unless @link_platform_settings
36
36
  @link ||= Bhf::Platform::Base.new(@link_platform_settings)
37
37
  end
38
-
38
+
39
39
  def reflection
40
40
  false
41
41
  end
@@ -43,10 +43,10 @@ module Bhf::Platform::Attribute
43
43
  def db_name
44
44
  name
45
45
  end
46
-
46
+
47
47
  def reorderble
48
48
  false
49
49
  end
50
50
 
51
51
  end
52
- end
52
+ end
@@ -15,7 +15,7 @@ module Bhf::Platform::Attribute
15
15
 
16
16
  @pk = options[:primary_key]
17
17
  end
18
-
18
+
19
19
  def macro
20
20
  :column
21
21
  end
@@ -31,10 +31,10 @@ module Bhf::Platform::Attribute
31
31
  supported_types(@type)
32
32
  end
33
33
  end
34
-
34
+
35
35
  def display_type
36
36
  return @options_display_type if @options_display_type
37
-
37
+
38
38
  if name == @pk
39
39
  :primary_key
40
40
  elsif name == 'type'
@@ -79,4 +79,4 @@ module Bhf::Platform::Attribute
79
79
  end
80
80
 
81
81
  end
82
- end
82
+ end