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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67db829bf99130d9746ef0d3bd416f0c38e9ecaf70530db4c4066a60032e934d
4
- data.tar.gz: 91694aac3e2db7fad14918af8be8ab97029ca542848e6ccc1f36d493d2bd4f1e
3
+ metadata.gz: 78993e05ef332c22e397e3c82e700613fa23cdb51b471f03f1b99eb5afbda30c
4
+ data.tar.gz: bd8983cc682bf888fcc728abd59926b3a06f9eabc44042a87146cd6b356cee85
5
5
  SHA512:
6
- metadata.gz: bfa374d40d58292a97885e238681bd6bfb91dbe2618f501bda0e25ada1b5490fa8a69b5e80b86cf7262fce44a501a1e1935b672bb6b46a5456e322b11939f93d
7
- data.tar.gz: 2cf03a691fcda333691547743b7879495bb2de3ed8fc992761a505c154d92d81cb47d994209cca501bcf7b91f26343ccc9b9f007441f641a71440164864b80e4
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 << File.expand_path("app/madmin/resources", Rails.root)
9
- app.config.eager_load_paths << File.expand_path("app/madmin/fields", Rails.root)
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
- query: {
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
@@ -1,3 +1,3 @@
1
1
  module Madmin
2
- VERSION = "2.1.2"
2
+ VERSION = "2.2.0"
3
3
  end
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
- root = Rails.root.join("app/madmin/resources/")
103
- files = Dir.glob(root.join("**/*.rb"))
104
- files.sort!.map! { |f| f.split(root.to_s).last.delete_suffix(".rb").classify }
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver