super 0.19.0 → 0.20.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/README.md +4 -4
- data/app/controllers/super/application_controller.rb +2 -2
- data/app/controllers/super/substructure_controller.rb +24 -1
- data/app/helpers/super/form_builder_helper.rb +4 -4
- data/app/views/super/application/_batch_checkbox.html.erb +4 -0
- data/app/views/super/application/_form.html.erb +1 -1
- data/app/views/super/application/_pagination.html.erb +1 -4
- data/app/views/super/application/_site_footer.html.erb +1 -1
- data/config/locales/en.yml +7 -1
- data/frontend/super-frontend/dist/application.js +6276 -6286
- data/frontend/super-frontend/dist/package.json +2 -2
- data/lib/super/action_inquirer.rb +3 -0
- data/lib/super/error.rb +1 -0
- data/lib/super/form/schema_types.rb +8 -36
- data/lib/super/form_builder/action_text_methods.rb +16 -0
- data/lib/super/form_builder/base_methods.rb +73 -0
- data/lib/super/form_builder/flatpickr_methods.rb +75 -0
- data/lib/super/form_builder/option_methods.rb +73 -0
- data/lib/super/form_builder.rb +143 -0
- data/lib/super/link.rb +47 -63
- data/lib/super/link_builder.rb +24 -43
- data/lib/super/useful/i19.rb +35 -0
- data/lib/super/version.rb +1 -1
- data/lib/super.rb +6 -1
- metadata +13 -8
- data/lib/super/form/builder.rb +0 -289
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e47e4344e0e7e7cf55cc943672017a92e7e30d566aa84b28b2351b4f190b22ed
|
4
|
+
data.tar.gz: 62b74ffa083bbabe27890359f987e78363e6fc86a8b164d8529155f9eeaff655
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec637b18bb09e636e988507036d41dde995a8f33aeacd69a5b94924eadfcbae4acba73a58c32a0d4188f4f3a8ae852c5b9a9566af647bf4e0583484369d4566c
|
7
|
+
data.tar.gz: 7a9e37ed3dc2232e902e2d8b770c02e737413eec66cc4df80c1cefdb974e38d523568a1f66962a2943b667c6cb28439c0fb501c98b102747ad511d9d5204cc3c
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Super
|
2
2
|
|
3
|
-

|
4
4
|
[][gem]
|
5
5
|
[][demo]
|
6
6
|
[][docs]
|
@@ -88,7 +88,7 @@ The gem is available under the terms of the [GNU LGPLv3](./LICENSE).
|
|
88
88
|
|
89
89
|
|
90
90
|
[gem]: https://rubygems.org/gems/super
|
91
|
-
[discussions]: https://github.com/
|
91
|
+
[discussions]: https://github.com/superadministration/super/discussions
|
92
92
|
[docs]: https://superadministration.github.io/
|
93
|
-
[demo]: https://demo-super.herokuapp.com/admin
|
94
|
-
[demo_source]: https://github.com/
|
93
|
+
[demo]: https://demo-super.herokuapp.com/admin
|
94
|
+
[demo_source]: https://github.com/superadministration/super_demo
|
@@ -118,7 +118,7 @@ module Super
|
|
118
118
|
helper_method def resolved_member_actions(record)
|
119
119
|
member_actions(record).map do |action|
|
120
120
|
if action.respond_to?(:resolve)
|
121
|
-
action
|
121
|
+
resolve_member_action(action, record)
|
122
122
|
else
|
123
123
|
action
|
124
124
|
end
|
@@ -128,7 +128,7 @@ module Super
|
|
128
128
|
helper_method def resolved_collection_actions
|
129
129
|
collection_actions.map do |action|
|
130
130
|
if action.respond_to?(:resolve)
|
131
|
-
action
|
131
|
+
resolve_collection_action(action)
|
132
132
|
else
|
133
133
|
action
|
134
134
|
end
|
@@ -93,6 +93,14 @@ module Super
|
|
93
93
|
params.require(strong_params.require(model)).permit(strong_params.permit)
|
94
94
|
end
|
95
95
|
|
96
|
+
helper_method def form_record(record)
|
97
|
+
record
|
98
|
+
end
|
99
|
+
|
100
|
+
helper_method def form_action(record)
|
101
|
+
Super::Link.polymorphic_parts(record)
|
102
|
+
end
|
103
|
+
|
96
104
|
# Configures the actions linked to on the index page. This is an optional
|
97
105
|
# method
|
98
106
|
#
|
@@ -127,6 +135,14 @@ module Super
|
|
127
135
|
end
|
128
136
|
end
|
129
137
|
|
138
|
+
helper_method def resolve_collection_action(action)
|
139
|
+
action.resolve(params: params)
|
140
|
+
end
|
141
|
+
|
142
|
+
helper_method def resolve_member_action(action, record)
|
143
|
+
action.resolve(params: params, record: record)
|
144
|
+
end
|
145
|
+
|
130
146
|
helper_method def filters_enabled?
|
131
147
|
true
|
132
148
|
end
|
@@ -264,6 +280,13 @@ module Super
|
|
264
280
|
.offset(@pagination.offset)
|
265
281
|
end
|
266
282
|
|
283
|
+
helper_method def paginated_link(page_query_params)
|
284
|
+
polymorphic_path(
|
285
|
+
Super::Link.polymorphic_parts(model),
|
286
|
+
page_query_params
|
287
|
+
)
|
288
|
+
end
|
289
|
+
|
267
290
|
helper_method def csv_enabled?
|
268
291
|
true
|
269
292
|
end
|
@@ -286,7 +309,7 @@ module Super
|
|
286
309
|
Super::Layout.new(
|
287
310
|
main: Super::ViewChain.new(
|
288
311
|
main_panel: Super::Panel.new,
|
289
|
-
main_header: Super::Partial.new("
|
312
|
+
main_header: Super::Partial.new("member_header"),
|
290
313
|
main: :@display
|
291
314
|
)
|
292
315
|
)
|
@@ -10,9 +10,9 @@ module Super
|
|
10
10
|
# Super's version of `#form_for`
|
11
11
|
def super_form_for(record, options = {}, &block)
|
12
12
|
original = ActionView::Base.field_error_proc
|
13
|
-
ActionView::Base.field_error_proc =
|
13
|
+
ActionView::Base.field_error_proc = FormBuilder::FIELD_ERROR_PROC
|
14
14
|
|
15
|
-
options[:builder] ||=
|
15
|
+
options[:builder] ||= FormBuilder
|
16
16
|
return form_for(record, options, &block)
|
17
17
|
ensure
|
18
18
|
ActionView::Base.field_error_proc = original
|
@@ -21,9 +21,9 @@ module Super
|
|
21
21
|
# Super's version of `#form_with`
|
22
22
|
def super_form_with(**options, &block)
|
23
23
|
original = ActionView::Base.field_error_proc
|
24
|
-
ActionView::Base.field_error_proc =
|
24
|
+
ActionView::Base.field_error_proc = FormBuilder::FIELD_ERROR_PROC
|
25
25
|
|
26
|
-
options[:builder] ||=
|
26
|
+
options[:builder] ||= FormBuilder
|
27
27
|
return form_with(**options, &block)
|
28
28
|
ensure
|
29
29
|
ActionView::Base.field_error_proc = original
|
@@ -1,5 +1,9 @@
|
|
1
|
+
<% if current_action.collection? %>
|
1
2
|
<div class="whitespace-nowrap gap-1">
|
2
3
|
<% html_id = "batch-checkbox-#{value.to_s.gsub(/[^a-z0-9]+/, "-")}" %>
|
3
4
|
<input type="checkbox" name="batch[]" value="<%= value %>" id="<%= html_id %>">
|
4
5
|
<label for="<%= html_id %>"><%= value %></label>
|
5
6
|
</div>
|
7
|
+
<% else %>
|
8
|
+
<%= value %>
|
9
|
+
<% end %>
|
@@ -5,10 +5,7 @@
|
|
5
5
|
<% @pagination.each do |page_query_params, is_current_page, display| %>
|
6
6
|
<%= link_to(
|
7
7
|
display,
|
8
|
-
|
9
|
-
Super::Link.polymorphic_parts(model),
|
10
|
-
page_query_params
|
11
|
-
),
|
8
|
+
paginated_link(page_query_params),
|
12
9
|
class: "inline-block ml-2 text-lg #{is_current_page ? " text-gray-900" : ""}"
|
13
10
|
) %>
|
14
11
|
<% end %>
|
data/config/locales/en.yml
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
---
|
2
2
|
en:
|
3
3
|
super:
|
4
|
+
actions:
|
5
|
+
new: New
|
6
|
+
index: Index
|
7
|
+
show: View
|
8
|
+
edit: Edit
|
9
|
+
destroy: Delete
|
4
10
|
batch:
|
5
11
|
none_error: This batch action received no items to act upon
|
6
12
|
csv:
|
@@ -9,5 +15,5 @@ en:
|
|
9
15
|
download_current_cta: Download current view
|
10
16
|
download_all_cta: Download all matching query
|
11
17
|
layout:
|
12
|
-
|
18
|
+
powered_by_html: "%{env} environment. Powered by Super %{version}. <a href='https://superadministration.github.io/v%{version}/'>Developer docs.</a>"
|
13
19
|
mismatching_package_json_gemfile_versions: "The version of Super specified in your package.json file does not match the version specified in your Gemfile.lock."
|