super 0.0.12 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +0 -1
  3. data/README.md +38 -46
  4. data/app/assets/javascripts/super/application.js +5747 -3803
  5. data/app/assets/stylesheets/super/application.css +114686 -71486
  6. data/app/controllers/super/application_controller.rb +44 -37
  7. data/app/controllers/super/substructure_controller.rb +276 -0
  8. data/app/helpers/super/form_builder_helper.rb +7 -0
  9. data/app/views/layouts/super/application.html.erb +4 -19
  10. data/app/views/super/application/_collection_header.html.erb +2 -2
  11. data/app/views/super/application/_display_actions.html.erb +1 -1
  12. data/app/views/super/application/_display_index.html.erb +2 -2
  13. data/app/views/super/application/_display_show.html.erb +1 -1
  14. data/app/views/super/application/_filter.html.erb +62 -2
  15. data/app/views/super/application/_form_field.html.erb +5 -0
  16. data/app/views/super/application/_layout.html.erb +1 -1
  17. data/app/views/super/application/_member_header.html.erb +2 -2
  18. data/app/views/super/application/_pagination.html.erb +1 -1
  19. data/app/views/super/application/_site_footer.html.erb +3 -0
  20. data/app/views/super/application/_site_header.html.erb +17 -0
  21. data/app/views/super/application/_sort_expression.html.erb +2 -2
  22. data/app/views/super/feather/README.md +0 -1
  23. data/frontend/super-frontend/dist/application.css +114686 -71486
  24. data/frontend/super-frontend/dist/application.js +5747 -3803
  25. data/lib/generators/super/install/install_generator.rb +0 -16
  26. data/lib/generators/super/install/templates/base_controller.rb.tt +0 -8
  27. data/lib/generators/super/resource/templates/resources_controller.rb.tt +4 -4
  28. data/lib/generators/super/webpacker/webpacker_generator.rb +9 -5
  29. data/lib/super.rb +5 -2
  30. data/lib/super/action_inquirer.rb +18 -3
  31. data/lib/super/assets.rb +44 -23
  32. data/lib/super/badge.rb +60 -0
  33. data/lib/super/cheat.rb +17 -0
  34. data/lib/super/compatibility.rb +19 -0
  35. data/lib/super/display/guesser.rb +3 -1
  36. data/lib/super/display/schema_types.rb +51 -2
  37. data/lib/super/error.rb +2 -0
  38. data/lib/super/filter.rb +1 -1
  39. data/lib/super/filter/form_object.rb +74 -48
  40. data/lib/super/filter/guesser.rb +2 -0
  41. data/lib/super/filter/operator.rb +90 -64
  42. data/lib/super/filter/schema_types.rb +63 -80
  43. data/lib/super/form/builder.rb +110 -27
  44. data/lib/super/form/field_transcript.rb +43 -0
  45. data/lib/super/form/guesser.rb +10 -1
  46. data/lib/super/form/schema_types.rb +73 -16
  47. data/lib/super/link.rb +38 -32
  48. data/lib/super/link_builder.rb +58 -0
  49. data/lib/super/navigation.rb +164 -0
  50. data/lib/super/pagination.rb +2 -44
  51. data/lib/super/reset.rb +22 -0
  52. data/lib/super/schema.rb +4 -0
  53. data/lib/super/useful/builder.rb +4 -4
  54. data/lib/super/version.rb +1 -1
  55. data/lib/tasks/super/cheat.rake +9 -0
  56. metadata +14 -19
  57. data/CONTRIBUTING.md +0 -56
  58. data/Rakefile +0 -36
  59. data/app/views/super/application/_filter_type_select.html.erb +0 -21
  60. data/app/views/super/application/_filter_type_text.html.erb +0 -18
  61. data/app/views/super/application/_filter_type_timestamp.html.erb +0 -24
  62. data/app/views/super/application/_form_field_checkbox.html.erb +0 -1
  63. data/app/views/super/application/_form_field_rich_text_area.html.erb +0 -1
  64. data/app/views/super/application/_form_field_select.html.erb +0 -1
  65. data/app/views/super/application/_form_field_text.html.erb +0 -1
  66. data/app/views/super/feather/_chevron_down.html +0 -1
  67. data/docs/cheat.md +0 -41
  68. data/lib/super/controls.rb +0 -22
  69. data/lib/super/controls/optional.rb +0 -113
  70. data/lib/super/controls/steps.rb +0 -106
  71. data/lib/super/controls/view.rb +0 -55
  72. data/lib/super/navigation/automatic.rb +0 -73
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Super
4
- class Controls
5
- # Methods for `Controls` that have a sane default implementation
6
- module View
7
- def index_view
8
- Super::Layout.new(
9
- mains: [
10
- Super::Panel.new(
11
- Super::Partial.new("collection_header"),
12
- :@display
13
- ),
14
- ],
15
- asides: [
16
- :@query_form,
17
- ]
18
- )
19
- end
20
-
21
- def show_view
22
- Super::Layout.new(
23
- mains: [
24
- Super::Panel.new(
25
- Super::Partial.new("member_header"),
26
- :@display
27
- ),
28
- ]
29
- )
30
- end
31
-
32
- def new_view
33
- Super::Layout.new(
34
- mains: [
35
- Super::Panel.new(
36
- Super::Partial.new("collection_header"),
37
- :@form
38
- ),
39
- ]
40
- )
41
- end
42
-
43
- def edit_view
44
- Super::Layout.new(
45
- mains: [
46
- Super::Panel.new(
47
- Super::Partial.new("member_header"),
48
- :@form
49
- ),
50
- ]
51
- )
52
- end
53
- end
54
- end
55
- end
@@ -1,73 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Super
4
- class Navigation
5
- # Traverses the defined Rails Routes and attempts to build a list of links.
6
- # This is used for building the nav bar on each admin page.
7
- class Automatic
8
- def initialize(route_namespace: Super.configuration.path)
9
- route_namespace = route_namespace.strip.gsub(%r{\A/+}, "").gsub(%r{/+\z}, "").strip
10
-
11
- if route_namespace.include?("/")
12
- raise "Can't be nested namespace"
13
- end
14
-
15
- @route_namespace = route_namespace
16
- end
17
-
18
- def each
19
- if !block_given?
20
- return enum_for(:each)
21
- end
22
-
23
- navigable_namespace_routes = Rails.application.routes.routes.select do |route|
24
- path_spec = route.path.spec
25
-
26
- next if route.verb != "GET"
27
- next if !path_spec.respond_to?(:right)
28
- next if path_spec.right.left.to_s != @route_namespace
29
- next if route.required_parts.any?
30
- next if route.defaults.empty?
31
-
32
- true
33
- end
34
-
35
- navigable_defaults = navigable_namespace_routes.map do |route|
36
- controller_name = route.defaults[:controller] + "_controller"
37
- _controller =
38
- begin
39
- controller_name.camelize.constantize
40
- rescue NameError
41
- warn("[super] Couldn't find controller: #{controller_name}")
42
- next
43
- end
44
-
45
- route.defaults
46
- end
47
-
48
- grouped_navigable_defaults =
49
- navigable_defaults.compact.uniq.group_by { |d| d[:controller] }
50
-
51
- grouped_navigable_defaults.each do |controller, defaults|
52
- actions = defaults.map { |d| [d[:action], d[:action]] }.to_h
53
- action = actions["index"] || actions["show"]
54
-
55
- next if action.nil?
56
-
57
- path =
58
- begin
59
- Rails.application.routes.url_for(
60
- controller: controller,
61
- action: action,
62
- only_path: true
63
- )
64
- rescue ActionController::UrlGenerationError
65
- next
66
- end
67
-
68
- yield(controller.split("/").last.humanize, path)
69
- end
70
- end
71
- end
72
- end
73
- end