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
@@ -1,18 +1,22 @@
1
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 %>
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
+ <%= render "sort_expression", expr_fields: expr_fields, sort: sort %>
7
+ <% end %>
6
8
  <% end %>
7
- <% end %>
8
9
 
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 %>
10
+ <%= form.fields_for("exprs[]", sort.new_expr.with_index("TEMPLATEINDEX")) do |expr_fields| %>
11
+ <template data-apply-template-target="template">
12
+ <%= 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
- <a href="#" data-action="apply-template#call" class="block mt-2 text-sm">
16
- Add
17
- </a>
18
- </div>
22
+ <%= yield if block_given? %>
@@ -1,5 +1,24 @@
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) %>
1
+ <%
2
+ name, current = view_chain.shift
3
+ current =
4
+ if current.kind_of?(Symbol)
5
+ instance_variable_get(current)
6
+ else
7
+ current
8
+ end
9
+
10
+ if !current
11
+ Rails.logger.warn do
12
+ "Super::ViewChain encountered a nil view: #{name.inspect}."
13
+ end
14
+ end
15
+ %>
16
+ <% if current %>
17
+ <% if view_chain.empty? %>
18
+ <%= render(current) %>
19
+ <% else %>
20
+ <%= render(current) do %>
21
+ <%= render(view_chain) %>
22
+ <% end %>
23
+ <% end %>
5
24
  <% end %>
@@ -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,8 @@ en:
9
15
  download_current_cta: Download current view
10
16
  download_all_cta: Download all matching query
11
17
  layout:
12
- powered_by: "%{env} environment. Powered by Super %{version}."
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."
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