jav_madmin 2.6.6 → 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 +4 -4
- data/lib/madmin/resource.rb +19 -31
- data/lib/madmin/version.rb +1 -1
- 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: c4901ab95118bdd1ee7273a72c2485dc63ebd3eeaa59206b1e96230920acae84
|
|
4
|
+
data.tar.gz: c6816fbe255ce60c1c1af161da6120795c5ac45cf7ab56e72979589c2a5ace42
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 58d2ecaa79969d5f781b02654d4f55f1728bcef1d232f8dc94d33f90f850176600cf86b9b527ad0c333486e10128115cc3122d858ba1efca5c426b9dd71f8aae
|
|
7
|
+
data.tar.gz: 40b2e8d203803b1c019404919a256df54c04be3789f2c8d15ab216459f7e691be6009848cc985a408607039537509436fa7fee24ff2cb633ef7cd4d98961f5f4
|
data/lib/madmin/resource.rb
CHANGED
|
@@ -97,43 +97,20 @@ module Madmin
|
|
|
97
97
|
@route_namespace = (namespace ? namespace.name.underscore.to_sym : nil)
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
# [
|
|
103
|
-
# [:index_path, ori_opts, false],
|
|
104
|
-
# [:new_path, ori_opts.merge(action: :new), false],
|
|
105
|
-
# [:show_path, ori_opts, true],
|
|
106
|
-
# [:edit_path, ori_opts.merge(action: :edit), true]
|
|
107
|
-
# ].each do |item|
|
|
108
|
-
# if item[2]
|
|
109
|
-
# define_method item[0] do |record, options = item[1]|
|
|
110
|
-
# url_helpers.polymorphic_path([:madmin, route_namespace, becomes(record)], options)
|
|
111
|
-
# end
|
|
112
|
-
# else
|
|
113
|
-
# define_method item[0] do |options = item[1]|
|
|
114
|
-
# url_helpers.polymorphic_path([:madmin, route_namespace, model], options)
|
|
115
|
-
# end
|
|
116
|
-
# end
|
|
117
|
-
# end
|
|
118
|
-
|
|
119
|
-
def index_path(options = {})
|
|
120
|
-
ori_opts = Madmin.multi_locales ? {locale: I18n.locale} : {}
|
|
121
|
-
url_helpers.polymorphic_path([:madmin, route_namespace, model], options.merge(ori_opts))
|
|
100
|
+
def index_path(options = nil)
|
|
101
|
+
build_polymorphic_path([:madmin, route_namespace, model], options)
|
|
122
102
|
end
|
|
123
103
|
|
|
124
|
-
def new_path(options =
|
|
125
|
-
|
|
126
|
-
url_helpers.polymorphic_path([:madmin, route_namespace, model], options.merge(ori_opts))
|
|
104
|
+
def new_path(options = nil)
|
|
105
|
+
build_polymorphic_path([:madmin, route_namespace, model], options, action: :new)
|
|
127
106
|
end
|
|
128
107
|
|
|
129
|
-
def show_path(record, options =
|
|
130
|
-
|
|
131
|
-
url_helpers.polymorphic_path([:madmin, route_namespace, becomes(record)], options.merge(ori_opts))
|
|
108
|
+
def show_path(record, options = nil)
|
|
109
|
+
build_polymorphic_path([:madmin, route_namespace, becomes(record)], options)
|
|
132
110
|
end
|
|
133
111
|
|
|
134
|
-
def edit_path(record, options =
|
|
135
|
-
|
|
136
|
-
url_helpers.polymorphic_path([:madmin, route_namespace, becomes(record)], options.merge(ori_opts))
|
|
112
|
+
def edit_path(record, options = nil)
|
|
113
|
+
build_polymorphic_path([:madmin, route_namespace, becomes(record)], options, action: :edit)
|
|
137
114
|
end
|
|
138
115
|
|
|
139
116
|
def becomes(record)
|
|
@@ -311,6 +288,17 @@ module Madmin
|
|
|
311
288
|
@menu_options ||= {}
|
|
312
289
|
@menu_options.with_defaults(label: model.model_name.i18n_key, url: index_path)
|
|
313
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
|
|
314
302
|
end
|
|
315
303
|
|
|
316
304
|
ActiveSupport.run_load_hooks(:madmin_resource, self)
|
data/lib/madmin/version.rb
CHANGED