bhf 1.0.0.beta13 → 1.0.0.beta15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -23
- data/VERSION +1 -1
- data/app/controllers/bhf/embed_entries_controller.rb +1 -1
- data/app/controllers/bhf/entries_controller.rb +1 -1
- data/bhf.gemspec +4 -4
- data/config/locales/de.yml +2 -2
- data/config/locales/en.yml +3 -3
- data/config/locales/pt.yml +3 -3
- data/lib/bhf/mongoid/document.rb +17 -16
- data/lib/bhf/platform/pagination.rb +16 -8
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7de2d8de2daf035ca6792f1a8f0ee79d115c147ec524d05cfb399062ea613a51
|
4
|
+
data.tar.gz: 2da1451f1ac4a51ac6ef2bb64049cf77f276731d2fb9f0ad361e0889a013640e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dabe94a653a2ecb3d374b1a32278fbb5132c6eabbf6abafb34381562c97bb0f91d72011c192c230b221b366c413a7d21e090ea75d7021edd0b81b3afdd786aa
|
7
|
+
data.tar.gz: c771edcf4fcbea5674fce3f56cfd5e8da1edf47b3c45838a7687983e8a5d51dfadda4912a2addbbba90ad016b3ccd717e066534e5ae1f8516abd0aea04a00440
|
data/Gemfile.lock
CHANGED
@@ -58,8 +58,8 @@ GEM
|
|
58
58
|
zeitwerk (~> 2.2)
|
59
59
|
addressable (2.4.0)
|
60
60
|
builder (3.2.4)
|
61
|
-
concurrent-ruby (1.1.
|
62
|
-
crass (1.0.
|
61
|
+
concurrent-ruby (1.1.6)
|
62
|
+
crass (1.0.6)
|
63
63
|
descendants_tracker (0.0.4)
|
64
64
|
thread_safe (~> 0.3, >= 0.3.1)
|
65
65
|
docile (1.3.2)
|
@@ -94,7 +94,7 @@ GEM
|
|
94
94
|
haml (>= 4.0, < 6)
|
95
95
|
nokogiri (>= 1.6.0)
|
96
96
|
ruby_parser (~> 3.5)
|
97
|
-
i18n (1.
|
97
|
+
i18n (1.8.3)
|
98
98
|
concurrent-ruby (~> 1.0)
|
99
99
|
jeweler (2.3.9)
|
100
100
|
builder
|
@@ -109,19 +109,19 @@ GEM
|
|
109
109
|
semver2
|
110
110
|
json (2.3.0)
|
111
111
|
jwt (2.2.1)
|
112
|
-
kaminari (1.
|
112
|
+
kaminari (1.2.1)
|
113
113
|
activesupport (>= 4.1.0)
|
114
|
-
kaminari-actionview (= 1.
|
115
|
-
kaminari-activerecord (= 1.
|
116
|
-
kaminari-core (= 1.
|
117
|
-
kaminari-actionview (1.
|
114
|
+
kaminari-actionview (= 1.2.1)
|
115
|
+
kaminari-activerecord (= 1.2.1)
|
116
|
+
kaminari-core (= 1.2.1)
|
117
|
+
kaminari-actionview (1.2.1)
|
118
118
|
actionview
|
119
|
-
kaminari-core (= 1.
|
120
|
-
kaminari-activerecord (1.
|
119
|
+
kaminari-core (= 1.2.1)
|
120
|
+
kaminari-activerecord (1.2.1)
|
121
121
|
activerecord
|
122
|
-
kaminari-core (= 1.
|
123
|
-
kaminari-core (1.
|
124
|
-
loofah (2.
|
122
|
+
kaminari-core (= 1.2.1)
|
123
|
+
kaminari-core (1.2.1)
|
124
|
+
loofah (2.6.0)
|
125
125
|
crass (~> 1.0.2)
|
126
126
|
nokogiri (>= 1.5.9)
|
127
127
|
mail (2.7.1)
|
@@ -130,16 +130,19 @@ GEM
|
|
130
130
|
mimemagic (~> 0.3.2)
|
131
131
|
method_source (0.9.2)
|
132
132
|
mime-types (2.99.3)
|
133
|
-
mimemagic (0.3.
|
133
|
+
mimemagic (0.3.10)
|
134
|
+
nokogiri (~> 1)
|
135
|
+
rake
|
134
136
|
mini_mime (1.0.2)
|
135
|
-
mini_portile2 (2.
|
136
|
-
minitest (5.
|
137
|
+
mini_portile2 (2.8.0)
|
138
|
+
minitest (5.14.1)
|
137
139
|
multi_json (1.14.1)
|
138
140
|
multi_xml (0.6.0)
|
139
141
|
multipart-post (2.1.1)
|
140
142
|
nio4r (2.5.2)
|
141
|
-
nokogiri (1.
|
142
|
-
mini_portile2 (~> 2.
|
143
|
+
nokogiri (1.13.4)
|
144
|
+
mini_portile2 (~> 2.8.0)
|
145
|
+
racc (~> 1.4)
|
143
146
|
oauth2 (1.4.2)
|
144
147
|
faraday (>= 0.8, < 2.0)
|
145
148
|
jwt (>= 1.0, < 3.0)
|
@@ -147,7 +150,8 @@ GEM
|
|
147
150
|
multi_xml (~> 0.5)
|
148
151
|
rack (>= 1.2, < 3)
|
149
152
|
psych (3.1.0)
|
150
|
-
|
153
|
+
racc (1.6.0)
|
154
|
+
rack (2.2.3)
|
151
155
|
rack-test (1.1.0)
|
152
156
|
rack (>= 1.0, < 3)
|
153
157
|
rails (6.0.2.1)
|
@@ -177,7 +181,7 @@ GEM
|
|
177
181
|
rake (>= 0.8.7)
|
178
182
|
thor (>= 0.20.3, < 2.0)
|
179
183
|
rake (13.0.1)
|
180
|
-
rdoc (6.
|
184
|
+
rdoc (6.3.1)
|
181
185
|
ruby_parser (3.14.1)
|
182
186
|
sexp_processor (~> 4.9)
|
183
187
|
sass-rails (6.0.0)
|
@@ -217,12 +221,12 @@ GEM
|
|
217
221
|
turbolinks (5.2.1)
|
218
222
|
turbolinks-source (~> 5.2)
|
219
223
|
turbolinks-source (5.2.0)
|
220
|
-
tzinfo (1.2.
|
224
|
+
tzinfo (1.2.7)
|
221
225
|
thread_safe (~> 0.1)
|
222
226
|
websocket-driver (0.7.1)
|
223
227
|
websocket-extensions (>= 0.1.0)
|
224
|
-
websocket-extensions (0.1.
|
225
|
-
zeitwerk (2.
|
228
|
+
websocket-extensions (0.1.5)
|
229
|
+
zeitwerk (2.4.0)
|
226
230
|
|
227
231
|
PLATFORMS
|
228
232
|
ruby
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.
|
1
|
+
1.0.0.beta15
|
@@ -53,7 +53,7 @@ class Bhf::EntriesController < Bhf::ApplicationController
|
|
53
53
|
render file: 'public/404.html', layout: false and return unless @object
|
54
54
|
|
55
55
|
before_save
|
56
|
-
if @object.
|
56
|
+
if @object.update(@permited_params)
|
57
57
|
manage_relations
|
58
58
|
after_save
|
59
59
|
|
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 1.0.0.
|
5
|
+
# stub: bhf 1.0.0.beta15 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bhf".freeze
|
9
|
-
s.version = "1.0.0.
|
9
|
+
s.version = "1.0.0.beta15"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Anton Pawlik".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2023-03-21"
|
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.".freeze
|
16
16
|
s.email = "anton.pawlik@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -174,7 +174,7 @@ Gem::Specification.new do |s|
|
|
174
174
|
]
|
175
175
|
s.homepage = "http://antpaw.github.io/bhf".freeze
|
176
176
|
s.licenses = ["MIT".freeze]
|
177
|
-
s.rubygems_version = "3.0.
|
177
|
+
s.rubygems_version = "3.0.9".freeze
|
178
178
|
s.summary = "A simple to use Rails-Engine-Gem that offers an admin interface for trusted user.".freeze
|
179
179
|
|
180
180
|
if s.respond_to? :specification_version then
|
data/config/locales/de.yml
CHANGED
@@ -64,8 +64,8 @@ de:
|
|
64
64
|
entries: Einträge
|
65
65
|
info:
|
66
66
|
default: "Es werden <strong>%{offset_start} - %{offset_end}</strong> von <strong>%{count}</strong> %{name} angezeigt"
|
67
|
-
other: "Es werden <strong>alle %{count}</strong> %{
|
68
|
-
one: "Es wird <strong>1</strong> %{
|
67
|
+
other: "Es werden <strong>alle %{count}</strong> %{name} angezeigt"
|
68
|
+
one: "Es wird <strong>1</strong> %{name} angezeigt"
|
69
69
|
zero: "Es wurde nichts gefunden"
|
70
70
|
|
71
71
|
footer:
|
data/config/locales/en.yml
CHANGED
@@ -69,9 +69,9 @@ en:
|
|
69
69
|
entries: entries
|
70
70
|
info:
|
71
71
|
default: "Displaying <strong>%{offset_start} - %{offset_end}</strong> of <strong>%{count}</strong> %{name} in total"
|
72
|
-
other: "Displaying <strong>all %{count}</strong> %{
|
73
|
-
one: "Displaying <strong>1</strong> %{
|
74
|
-
zero: "No %{
|
72
|
+
other: "Displaying <strong>all %{count}</strong> %{name}"
|
73
|
+
one: "Displaying <strong>1</strong> %{name}"
|
74
|
+
zero: "No %{name} found"
|
75
75
|
|
76
76
|
footer:
|
77
77
|
state: 'Page rendered in ~%{time} seconds'
|
data/config/locales/pt.yml
CHANGED
@@ -68,9 +68,9 @@ pt:
|
|
68
68
|
entries: registros
|
69
69
|
info:
|
70
70
|
default: "Exibindo <strong>%{offset_start} - %{offset_end}</strong> de <strong>%{count}</strong> %{name} no total"
|
71
|
-
other: "Exibindo <strong>todos %{count}</strong> %{
|
72
|
-
one: "Exibindo <strong>1</strong> %{
|
73
|
-
zero: "Nenhum(a) %{
|
71
|
+
other: "Exibindo <strong>todos %{count}</strong> %{name}"
|
72
|
+
one: "Exibindo <strong>1</strong> %{name}"
|
73
|
+
zero: "Nenhum(a) %{name} encontrado"
|
74
74
|
|
75
75
|
footer:
|
76
76
|
state: 'Página renderizada em ~%{time} segundos'
|
data/lib/bhf/mongoid/document.rb
CHANGED
@@ -20,18 +20,19 @@ module Bhf::Mongoid
|
|
20
20
|
@name = mongoid_field.name
|
21
21
|
@klass = mongoid_field.class_name.constantize
|
22
22
|
@foreign_key = mongoid_field.key
|
23
|
-
@macro =
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
23
|
+
@macro = mongoid_field.class.name.demodulize.underscore.to_sym
|
24
|
+
# @macro = case mongoid_field.macro
|
25
|
+
# when :references_and_referenced_in_many
|
26
|
+
# :has_and_belongs_to_many
|
27
|
+
# when :references_many
|
28
|
+
# :has_many
|
29
|
+
# when :references_one
|
30
|
+
# :has_one
|
31
|
+
# when :referenced_in
|
32
|
+
# :belongs_to
|
33
|
+
# else
|
34
|
+
# mongoid_field.macro
|
35
|
+
# end
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -67,7 +68,7 @@ module Bhf::Mongoid
|
|
67
68
|
def reflections
|
68
69
|
c = {}
|
69
70
|
relations.each do |key, meta|
|
70
|
-
next if meta.
|
71
|
+
next if meta.is_a?(Mongoid::Association::Embedded::EmbeddedIn)
|
71
72
|
c[key] = Reflection.new(meta)
|
72
73
|
end
|
73
74
|
c
|
@@ -112,7 +113,7 @@ module Bhf::Mongoid
|
|
112
113
|
|
113
114
|
def get_embedded_parent(parent_id, &block)
|
114
115
|
relations.each do |key, meta|
|
115
|
-
next unless meta.
|
116
|
+
next unless meta.is_a?(Mongoid::Association::Embedded::EmbeddedIn)
|
116
117
|
parent = meta.class_name.constantize
|
117
118
|
parent = parent.find(parent_id) rescue nil
|
118
119
|
|
@@ -130,7 +131,7 @@ module Bhf::Mongoid
|
|
130
131
|
else
|
131
132
|
meta.inverse_foreign_key.pluralize
|
132
133
|
end.to_s
|
133
|
-
if parent.relations[key_name] and parent.relations[key_name].
|
134
|
+
if parent.relations[key_name] and parent.relations[key_name].is_a?(Mongoid::Association::Embedded::EmbedsOne)
|
134
135
|
parent.send("build_#{key_name}", params)
|
135
136
|
else
|
136
137
|
parent.send(key_name).build(params)
|
@@ -146,7 +147,7 @@ module Bhf::Mongoid
|
|
146
147
|
meta.inverse_foreign_key.pluralize
|
147
148
|
end.to_s
|
148
149
|
relation = parent.send(key_name)
|
149
|
-
if parent.relations[key_name].
|
150
|
+
if parent.relations[key_name].is_a?(Mongoid::Association::Embedded::EmbedsOne)
|
150
151
|
relation
|
151
152
|
else
|
152
153
|
relation.find(ref_id)
|
@@ -25,11 +25,11 @@ module Bhf::Platform
|
|
25
25
|
def create(platform)
|
26
26
|
platform_params = template.params[platform.name] || {}
|
27
27
|
|
28
|
-
links = if !(page_links = template.paginate(platform.objects,
|
28
|
+
links = if !(page_links = template.paginate(platform.objects,
|
29
29
|
theme: 'bhf',
|
30
30
|
param_name: [platform.name, :page],
|
31
31
|
params: template.params.permit!
|
32
|
-
|
32
|
+
)).blank?
|
33
33
|
"#{load_more(platform)} #{page_links}"
|
34
34
|
elsif platform.objects.total_pages == 1 && platform.objects.size > @offset_to_add
|
35
35
|
load_less(platform)
|
@@ -51,12 +51,20 @@ module Bhf::Platform
|
|
51
51
|
offset_end: collection.offset_value + collection.limit_value
|
52
52
|
})
|
53
53
|
else
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
count = collection.size
|
55
|
+
platform_title = case count
|
56
|
+
when 0
|
57
|
+
platform.title
|
58
|
+
when 1
|
59
|
+
platform.title_singular
|
60
|
+
else
|
61
|
+
platform.title
|
62
|
+
end
|
63
|
+
|
64
|
+
I18n.t('bhf.pagination.info',
|
65
|
+
count: count,
|
66
|
+
name: platform_title
|
67
|
+
)
|
60
68
|
end.html_safe
|
61
69
|
end
|
62
70
|
|
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: 1.0.0.
|
4
|
+
version: 1.0.0.beta15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Pawlik
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -316,7 +316,7 @@ homepage: http://antpaw.github.io/bhf
|
|
316
316
|
licenses:
|
317
317
|
- MIT
|
318
318
|
metadata: {}
|
319
|
-
post_install_message:
|
319
|
+
post_install_message:
|
320
320
|
rdoc_options: []
|
321
321
|
require_paths:
|
322
322
|
- lib
|
@@ -331,8 +331,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
331
|
- !ruby/object:Gem::Version
|
332
332
|
version: 1.3.1
|
333
333
|
requirements: []
|
334
|
-
rubygems_version: 3.0.
|
335
|
-
signing_key:
|
334
|
+
rubygems_version: 3.0.9
|
335
|
+
signing_key:
|
336
336
|
specification_version: 4
|
337
337
|
summary: A simple to use Rails-Engine-Gem that offers an admin interface for trusted
|
338
338
|
user.
|