super 0.19.0.rc1 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/app/controllers/super/application_controller.rb +10 -19
  4. data/app/controllers/super/sitewide_controller.rb +33 -0
  5. data/app/controllers/super/substructure_controller.rb +63 -85
  6. data/app/controllers/super/view_controller.rb +55 -0
  7. data/app/views/super/application/_batch_checkbox.html.erb +4 -0
  8. data/app/views/super/application/_display_index.html.erb +8 -2
  9. data/app/views/super/application/_display_show.html.erb +10 -2
  10. data/app/views/super/application/_filter.html.erb +63 -59
  11. data/app/views/super/application/_form.html.erb +1 -1
  12. data/app/views/super/application/_layout.html.erb +0 -2
  13. data/app/views/super/application/_pagination.html.erb +1 -4
  14. data/app/views/super/application/_query.html.erb +13 -12
  15. data/app/views/super/application/_site_footer.html.erb +1 -1
  16. data/app/views/super/application/_sort.html.erb +18 -14
  17. data/app/views/super/application/_view_chain.html.erb +23 -4
  18. data/config/locales/en.yml +10 -1
  19. data/frontend/super-frontend/dist/application.js +6276 -6286
  20. data/frontend/super-frontend/dist/package.json +2 -2
  21. data/lib/super/action_inquirer.rb +3 -0
  22. data/lib/super/badge.rb +11 -2
  23. data/lib/super/cheat.rb +6 -1
  24. data/lib/super/display/schema_types.rb +37 -14
  25. data/lib/super/display.rb +5 -4
  26. data/lib/super/error.rb +3 -2
  27. data/lib/super/form/schema_types.rb +8 -36
  28. data/lib/super/form_builder/action_text_methods.rb +16 -0
  29. data/lib/super/form_builder/base_methods.rb +73 -0
  30. data/lib/super/form_builder/flatpickr_methods.rb +75 -0
  31. data/lib/super/form_builder/option_methods.rb +73 -0
  32. data/lib/super/form_builder.rb +143 -0
  33. data/{app/helpers → lib}/super/form_builder_helper.rb +15 -4
  34. data/lib/super/link.rb +47 -63
  35. data/lib/super/link_builder.rb +24 -43
  36. data/lib/super/navigation.rb +40 -40
  37. data/lib/super/query.rb +61 -0
  38. data/lib/super/{engine.rb → railtie.rb} +7 -1
  39. data/lib/super/reset.rb +7 -0
  40. data/lib/super/schema.rb +8 -2
  41. data/lib/super/sort.rb +1 -3
  42. data/lib/super/useful/deprecations.rb +18 -0
  43. data/lib/super/useful/i19.rb +35 -0
  44. data/lib/super/version.rb +1 -1
  45. data/lib/super/view_chain.rb +14 -4
  46. data/lib/super.rb +14 -3
  47. metadata +21 -56
  48. data/config/routes.rb +0 -4
  49. data/lib/super/form/builder.rb +0 -289
  50. data/lib/super/query/form_object.rb +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 769aa4e346a63bc668e30e60c62c0528f822c722c3f296c678758d90a058030c
4
- data.tar.gz: bd6f44c93564894a94bf00bee3d7346b6f1ad9dd863673cb561f2546c527c74c
3
+ metadata.gz: 8074c717fdd2f747e7d880cdbb02ec13515ec85b3504e7f55f1db526ace24838
4
+ data.tar.gz: 5d446f1574a35e4ba542281b2edfe5ef36dd588a5c2420b81288702bb96f4607
5
5
  SHA512:
6
- metadata.gz: 7388dfd86344db6a09c843e385139b513235e4274d246bc58348d2fe86809fba92d1ca220b38495917a43442bd4f61eb22d4fb81e6edfe58d4fba64ddb05e40c
7
- data.tar.gz: 9cc238982a9bcd8d0ceab1a6d3513dfa8c1491308b77d214ade013989815a6003b0e5ff11f02fa3d514cefe600ba8edd7637764e77375baf40b1bf3b567f94f0
6
+ metadata.gz: adca04cac0470dfe22929b710d331ff651eb53ee0fdf5f88657f9b18094963f09bda9c6b13808bc112a565937851eda14622e8a0d853b992fa5f1551e6daadb0
7
+ data.tar.gz: b694a20146e50d743fcc7ca5bbf6e67cdd63df3e256352b70a99a5a677ad0f5014f38ca29efe48263d840809d9c4e3f63d1972a28277510c882c0a6023cf55d0
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Super
2
2
 
3
- ![Unit tests status](https://github.com/zachahn/super/workflows/Unit%20tests/badge.svg?branch=master)
3
+ ![Unit tests status](https://github.com/superadministration/super/workflows/Unit%20tests/badge.svg?branch=master)
4
4
  [![Gem](https://img.shields.io/gem/v/super)][gem]
5
5
  [![Try the demo](https://img.shields.io/badge/demo-try-blue)][demo]
6
6
  [![Read the docs](https://img.shields.io/badge/docs-available-brightgreen)][docs]
@@ -38,7 +38,7 @@ changes before 1.0.
38
38
  * Builds on top of standard Rails controllers and ERB views
39
39
  * Plenty of escape hatches for those very customized pages
40
40
  * No DSL. Configure your admin pages by setting methods and returning objects
41
- * Supports Rails 5.0+, 6.0+
41
+ * Supports Rails 5.0+, 6.0+, 7.0+
42
42
  * Supports Ruby 2.3+, 3.0+
43
43
 
44
44
 
@@ -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/zachahn/super/discussions
91
+ [discussions]: https://github.com/superadministration/super/discussions
92
92
  [docs]: https://superadministration.github.io/
93
- [demo]: https://demo-super.herokuapp.com/admin/members
94
- [demo_source]: https://github.com/zachahn/super_demo
93
+ [demo]: https://demo-super.herokuapp.com/admin
94
+ [demo_source]: https://github.com/superadministration/super_demo
@@ -22,7 +22,6 @@ module Super
22
22
  @records = load_records
23
23
  @display = display_schema.apply(action: current_action, format: request.format)
24
24
  @view = index_view
25
- @query_form = initialize_query_form
26
25
  initialize_filter_form
27
26
  initialize_sort_form
28
27
  @records = apply_queries
@@ -48,12 +47,9 @@ module Super
48
47
  set_record_attributes
49
48
 
50
49
  if save_record
51
- redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
50
+ redirect_to_record
52
51
  else
53
- @current_action = ActionInquirer.new!
54
- @form = form_schema
55
- @view = new_view
56
- render :new, status: :bad_request
52
+ render_new_as_bad_request
57
53
  end
58
54
  end
59
55
 
@@ -70,12 +66,9 @@ module Super
70
66
  set_record_attributes
71
67
 
72
68
  if save_record
73
- redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
69
+ redirect_to_record
74
70
  else
75
- @current_action = ActionInquirer.edit!
76
- @form = form_schema
77
- @view = edit_view
78
- render :edit, status: :bad_request
71
+ render_edit_as_bad_request
79
72
  end
80
73
  end
81
74
 
@@ -84,14 +77,12 @@ module Super
84
77
  @record = load_record
85
78
 
86
79
  if destroy_record
87
- redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
80
+ redirect_to_records
88
81
  else
89
- flash.alert = "Couldn't delete record"
90
- redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
82
+ redirect_to_record_with_destroy_failure_message
91
83
  end
92
- rescue ActiveRecord::InvalidForeignKey => e
93
- flash.alert = "Couldn't delete record: #{e.class}"
94
- redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
84
+ rescue ActiveRecord::ActiveRecordError => e
85
+ redirect_to_record_with_destroy_failure_message(e)
95
86
  end
96
87
 
97
88
  private
@@ -118,7 +109,7 @@ module Super
118
109
  helper_method def resolved_member_actions(record)
119
110
  member_actions(record).map do |action|
120
111
  if action.respond_to?(:resolve)
121
- action.resolve(record: record, params: params)
112
+ resolve_member_action(action, record)
122
113
  else
123
114
  action
124
115
  end
@@ -128,7 +119,7 @@ module Super
128
119
  helper_method def resolved_collection_actions
129
120
  collection_actions.map do |action|
130
121
  if action.respond_to?(:resolve)
131
- action.resolve(params: params)
122
+ resolve_collection_action(action)
132
123
  else
133
124
  action
134
125
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Super
4
+ # Various methods that are useful for all Super admin controllers, regardless
5
+ # of the controller being a resourceful or non-resourceful.
6
+ class SitewideController < ActionController::Base
7
+ private
8
+
9
+ helper_method def site_title
10
+ Super.configuration.title
11
+ end
12
+
13
+ helper_method def site_navigation
14
+ Super::Navigation.new(&:all)
15
+ end
16
+
17
+ helper_method def document_title
18
+ if instance_variable_defined?(:@document_title)
19
+ return @document_title
20
+ end
21
+
22
+ document_title_segments.map(&:presence).compact.join(document_title_separator)
23
+ end
24
+
25
+ def document_title_segments
26
+ @document_title_segments ||= [page_title, site_title]
27
+ end
28
+
29
+ def document_title_separator
30
+ @document_title_separator ||= " - "
31
+ end
32
+ end
33
+ end
@@ -3,7 +3,7 @@
3
3
  module Super
4
4
  # Various methods that determine the behavior of your controllers. These
5
5
  # methods can and should be overridden.
6
- class SubstructureController < ActionController::Base
6
+ class SubstructureController < ViewController
7
7
  def self.batch(action_name)
8
8
  mod = Module.new do
9
9
  define_method(action_name) do
@@ -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
@@ -199,22 +215,55 @@ module Super
199
215
  @record.destroy
200
216
  end
201
217
 
202
- def initialize_query_form
203
- Super::Query::FormObject.new(
218
+ def redirect_to_record
219
+ redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
220
+ end
221
+
222
+ def redirect_to_records
223
+ redirect_to polymorphic_path(Super::Link.polymorphic_parts(model))
224
+ end
225
+
226
+ def redirect_to_record_with_destroy_failure_message(error = nil)
227
+ flash.alert =
228
+ case error
229
+ when ActiveRecord::InvalidForeignKey
230
+ I18n.t("super.destroy_error.invalid_foreign_key")
231
+ else
232
+ I18n.t("super.destroy_error.generic")
233
+ end
234
+
235
+ redirect_to polymorphic_path(Super::Link.polymorphic_parts(@record))
236
+ end
237
+
238
+ def render_new_as_bad_request
239
+ @current_action = ActionInquirer.new!
240
+ @form = form_schema
241
+ @view = new_view
242
+ render :new, status: :bad_request
243
+ end
244
+
245
+ def render_edit_as_bad_request
246
+ @current_action = ActionInquirer.edit!
247
+ @form = form_schema
248
+ @view = edit_view
249
+ render :edit, status: :bad_request
250
+ end
251
+
252
+ helper_method def query
253
+ @query ||= Super::Query.new(
204
254
  model: model,
205
- params: params,
206
- namespace: :q,
255
+ params: request.GET,
207
256
  current_path: request.path,
208
257
  )
209
258
  end
210
259
 
211
260
  def apply_queries
212
- @query_form.apply_changes(@records)
261
+ query.apply_changes(@records)
213
262
  end
214
263
 
215
264
  def initialize_filter_form
216
265
  if filters_enabled?
217
- @query_form.add(
266
+ @filter_form = query.build(
218
267
  Super::Filter::FormObject,
219
268
  namespace: :f,
220
269
  schema: filter_schema
@@ -224,7 +273,7 @@ module Super
224
273
 
225
274
  def initialize_sort_form
226
275
  if sort_enabled?
227
- @query_form.add(
276
+ @sort_form = query.build(
228
277
  Super::Sort::FormObject,
229
278
  namespace: :s,
230
279
  default: default_sort,
@@ -264,86 +313,15 @@ module Super
264
313
  .offset(@pagination.offset)
265
314
  end
266
315
 
267
- helper_method def csv_enabled?
268
- true
269
- end
270
-
271
- def index_view
272
- Super::Layout.new(
273
- main: Super::ViewChain.new(
274
- main_panel: Super::Panel.new,
275
- batch_form: Super::Partial.new("batch_form"),
276
- main_header: Super::Partial.new("collection_header"),
277
- main: :@display
278
- ),
279
- aside: Super::ViewChain.new(
280
- main: :@query_form
281
- )
282
- )
283
- end
284
-
285
- def show_view
286
- Super::Layout.new(
287
- main: Super::ViewChain.new(
288
- main_panel: Super::Panel.new,
289
- main_header: Super::Partial.new("collection_header"),
290
- main: :@display
291
- )
292
- )
293
- end
294
-
295
- def new_view
296
- Super::Layout.new(
297
- main: Super::ViewChain.new(
298
- main_panel: Super::Panel.new,
299
- main_header: Super::Partial.new("collection_header"),
300
- main: :@form
301
- )
302
- )
303
- end
304
-
305
- def edit_view
306
- Super::Layout.new(
307
- main: Super::ViewChain.new(
308
- main_panel: Super::Panel.new,
309
- main_header: Super::Partial.new("member_header"),
310
- main: :@form
311
- )
316
+ helper_method def paginated_link(page_query_params)
317
+ polymorphic_path(
318
+ Super::Link.polymorphic_parts(model),
319
+ page_query_params
312
320
  )
313
321
  end
314
322
 
315
- concerning :Sitewide do
316
- included do
317
- helper_method :site_title
318
- helper_method :site_navigation
319
- helper_method :document_title
320
- end
321
-
322
- private
323
-
324
- def site_title
325
- Super.configuration.title
326
- end
327
-
328
- def site_navigation
329
- Super::Navigation.new(&:all)
330
- end
331
-
332
- def document_title
333
- if instance_variable_defined?(:@document_title)
334
- return @document_title
335
- end
336
-
337
- document_title_segments.map(&:presence).compact.join(document_title_separator)
338
- end
339
-
340
- def document_title_segments
341
- @document_title_segments ||= [page_title, site_title]
342
- end
343
-
344
- def document_title_separator
345
- @document_title_separator ||= " - "
346
- end
323
+ helper_method def csv_enabled?
324
+ true
347
325
  end
348
326
  end
349
327
  end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Super
4
+ # These methods define what each resourceful Super admin page looks like.
5
+ # Generally, the return value of each of these methods should be set to
6
+ # `@view`.
7
+ class ViewController < SitewideController
8
+ private
9
+
10
+ def index_view
11
+ Super::Layout.new(
12
+ main: Super::ViewChain.new(
13
+ main_panel: Super::Panel.new,
14
+ batch_form: Super::Partial.new("batch_form"),
15
+ main_header: Super::Partial.new("collection_header"),
16
+ main: :@display
17
+ ),
18
+ aside: Super::ViewChain.new(
19
+ query_panel: Super::Panel.new,
20
+ query: query,
21
+ )
22
+ )
23
+ end
24
+
25
+ def show_view
26
+ Super::Layout.new(
27
+ main: Super::ViewChain.new(
28
+ main_panel: Super::Panel.new,
29
+ main_header: Super::Partial.new("member_header"),
30
+ main: :@display
31
+ )
32
+ )
33
+ end
34
+
35
+ def new_view
36
+ Super::Layout.new(
37
+ main: Super::ViewChain.new(
38
+ main_panel: Super::Panel.new,
39
+ main_header: Super::Partial.new("collection_header"),
40
+ main: :@form
41
+ )
42
+ )
43
+ end
44
+
45
+ def edit_view
46
+ Super::Layout.new(
47
+ main: Super::ViewChain.new(
48
+ main_panel: Super::Panel.new,
49
+ main_header: Super::Partial.new("member_header"),
50
+ main: :@form
51
+ )
52
+ )
53
+ end
54
+ end
55
+ end
@@ -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 %>
@@ -2,9 +2,15 @@
2
2
  <table class="w-full border-separate" cellspacing="0" cellpadding="0">
3
3
  <thead class="">
4
4
  <tr class="">
5
- <% display_index.each_attribute_name do |attribute_name| %>
5
+ <% display_index.each_attribute do |attribute_name, attribute_definition| %>
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
- <%= model.human_attribute_name(attribute_name) %>
7
+ <%=
8
+ if attribute_definition.respond_to?(:attribute_name) && attribute_definition.attribute_name
9
+ attribute_definition.attribute_name
10
+ else
11
+ model.human_attribute_name(attribute_name)
12
+ end
13
+ %>
8
14
  </th>
9
15
  <% end %>
10
16
  </tr>
@@ -1,7 +1,15 @@
1
1
  <table class="max-w-full mt-4">
2
- <% display_show.each_attribute_name do |attribute_name| %>
2
+ <% display_show.each_attribute do |attribute_name, attribute_definition| %>
3
3
  <tr>
4
- <th class="py-1 align-baseline text-right px-4"><%= model.human_attribute_name(attribute_name) %></th>
4
+ <th class="py-1 align-baseline text-right px-4">
5
+ <%=
6
+ if attribute_definition.respond_to?(:attribute_name) && attribute_definition.attribute_name
7
+ attribute_definition.attribute_name
8
+ else
9
+ model.human_attribute_name(attribute_name)
10
+ end
11
+ %>
12
+ </th>
5
13
  <td class="py-1 align-baseline"><%= display_show.render_attribute(template: self, record: @record, column: attribute_name) %></td>
6
14
  </tr>
7
15
  <% end %>
@@ -1,66 +1,70 @@
1
- <h1 class="text-lg">Filter</h1>
2
- <% filter.each_attribute do |attribute_form_object| %>
3
- <div class="mt-4">
4
- <%= form.fields_for(attribute_form_object.field_name, attribute_form_object) do |attribute_form| %>
5
- <% selected_index = 0 %>
6
- <div data-controller="tab-container" data-tab-container-tab-identifier-getter-value="tabIdentifierValue" data-tab-container-tab-controller-name-value="tab">
7
- <div>
8
- <span class="inline-block"><%= attribute_form_object.humanized_attribute_name %></span>
9
- <select data-tab-container-target="control" data-action="tab-container#change" class="super-input super-input-select inline-block">
10
- <% selected = false %>
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
- selected_attribute =
14
- if !selected && operator_form_object.specified?
15
- selected = true
16
- selected_index = index
17
- %(selected=selected)
18
- else
19
- ""
20
- end
21
- %>
22
- <option value="<%= operator_form_object.identifier %>" <%= selected_attribute %>><%= operator_form_object.operator.humanized_operator_name %></option>
23
- <% end %>
24
- </select>
25
- </div>
26
- <div>
27
- <% attribute_form_object.each_operator.with_index do |operator_form_object, index| %>
28
- <div data-controller="tab" data-tab-tab-container-getter-value="tabContainer" data-tab-container-target="tab" data-tab-identifier-value="<%= operator_form_object.identifier %>">
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.public_send(field_transcript.method_name, operator_field_name, *field_transcript.args, **field_transcript.kwargs) %>
47
+ <%= operator_form.super.text_field(operator_field_name) %>
44
48
  <% end %>
45
- <% else %>
46
- <%= operator_form.super.text_field(operator_field_name) %>
47
- <% end %>
48
- </div>
49
- <% end %>
50
- </div>
51
- <% end %>
52
- </div>
53
- <% end %>
49
+ </div>
50
+ <% end %>
51
+ </div>
52
+ <% end %>
53
+ </div>
54
+ <% end %>
54
55
 
55
- <%= form_html if index == selected_index %>
56
+ <%= form_html if index == selected_index %>
56
57
 
57
- <template data-tab-target="pocket">
58
- <%= form_html %>
59
- </template>
60
- </div>
61
- <% end %>
58
+ <template data-tab-target="pocket">
59
+ <%= form_html %>
60
+ </template>
61
+ </div>
62
+ <% end %>
63
+ </div>
62
64
  </div>
63
- </div>
64
- <% end %>
65
- </div>
65
+ <% end %>
66
+ </div>
67
+ <% end %>
66
68
  <% end %>
69
+
70
+ <%= yield if block_given? %>
@@ -1,4 +1,4 @@
1
- <%= super_form_for(Super::Link.polymorphic_parts(@record), builder: Super::Form::Builder) do |f| %>
1
+ <%= super_form_for(form_record(@record), url: form_action(@record)) do |f| %>
2
2
  <div class="max-w-3xl">
3
3
  <% form.each_attribute do |field, type| %>
4
4
  <%= render(
@@ -1,5 +1,3 @@
1
- <%# <% layout.resolve(self) %1> %>
2
-
3
1
  <% if layout.header %>
4
2
  <%= render layout.header %>
5
3
  <% 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
- polymorphic_path(
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 %>
@@ -1,18 +1,19 @@
1
- <%= render(Super::Panel.new) do %>
1
+ <% if filters_enabled? || sort_enabled? %>
2
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) %>
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
+ <%= render @filter_form %>
7
+ <% end %>
8
+ <% if sort_enabled? %>
9
+ <% if filters_enabled? %>
10
+ <div class="mt-6"></div>
13
11
  <% end %>
12
+ <%= render @sort_form %>
14
13
  <% end %>
15
14
 
16
- <%= form.super.submit "Apply", class: "super-button--border-gray mt-6" %>
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? %>
@@ -1,3 +1,3 @@
1
1
  <div class="pt-8 text-sm text-gray-800">
2
- <%= t("super.layout.powered_by", env: Rails.env.capitalize, version: Super::VERSION) %>
2
+ <%= t("super.layout.powered_by_html", env: Rails.env.capitalize, version: Super::VERSION) %>
3
3
  </div>