rails_admin_next 1.0.2 → 1.1.1
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/app/helpers/rails_admin_next/application_helper.rb +2 -2
- data/lib/rails_admin_next/abstract_model.rb +11 -0
- data/lib/rails_admin_next/config/actions/base.rb +7 -0
- data/lib/rails_admin_next/config/actions/show.rb +3 -1
- data/lib/rails_admin_next/config/fields/base.rb +10 -3
- data/lib/rails_admin_next/config/fields/types/datetime.rb +0 -5
- data/lib/rails_admin_next/config/fields/types/multiple_file_upload.rb +0 -2
- data/lib/rails_admin_next/config/sections/list.rb +0 -8
- data/lib/rails_admin_next/config.rb +0 -8
- data/lib/rails_admin_next/version.rb +2 -2
- 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: bb4c3297b700fd39f935a4983531ed06ad5312c195132215fa1b85402053aa86
|
|
4
|
+
data.tar.gz: 1ea265ef3f1e93c8b5ab452167f3400638a04450628c9939f9f10c38e60715ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80d8dbceeff208207a33156dd6a58e1de13895e65206c73c491a2c136f759388d78a4c37875f47ae63135cb1adb9dc46b6c5ba3482f6ce616a6aa3f64b34b031
|
|
7
|
+
data.tar.gz: d8568d4805acf6887dcde84c49b4b598657bd1cc06fb24bd726a22b0c857fedfd090dfb9af87d662d659a01c6324cb18e1c23692992d9ab3f297eeec07c263ee
|
|
@@ -144,7 +144,7 @@ module RailsAdminNext
|
|
|
144
144
|
content_tag(:li, class: ["breadcrumb-item", current_action?(a, am, o) && "active"]) do
|
|
145
145
|
if current_action?(a, am, o)
|
|
146
146
|
wording_for(:breadcrumb, a, am, o)
|
|
147
|
-
elsif a.
|
|
147
|
+
elsif a.linkable?
|
|
148
148
|
link_to rails_admin_next.url_for(action: a.action_name, controller: "rails_admin_next/main", model_name: am.try(:to_param), id: o.try(:persisted?) && o.try(:id) || nil) do
|
|
149
149
|
wording_for(:breadcrumb, a, am, o)
|
|
150
150
|
end
|
|
@@ -159,7 +159,7 @@ module RailsAdminNext
|
|
|
159
159
|
# parent => :root, :collection, :member
|
|
160
160
|
# perf matters here (no action view trickery)
|
|
161
161
|
def menu_for(parent, abstract_model = nil, object = nil, only_icon = false)
|
|
162
|
-
actions = actions(parent, abstract_model, object).select { |a| a.
|
|
162
|
+
actions = actions(parent, abstract_model, object).select { |a| a.linkable? && a.show_in_menu }
|
|
163
163
|
actions.collect do |action|
|
|
164
164
|
wording = wording_for(:menu, action)
|
|
165
165
|
li_class = ["nav-item", "icon", "#{action.key}_#{parent}_link"]
|
|
@@ -131,6 +131,17 @@ module RailsAdminNext
|
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
def to_statement
|
|
134
|
+
# A multi-select filter submits its values as an array, so the sentinel has to
|
|
135
|
+
# be stripped out of one rather than compared against it. An array emptied by
|
|
136
|
+
# that strip discards the filter, but one that arrived empty does not: a date
|
|
137
|
+
# filter carries its meaning in the operator alone ("today", "this_week").
|
|
138
|
+
#
|
|
139
|
+
# "between" is excluded because it alone reads the array by index, so removing
|
|
140
|
+
# an element would shift the range ends rather than discard anything.
|
|
141
|
+
if @value.is_a?(Array) && @operator != "between" && @value.include?("_discard")
|
|
142
|
+
@value -= ["_discard"]
|
|
143
|
+
return if @value.empty?
|
|
144
|
+
end
|
|
134
145
|
return if [@operator, @value].any? { |v| v == "_discard" }
|
|
135
146
|
|
|
136
147
|
unary_operators[@operator] || unary_operators[@value] ||
|
|
@@ -147,6 +147,13 @@ module RailsAdminNext
|
|
|
147
147
|
|
|
148
148
|
# Off API.
|
|
149
149
|
|
|
150
|
+
# Whether visiting the action's URL performs it, so it can be rendered as a
|
|
151
|
+
# plain link rather than a button. Verbs are host-supplied, so they may be
|
|
152
|
+
# written as :GET or "get".
|
|
153
|
+
def linkable?
|
|
154
|
+
http_methods.include?(:get) || http_methods.any? { |verb| verb.to_s.casecmp?("get") }
|
|
155
|
+
end
|
|
156
|
+
|
|
150
157
|
def key
|
|
151
158
|
self.class.key
|
|
152
159
|
end
|
|
@@ -20,9 +20,11 @@ module RailsAdminNext
|
|
|
20
20
|
|
|
21
21
|
register_instance_option :controller do
|
|
22
22
|
proc do
|
|
23
|
+
# HTML first: an Accept-less request arrives as */*, which matches every
|
|
24
|
+
# registered type, so Rails falls back to whichever is declared first.
|
|
23
25
|
respond_to do |format|
|
|
24
|
-
format.json { render json: @object }
|
|
25
26
|
format.html { render @action.template_name }
|
|
27
|
+
format.json { render json: @object }
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
end
|
|
@@ -16,6 +16,9 @@ module RailsAdminNext
|
|
|
16
16
|
include RailsAdminNext::Config::Groupable
|
|
17
17
|
include RailsAdminNext::Config::Inspectable
|
|
18
18
|
|
|
19
|
+
# The length-validation options that are compared against the column limit.
|
|
20
|
+
LENGTH_BOUNDS = %i[is maximum minimum].freeze
|
|
21
|
+
|
|
19
22
|
attr_reader :name, :properties, :abstract_model, :parent, :root
|
|
20
23
|
attr_accessor :defined, :order, :section
|
|
21
24
|
|
|
@@ -196,8 +199,14 @@ module RailsAdminNext
|
|
|
196
199
|
|
|
197
200
|
# Accessor for field's length restrictions per validations
|
|
198
201
|
#
|
|
202
|
+
# ActiveModel also accepts a bound as a Proc or a Symbol, which it resolves
|
|
203
|
+
# against the record at validation time. Neither can be compared against the
|
|
204
|
+
# column limit here, so both are dropped. Devise's password length validation
|
|
205
|
+
# declares its bounds as Procs.
|
|
199
206
|
register_instance_option :valid_length do
|
|
200
|
-
@valid_length ||=
|
|
207
|
+
@valid_length ||=
|
|
208
|
+
(abstract_model.model.validators_on(name).detect { |v| v.kind == :length }.try(&:options) || {})
|
|
209
|
+
.reject { |option, bound| LENGTH_BOUNDS.include?(option) && (bound.is_a?(Proc) || bound.is_a?(Symbol)) }
|
|
201
210
|
end
|
|
202
211
|
|
|
203
212
|
register_instance_option :partial do
|
|
@@ -266,8 +275,6 @@ module RailsAdminNext
|
|
|
266
275
|
false
|
|
267
276
|
end
|
|
268
277
|
|
|
269
|
-
register_deprecated_instance_option :eager_load?, :eager_load
|
|
270
|
-
|
|
271
278
|
def eager_load_values
|
|
272
279
|
case eager_load
|
|
273
280
|
when true
|
|
@@ -63,11 +63,6 @@ module RailsAdminNext
|
|
|
63
63
|
:form_datetime
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
# Picker-only legacy option; native HTML5 inputs render per the browser locale, so it is ignored.
|
|
67
|
-
register_deprecated_instance_option :momentjs_format do
|
|
68
|
-
RailsAdminNext.deprecator.warn("The momentjs_format configuration option is deprecated and ignored; date/time fields now use native HTML5 inputs.")
|
|
69
|
-
end
|
|
70
|
-
|
|
71
66
|
# The native <input type="datetime-local" step="1"> control accepts and emits ISO 8601 only.
|
|
72
67
|
def form_value
|
|
73
68
|
value&.in_time_zone&.strftime("%Y-%m-%dT%H:%M:%S") || form_default_value
|
|
@@ -46,17 +46,9 @@ module RailsAdminNext
|
|
|
46
46
|
""
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
register_deprecated_instance_option :sidescroll do
|
|
50
|
-
RailsAdminNext.deprecator.warn("The sidescroll configuration option was removed, it is always enabled now.")
|
|
51
|
-
end
|
|
52
|
-
|
|
53
49
|
def fields_for_table
|
|
54
50
|
visible_fields.partition(&:sticky?).flatten
|
|
55
51
|
end
|
|
56
|
-
|
|
57
|
-
register_deprecated_instance_option :sort_reverse do
|
|
58
|
-
RailsAdminNext.deprecator.warn("The sort_reverse configuration option is deprecated and has no effect.")
|
|
59
|
-
end
|
|
60
52
|
end
|
|
61
53
|
end
|
|
62
54
|
end
|
|
@@ -316,14 +316,6 @@ module RailsAdminNext
|
|
|
316
316
|
end
|
|
317
317
|
end
|
|
318
318
|
|
|
319
|
-
def total_columns_width=(_)
|
|
320
|
-
RailsAdminNext.deprecator.warn("The total_columns_width configuration option is deprecated and has no effect.")
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
def sidescroll=(_)
|
|
324
|
-
RailsAdminNext.deprecator.warn("The sidescroll configuration option was removed, it is always enabled now.")
|
|
325
|
-
end
|
|
326
|
-
|
|
327
319
|
# Setup actions to be used.
|
|
328
320
|
def actions(&block)
|
|
329
321
|
return unless block
|