bhf 0.10.12 → 0.10.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/bhf/application.js +26 -26
- data/app/assets/javascripts/bhf/classes/Ajaxify.js +4 -4
- data/app/assets/javascripts/bhf/classes/ArrayFields.js +3 -3
- data/app/assets/javascripts/bhf/classes/FormHelper.js +4 -4
- data/app/assets/javascripts/bhf/classes/MultipleFields.js +2 -2
- data/app/assets/javascripts/bhf/classes/PlatformHelper.js +2 -2
- data/app/assets/javascripts/bhf/classes/QuickEdit.js +18 -18
- data/app/assets/javascripts/bhf/classes/QuickEditStack.js +3 -3
- data/app/assets/javascripts/bhf/classes/Request_bhf.js +2 -3
- data/app/assets/javascripts/bhf/classes/Setlatlng.js +8 -9
- data/app/assets/javascripts/bhf/locales/Locale.de-DE.js +0 -1
- data/app/assets/javascripts/bhf/mootools_ujs.js +81 -26
- data/app/assets/stylesheets/bhf/application.css.sass +1 -1
- data/app/controllers/bhf/embed_entries_controller.rb +3 -3
- data/app/controllers/bhf/entries_controller.rb +17 -15
- data/app/controllers/bhf/pages_controller.rb +3 -3
- data/app/helpers/bhf/application_helper.rb +2 -2
- data/app/helpers/bhf/entries_helper.rb +6 -6
- data/app/helpers/bhf/frontend_helper.rb +3 -3
- data/app/helpers/bhf/pages_helper.rb +5 -5
- data/app/views/bhf/entries/_form.html.haml +4 -4
- data/app/views/bhf/entries/_validation_errors.html.haml +1 -1
- data/app/views/bhf/entries/edit.html.haml +1 -1
- data/app/views/bhf/entries/new.html.haml +1 -1
- data/app/views/bhf/form/belongs_to/_radio.html.haml +5 -5
- data/app/views/bhf/form/belongs_to/_select.html.haml +3 -3
- data/app/views/bhf/form/column/_boolean.html.haml +1 -1
- data/app/views/bhf/form/column/_date.html.haml +1 -1
- data/app/views/bhf/form/column/_hash.html.haml +1 -1
- data/app/views/bhf/form/column/_hidden.html.haml +1 -1
- data/app/views/bhf/form/column/_markdown.html.haml +1 -1
- data/app/views/bhf/form/column/_multiple_fields.html.haml +1 -1
- data/app/views/bhf/form/column/_number.html.haml +1 -1
- data/app/views/bhf/form/column/_paperclip.html.haml +3 -3
- data/app/views/bhf/form/column/_password.html.haml +1 -1
- data/app/views/bhf/form/column/_static.html.haml +1 -1
- data/app/views/bhf/form/column/_string.html.haml +1 -1
- data/app/views/bhf/form/column/_text.html.haml +1 -1
- data/app/views/bhf/form/column/_wysiwyg.html.haml +1 -1
- data/app/views/bhf/form/embeds_many/_static.html.haml +3 -3
- data/app/views/bhf/form/has_and_belongs_to_many/_check_box.html.haml +3 -3
- data/app/views/bhf/form/has_and_belongs_to_many/_static.html.haml +1 -1
- data/app/views/bhf/form/has_many/_static.html.haml +1 -1
- data/app/views/bhf/helper/_field_errors.html.haml +1 -1
- data/app/views/bhf/helper/_flash.html.haml +1 -1
- data/app/views/bhf/helper/_frontend_edit.html.haml +1 -1
- data/app/views/bhf/helper/_info.html.haml +1 -1
- data/app/views/bhf/helper/_node.html.haml +1 -1
- data/app/views/bhf/pages/_platform.html.haml +2 -2
- data/app/views/bhf/pages/_search.html.haml +2 -4
- data/app/views/bhf/pages/show.html.haml +1 -1
- data/app/views/bhf/table/column/_array.html.haml +1 -1
- data/app/views/bhf/table/column/_boolean.html.haml +1 -1
- data/app/views/bhf/table/column/_date.html.haml +1 -1
- data/app/views/bhf/table/column/_empty.html.haml +1 -1
- data/app/views/bhf/table/column/_extern_link.html.haml +1 -1
- data/app/views/bhf/table/column/_file.html.haml +1 -1
- data/app/views/bhf/table/column/_hash.html.haml +1 -1
- data/app/views/bhf/table/column/_image.html.haml +1 -1
- data/app/views/bhf/table/column/_number.html.haml +1 -1
- data/app/views/bhf/table/column/_paperclip.html.haml +1 -1
- data/app/views/bhf/table/column/_primary_key.html.haml +1 -1
- data/app/views/bhf/table/column/_string.html.haml +1 -1
- data/app/views/bhf/table/column/_text.html.haml +1 -1
- data/app/views/bhf/table/column/{_thumbmail.haml → _thumbnail.html.haml} +0 -0
- data/app/views/bhf/table/column/_type.html.haml +1 -1
- data/app/views/bhf/table/embeds_many/_default.html.haml +1 -1
- data/app/views/bhf/table/embeds_one/_default.html.haml +1 -1
- data/app/views/bhf/table/has_and_belongs_to_many/_default.html.haml +1 -1
- data/app/views/bhf/table/has_many/_default.html.haml +1 -1
- data/app/views/bhf/table/has_one/_default.html.haml +1 -1
- data/app/views/layouts/bhf/application.haml +4 -5
- data/app/views/layouts/bhf/quick_edit.haml +1 -1
- data/bhf.gemspec +5 -6
- data/config/locales/de.yml +2 -2
- data/config/locales/en.yml +2 -2
- data/config/locales/pt.yml +2 -2
- data/config/routes.rb +5 -5
- data/lib/bhf/action_view/form_builder.rb +3 -3
- data/lib/bhf/action_view/form_options.rb +5 -5
- data/lib/bhf/active_record/base.rb +5 -5
- data/lib/bhf/mongoid/document.rb +8 -8
- data/lib/bhf/platform/attribute/abstract.rb +12 -12
- data/lib/bhf/platform/attribute/column.rb +4 -4
- data/lib/bhf/platform/attribute/reflection.rb +11 -11
- data/lib/bhf/platform/base.rb +14 -14
- data/lib/bhf/platform/pagination.rb +3 -3
- data/lib/bhf/settings/base.rb +4 -4
- data/lib/bhf/settings/platform.rb +4 -4
- data/lib/bhf/settings/yaml_parser.rb +1 -1
- data/lib/bhf.rb +5 -5
- data/lib/rails/generators/bhf/templates/initializer.rb +3 -3
- data/test/database.yml +2 -2
- data/test/test_helper.rb +4 -4
- metadata +4 -5
- data/Getting_Started.md +0 -32
@@ -1,23 +1,23 @@
|
|
1
1
|
module Bhf::Platform::Attribute
|
2
2
|
class Reflection
|
3
|
-
|
3
|
+
|
4
4
|
attr_reader :name, :title, :info
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(reflection, options = {})
|
7
7
|
@name = reflection.name.to_s
|
8
8
|
@title = options[:title]
|
9
9
|
@info = options[:info]
|
10
10
|
@reflection = reflection
|
11
|
-
|
11
|
+
|
12
12
|
@options_form_type = options[:form_type].to_sym if options[:form_type]
|
13
13
|
@options_display_type = options[:display_type].to_sym if options[:display_type]
|
14
14
|
@options_show_type = options[:show_type].to_sym if options[:show_type]
|
15
|
-
|
15
|
+
|
16
16
|
@link_platform_settings = options[:link] unless options[:link].blank?
|
17
|
-
|
17
|
+
|
18
18
|
@reorderble = options[:reorderble]
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def macro
|
22
22
|
return :has_and_belongs_to_many if @reflection.macro == :has_many && @reflection.options[:through]
|
23
23
|
@reflection.macro
|
@@ -34,7 +34,7 @@ module Bhf::Platform::Attribute
|
|
34
34
|
def show_type
|
35
35
|
@options_show_type || display_type
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def type
|
39
39
|
return @options_form_type if @options_form_type
|
40
40
|
|
@@ -46,7 +46,7 @@ module Bhf::Platform::Attribute
|
|
46
46
|
:static
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def reflection
|
51
51
|
@reflection
|
52
52
|
end
|
@@ -54,15 +54,15 @@ module Bhf::Platform::Attribute
|
|
54
54
|
def db_name
|
55
55
|
@reflection.foreign_key
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
def reorderble
|
59
59
|
@reorderble
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def link
|
63
63
|
return unless @link_platform_settings
|
64
64
|
@link ||= Bhf::Platform::Base.new(@link_platform_settings)
|
65
65
|
end
|
66
66
|
|
67
67
|
end
|
68
|
-
end
|
68
|
+
end
|
data/lib/bhf/platform/base.rb
CHANGED
@@ -4,7 +4,7 @@ module Bhf::Platform
|
|
4
4
|
|
5
5
|
def initialize(options)
|
6
6
|
@objects = []
|
7
|
-
|
7
|
+
|
8
8
|
@name = options.name
|
9
9
|
@data = options.hash
|
10
10
|
@settings = options.settings_base
|
@@ -20,8 +20,8 @@ module Bhf::Platform
|
|
20
20
|
|
21
21
|
@page_name = options.page_name
|
22
22
|
end
|
23
|
-
|
24
|
-
|
23
|
+
|
24
|
+
|
25
25
|
def pagination
|
26
26
|
@pagination ||= Bhf::Platform::Pagination.new(entries_per_page)
|
27
27
|
end
|
@@ -81,36 +81,36 @@ module Bhf::Platform
|
|
81
81
|
|
82
82
|
def fields
|
83
83
|
return @fields if @fields
|
84
|
-
|
84
|
+
|
85
85
|
tmp = default_attrs(form_value(:display), attributes)
|
86
86
|
if sortable and ! form_value(:display)
|
87
87
|
tmp = remove_excludes(tmp, [sortable_property.to_s])
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
@fields = remove_excludes(tmp, form_value(:exclude))
|
91
91
|
end
|
92
92
|
|
93
93
|
def columns
|
94
94
|
return @columns if @columns
|
95
|
-
|
95
|
+
|
96
96
|
tmp = default_attrs(table_columns, attributes[0..5])
|
97
97
|
if sortable and ! table_columns
|
98
98
|
tmp = remove_excludes(tmp, [sortable_property.to_s])
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
@columns = remove_excludes(tmp, table_value(:exclude))
|
102
102
|
end
|
103
103
|
|
104
104
|
def definitions
|
105
105
|
return @definitions if @definitions
|
106
|
-
|
106
|
+
|
107
107
|
tmp = default_attrs(show_value(:display) || show_value(:definitions), attributes)
|
108
108
|
@definitions = remove_excludes(tmp, show_value(:exclude))
|
109
109
|
end
|
110
110
|
|
111
111
|
def has_file_upload?
|
112
112
|
return true if form_value(:multipart) == true
|
113
|
-
|
113
|
+
|
114
114
|
fields.each do |field|
|
115
115
|
return true if field.form_type == :file
|
116
116
|
end
|
@@ -207,7 +207,7 @@ module Bhf::Platform
|
|
207
207
|
def custom_partial
|
208
208
|
table_value 'partial'
|
209
209
|
end
|
210
|
-
|
210
|
+
|
211
211
|
def read_data_source
|
212
212
|
table_value(:source) || table_value(:scope)
|
213
213
|
end
|
@@ -218,7 +218,7 @@ module Bhf::Platform
|
|
218
218
|
return temp_scope[0] if temp_scope.is_a?(Array)
|
219
219
|
temp_scope
|
220
220
|
end
|
221
|
-
|
221
|
+
|
222
222
|
def scopes
|
223
223
|
temp_scope = read_data_source
|
224
224
|
return unless temp_scope.is_a?(Array) and temp_scope.count > 1
|
@@ -250,7 +250,7 @@ module Bhf::Platform
|
|
250
250
|
chain.bhf_default_search(search_params)
|
251
251
|
end
|
252
252
|
end
|
253
|
-
|
253
|
+
|
254
254
|
def find_platform_settings_for_link(link_name)
|
255
255
|
if form_value(:links, link_name) != false
|
256
256
|
if form_value(:links, link_name)
|
@@ -277,7 +277,7 @@ module Bhf::Platform
|
|
277
277
|
|
278
278
|
def attributes
|
279
279
|
return @attributes if @attributes
|
280
|
-
|
280
|
+
|
281
281
|
all = {}
|
282
282
|
|
283
283
|
model.columns_hash.each_pair do |name, props|
|
@@ -358,4 +358,4 @@ module Bhf::Platform
|
|
358
358
|
end
|
359
359
|
|
360
360
|
end
|
361
|
-
end
|
361
|
+
end
|
@@ -72,9 +72,9 @@ module Bhf::Platform
|
|
72
72
|
|
73
73
|
platform_params.delete(:page)
|
74
74
|
platform_params[:per_page] = load_offset
|
75
|
-
|
75
|
+
|
76
76
|
direction = plus ? 'more' : 'less'
|
77
|
-
|
77
|
+
|
78
78
|
parsed_paramas = {
|
79
79
|
bhf_area: template.params[:bhf_area],
|
80
80
|
page: template.params[:page]
|
@@ -89,6 +89,6 @@ module Bhf::Platform
|
|
89
89
|
def load_less(platform, attributes = {})
|
90
90
|
load_more(platform, attributes, false)
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
end
|
94
94
|
end
|
data/lib/bhf/settings/base.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
module Bhf::Settings
|
2
2
|
|
3
3
|
class Base
|
4
|
-
|
4
|
+
|
5
5
|
attr_accessor :user
|
6
6
|
|
7
7
|
def initialize(settings_hash, user = nil)
|
8
8
|
@settings_hash = settings_hash
|
9
9
|
@user = user
|
10
|
-
|
10
|
+
|
11
11
|
t = pages.each_with_object([]) do |page, obj|
|
12
12
|
content_for_page(page).each do |platform|
|
13
13
|
obj << platform.keys.flatten
|
@@ -33,7 +33,7 @@ module Bhf::Settings
|
|
33
33
|
def content_for_page(selected_page)
|
34
34
|
@settings_hash['pages'].each do |page|
|
35
35
|
page = {page => nil} if page.is_a?(String)
|
36
|
-
|
36
|
+
|
37
37
|
if selected_page == page.keys[0]
|
38
38
|
return page.values.flatten
|
39
39
|
end
|
@@ -54,4 +54,4 @@ module Bhf::Settings
|
|
54
54
|
|
55
55
|
end
|
56
56
|
|
57
|
-
end
|
57
|
+
end
|
@@ -3,18 +3,18 @@ module Bhf::Settings
|
|
3
3
|
class Platform
|
4
4
|
|
5
5
|
attr_reader :name, :data, :page_name, :hash, :settings_base
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(settings_hash, page_name, settings_base)
|
8
8
|
if settings_hash.is_a?(String)
|
9
9
|
settings_hash = {settings_hash => nil}
|
10
10
|
end
|
11
11
|
@name = settings_hash.keys[0]
|
12
12
|
@hash = settings_hash.values[0] || {}
|
13
|
-
|
13
|
+
|
14
14
|
@settings_base = settings_base
|
15
15
|
@page_name = page_name
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
end
|
data/lib/bhf.rb
CHANGED
@@ -5,15 +5,15 @@ require 'kaminari'
|
|
5
5
|
|
6
6
|
module Bhf
|
7
7
|
class Engine < Rails::Engine
|
8
|
-
|
8
|
+
|
9
9
|
isolate_namespace Bhf
|
10
|
-
|
10
|
+
|
11
11
|
initializer 'bhf.helper' do
|
12
12
|
ActiveSupport.on_load :action_controller do
|
13
13
|
helper Bhf::FrontendHelper
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
initializer 'bhf.model_hooks' do
|
18
18
|
ActiveSupport.on_load :active_record do
|
19
19
|
include Bhf::ActiveRecord::Base
|
@@ -23,8 +23,8 @@ module Bhf
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
27
|
-
|
26
|
+
|
27
|
+
|
28
28
|
def self.configuration
|
29
29
|
@configuration ||= Bhf::Configuration.new
|
30
30
|
end
|
@@ -2,12 +2,12 @@ Bhf.configure do |config|
|
|
2
2
|
# config.css << 'bhf'
|
3
3
|
# config.js << 'bhf'
|
4
4
|
# config.abstract_settings << 'abstract'
|
5
|
-
|
5
|
+
|
6
6
|
# config.on_login_fail = :root_url
|
7
7
|
# config.logout_path = :logout_path
|
8
|
-
|
8
|
+
|
9
9
|
# config.session_account_id = :admin_account_id
|
10
10
|
# config.session_auth_name = :is_admin
|
11
11
|
# config.account_model = 'User'
|
12
12
|
# config.account_model_find_method = 'find'
|
13
|
-
end
|
13
|
+
end
|
data/test/database.yml
CHANGED
data/test/test_helper.rb
CHANGED
@@ -19,14 +19,14 @@ def load_schema
|
|
19
19
|
# Manually initialize the database
|
20
20
|
conn = Mysql.real_connect( config['mysql']['host'], config['mysql']['username'], config['mysql']['password'] )
|
21
21
|
conn.query( "CREATE DATABASE IF NOT EXISTS #{config['mysql']['database']}" )
|
22
|
-
|
22
|
+
|
23
23
|
ActiveRecord::Base.establish_connection( config['mysql'] )
|
24
24
|
ActiveRecord::Base.connection()
|
25
|
-
|
25
|
+
|
26
26
|
load(File.dirname(__FILE__) + "/../lib/rails/generators/bhf/templates/schema.rb")
|
27
27
|
|
28
28
|
@@fixtures = {}
|
29
|
-
|
29
|
+
|
30
30
|
load_fixture( 'bhf_widget' )
|
31
31
|
end
|
32
32
|
|
@@ -47,7 +47,7 @@ def load_fixture( table )
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
r = klass.create( record )
|
52
52
|
@@fixtures[ table ][ record_name ][ 'id' ] = r.id
|
53
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bhf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Pawlik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -162,7 +162,6 @@ extra_rdoc_files:
|
|
162
162
|
files:
|
163
163
|
- Gemfile
|
164
164
|
- Gemfile.lock
|
165
|
-
- Getting_Started.md
|
166
165
|
- LICENSE.txt
|
167
166
|
- README.md
|
168
167
|
- Rakefile
|
@@ -270,7 +269,7 @@ files:
|
|
270
269
|
- app/views/bhf/table/column/_primary_key.html.haml
|
271
270
|
- app/views/bhf/table/column/_string.html.haml
|
272
271
|
- app/views/bhf/table/column/_text.html.haml
|
273
|
-
- app/views/bhf/table/column/
|
272
|
+
- app/views/bhf/table/column/_thumbnail.html.haml
|
274
273
|
- app/views/bhf/table/column/_type.html.haml
|
275
274
|
- app/views/bhf/table/embeds_many/_default.html.haml
|
276
275
|
- app/views/bhf/table/embeds_one/_default.html.haml
|
@@ -326,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
325
|
version: '0'
|
327
326
|
requirements: []
|
328
327
|
rubyforge_project:
|
329
|
-
rubygems_version: 2.
|
328
|
+
rubygems_version: 2.4.8
|
330
329
|
signing_key:
|
331
330
|
specification_version: 4
|
332
331
|
summary: A simple to use Rails-Engine-Gem that offers an admin interface for trusted
|
data/Getting_Started.md
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
### Setup user authentication
|
2
|
-
|
3
|
-
Along with the standard approach in authentication, instead of defining the `#login` action in the
|
4
|
-
`Admin` controller, you are able to redefine `Bhf::ApplicationController`, and its `#check_admin_account`
|
5
|
-
method, to give to `Bhf` the knowledge about weither current user is admin or not. Do it like follows:
|
6
|
-
|
7
|
-
class Bhf::ApplicationController < ActionController::Base
|
8
|
-
protect_from_forgery
|
9
|
-
before_filter :authenticate_user! # if devise authentication is used
|
10
|
-
include Bhf::Extension::ApplicationController
|
11
|
-
|
12
|
-
def check_admin_account
|
13
|
-
current_user.is_admin? # Here expression must be evaluated to `true` if user is admin.
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
### Addtional field types
|
19
|
-
|
20
|
-
Additional two fields `file`, and `type` was added for form view. `File` field can be applied,
|
21
|
-
when user have to select, and attach a file, which should be sent to server. The file can be
|
22
|
-
image, etc. If the file is an image, a preview image appeared, when user select input image
|
23
|
-
for `file` field, or when user edits a record with `file` field and the file is an image.
|
24
|
-
`Type` field can be applied, when user the `type` named field should be shewn, and selected in
|
25
|
-
the form. The descendants of the base class is begin enumerated in the select.
|
26
|
-
|
27
|
-
Additional three fields `image`, `carrierwave`, and `type` was added for table view. `Image`
|
28
|
-
field can be applied, when the record has image properties. `Carrierwave` is the same as the `image`
|
29
|
-
but gets the image from `#midem` action for carrierwave uploader. PDF files also can be shewn
|
30
|
-
up as a thumbnail. When user moves a cursor over an image or PDF thumbnail, a preview image
|
31
|
-
is being pop up in table view. `Type` field defines that the spcific records class descendant
|
32
|
-
type name should be shewn for the column. The name is reduced by the base class name itself.
|