super 0.0.10 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +0 -9
  3. data/README.md +40 -52
  4. data/app/assets/javascripts/super/application.js +5672 -3671
  5. data/app/assets/stylesheets/super/application.css +114681 -71486
  6. data/app/controllers/super/application_controller.rb +31 -21
  7. data/app/helpers/super/form_builder_helper.rb +2 -0
  8. data/app/views/layouts/super/application.html.erb +15 -14
  9. data/app/views/super/application/{_super_schema_display_actions.html.erb → _display_actions.html.erb} +0 -0
  10. data/app/views/super/application/{_super_schema_display_index.html.erb → _display_index.html.erb} +4 -4
  11. data/app/views/super/application/_display_show.html.erb +8 -0
  12. data/app/views/super/application/_filter.html.erb +5 -13
  13. data/app/views/super/application/_filter_type_select.html.erb +5 -2
  14. data/app/views/super/application/_filter_type_text.html.erb +6 -4
  15. data/app/views/super/application/_filter_type_timestamp.html.erb +6 -5
  16. data/app/views/super/application/{_super_schema_form.html.erb → _form.html.erb} +2 -2
  17. data/app/views/super/application/_form_field.html.erb +5 -0
  18. data/app/views/super/application/{_super_layout.html.erb → _layout.html.erb} +8 -8
  19. data/app/views/super/application/{_super_pagination.html.erb → _pagination.html.erb} +1 -1
  20. data/app/views/super/application/{_super_panel.html.erb → _panel.html.erb} +2 -2
  21. data/app/views/super/application/_query.html.erb +18 -0
  22. data/app/views/super/application/_sort.html.erb +18 -0
  23. data/app/views/super/application/_sort_expression.html.erb +25 -0
  24. data/app/views/super/feather/README.md +1 -1
  25. data/app/views/super/feather/_x.html +15 -0
  26. data/config/routes.rb +2 -0
  27. data/frontend/super-frontend/dist/application.css +114681 -71486
  28. data/frontend/super-frontend/dist/application.js +5672 -3671
  29. data/lib/generators/super/action_text/action_text_generator.rb +2 -0
  30. data/lib/generators/super/install/install_generator.rb +18 -23
  31. data/lib/generators/super/install/templates/base_controller.rb.tt +9 -1
  32. data/lib/generators/super/install/templates/initializer.rb.tt +9 -2
  33. data/lib/generators/super/resource/resource_generator.rb +107 -30
  34. data/lib/generators/super/resource/templates/resources_controller.rb.tt +3 -9
  35. data/lib/generators/super/webpacker/webpacker_generator.rb +11 -5
  36. data/lib/super.rb +10 -2
  37. data/lib/super/action_inquirer.rb +13 -3
  38. data/lib/super/assets.rb +46 -23
  39. data/lib/super/badge.rb +61 -0
  40. data/lib/super/cheat.rb +17 -0
  41. data/lib/super/client_error.rb +2 -0
  42. data/lib/super/compatibility.rb +21 -0
  43. data/lib/super/configuration.rb +16 -24
  44. data/lib/super/controls.rb +11 -2
  45. data/lib/super/controls/optional.rb +44 -1
  46. data/lib/super/controls/steps.rb +53 -34
  47. data/lib/super/controls/view.rb +55 -0
  48. data/lib/super/display.rb +29 -13
  49. data/lib/super/display/guesser.rb +4 -0
  50. data/lib/super/display/schema_types.rb +118 -29
  51. data/lib/super/engine.rb +2 -0
  52. data/lib/super/error.rb +12 -0
  53. data/lib/super/filter.rb +2 -0
  54. data/lib/super/filter/form_object.rb +5 -8
  55. data/lib/super/filter/guesser.rb +2 -0
  56. data/lib/super/filter/operator.rb +2 -0
  57. data/lib/super/filter/schema_types.rb +2 -0
  58. data/lib/super/form.rb +3 -1
  59. data/lib/super/form/builder.rb +109 -27
  60. data/lib/super/form/guesser.rb +12 -1
  61. data/lib/super/form/inline_errors.rb +2 -0
  62. data/lib/super/form/schema_types.rb +75 -7
  63. data/lib/super/form/strong_params.rb +2 -0
  64. data/lib/super/layout.rb +3 -1
  65. data/lib/super/link.rb +44 -31
  66. data/lib/super/link_builder.rb +58 -0
  67. data/lib/super/navigation.rb +164 -0
  68. data/lib/super/pagination.rb +3 -43
  69. data/lib/super/panel.rb +3 -1
  70. data/lib/super/partial.rb +2 -0
  71. data/lib/super/partial/resolving.rb +2 -0
  72. data/lib/super/plugin.rb +2 -0
  73. data/lib/super/query/form_object.rb +48 -0
  74. data/lib/super/reset.rb +17 -0
  75. data/lib/super/schema.rb +2 -0
  76. data/lib/super/schema/common.rb +2 -0
  77. data/lib/super/schema/guesser.rb +2 -0
  78. data/lib/super/sort.rb +110 -0
  79. data/lib/super/useful/builder.rb +25 -0
  80. data/lib/super/useful/enum.rb +63 -0
  81. data/lib/super/version.rb +3 -1
  82. data/lib/super/view_helper.rb +2 -0
  83. data/lib/tasks/super/cheat.rake +9 -0
  84. metadata +45 -28
  85. data/CONTRIBUTING.md +0 -56
  86. data/Rakefile +0 -34
  87. data/STABILITY.md +0 -50
  88. data/app/views/super/application/_form_field_checkbox.html.erb +0 -1
  89. data/app/views/super/application/_form_field_rich_text_area.html.erb +0 -1
  90. data/app/views/super/application/_form_field_text.html.erb +0 -1
  91. data/app/views/super/application/_super_schema_display_show.html.erb +0 -8
  92. data/app/views/super/feather/_chevron_down.html +0 -1
  93. data/docs/README.md +0 -8
  94. data/docs/action_text.md +0 -48
  95. data/docs/cheat.md +0 -41
  96. data/docs/faq.md +0 -44
  97. data/docs/installation.md +0 -21
  98. data/docs/quick_start.md +0 -30
  99. data/docs/webpacker.md +0 -25
  100. data/docs/yard_customizations.rb +0 -41
  101. data/lib/super/controls/required.rb +0 -13
  102. data/lib/super/filter/plugin.rb +0 -47
  103. data/lib/super/navigation/automatic.rb +0 -71
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Super
2
4
  # Provides a default implementation for each of the resourceful actions
3
5
  class ApplicationController < ActionController::Base
@@ -5,26 +7,31 @@ module Super
5
7
 
6
8
  helper_method :action_inquirer
7
9
  helper_method :controls
10
+ helper_method :navigation
8
11
 
9
12
  # Displays a list of records to the user
10
13
  def index
11
14
  @records = controls.load_records(action: action_inquirer, params: params)
12
- @display = controls.display_schema(action: action_inquirer)
13
- @view = controls.build_index_view
15
+ @display = controls.display_schema(action: action_inquirer).apply(action: action_inquirer)
16
+ @view = controls.index_view
17
+ @query_form = controls.initialize_query_form(params: params, current_path: request.path)
18
+ controls.initialize_filter_form(query_form: @query_form)
19
+ controls.initialize_sort_form(query_form: @query_form)
20
+ @records = controls.apply_queries(query_form: @query_form, records: @records)
14
21
  end
15
22
 
16
23
  # Displays a specific record to the user
17
24
  def show
18
25
  @record = controls.load_record(action: action_inquirer, params: params)
19
- @display = controls.display_schema(action: action_inquirer)
20
- @view = controls.build_show_view
26
+ @display = controls.display_schema(action: action_inquirer).apply(action: action_inquirer)
27
+ @view = controls.show_view
21
28
  end
22
29
 
23
30
  # Displays a form to allow the user to create a new record
24
31
  def new
25
32
  @record = controls.build_record(action: action_inquirer)
26
33
  @form = controls.form_schema(action: action_inquirer)
27
- @view = controls.build_new_view
34
+ @view = controls.new_view
28
35
  end
29
36
 
30
37
  # Creates a record, or shows the validation errors
@@ -32,10 +39,11 @@ module Super
32
39
  @record = controls.build_record_with_params(action: action_inquirer, params: params)
33
40
 
34
41
  if controls.save_record(action: action_inquirer, record: @record, params: params)
35
- redirect_to polymorphic_path(Super.configuration.path_parts(@record))
42
+ redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
36
43
  else
37
- @form = controls.form_schema(action: action_inquirer_for("new"))
38
- @view = controls.build_new_view
44
+ @action_inquirer = ActionInquirer.new!
45
+ @form = controls.form_schema(action: action_inquirer)
46
+ @view = controls.new_view
39
47
  render :new, status: :bad_request
40
48
  end
41
49
  end
@@ -44,7 +52,7 @@ module Super
44
52
  def edit
45
53
  @record = controls.load_record(action: action_inquirer, params: params)
46
54
  @form = controls.form_schema(action: action_inquirer)
47
- @view = controls.build_edit_view
55
+ @view = controls.edit_view
48
56
  end
49
57
 
50
58
  # Updates a record, or shows validation errors
@@ -52,10 +60,11 @@ module Super
52
60
  @record = controls.load_record(action: action_inquirer, params: params)
53
61
 
54
62
  if controls.update_record(action: action_inquirer, record: @record, params: params)
55
- redirect_to polymorphic_path(Super.configuration.path_parts(@record))
63
+ redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
56
64
  else
57
- @form = controls.form_schema(action: action_inquirer_for("edit"))
58
- @view = controls.build_edit_view
65
+ @action_inquirer = ActionInquirer.edit!
66
+ @form = controls.form_schema(action: action_inquirer)
67
+ @view = controls.edit_view
59
68
  render :edit, status: :bad_request
60
69
  end
61
70
  end
@@ -65,14 +74,14 @@ module Super
65
74
  @record = controls.load_record(action: action_inquirer, params: params)
66
75
 
67
76
  if controls.destroy_record(action: action_inquirer, record: @record, params: params)
68
- redirect_to polymorphic_path(Super.configuration.path_parts(controls.model))
77
+ redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
69
78
  else
70
79
  flash.alert = "Couldn't delete record"
71
- redirect_to polymorphic_path(Super.configuration.path_parts(@record))
80
+ redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
72
81
  end
73
82
  rescue ActiveRecord::InvalidForeignKey => e
74
83
  flash.alert = "Couldn't delete record: #{e.class}"
75
- redirect_to polymorphic_path(Super.configuration.path_parts(@record))
84
+ redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
76
85
  end
77
86
 
78
87
  private
@@ -82,14 +91,15 @@ module Super
82
91
  end
83
92
 
84
93
  def action_inquirer
85
- @action_inquirer ||= action_inquirer_for(params[:action])
94
+ @action_inquirer ||=
95
+ ActionInquirer.new(
96
+ ActionInquirer.default_for_resources,
97
+ params[:action]
98
+ )
86
99
  end
87
100
 
88
- def action_inquirer_for(action)
89
- ActionInquirer.new(
90
- ActionInquirer.default_for_resources,
91
- action
92
- )
101
+ def navigation
102
+ Navigation.new(&:all)
93
103
  end
94
104
  end
95
105
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Super
2
4
  module FormBuilderHelper
3
5
  def super_form_for(record, options = {}, &block)
@@ -13,11 +13,7 @@
13
13
  <% if stylesheet.handler.sprockets? %>
14
14
  <%= stylesheet_link_tag(stylesheet.path, **stylesheet.arguments) %>
15
15
  <% elsif stylesheet.handler.webpacker? %>
16
- <% if Gem::Dependency.new("webpacker", "> 5.99", "< 7").matching_specs.any? %>
17
- <%= stylesheet_packs_with_chunks_tag(stylesheet.path) %>
18
- <% else %>
19
- <%= stylesheet_pack_tag(stylesheet.path, **stylesheet.arguments) %>
20
- <% end %>
16
+ <%= stylesheet_pack_tag(stylesheet.path, **stylesheet.arguments) %>
21
17
  <% end %>
22
18
  <% end %>
23
19
 
@@ -25,11 +21,7 @@
25
21
  <% if javascript.handler.sprockets? %>
26
22
  <%= javascript_include_tag(javascript.path) %>
27
23
  <% elsif javascript.handler.webpacker? %>
28
- <% if Gem::Dependency.new("webpacker", "> 5.99", "< 7").matching_specs.any? %>
29
- <%= javascript_packs_with_chunks_tag(javascript.path) %>
30
- <% else %>
31
- <%= javascript_pack_tag(javascript.path) %>
32
- <% end %>
24
+ <%= javascript_pack_tag(javascript.path) %>
33
25
  <% end %>
34
26
  <% end %>
35
27
  </head>
@@ -38,10 +30,19 @@
38
30
  <div class="px-4">
39
31
  <header class="pt-4">
40
32
  <h1 class="text-lg font-bold mr-6 mb-1"><%= Super.configuration.title %></h1>
41
- <%
42
- route_namespace = Super.configuration.route_namespace.map(&:to_s).join("/")
43
- Super::Navigation::Automatic.new(route_namespace: route_namespace).each do |text, href| %>
44
- <%= link_to(text, href, class: "inline-block mr-6") %>
33
+ <% navigation.definition.each do |link_or_menu| %>
34
+ <% if link_or_menu.is_a?(Super::Link) %>
35
+ <%= link_or_menu.to_s(default_options: { class: "inline-block mr-6" }) %>
36
+ <% else %>
37
+ <details class="details-reset select-none inline-block mr-6" data-controller="click-outside-to-close" data-action="click@window->click-outside-to-close#close">
38
+ <summary class="text-blue-700"><%= link_or_menu.title %></summary>
39
+ <ul class="absolute bg-white shadow-md px-4 py-3">
40
+ <% link_or_menu.links.each do |link| %>
41
+ <li><%= link.to_s(default_options: { class: "" }) %></li>
42
+ <% end %>
43
+ </ul>
44
+ </details>
45
+ <% end %>
45
46
  <% end %>
46
47
  </header>
47
48
 
@@ -1,8 +1,8 @@
1
1
  <div class="mt-4 overflow-x-auto">
2
- <table class="w-full border-separate relative" cellspacing="0" cellpadding="0">
2
+ <table class="w-full border-separate" cellspacing="0" cellpadding="0">
3
3
  <thead class="">
4
4
  <tr class="">
5
- <% super_schema_display_index.each_attribute_name do |attribute_name| %>
5
+ <% display_index.each_attribute_name do |attribute_name| %>
6
6
  <th class="p-2 first:pl-6 border-b border-b-2 border-gray-400 text-gray-600 text-left text-sm font-normal bg-white top-0 z-10">
7
7
  <%= controls.model.human_attribute_name(attribute_name) %>
8
8
  </th>
@@ -12,9 +12,9 @@
12
12
  <tbody class="">
13
13
  <% @records.each.with_index do |record, row_index| %>
14
14
  <tr id="record-pk-<%= record.id %>" class="group">
15
- <% super_schema_display_index.each_attribute_name do |attribute_name| %>
15
+ <% display_index.each_attribute_name do |attribute_name| %>
16
16
  <td class="py-1 px-2 first:pl-5 border-transparent border-t border-b group-hover:bg-blue-200 first:border-l first:rounded-l-lg last:border-r last:rounded-r-lg bg-white <%= Super::ViewHelper.classes(["bg-gray-100", row_index.odd?]) %>">
17
- <%= super_schema_display_index.render_field(template: self, record: record, column: attribute_name) %>
17
+ <%= display_index.render_attribute(template: self, record: record, column: attribute_name) %>
18
18
  </td>
19
19
  <% end %>
20
20
  </tr>
@@ -0,0 +1,8 @@
1
+ <table class="max-w-full mt-4">
2
+ <% display_show.each_attribute_name do |attribute_name| %>
3
+ <tr>
4
+ <th class="py-1 align-baseline text-right px-4"><%= controls.model.human_attribute_name(attribute_name) %></th>
5
+ <td class="py-1 align-baseline"><%= display_show.render_attribute(template: self, record: @record, column: attribute_name) %></td>
6
+ </tr>
7
+ <% end %>
8
+ </table>
@@ -1,14 +1,6 @@
1
- <%= render(Super::Panel.new) do %>
2
- <h1 class="text-xl">Filters</h1>
3
- <%= super_form_for(filter, url: filter.url, method: :get, as: :q, html: { class: "mt-4" }) do |form| %>
4
- <% filter.each_field do |filter_field| %>
5
- <div class="mt-4">
6
- <%= render(filter_field, form: form) %>
7
- </div>
8
- <% end %>
9
-
10
- <div>
11
- <%= form.super.submit "Filter", class: "super-button--border-gray mt-6" %>
12
- </div>
13
- <% end %>
1
+ <h1 class="text-lg">Filter</h1>
2
+ <% filter.each_field do |filter_field| %>
3
+ <div class="mt-4">
4
+ <%= render(filter_field, form: form) %>
5
+ </div>
14
6
  <% end %>
@@ -1,17 +1,20 @@
1
- <div class="super-field-group">
1
+ <div class="super-field-group" data-controller="clean-filter-param">
2
2
  <%= form.fields_for(filter_type_select.field_name, filter_type_select) do |form_field| %>
3
3
  <%= form_field.label(:q, filter_type_select.humanized_field_name) %>
4
- <div class="relative inline-block">
4
+ <div class="inline-block">
5
5
  <%= form_field.super.select(
6
6
  :op,
7
7
  filter_type_select.operators,
8
8
  { include_blank: false },
9
+ data: { clean_filter_param_target: "candidate" }
9
10
  ) %>
10
11
  </div>
11
12
  <div class="mt-3">
12
13
  <%= form_field.super.select(
13
14
  :q,
14
15
  filter_type_select.field_type.collection,
16
+ {},
17
+ data: { clean_filter_param_target: "control candidate" }
15
18
  ) %>
16
19
  </div>
17
20
  <% end %>
@@ -1,16 +1,18 @@
1
- <div class="super-field-group">
1
+ <div class="super-field-group" data-controller="clean-filter-param">
2
2
  <%= form.fields_for(filter_type_text.field_name, filter_type_text) do |form_field| %>
3
3
  <%= form_field.label(:q, filter_type_text.humanized_field_name) %>
4
- <div class="relative inline-block">
4
+ <div class="inline-block">
5
5
  <%= form_field.super.select(
6
6
  :op,
7
7
  filter_type_text.operators,
8
- { include_blank: false }
8
+ { include_blank: false },
9
+ data: { clean_filter_param_target: "candidate" }
9
10
  ) %>
10
11
  </div>
11
12
  <%= form_field.super.text_field(
12
13
  :q,
13
- class: "mt-3"
14
+ class: "mt-3",
15
+ data: { clean_filter_param_target: "control candidate" }
14
16
  ) %>
15
17
  <% end %>
16
18
  </div>
@@ -1,22 +1,23 @@
1
- <div class="super-field-group">
1
+ <div class="super-field-group" data-controller="clean-filter-param">
2
2
  <%= form.fields_for(filter_type_timestamp.field_name, filter_type_timestamp) do |form_field| %>
3
3
  <%= form_field.label(:q0, filter_type_timestamp.humanized_field_name) %>
4
- <div class="relative inline-block mt-2">
4
+ <div class="inline-block mt-2">
5
5
  <%= form_field.super.select(
6
6
  :op,
7
7
  filter_type_timestamp.operators,
8
- { include_blank: false}
8
+ { include_blank: false },
9
+ data: { clean_filter_param_target: "candidate" }
9
10
  ) %>
10
11
  </div>
11
12
  <div class="flex items-center mt-3">
12
13
  <div class="flex-initial">
13
- <%= form_field.super.text_field(:q0) %>
14
+ <%= form_field.super.datetime_flatpickr(:q0, data: { clean_filter_param_target: "control candidate" }) %>
14
15
  </div>
15
16
  <div class="flex-initial px-2">
16
17
  &ndash;
17
18
  </div>
18
19
  <div class="flex-initial">
19
- <%= form_field.super.text_field(:q1) %>
20
+ <%= form_field.super.datetime_flatpickr(:q1, data: { clean_filter_param_target: "control candidate" }) %>
20
21
  </div>
21
22
  </div>
22
23
  <% end %>
@@ -1,6 +1,6 @@
1
- <%= super_form_for(Super.configuration.path_parts(@record), builder: Super::Form::Builder) do |f| %>
1
+ <%= super_form_for(Super::Link.polymorphic_parts(@record), builder: Super::Form::Builder) do |f| %>
2
2
  <div class="max-w-3xl">
3
- <% super_schema_form.each_attribute do |field, type| %>
3
+ <% form.each_attribute do |field, type| %>
4
4
  <%= render(
5
5
  type,
6
6
  form: f,
@@ -0,0 +1,5 @@
1
+ <% if form_field.super_builder %>
2
+ <%= form.super.public_send(form_field.method_name, column, *form_field.args, **form_field.kwargs) %>
3
+ <% else %>
4
+ <%= form.public_send(form_field.method_name, column, *form_field.args, **form_field.kwargs) %>
5
+ <% end %>
@@ -1,29 +1,29 @@
1
- <% super_layout.resolve(self) %>
1
+ <% layout.resolve(self) %>
2
2
 
3
- <% super_layout.resolved_headers.each do |partial| %>
3
+ <% layout.resolved_headers.each do |partial| %>
4
4
  <%= Super::Partial.render(partial, template: self) %>
5
5
  <% end %>
6
6
 
7
- <% if super_layout.resolved_asides.empty? %>
8
- <% super_layout.resolved_mains.each do |partial| %>
7
+ <% if layout.resolved_asides.empty? %>
8
+ <% layout.resolved_mains.each do |partial| %>
9
9
  <%= Super::Partial.render(partial, template: self) %>
10
10
  <% end %>
11
11
  <% else %>
12
- <div class="clearfix -mx-2">
12
+ <div class="flow-root -mx-2">
13
13
  <div class="md:float-left md:w-9/12 px-2">
14
- <% super_layout.resolved_mains.each do |partial| %>
14
+ <% layout.resolved_mains.each do |partial| %>
15
15
  <%= Super::Partial.render(partial, template: self) %>
16
16
  <% end %>
17
17
  </div>
18
18
 
19
19
  <div class="md:float-right md:w-3/12 px-2">
20
- <% super_layout.resolved_asides.each do |partial| %>
20
+ <% layout.resolved_asides.each do |partial| %>
21
21
  <%= Super::Partial.render(partial, template: self) %>
22
22
  <% end %>
23
23
  </div>
24
24
  </div>
25
25
  <% end %>
26
26
 
27
- <% super_layout.resolved_footers.each do |partial| %>
27
+ <% layout.resolved_footers.each do |partial| %>
28
28
  <%= Super::Partial.render(partial, template: self) %>
29
29
  <% end %>
@@ -5,7 +5,7 @@
5
5
  <%= link_to(
6
6
  display,
7
7
  polymorphic_path(
8
- Super.configuration.path_parts(controls.model),
8
+ Super::Link.polymorphic_parts(controls.model),
9
9
  page_query_params
10
10
  ),
11
11
  class: "inline-block ml-2 text-lg #{is_current_page ? " text-gray-900" : ""}"
@@ -1,6 +1,6 @@
1
- <% if super_panel.resolve(self, block_given? ? Proc.new { yield } : nil).resolved_parts.any? %>
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
- <% super_panel.resolved_parts.each do |partial| %>
3
+ <% panel.resolved_parts.each do |partial| %>
4
4
  <%= Super::Partial.render(partial, template: self) %>
5
5
  <% end %>
6
6
  </div>
@@ -0,0 +1,18 @@
1
+ <%= render(Super::Panel.new) do %>
2
+ <h1 class="text-xl">Query</h1>
3
+ <%= super_form_for(
4
+ query,
5
+ url: query.path,
6
+ method: :get,
7
+ as: query.namespace,
8
+ html: { class: "mt-4" },
9
+ data: { controller: "clean-filter-params", action: "submit->clean-filter-params#call" }) do |form| %>
10
+ <% query.addons.each do |namespace, addon| %>
11
+ <%= form.fields_for namespace do |addon_form| %>
12
+ <%= render(addon, form: addon_form) %>
13
+ <% end %>
14
+ <% end %>
15
+
16
+ <%= form.super.submit "Apply", class: "super-button--border-gray mt-6" %>
17
+ <% end %>
18
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <h1 class="text-lg mt-6">Sort</h1>
2
+ <div data-controller="apply-template">
3
+ <% sort.exprs.each.with_index do |expr, index| %>
4
+ <%= form.fields_for("exprs[]", expr.with_index(index)) do |expr_fields| %>
5
+ <%= render "sort_expression", expr_fields: expr_fields, sort: sort %>
6
+ <% end %>
7
+ <% end %>
8
+
9
+ <%= form.fields_for("exprs[]", sort.new_expr.with_index("TEMPLATEINDEX")) do |expr_fields| %>
10
+ <template data-apply-template-target="template">
11
+ <%= render "sort_expression", expr_fields: expr_fields, sort: sort %>
12
+ </template>
13
+ <% end %>
14
+
15
+ <a href="#" data-action="apply-template#call" class="block mt-2 text-sm">
16
+ Add
17
+ </a>
18
+ </div>
@@ -0,0 +1,25 @@
1
+ <div data-controller="delete clean-filter-param" class="mt-4">
2
+ <div class="flex items-center">
3
+ <div class="flex-auto">
4
+ <%= expr_fields.super.select(
5
+ :a,
6
+ sort.sortable_columns,
7
+ {},
8
+ {}
9
+ ) %>
10
+ </div>
11
+ <div class="flex-none w-2">
12
+ </div>
13
+ <div class="flex-auto">
14
+ <%= expr_fields.super.select(
15
+ :d,
16
+ sort.class::DIRECTIONS,
17
+ { include_blank: false },
18
+ {}
19
+ ) %>
20
+ </div>
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"><%= render("super/feather/x") %></a>
23
+ </div>
24
+ </div>
25
+ </div>