madmin 2.1.2 → 2.2.0
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.
- checksums.yaml +4 -4
- data/lib/madmin/engine.rb +3 -2
- data/lib/madmin/fields/has_many.rb +2 -3
- data/lib/madmin/version.rb +1 -1
- data/lib/madmin.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78993e05ef332c22e397e3c82e700613fa23cdb51b471f03f1b99eb5afbda30c
|
|
4
|
+
data.tar.gz: bd8983cc682bf888fcc728abd59926b3a06f9eabc44042a87146cd6b356cee85
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af2d4bba734ce8debf047ff1fedbe8364cf416ea9e349f8c218582ae5e6f8480ce79f6ab2edff648608ab57bec550dcabf67ee1d1b304801552e89a45ae73390
|
|
7
|
+
data.tar.gz: ce73fc961adc7b6b06967c532a4220401e9f32112eea71933cacce0ab5c89262e331e07e97744b851038ff0590736298be10085c5c02cd7fcf4701e5ae4668ec
|
data/lib/madmin/engine.rb
CHANGED
|
@@ -5,8 +5,9 @@ module Madmin
|
|
|
5
5
|
isolate_namespace Madmin
|
|
6
6
|
|
|
7
7
|
config.before_configuration do |app|
|
|
8
|
-
app.config.eager_load_paths <<
|
|
9
|
-
app.config.eager_load_paths <<
|
|
8
|
+
app.config.eager_load_paths << app.root.join("app/madmin/resources")
|
|
9
|
+
app.config.eager_load_paths << app.root.join("app/madmin/fields")
|
|
10
|
+
Madmin.resource_locations << Rails.root.join("app/madmin/resources/")
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
config.to_prepare do
|
|
@@ -39,10 +39,9 @@ module Madmin
|
|
|
39
39
|
def paginated_value(record, params)
|
|
40
40
|
page_key = "#{attribute_name}_page"
|
|
41
41
|
request = {
|
|
42
|
-
|
|
42
|
+
params: {
|
|
43
43
|
"#{attribute_name}_page" => [params[page_key].to_i, 1].max
|
|
44
|
-
}
|
|
45
|
-
params: params
|
|
44
|
+
}
|
|
46
45
|
}
|
|
47
46
|
pagy value(record), page_key: page_key, request: request
|
|
48
47
|
rescue Pagy::OptionError
|
data/lib/madmin/version.rb
CHANGED
data/lib/madmin.rb
CHANGED
|
@@ -40,6 +40,7 @@ module Madmin
|
|
|
40
40
|
mattr_accessor :menu, default: Menu.new
|
|
41
41
|
mattr_accessor :site_name
|
|
42
42
|
mattr_accessor :stylesheets, default: []
|
|
43
|
+
mattr_accessor :resource_locations, default: []
|
|
43
44
|
|
|
44
45
|
class MissingResource < StandardError
|
|
45
46
|
end
|
|
@@ -99,9 +100,10 @@ module Madmin
|
|
|
99
100
|
end
|
|
100
101
|
|
|
101
102
|
def resource_names
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
resource_locations.flat_map do |root|
|
|
104
|
+
files = Dir.glob(root.join("**/*.rb"))
|
|
105
|
+
files.sort!.map! { |f| f.split(root.to_s).last.delete_suffix(".rb").classify }
|
|
106
|
+
end
|
|
105
107
|
end
|
|
106
108
|
end
|
|
107
109
|
end
|