super 0.20.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -48
- data/app/assets/javascripts/super/application.js +1201 -2092
- data/app/assets/stylesheets/super/application.css +54 -6569
- data/app/controllers/super/application_controller.rb +52 -47
- data/app/controllers/super/foundation_controller.rb +30 -0
- data/app/controllers/super/sitewide_controller.rb +36 -0
- data/app/controllers/super/substructure_controller.rb +40 -92
- data/app/controllers/super/view_controller.rb +59 -0
- data/app/views/layouts/super/application.html.erb +3 -3
- data/app/views/super/application/_batch_checkbox.csv.erb +1 -1
- data/app/views/super/application/_batch_checkbox.html.erb +1 -1
- data/app/views/super/application/_collection_header.html.erb +1 -1
- data/app/views/super/application/_csv_button.html.erb +1 -1
- data/app/views/super/application/_display_actions.html.erb +1 -1
- data/app/views/super/application/_display_index.html.erb +8 -2
- data/app/views/super/application/_display_rich_text.html.erb +1 -1
- data/app/views/super/application/_display_show.html.erb +10 -2
- data/app/views/super/application/_filter.html.erb +63 -59
- data/app/views/super/application/_form.html.erb +1 -1
- data/app/views/super/application/_form_fieldset.html.erb +1 -1
- data/app/views/super/application/_form_has_many.html.erb +2 -2
- data/app/views/super/application/_form_has_one.html.erb +1 -1
- data/app/views/super/application/_layout.html.erb +6 -8
- data/app/views/super/application/_link.html.erb +1 -6
- data/app/views/super/application/_member_header.html.erb +1 -1
- data/app/views/super/application/_panel.html.erb +1 -1
- data/app/views/super/application/_query.html.erb +13 -12
- data/app/views/super/application/_site_header.html.erb +2 -2
- data/app/views/super/application/_sort.html.erb +18 -14
- data/app/views/super/application/_sort_expression.html.erb +1 -1
- data/app/views/super/application/_view_chain.html.erb +1 -5
- data/app/views/super/application/edit.html.erb +1 -1
- data/app/views/super/application/index.html.erb +1 -1
- data/app/views/super/application/new.html.erb +1 -1
- data/app/views/super/application/show.html.erb +1 -1
- data/config/locales/en.yml +3 -0
- data/frontend/super-frontend/dist/application.css +54 -6569
- data/frontend/super-frontend/dist/application.js +1201 -2092
- data/lib/super/action_inquirer.rb +28 -8
- data/lib/super/assets.rb +2 -2
- data/lib/super/badge.rb +8 -23
- data/lib/super/cheat.rb +11 -5
- data/lib/super/client_error.rb +4 -0
- data/lib/super/compatibility.rb +4 -0
- data/lib/super/configuration.rb +3 -0
- data/lib/super/display/schema_types.rb +50 -71
- data/lib/super/display.rb +16 -15
- data/lib/super/error.rb +16 -2
- data/lib/super/filter/form_object.rb +2 -2
- data/lib/super/filter/operator.rb +1 -1
- data/lib/super/filter/schema_types.rb +1 -1
- data/lib/super/form/field_transcript.rb +4 -0
- data/lib/super/form/schema_types.rb +2 -2
- data/lib/super/form/strong_params.rb +1 -1
- data/lib/super/form_builder/base_methods.rb +3 -9
- data/lib/super/form_builder/flatpickr_methods.rb +3 -3
- data/lib/super/form_builder.rb +19 -21
- data/{app/helpers → lib}/super/form_builder_helper.rb +13 -2
- data/lib/super/link.rb +15 -6
- data/lib/super/link_builder.rb +4 -4
- data/lib/super/navigation.rb +49 -45
- data/lib/super/partial.rb +0 -12
- data/lib/super/plugin.rb +2 -2
- data/lib/super/query.rb +61 -0
- data/lib/super/{engine.rb → railtie.rb} +8 -1
- data/lib/super/render_helper.rb +31 -0
- data/lib/super/reset.rb +7 -5
- data/lib/super/schema/guesser.rb +5 -5
- data/lib/super/schema.rb +10 -4
- data/lib/super/sort.rb +2 -4
- data/lib/super/useful/deprecations.rb +16 -0
- data/lib/super/useful/enum.rb +1 -1
- data/lib/super/useful/i19.rb +1 -1
- data/lib/super/version.rb +1 -1
- data/lib/super/view_chain.rb +33 -4
- data/lib/super.rb +9 -2
- metadata +11 -49
- data/config/routes.rb +0 -4
- data/lib/super/query/form_object.rb +0 -48
@@ -1,66 +1,70 @@
|
|
1
|
-
<h1 class="text-lg">Filter</h1>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<div>
|
8
|
-
<
|
9
|
-
|
10
|
-
|
1
|
+
<h1 class="text-lg mt-4">Filter</h1>
|
2
|
+
<%= super_fields_for(query.namespace_for(filter), filter) do |form| %>
|
3
|
+
<% filter.each_attribute do |attribute_form_object| %>
|
4
|
+
<div class="mt-4">
|
5
|
+
<%= form.fields_for(attribute_form_object.field_name, attribute_form_object) do |attribute_form| %>
|
6
|
+
<% selected_index = 0 %>
|
7
|
+
<div data-controller="tab-container" data-tab-container-tab-identifier-getter-value="tabIdentifierValue" data-tab-container-tab-controller-name-value="tab">
|
8
|
+
<div>
|
9
|
+
<span class="inline-block"><%= attribute_form_object.humanized_attribute_name %></span>
|
10
|
+
<select data-tab-container-target="control" data-action="tab-container#change" class="super-input super-input-select inline-block">
|
11
|
+
<% selected = false %>
|
12
|
+
<% attribute_form_object.each_operator.with_index do |operator_form_object, index| %>
|
13
|
+
<%
|
14
|
+
selected_attribute =
|
15
|
+
if !selected && operator_form_object.specified?
|
16
|
+
selected = true
|
17
|
+
selected_index = index
|
18
|
+
%(selected=selected)
|
19
|
+
else
|
20
|
+
""
|
21
|
+
end
|
22
|
+
%>
|
23
|
+
<option value="<%= operator_form_object.identifier %>" <%= selected_attribute %>><%= operator_form_object.operator.humanized_operator_name %></option>
|
24
|
+
<% end %>
|
25
|
+
</select>
|
26
|
+
</div>
|
27
|
+
<div>
|
11
28
|
<% attribute_form_object.each_operator.with_index do |operator_form_object, index| %>
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
<% form_html = capture do %>
|
30
|
-
<div data-tab-target="content">
|
31
|
-
<%= attribute_form.fields_for(operator_form_object.identifier, operator_form_object) do |operator_form| %>
|
32
|
-
<div class="flex gap-x-2 mt-2">
|
33
|
-
<% operator_form_object.each_field.with_index do |operator_field_name, index| %>
|
34
|
-
<div class="flex-1">
|
35
|
-
<% if operator_field_name == Super::Filter::FormObject::OperatorForm::NULLARY %>
|
36
|
-
<%= operator_form.super.check_box(operator_field_name, {}, "1", "") %>
|
37
|
-
<%= operator_form.super.label(operator_field_name, nil, super: { class: "select-none ml-1" }) %>
|
38
|
-
<% elsif operator_form_object.operator.respond_to?(:field_transcript) && operator_form_object.operator.field_transcript %>
|
39
|
-
<% field_transcript = operator_form_object.operator.field_transcript %>
|
40
|
-
<% if field_transcript.super? %>
|
41
|
-
<%= operator_form.super.public_send(field_transcript.method_name, operator_field_name, *field_transcript.args, **field_transcript.kwargs) %>
|
29
|
+
<div data-controller="tab" data-tab-tab-container-getter-value="tabContainer" data-tab-container-target="tab" data-tab-identifier-value="<%= operator_form_object.identifier %>">
|
30
|
+
<% form_html = capture do %>
|
31
|
+
<div data-tab-target="content">
|
32
|
+
<%= attribute_form.fields_for(operator_form_object.identifier, operator_form_object) do |operator_form| %>
|
33
|
+
<div class="flex gap-x-2 mt-2">
|
34
|
+
<% operator_form_object.each_field.with_index do |operator_field_name, index| %>
|
35
|
+
<div class="flex-1">
|
36
|
+
<% if operator_field_name == Super::Filter::FormObject::OperatorForm::NULLARY %>
|
37
|
+
<%= operator_form.super.check_box(operator_field_name, {}, "1", "") %>
|
38
|
+
<%= operator_form.super.label(operator_field_name, nil, super: { class: "select-none ml-1" }) %>
|
39
|
+
<% elsif operator_form_object.operator.respond_to?(:field_transcript) && operator_form_object.operator.field_transcript %>
|
40
|
+
<% field_transcript = operator_form_object.operator.field_transcript %>
|
41
|
+
<% if field_transcript.super? %>
|
42
|
+
<%= operator_form.super.public_send(field_transcript.method_name, operator_field_name, *field_transcript.args, **field_transcript.kwargs) %>
|
43
|
+
<% else %>
|
44
|
+
<%= operator_form.public_send(field_transcript.method_name, operator_field_name, *field_transcript.args, **field_transcript.kwargs) %>
|
45
|
+
<% end %>
|
42
46
|
<% else %>
|
43
|
-
<%= operator_form.
|
47
|
+
<%= operator_form.super.text_field(operator_field_name) %>
|
44
48
|
<% end %>
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
<% end %>
|
52
|
-
</div>
|
53
|
-
<% end %>
|
49
|
+
</div>
|
50
|
+
<% end %>
|
51
|
+
</div>
|
52
|
+
<% end %>
|
53
|
+
</div>
|
54
|
+
<% end %>
|
54
55
|
|
55
|
-
|
56
|
+
<%= form_html if index == selected_index %>
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
<template data-tab-target="pocket">
|
59
|
+
<%= form_html %>
|
60
|
+
</template>
|
61
|
+
</div>
|
62
|
+
<% end %>
|
63
|
+
</div>
|
62
64
|
</div>
|
63
|
-
|
64
|
-
|
65
|
-
|
65
|
+
<% end %>
|
66
|
+
</div>
|
67
|
+
<% end %>
|
66
68
|
<% end %>
|
69
|
+
|
70
|
+
<%= yield if block_given? %>
|
@@ -3,6 +3,6 @@
|
|
3
3
|
<legend class="bg-white p-1 -mx-1"><%= form_fieldset.label %></legend>
|
4
4
|
<% end %>
|
5
5
|
<% form_fieldset.nested_fields.each do |field, type| %>
|
6
|
-
<%=
|
6
|
+
<%= super_render(type, form: form, column: field) %>
|
7
7
|
<% end %>
|
8
8
|
</fieldset>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div data-controller="apply-template">
|
2
2
|
<%= form.fields_for(form_has_many.reader) do |ff| %>
|
3
|
-
<%=
|
3
|
+
<%= super_render "form_fieldset", form_fieldset: form_has_many, form: ff %>
|
4
4
|
<% end %>
|
5
5
|
|
6
6
|
<%=
|
@@ -11,7 +11,7 @@
|
|
11
11
|
) do |ff|
|
12
12
|
%>
|
13
13
|
<template data-apply-template-target="template">
|
14
|
-
<%=
|
14
|
+
<%= super_render "form_fieldset", form_fieldset: form_has_many, form: ff %>
|
15
15
|
</template>
|
16
16
|
<% end %>
|
17
17
|
|
@@ -1,28 +1,26 @@
|
|
1
|
-
<%# <% layout.resolve(self) %1> %>
|
2
|
-
|
3
1
|
<% if layout.header %>
|
4
|
-
<%=
|
2
|
+
<%= super_render layout.header %>
|
5
3
|
<% end %>
|
6
4
|
|
7
5
|
<% if layout.aside %>
|
8
6
|
<div class="flow-root -mx-2">
|
9
7
|
<div class="md:float-left md:w-9/12 px-2">
|
10
8
|
<% if layout.main %>
|
11
|
-
<%=
|
9
|
+
<%= super_render layout.main %>
|
12
10
|
<% end %>
|
13
11
|
</div>
|
14
12
|
|
15
13
|
<div class="md:float-right md:w-3/12 px-2">
|
16
|
-
<%=
|
14
|
+
<%= super_render layout.aside %>
|
17
15
|
</div>
|
18
16
|
</div>
|
19
17
|
<% else %>
|
20
18
|
<% if layout.main %>
|
21
|
-
<%=
|
19
|
+
<%= super_render layout.main %>
|
22
20
|
<% end %>
|
23
21
|
<% end %>
|
24
22
|
|
25
23
|
<% if layout.footer %>
|
26
|
-
<%=
|
27
|
-
<%=
|
24
|
+
<%= super_render layout.footer %>
|
25
|
+
<%= super_render(partial) %>
|
28
26
|
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if panel.resolve(self, block_given? ? Proc.new { yield } : nil).resolved_parts.any? %>
|
2
2
|
<div class="border rounded shadow border-gray-400 bg-white px-5 pt-4 pb-8 mt-6">
|
3
3
|
<% panel.resolved_parts.each do |partial| %>
|
4
|
-
<%=
|
4
|
+
<%= super_render(partial) %>
|
5
5
|
<% end %>
|
6
6
|
</div>
|
7
7
|
<% end %>
|
@@ -1,18 +1,19 @@
|
|
1
|
-
|
1
|
+
<% if filters_enabled? || sort_enabled? %>
|
2
2
|
<h1 class="text-xl">Query</h1>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<%= form.fields_for namespace do |addon_form| %>
|
12
|
-
<%= render(addon, form: addon_form) %>
|
3
|
+
|
4
|
+
<%= form_tag(query.path, method: :get, data: { controller: "clean-filter-params", action: "submit->clean-filter-params#call" }) do %>
|
5
|
+
<% if filters_enabled? %>
|
6
|
+
<%= super_render @filter_form %>
|
7
|
+
<% end %>
|
8
|
+
<% if sort_enabled? %>
|
9
|
+
<% if filters_enabled? %>
|
10
|
+
<div class="mt-6"></div>
|
13
11
|
<% end %>
|
12
|
+
<%= super_render @sort_form %>
|
14
13
|
<% end %>
|
15
14
|
|
16
|
-
<%=
|
15
|
+
<%= submit_tag("Apply", class: "super-button super-button--border-gray mt-6") %>
|
17
16
|
<% end %>
|
18
17
|
<% end %>
|
18
|
+
|
19
|
+
<%= yield if block_given? %>
|
@@ -2,13 +2,13 @@
|
|
2
2
|
<h1 class="text-lg font-bold mr-6 mb-1"><%= site_title %></h1>
|
3
3
|
<% site_navigation.definition.each do |link_or_menu| %>
|
4
4
|
<% if link_or_menu.is_a?(Super::Link) %>
|
5
|
-
<%=
|
5
|
+
<%= super_render(link_or_menu, default_options: { class: "inline-block mr-6" }) %>
|
6
6
|
<% else %>
|
7
7
|
<details class="details-reset details-backdrop-transparent select-none inline-block mr-6">
|
8
8
|
<summary class="text-blue-700"><%= link_or_menu.title %></summary>
|
9
9
|
<ul class="absolute bg-white shadow-md px-4 py-3 z-20">
|
10
10
|
<% link_or_menu.links.each do |link| %>
|
11
|
-
<li><%=
|
11
|
+
<li><%= super_render(link, default_options: { class: "" }) %></li>
|
12
12
|
<% end %>
|
13
13
|
</ul>
|
14
14
|
</details>
|
@@ -1,18 +1,22 @@
|
|
1
1
|
<h1 class="text-lg mt-6">Sort</h1>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<%=
|
2
|
+
<%= super_fields_for(query.namespace_for(sort), sort) do |form| %>
|
3
|
+
<div data-controller="apply-template">
|
4
|
+
<% sort.exprs.each.with_index do |expr, index| %>
|
5
|
+
<%= form.fields_for("exprs[]", expr.with_index(index)) do |expr_fields| %>
|
6
|
+
<%= super_render "sort_expression", expr_fields: expr_fields, sort: sort %>
|
7
|
+
<% end %>
|
6
8
|
<% end %>
|
7
|
-
<% end %>
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
<%= form.fields_for("exprs[]", sort.new_expr.with_index("TEMPLATEINDEX")) do |expr_fields| %>
|
11
|
+
<template data-apply-template-target="template">
|
12
|
+
<%= super_render "sort_expression", expr_fields: expr_fields, sort: sort %>
|
13
|
+
</template>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<a href="#" data-action="apply-template#call" class="block mt-2 text-sm">
|
17
|
+
Add
|
18
|
+
</a>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
14
21
|
|
15
|
-
|
16
|
-
Add
|
17
|
-
</a>
|
18
|
-
</div>
|
22
|
+
<%= yield if block_given? %>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
) %>
|
20
20
|
</div>
|
21
21
|
<div class="flex-none pl-2">
|
22
|
-
<a href="#" data-action="delete#call" class="block text-black hover:text-red-600 h-4 w-4"><%=
|
22
|
+
<a href="#" data-action="delete#call" class="block text-black hover:text-red-600 h-4 w-4"><%= super_render("super/feather/x") %></a>
|
23
23
|
</div>
|
24
24
|
</div>
|
25
25
|
</div>
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<% raise Super::Error::NothingToRender, "edit" if @view.nil? %>
|
2
|
-
<%=
|
2
|
+
<%= super_render(@view) %>
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<% raise Super::Error::NothingToRender, "index" if @view.nil? %>
|
2
|
-
<%=
|
2
|
+
<%= super_render(@view) %>
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<% raise Super::Error::NothingToRender, "new" if @view.nil? %>
|
2
|
-
<%=
|
2
|
+
<%= super_render(@view) %>
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<% raise Super::Error::NothingToRender, "show" if @view.nil? %>
|
2
|
-
<%=
|
2
|
+
<%= super_render(@view) %>
|
data/config/locales/en.yml
CHANGED
@@ -17,3 +17,6 @@ en:
|
|
17
17
|
layout:
|
18
18
|
powered_by_html: "%{env} environment. Powered by Super %{version}. <a href='https://superadministration.github.io/v%{version}/'>Developer docs.</a>"
|
19
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."
|
20
|
+
destroy_error:
|
21
|
+
invalid_foreign_key: Couldn't delete record because other records still refer to this one
|
22
|
+
generic: Couldn't delete record
|