bhf 0.4.2.2 → 0.4.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/bhf/application_controller.rb +2 -2
- data/app/controllers/bhf/embed_entries_controller.rb +8 -8
- data/app/controllers/bhf/entries_controller.rb +10 -10
- data/app/controllers/bhf/pages_controller.rb +2 -2
- data/app/helpers/bhf/application_helper.rb +3 -3
- data/app/helpers/bhf/entries_helper.rb +4 -4
- data/app/views/bhf/_user.haml +2 -2
- data/app/views/bhf/application/index.haml +1 -1
- data/app/views/bhf/entries/_form.haml +5 -5
- data/app/views/bhf/entries/_validation_errors.haml +1 -1
- data/app/views/bhf/entries/form/belongs_to/_account_scope.haml +1 -1
- data/app/views/bhf/entries/form/belongs_to/_radio.haml +1 -1
- data/app/views/bhf/entries/form/belongs_to/_select.haml +2 -2
- data/app/views/bhf/entries/form/belongs_to/_static.haml +1 -1
- data/app/views/bhf/entries/form/column/_array.haml +2 -2
- data/app/views/bhf/entries/form/column/_date.haml +1 -1
- data/app/views/bhf/entries/form/column/_file.haml +2 -2
- data/app/views/bhf/entries/form/column/_markdown.haml +2 -2
- data/app/views/bhf/entries/form/column/_multiple_fields.haml +1 -1
- data/app/views/bhf/entries/form/column/_number.haml +1 -1
- data/app/views/bhf/entries/form/column/_static.haml +1 -1
- data/app/views/bhf/entries/form/column/_wysiwyg.haml +1 -1
- data/app/views/bhf/entries/form/embeds_many/_static.haml +5 -5
- data/app/views/bhf/entries/form/embeds_one/_static.haml +5 -5
- data/app/views/bhf/entries/form/has_and_belongs_to_many/_account_scope.haml +1 -1
- data/app/views/bhf/entries/form/has_and_belongs_to_many/_static.haml +1 -1
- data/app/views/bhf/entries/form/has_many/_static.haml +4 -4
- data/app/views/bhf/entries/form/has_one/_account_scope.haml +1 -1
- data/app/views/bhf/entries/form/has_one/_static.haml +4 -4
- data/app/views/bhf/helper/_flash.haml +1 -1
- data/app/views/bhf/helper/_frontend_edit.haml +1 -1
- data/app/views/bhf/helper/_node.haml +3 -3
- data/app/views/bhf/helper/_reflection_node.haml +2 -2
- data/app/views/bhf/pages/_platform.haml +15 -15
- data/app/views/bhf/pages/_search.haml +7 -7
- data/app/views/bhf/pages/macro/belongs_to/_default.haml +1 -1
- data/app/views/bhf/pages/macro/column/_date.haml +1 -1
- data/app/views/bhf/pages/macro/column/_text.haml +1 -1
- data/app/views/bhf/pages/macro/embeds_many/_default.haml +1 -1
- data/app/views/bhf/pages/macro/embeds_one/_default.haml +1 -1
- data/app/views/bhf/pages/macro/has_and_belongs_to_many/_default.haml +1 -1
- data/app/views/bhf/pages/macro/has_many/_default.haml +1 -1
- data/app/views/bhf/pages/macro/has_one/_default.haml +1 -1
- data/app/views/bhf/pages/show.haml +1 -1
- data/app/views/kaminari/bhf/_next_page.html.haml +1 -1
- data/app/views/kaminari/bhf/_page.html.haml +1 -1
- data/app/views/kaminari/bhf/_prev_page.html.haml +1 -1
- data/app/views/layouts/bhf/application.haml +10 -11
- data/app/views/layouts/bhf/quick_edit.haml +2 -2
- data/config/routes.rb +6 -6
- data/lib/bhf/active_record/upload.rb +1 -1
- data/lib/bhf/form.rb +1 -1
- data/lib/bhf/i18n.rb +3 -3
- data/lib/bhf/mongoid/document.rb +2 -2
- data/lib/bhf/pagination.rb +14 -14
- data/lib/bhf/platform.rb +17 -17
- data/lib/bhf/view_helpers.rb +1 -1
- data/vendor/assets/images/bhf/ajax_loader.gif +0 -0
- data/vendor/assets/images/bhf/bg.png +0 -0
- data/vendor/assets/images/bhf/mooeditable-toolbarbuttons-tango.png +0 -0
- data/vendor/assets/images/bhf/pictos.png +0 -0
- data/vendor/assets/images/bhf/small_ajax_loader.gif +0 -0
- data/vendor/assets/images/bhf/small_ajax_loader_h.gif +0 -0
- data/vendor/assets/images/bhf/wmd-buttons.png +0 -0
- data/vendor/assets/images/logo_bhf.png +0 -0
- data/vendor/assets/javascripts/bhf/application.js +280 -0
- data/vendor/assets/javascripts/bhf/classes/AjaxEdit.js +104 -0
- data/vendor/assets/javascripts/bhf/classes/Ajaxify.js +63 -0
- data/vendor/assets/javascripts/bhf/classes/ArrayFields.js +25 -0
- data/vendor/assets/javascripts/bhf/classes/BrowserUpdate.js +185 -0
- data/vendor/assets/javascripts/bhf/classes/Datepicker.js +38 -0
- data/vendor/assets/javascripts/bhf/classes/MooEditable.js +1549 -0
- data/vendor/assets/javascripts/bhf/classes/MultipleFields.js +50 -0
- data/vendor/assets/javascripts/bhf_includes/wmd.js +1 -1
- data/vendor/assets/stylesheets/bhf/MooEditable.css.scss +176 -0
- data/vendor/assets/stylesheets/bhf/application.css.sass +1067 -0
- data/vendor/assets/stylesheets/bhf/functions.css.sass +137 -0
- data/vendor/assets/stylesheets/bhf/reset.css.sass +32 -0
- data/vendor/assets/stylesheets/bhf/typo.css.scss +62 -0
- metadata +24 -3
@@ -3,5 +3,5 @@
|
|
3
3
|
%p= reflection_title(f, field)
|
4
4
|
.input
|
5
5
|
= input
|
6
|
-
= render :
|
7
|
-
= render :
|
6
|
+
= render partial: 'bhf/helper/field_errors', locals: {f: f, field: field.reflection.name}
|
7
|
+
= render partial: 'bhf/helper/info', locals: {info: field.info}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
- platform.pagination.template = self
|
2
|
-
%table{:
|
2
|
+
%table{id: "#{platform.name}_platform", class: (platform.custom_columns? ? :custom_columns : :default_columns)}
|
3
3
|
%caption
|
4
4
|
%h4= platform.title
|
5
5
|
%p.info= platform.pagination.info platform
|
6
|
-
%p.create= link_to new_t(platform), new_bhf_entry_path(platform.name), :
|
6
|
+
%p.create= link_to new_t(platform), new_bhf_entry_path(platform.name), class: :alt_button
|
7
7
|
- unless platform.custom_partial
|
8
|
-
= render :
|
8
|
+
= render partial: 'search', locals: {platform: platform} if platform.search?
|
9
9
|
|
10
10
|
- unless platform.custom_partial
|
11
11
|
%thead
|
@@ -13,7 +13,7 @@
|
|
13
13
|
- if platform.sortable
|
14
14
|
%th.drag
|
15
15
|
- platform.columns.each do |column|
|
16
|
-
%th{:
|
16
|
+
%th{class: "#{column.field.macro} #{column.field.display_type} #{order_class(column.name, platform.name)}"}
|
17
17
|
- column_name = platform.model.human_attribute_name(column.name)
|
18
18
|
- # TODO: link only if column.name is a database column
|
19
19
|
- # column_names = platform.model.column_names
|
@@ -23,33 +23,33 @@
|
|
23
23
|
|
24
24
|
%tfoot
|
25
25
|
%tr
|
26
|
-
%td{:
|
26
|
+
%td{colspan: platform.columns_count}
|
27
27
|
= platform.pagination.create(platform) unless platform.sortable
|
28
28
|
|
29
|
-
%tbody{:
|
29
|
+
%tbody{class: (:sortable if platform.sortable), :'data-sort-url' => sort_bhf_entries_path(platform.name)}
|
30
30
|
- if platform.objects.any?
|
31
31
|
- platform.objects.each do |object|
|
32
32
|
- edit_link = edit_bhf_entry_path(platform.name, object)
|
33
|
-
%tr{:
|
33
|
+
%tr{id: "#{object.id}_#{platform.name}"}
|
34
34
|
- if platform.sortable
|
35
35
|
%td.drag
|
36
36
|
%span.handle
|
37
37
|
-# TODO: external link partial from anpex
|
38
38
|
- platform.columns.each do |column|
|
39
|
-
%td{:
|
39
|
+
%td{class: "#{column.field.macro} #{column.field.display_type}", :'data-column-name' => column.name}
|
40
40
|
- a = if column.field.display_type != :boolean && object.send(column.name).blank?
|
41
41
|
- ' '
|
42
42
|
- else
|
43
|
-
- render(:
|
44
|
-
= link_to_if !has_link?(column.field.overwrite_display_type), a.html_safe, edit_link, :
|
43
|
+
- render(partial: "bhf/pages/macro/#{column.field.macro}/#{column.field.display_type}", locals: {column: column, object: object})
|
44
|
+
= link_to_if !has_link?(column.field.overwrite_display_type), a.html_safe, edit_link, class: 'quick_edit'
|
45
45
|
|
46
46
|
%td.action
|
47
|
-
= link_to edit_t(platform), edit_link, :
|
48
|
-
= link_to delete_t(platform), bhf_entry_path(platform.name, object), :
|
47
|
+
= link_to edit_t(platform), edit_link, class: 'edit'
|
48
|
+
= link_to delete_t(platform), bhf_entry_path(platform.name, object), method: :delete, remote: true, class: :delete, confirm: t('bhf.helpers.promts.confirm')
|
49
49
|
- else
|
50
|
-
%td.no_entries{:
|
51
|
-
= t 'bhf.pagination.info', :
|
50
|
+
%td.no_entries{colspan: platform.columns_count}
|
51
|
+
= t 'bhf.pagination.info', name_zero: platform.title, count: 0
|
52
52
|
= link_to new_t(platform), new_bhf_entry_path(platform.name)
|
53
53
|
|
54
54
|
- if platform.custom_partial
|
55
|
-
= render :
|
55
|
+
= render partial: "bhf/pages/#{platform.custom_partial}", locals: {}
|
@@ -1,16 +1,16 @@
|
|
1
|
-
= form_for platform.name, :
|
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
|
- if platform.search_field?
|
5
|
-
= s.text_field :text, :
|
5
|
+
= s.text_field :text, value: get_value([:search, :text], p), placeholder: t('bhf.helpers.searchform.placeholder')
|
6
6
|
|
7
7
|
- if p && p[:search].is_a?(Hash)
|
8
8
|
- p[:search].each do |key, value|
|
9
|
-
= s.hidden_field key, :
|
9
|
+
= s.hidden_field key, value: value, id: nil, class: (:hidden_search if key == 'text')
|
10
10
|
|
11
11
|
- if platform.custom_search
|
12
|
-
= render :
|
12
|
+
= render partial: platform.custom_search, locals: { platform: platform, f: f, s: s, p: p }
|
13
13
|
|
14
|
-
= f.hidden_field :per_page, :
|
15
|
-
= f.hidden_field :order, :
|
16
|
-
= f.hidden_field :direction, :
|
14
|
+
= f.hidden_field :per_page, value: get_value(:per_page, p)
|
15
|
+
= f.hidden_field :order, value: get_value(:order, p)
|
16
|
+
= f.hidden_field :direction, value: get_value(:direction, p)
|
@@ -1,2 +1,2 @@
|
|
1
1
|
- ref_object = object.send(column.name)
|
2
|
-
= ref_object.blank? ? t('bhf.helpers.entry.empty', :
|
2
|
+
= ref_object.blank? ? t('bhf.helpers.entry.empty', count: 1) : ref_object.to_bhf_s
|
@@ -1 +1 @@
|
|
1
|
-
= l(object.send(column.name), :
|
1
|
+
= l(object.send(column.name), format: :short)
|
@@ -1 +1 @@
|
|
1
|
-
= sanitize(object.send(column.name), :
|
1
|
+
= sanitize(object.send(column.name), tags: %w(strong em))
|
@@ -1 +1 @@
|
|
1
|
-
= render :
|
1
|
+
= render partial: 'bhf/pages/macro/has_many/default', locals: {ref_objects: object.send(column.name)}
|
@@ -1 +1 @@
|
|
1
|
-
= render :
|
1
|
+
= render partial: 'bhf/pages/macro/has_one/default', locals: {ref_object: object.send(column.name)}
|
@@ -1 +1 @@
|
|
1
|
-
= render :
|
1
|
+
= render partial: 'bhf/pages/macro/has_many/default', locals: {ref_objects: object.send(column.name)}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
- ref_objects ||= object.send(column.name)
|
2
|
-
= ref_objects.blank? ? t('bhf.helpers.entry.empty', :
|
2
|
+
= ref_objects.blank? ? t('bhf.helpers.entry.empty', count: 2) : ref_objects.collect(&:to_bhf_s).join(', ')
|
@@ -1,2 +1,2 @@
|
|
1
1
|
- ref_object ||= object.send(column.name)
|
2
|
-
= ref_object.blank? ? t('bhf.helpers.entry.empty', :
|
2
|
+
= ref_object.blank? ? t('bhf.helpers.entry.empty', count: 1) : ref_object.to_bhf_s
|
@@ -1,2 +1,2 @@
|
|
1
|
-
= link_to_unless current_page.last?, t('bhf.pagination.next_label'), url, :
|
1
|
+
= link_to_unless current_page.last?, t('bhf.pagination.next_label'), url, remote: remote do |name|
|
2
2
|
%span= name
|
@@ -1,2 +1,2 @@
|
|
1
|
-
= link_to_unless page.current?, page, url, :
|
1
|
+
= link_to_unless page.current?, page, url, remote: remote, class: 'page_number' do |name|
|
2
2
|
%em= name
|
@@ -1,2 +1,2 @@
|
|
1
|
-
= link_to_unless current_page.first?, t('bhf.pagination.previous_label'), url, :
|
1
|
+
= link_to_unless current_page.first?, t('bhf.pagination.previous_label'), url, remote: remote do |name|
|
2
2
|
%span= name
|
@@ -1,27 +1,26 @@
|
|
1
1
|
!!!
|
2
|
-
%html{:
|
2
|
+
%html{lang: I18n.locale}
|
3
3
|
%head
|
4
|
-
%meta{:
|
4
|
+
%meta{charset: 'utf-8'}
|
5
5
|
%title= @title
|
6
|
-
|
7
|
-
|
8
|
-
- ([:bhf] + Bhf::Engine.config.css.to_a).each do |css|
|
6
|
+
%link{href: '/favicon.ico', rel: 'icon', type: 'image/x-icon'}
|
7
|
+
- (['bhf/application'] + Bhf::Engine.config.css.to_a).each do |css|
|
9
8
|
= stylesheet_link_tag css
|
10
|
-
= javascript_include_tag 'bhf'
|
11
|
-
|
9
|
+
= javascript_include_tag 'bhf/application'
|
10
|
+
|
12
11
|
%body
|
13
12
|
%header
|
14
|
-
%h1= link_to image_tag('
|
13
|
+
%h1= link_to image_tag('logo_bhf.png'), root_url
|
15
14
|
- if @config && @config.pages.any?
|
16
15
|
%nav
|
17
16
|
%ul
|
18
17
|
- @config.pages.each do |page|
|
19
|
-
%li{:
|
20
|
-
= link_to t("bhf.pages.navigation.#{page}", :
|
18
|
+
%li{class: ('active' if @page == page)}
|
19
|
+
= link_to t("bhf.pages.navigation.#{page}", default: page.capitalize), bhf_page_path(page)
|
21
20
|
|
22
21
|
#content
|
23
22
|
#main
|
24
|
-
= render :
|
23
|
+
= render partial: 'bhf/helper/flash', locals: {flash: flash}
|
25
24
|
= yield
|
26
25
|
|
27
26
|
%footer
|
@@ -2,6 +2,6 @@
|
|
2
2
|
%button.alt_button.open= t('bhf.quick_edit.buttons.open')
|
3
3
|
= yield
|
4
4
|
.button.group
|
5
|
-
%button.save{:
|
5
|
+
%button.save{class: ('create' if @object.new_record?)}= @object.new_record? ? t('bhf.quick_edit.buttons.create') : t('bhf.quick_edit.buttons.save')
|
6
6
|
- unless @object.new_record?
|
7
|
-
%button.save_and_next{:
|
7
|
+
%button.save_and_next{title: t('bhf.quick_edit.buttons.save_and_next')}= t('bhf.quick_edit.buttons.save_and_next')
|
data/config/routes.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
|
3
|
-
namespace :bhf, :
|
4
|
-
root :
|
3
|
+
namespace :bhf, path: Bhf::Engine.config.mount_at do
|
4
|
+
root to: 'application#index'
|
5
5
|
|
6
|
-
get 'page/:page', :
|
6
|
+
get 'page/:page', to: 'pages#show', as: :page
|
7
7
|
|
8
8
|
scope ':platform' do
|
9
|
-
resources :entries, :
|
10
|
-
resources :embed_entries, :
|
11
|
-
put :sort, :
|
9
|
+
resources :entries, except: [:index, :show] do
|
10
|
+
resources :embed_entries, except: [:index, :show], as: :embed
|
11
|
+
put :sort, on: :collection
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
data/lib/bhf/form.rb
CHANGED
@@ -24,7 +24,7 @@ module Bhf
|
|
24
24
|
object.send(ref_name).include?(obj)
|
25
25
|
end
|
26
26
|
|
27
|
-
hidden_field_tag("#{mm}[#{ref_name}][#{obj.id}]", '', :
|
27
|
+
hidden_field_tag("#{mm}[#{ref_name}][#{obj.id}]", '', id: "hidden_has_and_belongs_to_many_#{ref_name}_#{obj.id}")+' '+
|
28
28
|
check_box_tag("#{mm}[#{ref_name}][#{obj.id}]", obj.id, checked)+' '+
|
29
29
|
label_tag("#{mm}_#{ref_name}_#{obj.id}", obj.to_bhf_s)
|
30
30
|
end
|
data/lib/bhf/i18n.rb
CHANGED
@@ -9,17 +9,17 @@ module Bhf
|
|
9
9
|
default = options.delete(:default)
|
10
10
|
|
11
11
|
[locale, :en].each do |lookup_locale|
|
12
|
-
translation_found, translation = attempt_translation(text, options.merge(:
|
12
|
+
translation_found, translation = attempt_translation(text, options.merge(locale: lookup_locale))
|
13
13
|
return translation if translation_found
|
14
14
|
end
|
15
15
|
|
16
16
|
# Ensure 'translation missing' return is exactly the default behaviour
|
17
|
-
translate_without_fallback(text, options.merge(:
|
17
|
+
translate_without_fallback(text, options.merge(default: default))
|
18
18
|
end
|
19
19
|
|
20
20
|
def attempt_translation(text, options = {})
|
21
21
|
puts "Attempting translation of '#{text}' with locale '#{options[:locale]}'." if options[:debug]
|
22
|
-
translation = translate_without_fallback(text, options.merge(:
|
22
|
+
translation = translate_without_fallback(text, options.merge(raise: true))
|
23
23
|
translation_found = options[:locale]
|
24
24
|
rescue I18n::MissingTranslationData
|
25
25
|
translation_found = nil
|
data/lib/bhf/mongoid/document.rb
CHANGED
@@ -81,7 +81,7 @@ module Bhf
|
|
81
81
|
|
82
82
|
def except(key)
|
83
83
|
if key == :order || key == :sort
|
84
|
-
#order_by.extras(:
|
84
|
+
#order_by.extras(sort: []) #TODO: drop default_scope criteria
|
85
85
|
end
|
86
86
|
self
|
87
87
|
end
|
@@ -96,7 +96,7 @@ module Bhf
|
|
96
96
|
return if (search_term = search_params[:text]).blank?
|
97
97
|
|
98
98
|
# TODO: add mongoid search
|
99
|
-
return where(:
|
99
|
+
return where(name: /^antp/i)
|
100
100
|
#return where("this.nick == 'antpaw'")
|
101
101
|
end
|
102
102
|
|
data/lib/bhf/pagination.rb
CHANGED
@@ -9,7 +9,7 @@ module Kaminari
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_s(locals = {}) #:nodoc:
|
12
|
-
@template.render :
|
12
|
+
@template.render partial: "kaminari/#{@theme}#{self.class.name.demodulize.underscore}", locals: @options.merge(locals)
|
13
13
|
end
|
14
14
|
|
15
15
|
def page_url_for(page)
|
@@ -43,9 +43,9 @@ module Bhf
|
|
43
43
|
platform_params = template.params[platform.name] || {}
|
44
44
|
|
45
45
|
links = if !(page_links = template.paginate(platform.objects, {
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
46
|
+
theme: 'bhf',
|
47
|
+
param_name: [platform.name, 'page'],
|
48
|
+
params: template.params
|
49
49
|
})).blank?
|
50
50
|
"#{load_more(platform)} #{page_links}"
|
51
51
|
elsif platform.objects.num_pages == 1 && platform.objects.size > @offset_to_add
|
@@ -53,7 +53,7 @@ module Bhf
|
|
53
53
|
end
|
54
54
|
|
55
55
|
if links
|
56
|
-
template.content_tag(:div, links.html_safe, {:
|
56
|
+
template.content_tag(:div, links.html_safe, {class: 'pagination'})
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -62,17 +62,17 @@ module Bhf
|
|
62
62
|
|
63
63
|
if collection.respond_to?(:num_pages) and collection.num_pages > 1
|
64
64
|
I18n.t('bhf.pagination.info.default', {
|
65
|
-
:
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:
|
65
|
+
name: platform.title,
|
66
|
+
count: collection.total_count,
|
67
|
+
offset_start: collection.offset_value + 1,
|
68
|
+
offset_end: collection.offset_value + collection.length
|
69
69
|
})
|
70
70
|
else
|
71
71
|
I18n.t('bhf.pagination.info', {
|
72
|
-
:
|
73
|
-
:
|
74
|
-
:
|
75
|
-
:
|
72
|
+
name_zero: platform.title,
|
73
|
+
name_singular: platform.title_singular,
|
74
|
+
name_plural: platform.title,
|
75
|
+
count: collection.size
|
76
76
|
})
|
77
77
|
end.html_safe
|
78
78
|
end
|
@@ -96,7 +96,7 @@ module Bhf
|
|
96
96
|
template.bhf_page_path(
|
97
97
|
platform.page_name,
|
98
98
|
template.params.merge(platform.name => platform_params)
|
99
|
-
), attributes.merge(:
|
99
|
+
), attributes.merge(class: "load_#{direction}")
|
100
100
|
)
|
101
101
|
end
|
102
102
|
|
data/lib/bhf/platform.rb
CHANGED
@@ -15,12 +15,12 @@ module Bhf
|
|
15
15
|
@collection = get_collection
|
16
16
|
|
17
17
|
t_model_path = "activerecord.models.#{model.model_name.downcase}"
|
18
|
-
model_name = I18n.t(t_model_path, :
|
19
|
-
@title = I18n.t("bhf.platforms.#{@name}.title", :
|
20
|
-
model_name = I18n.t(t_model_path, :
|
21
|
-
@title_singular = I18n.t("bhf.platforms.#{@name}.title", :
|
22
|
-
model_name = I18n.t(t_model_path, :
|
23
|
-
@title_zero = I18n.t("bhf.platforms.#{@name}.title", :
|
18
|
+
model_name = I18n.t(t_model_path, count: 2, default: @name.pluralize.capitalize)
|
19
|
+
@title = I18n.t("bhf.platforms.#{@name}.title", count: 2, default: model_name)
|
20
|
+
model_name = I18n.t(t_model_path, count: 1, default: @name.singularize.capitalize)
|
21
|
+
@title_singular = I18n.t("bhf.platforms.#{@name}.title", count: 1, default: model_name)
|
22
|
+
model_name = I18n.t(t_model_path, count: 0, default: @name.singularize.capitalize)
|
23
|
+
@title_zero = I18n.t("bhf.platforms.#{@name}.title", count: 0, default: model_name)
|
24
24
|
|
25
25
|
@page_name = page_name
|
26
26
|
@user = user
|
@@ -157,10 +157,10 @@ module Bhf
|
|
157
157
|
obj << (
|
158
158
|
@collection.select{ |field| attr_name == field.name }[0] ||
|
159
159
|
Bhf::Data::AbstractField.new({
|
160
|
-
:
|
161
|
-
:
|
162
|
-
:
|
163
|
-
:
|
160
|
+
name: attr_name,
|
161
|
+
form_type: form_options(:types, attr_name) || attr_name,
|
162
|
+
display_type: table_options(:types, attr_name) || attr_name,
|
163
|
+
info: I18n.t("bhf.platforms.#{@name}.infos.#{attr_name}", default: '')
|
164
164
|
})
|
165
165
|
)
|
166
166
|
end
|
@@ -172,19 +172,19 @@ module Bhf
|
|
172
172
|
model.columns_hash.each_pair do |name, props|
|
173
173
|
next if name == sortable
|
174
174
|
all[name] = Bhf::Data::Field.new(props, {
|
175
|
-
:
|
176
|
-
:
|
177
|
-
:
|
175
|
+
overwrite_type: form_options(:types, name),
|
176
|
+
overwrite_display_type: table_options(:types, name),
|
177
|
+
info: I18n.t("bhf.platforms.#{@name}.infos.#{name}", default: '')
|
178
178
|
}, model.bhf_primary_key)
|
179
179
|
end
|
180
180
|
|
181
181
|
# TODO: test polymorphic
|
182
182
|
model.reflections.each_pair do |name, props|
|
183
183
|
all[name.to_s] = Bhf::Data::Reflection.new(props, {
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
187
|
-
:
|
184
|
+
overwrite_type: form_options(:types, name),
|
185
|
+
overwrite_display_type: table_options(:types, name),
|
186
|
+
info: I18n.t("bhf.platforms.#{@name}.infos.#{name}", default: ''),
|
187
|
+
link: form_options(:links, name)
|
188
188
|
})
|
189
189
|
|
190
190
|
fk = all[name.to_s].reflection.primary_key_name
|
data/lib/bhf/view_helpers.rb
CHANGED
@@ -11,7 +11,7 @@ module Bhf
|
|
11
11
|
return unless object.bhf_can_edit?(options)
|
12
12
|
end
|
13
13
|
|
14
|
-
render :
|
14
|
+
render partial: 'bhf/helper/frontend_edit', locals: { platform_name: options[:platform_name], object: object }
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|