super 0.0.15 → 0.19.0.rc1

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/super/application.js +1403 -127
  4. data/app/assets/stylesheets/super/application.css +90708 -90026
  5. data/app/controllers/super/application_controller.rb +73 -40
  6. data/app/controllers/super/substructure_controller.rb +349 -0
  7. data/app/helpers/super/form_builder_helper.rb +7 -0
  8. data/app/views/layouts/super/application.html.erb +3 -21
  9. data/app/views/super/application/_batch_button.html.erb +12 -0
  10. data/app/views/super/application/_batch_checkbox.csv.erb +1 -0
  11. data/app/views/super/application/_batch_checkbox.html.erb +5 -0
  12. data/app/views/super/application/_batch_form.html.erb +3 -0
  13. data/app/views/super/application/_collection_header.html.erb +8 -7
  14. data/app/views/super/application/_csv_button.html.erb +25 -0
  15. data/app/views/super/application/_display_actions.html.erb +2 -2
  16. data/app/views/super/application/_display_index.html.erb +1 -1
  17. data/app/views/super/application/_display_show.html.erb +1 -1
  18. data/app/views/super/application/_filter.html.erb +62 -2
  19. data/app/views/super/application/_layout.html.erb +13 -14
  20. data/app/views/super/application/_link.html.erb +8 -0
  21. data/app/views/super/application/_member_header.html.erb +8 -8
  22. data/app/views/super/application/_pagination.html.erb +2 -1
  23. data/app/views/super/application/_site_footer.html.erb +3 -0
  24. data/app/views/super/application/_site_header.html.erb +17 -0
  25. data/app/views/super/application/_sort_expression.html.erb +2 -2
  26. data/app/views/super/application/_view_chain.html.erb +5 -0
  27. data/app/views/super/application/index.csv.erb +14 -0
  28. data/config/locales/en.yml +8 -0
  29. data/frontend/super-frontend/dist/application.css +90708 -90026
  30. data/frontend/super-frontend/dist/application.js +1403 -127
  31. data/frontend/super-frontend/dist/package.json +13 -0
  32. data/lib/generators/super/install/templates/base_controller.rb.tt +0 -8
  33. data/lib/generators/super/resource/templates/resources_controller.rb.tt +4 -4
  34. data/lib/generators/super/webpacker/USAGE +1 -7
  35. data/lib/generators/super/webpacker/templates/pack_super_application.js.tt +2 -0
  36. data/lib/generators/super/webpacker/webpacker_generator.rb +10 -6
  37. data/lib/super/action_inquirer.rb +7 -0
  38. data/lib/super/badge.rb +0 -1
  39. data/lib/super/cheat.rb +7 -6
  40. data/lib/super/display/guesser.rb +1 -1
  41. data/lib/super/display/schema_types.rb +6 -1
  42. data/lib/super/display.rb +2 -1
  43. data/lib/super/engine.rb +5 -0
  44. data/lib/super/error.rb +12 -0
  45. data/lib/super/filter/form_object.rb +74 -48
  46. data/lib/super/filter/guesser.rb +2 -0
  47. data/lib/super/filter/operator.rb +90 -64
  48. data/lib/super/filter/schema_types.rb +63 -80
  49. data/lib/super/filter.rb +1 -1
  50. data/lib/super/form/builder.rb +6 -3
  51. data/lib/super/form/field_transcript.rb +43 -0
  52. data/lib/super/form/guesser.rb +1 -1
  53. data/lib/super/form/schema_types.rb +11 -20
  54. data/lib/super/layout.rb +9 -33
  55. data/lib/super/link.rb +3 -8
  56. data/lib/super/link_builder.rb +0 -4
  57. data/lib/super/packaged_asset.rb +49 -0
  58. data/lib/super/pagination.rb +4 -3
  59. data/lib/super/reorderable_hash.rb +88 -0
  60. data/lib/super/reset.rb +24 -0
  61. data/lib/super/schema.rb +4 -0
  62. data/lib/super/version.rb +1 -1
  63. data/lib/super/view_chain.rb +25 -0
  64. data/lib/super.rb +4 -1
  65. data/lib/tasks/super/cheat.rake +1 -1
  66. metadata +51 -15
  67. data/app/views/super/application/_filter_type_select.html.erb +0 -21
  68. data/app/views/super/application/_filter_type_text.html.erb +0 -18
  69. data/app/views/super/application/_filter_type_timestamp.html.erb +0 -24
  70. data/app/views/super/application/_form_field_select.html.erb +0 -1
  71. data/lib/generators/super/webpacker/templates/pack_super_application.js.erb.tt +0 -2
  72. data/lib/super/controls/optional.rb +0 -122
  73. data/lib/super/controls/steps.rb +0 -133
  74. data/lib/super/controls/view.rb +0 -55
  75. data/lib/super/controls.rb +0 -22
@@ -1,7 +1,7 @@
1
1
  <table class="max-w-full mt-4">
2
2
  <% display_show.each_attribute_name do |attribute_name| %>
3
3
  <tr>
4
- <th class="py-1 align-baseline text-right px-4"><%= controls.model.human_attribute_name(attribute_name) %></th>
4
+ <th class="py-1 align-baseline text-right px-4"><%= model.human_attribute_name(attribute_name) %></th>
5
5
  <td class="py-1 align-baseline"><%= display_show.render_attribute(template: self, record: @record, column: attribute_name) %></td>
6
6
  </tr>
7
7
  <% end %>
@@ -1,6 +1,66 @@
1
1
  <h1 class="text-lg">Filter</h1>
2
- <% filter.each_field do |filter_field| %>
2
+ <% filter.each_attribute do |attribute_form_object| %>
3
3
  <div class="mt-4">
4
- <%= render(filter_field, form: form) %>
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 %>
11
+ <% 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) %>
42
+ <% else %>
43
+ <%= operator_form.public_send(field_transcript.method_name, operator_field_name, *field_transcript.args, **field_transcript.kwargs) %>
44
+ <% 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 %>
54
+
55
+ <%= form_html if index == selected_index %>
56
+
57
+ <template data-tab-target="pocket">
58
+ <%= form_html %>
59
+ </template>
60
+ </div>
61
+ <% end %>
62
+ </div>
63
+ </div>
64
+ <% end %>
5
65
  </div>
6
66
  <% end %>
@@ -1,29 +1,28 @@
1
- <% layout.resolve(self) %>
1
+ <%# <% layout.resolve(self) %1> %>
2
2
 
3
- <% layout.resolved_headers.each do |partial| %>
4
- <%= Super::Partial.render(partial, template: self) %>
3
+ <% if layout.header %>
4
+ <%= render layout.header %>
5
5
  <% end %>
6
6
 
7
- <% if layout.resolved_asides.empty? %>
8
- <% layout.resolved_mains.each do |partial| %>
9
- <%= Super::Partial.render(partial, template: self) %>
10
- <% end %>
11
- <% else %>
7
+ <% if layout.aside %>
12
8
  <div class="flow-root -mx-2">
13
9
  <div class="md:float-left md:w-9/12 px-2">
14
- <% layout.resolved_mains.each do |partial| %>
15
- <%= Super::Partial.render(partial, template: self) %>
10
+ <% if layout.main %>
11
+ <%= render layout.main %>
16
12
  <% end %>
17
13
  </div>
18
14
 
19
15
  <div class="md:float-right md:w-3/12 px-2">
20
- <% layout.resolved_asides.each do |partial| %>
21
- <%= Super::Partial.render(partial, template: self) %>
22
- <% end %>
16
+ <%= render layout.aside %>
23
17
  </div>
24
18
  </div>
19
+ <% else %>
20
+ <% if layout.main %>
21
+ <%= render layout.main %>
22
+ <% end %>
25
23
  <% end %>
26
24
 
27
- <% layout.resolved_footers.each do |partial| %>
25
+ <% if layout.footer %>
26
+ <%= render layout.footer %>
28
27
  <%= Super::Partial.render(partial, template: self) %>
29
28
  <% end %>
@@ -0,0 +1,8 @@
1
+ <%=
2
+ default_options ||= {}
3
+ link_to(
4
+ link.text,
5
+ link.href,
6
+ default_options.deep_merge(link.options)
7
+ )
8
+ %>
@@ -1,16 +1,16 @@
1
1
  <header class="flex justify-between content-end">
2
2
  <h1 class="text-xl">
3
- <%= controls.title %>
3
+ <%= title %>
4
4
  </h1>
5
- <div>
6
- <% controls.member_actions(action: action_inquirer).each do |link| %>
7
- <%= link.to_s(
5
+ <div class="flex gap-2">
6
+ <% resolved_member_actions(@record).each do |link| %>
7
+ <%= render(
8
+ link,
8
9
  default_options: {
9
- class: "super-button super-button--border-blue super-button-sm inline-block ml-2"
10
- },
11
- record: @record,
12
- params: params
10
+ class: "super-button super-button--border-blue super-button-sm inline-block"
11
+ }
13
12
  ) %>
14
13
  <% end %>
15
14
  </div>
16
15
  </header>
16
+ <%= yield if block_given? %>
@@ -1,3 +1,4 @@
1
+ <%= yield %>
1
2
  <% if @pagination.necessary? %>
2
3
  <div class="flex justify-end mr-2">
3
4
  <div class="mt-4">
@@ -5,7 +6,7 @@
5
6
  <%= link_to(
6
7
  display,
7
8
  polymorphic_path(
8
- Super::Link.polymorphic_parts(controls.model),
9
+ Super::Link.polymorphic_parts(model),
9
10
  page_query_params
10
11
  ),
11
12
  class: "inline-block ml-2 text-lg #{is_current_page ? " text-gray-900" : ""}"
@@ -0,0 +1,3 @@
1
+ <div class="pt-8 text-sm text-gray-800">
2
+ <%= t("super.layout.powered_by", env: Rails.env.capitalize, version: Super::VERSION) %>
3
+ </div>
@@ -0,0 +1,17 @@
1
+ <header class="pt-4">
2
+ <h1 class="text-lg font-bold mr-6 mb-1"><%= site_title %></h1>
3
+ <% site_navigation.definition.each do |link_or_menu| %>
4
+ <% if link_or_menu.is_a?(Super::Link) %>
5
+ <%= render(link_or_menu, default_options: { class: "inline-block mr-6" }) %>
6
+ <% else %>
7
+ <details class="details-reset details-backdrop-transparent select-none inline-block mr-6">
8
+ <summary class="text-blue-700"><%= link_or_menu.title %></summary>
9
+ <ul class="absolute bg-white shadow-md px-4 py-3 z-20">
10
+ <% link_or_menu.links.each do |link| %>
11
+ <li><%= render(link, default_options: { class: "" }) %></li>
12
+ <% end %>
13
+ </ul>
14
+ </details>
15
+ <% end %>
16
+ <% end %>
17
+ </header>
@@ -5,7 +5,7 @@
5
5
  :a,
6
6
  sort.sortable_columns,
7
7
  {},
8
- {}
8
+ { class: "w-full" }
9
9
  ) %>
10
10
  </div>
11
11
  <div class="flex-none w-2">
@@ -15,7 +15,7 @@
15
15
  :d,
16
16
  sort.class::DIRECTIONS,
17
17
  { include_blank: false },
18
- {}
18
+ { class: "w-full" }
19
19
  ) %>
20
20
  </div>
21
21
  <div class="flex-none pl-2">
@@ -0,0 +1,5 @@
1
+ <% current = view_chain.chain.shift %>
2
+ <% current = instance_variable_get(current) if current.kind_of?(Symbol) %>
3
+ <%= render(current) do %>
4
+ <%= render(view_chain) %>
5
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <%=
2
+ attribute_names = @display.each_attribute_name.to_a
3
+
4
+ CSV
5
+ .generate(write_headers: true, headers: attribute_names) do |csv|
6
+ @records.each do |record|
7
+ row = attribute_names.map do |attribute_name|
8
+ @display.render_attribute(template: self, record: record, column: attribute_name)
9
+ end
10
+ csv << row
11
+ end
12
+ end
13
+ .html_safe
14
+ -%>
@@ -1,5 +1,13 @@
1
1
  ---
2
2
  en:
3
3
  super:
4
+ batch:
5
+ none_error: This batch action received no items to act upon
6
+ csv:
7
+ initial_cta: Export CSV
8
+ modal_header: Export CSV
9
+ download_current_cta: Download current view
10
+ download_all_cta: Download all matching query
4
11
  layout:
5
12
  powered_by: "%{env} environment. Powered by Super %{version}."
13
+ 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."