jav_madmin 2.6.5 → 2.6.7

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: bdca12e732cb02bb6a5627f86c80dfc392990e96f6e3170af55981ae3de3d247
4
- data.tar.gz: 6725ea9f24078be1a59d0fd7c003c261bdd5f21d60d033a2f7d21d3849841176
3
+ metadata.gz: c4901ab95118bdd1ee7273a72c2485dc63ebd3eeaa59206b1e96230920acae84
4
+ data.tar.gz: c6816fbe255ce60c1c1af161da6120795c5ac45cf7ab56e72979589c2a5ace42
5
5
  SHA512:
6
- metadata.gz: c0b6000f7c185be369897bfb77396424e44f1492fe499e8ad52d89a1fc6b6d81317a3b3c8afba26c96b8367f20ea1682d63287e8d630c8492e3f7e1757d2cb22
7
- data.tar.gz: 352f7789b1edff23e396b35ac69f8abf9b4ccd4d7737493df6f519ccab621f77a1919761d4bab23431c2a9fe237385b96414e560c9e3af4b03aeb21a62d1e922
6
+ metadata.gz: 58d2ecaa79969d5f781b02654d4f55f1728bcef1d232f8dc94d33f90f850176600cf86b9b527ad0c333486e10128115cc3122d858ba1efca5c426b9dd71f8aae
7
+ data.tar.gz: 40b2e8d203803b1c019404919a256df54c04be3789f2c8d15ab216459f7e691be6009848cc985a408607039537509436fa7fee24ff2cb633ef7cd4d98961f5f4
@@ -97,20 +97,20 @@ module Madmin
97
97
  @route_namespace = (namespace ? namespace.name.underscore.to_sym : nil)
98
98
  end
99
99
 
100
- def index_path(options = {})
101
- url_helpers.polymorphic_path([:madmin, route_namespace, model], options)
100
+ def index_path(options = nil)
101
+ build_polymorphic_path([:madmin, route_namespace, model], options)
102
102
  end
103
103
 
104
- def new_path
105
- url_helpers.polymorphic_path([:madmin, route_namespace, model], action: :new)
104
+ def new_path(options = nil)
105
+ build_polymorphic_path([:madmin, route_namespace, model], options, action: :new)
106
106
  end
107
107
 
108
- def show_path(record)
109
- url_helpers.polymorphic_path([:madmin, route_namespace, becomes(record)])
108
+ def show_path(record, options = nil)
109
+ build_polymorphic_path([:madmin, route_namespace, becomes(record)], options)
110
110
  end
111
111
 
112
- def edit_path(record)
113
- url_helpers.polymorphic_path([:madmin, route_namespace, becomes(record)], action: :edit)
112
+ def edit_path(record, options = nil)
113
+ build_polymorphic_path([:madmin, route_namespace, becomes(record)], options, action: :edit)
114
114
  end
115
115
 
116
116
  def becomes(record)
@@ -288,6 +288,17 @@ module Madmin
288
288
  @menu_options ||= {}
289
289
  @menu_options.with_defaults(label: model.model_name.i18n_key, url: index_path)
290
290
  end
291
+
292
+ private
293
+
294
+ def locale_options
295
+ Madmin.multi_locales ? {locale: I18n.locale} : {}
296
+ end
297
+
298
+ def build_polymorphic_path(path_array, options, extra_opts = {})
299
+ opts = (options || {}).merge(extra_opts).merge(locale_options)
300
+ url_helpers.polymorphic_path(path_array, opts)
301
+ end
291
302
  end
292
303
 
293
304
  ActiveSupport.run_load_hooks(:madmin_resource, self)
@@ -1,3 +1,3 @@
1
1
  module Madmin
2
- VERSION = "2.6.5"
2
+ VERSION = "2.6.7"
3
3
  end
data/lib/madmin.rb CHANGED
@@ -44,6 +44,7 @@ module Madmin
44
44
  mattr_accessor :site_name
45
45
  mattr_accessor :stylesheets, default: []
46
46
  mattr_accessor :resource_locations, default: []
47
+ mattr_accessor :multi_locales, default: false, instance_accessor: false
47
48
 
48
49
  class MissingResource < StandardError
49
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jav_madmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.5
4
+ version: 2.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
@@ -278,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
278
  - !ruby/object:Gem::Version
279
279
  version: '0'
280
280
  requirements: []
281
- rubygems_version: 4.0.16
281
+ rubygems_version: 4.0.20
282
282
  specification_version: 4
283
283
  summary: A modern admin for Ruby on Rails apps
284
284
  test_files: []