super 0.0.9 → 0.0.14
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.
- checksums.yaml +4 -4
- data/.yardopts +0 -9
- data/README.md +40 -52
- data/app/assets/javascripts/super/application.js +5671 -3669
- data/app/assets/stylesheets/super/application.css +114693 -71486
- data/app/controllers/super/application_controller.rb +24 -13
- data/app/helpers/super/form_builder_helper.rb +25 -0
- data/app/views/layouts/super/application.html.erb +15 -14
- data/app/views/super/application/{_super_schema_display_actions.html.erb → _display_actions.html.erb} +0 -0
- data/app/views/super/application/{_super_schema_display_index.html.erb → _display_index.html.erb} +5 -5
- data/app/views/super/application/_display_show.html.erb +8 -0
- data/app/views/super/application/_filter.html.erb +5 -13
- data/app/views/super/application/_filter_type_select.html.erb +9 -19
- data/app/views/super/application/_filter_type_text.html.erb +7 -11
- data/app/views/super/application/_filter_type_timestamp.html.erb +6 -17
- data/app/views/super/application/_form.html.erb +15 -0
- data/app/views/super/application/_form_field__destroy.html.erb +1 -9
- data/app/views/super/application/_form_field_checkbox.html.erb +1 -15
- data/app/views/super/application/_form_field_flatpickr_date.html.erb +8 -0
- data/app/views/super/application/_form_field_flatpickr_datetime.html.erb +8 -0
- data/app/views/super/application/_form_field_flatpickr_time.html.erb +8 -0
- data/app/views/super/application/_form_field_rich_text_area.html.erb +1 -13
- data/app/views/super/application/_form_field_select.html.erb +1 -23
- data/app/views/super/application/_form_field_text.html.erb +1 -13
- data/app/views/super/application/{_super_layout.html.erb → _layout.html.erb} +8 -8
- data/app/views/super/application/{_super_pagination.html.erb → _pagination.html.erb} +1 -1
- data/app/views/super/application/{_super_panel.html.erb → _panel.html.erb} +2 -2
- data/app/views/super/application/_query.html.erb +18 -0
- data/app/views/super/application/_sort.html.erb +18 -0
- data/app/views/super/application/_sort_expression.html.erb +25 -0
- data/app/views/super/application/edit.html.erb +1 -0
- data/app/views/super/application/index.html.erb +1 -0
- data/app/views/super/application/new.html.erb +1 -0
- data/app/views/super/application/show.html.erb +1 -0
- data/app/views/super/feather/README.md +1 -0
- data/app/views/super/feather/_x.html +15 -0
- data/config/routes.rb +2 -0
- data/frontend/super-frontend/dist/application.css +114693 -71486
- data/frontend/super-frontend/dist/application.js +5671 -3669
- data/lib/generators/super/action_text/action_text_generator.rb +2 -0
- data/lib/generators/super/install/install_generator.rb +18 -7
- data/lib/generators/super/install/templates/base_controller.rb.tt +9 -1
- data/lib/generators/super/install/templates/initializer.rb.tt +9 -2
- data/lib/generators/super/resource/resource_generator.rb +107 -30
- data/lib/generators/super/resource/templates/resources_controller.rb.tt +3 -9
- data/lib/generators/super/webpacker/webpacker_generator.rb +11 -5
- data/lib/super.rb +9 -2
- data/lib/super/action_inquirer.rb +2 -0
- data/lib/super/assets.rb +46 -23
- data/lib/super/cheat.rb +17 -0
- data/lib/super/client_error.rb +2 -0
- data/lib/super/compatibility.rb +21 -0
- data/lib/super/configuration.rb +16 -24
- data/lib/super/controls.rb +11 -2
- data/lib/super/controls/optional.rb +35 -1
- data/lib/super/controls/steps.rb +27 -35
- data/lib/super/controls/view.rb +55 -0
- data/lib/super/display.rb +29 -13
- data/lib/super/display/guesser.rb +4 -0
- data/lib/super/display/schema_types.rb +73 -33
- data/lib/super/engine.rb +4 -0
- data/lib/super/error.rb +21 -0
- data/lib/super/filter.rb +2 -0
- data/lib/super/filter/form_object.rb +5 -8
- data/lib/super/filter/guesser.rb +2 -0
- data/lib/super/filter/operator.rb +2 -0
- data/lib/super/filter/schema_types.rb +2 -0
- data/lib/super/form.rb +3 -1
- data/lib/super/form/builder.rb +289 -39
- data/lib/super/form/guesser.rb +12 -1
- data/lib/super/form/inline_errors.rb +28 -0
- data/lib/super/form/schema_types.rb +15 -0
- data/lib/super/form/strong_params.rb +2 -0
- data/lib/super/layout.rb +3 -1
- data/lib/super/link.rb +44 -31
- data/lib/super/link_builder.rb +58 -0
- data/lib/super/navigation.rb +164 -0
- data/lib/super/pagination.rb +3 -1
- data/lib/super/panel.rb +3 -1
- data/lib/super/partial.rb +2 -0
- data/lib/super/partial/resolving.rb +2 -0
- data/lib/super/plugin.rb +2 -0
- data/lib/super/query/form_object.rb +48 -0
- data/lib/super/schema.rb +2 -0
- data/lib/super/schema/common.rb +2 -0
- data/lib/super/schema/guesser.rb +2 -0
- data/lib/super/sort.rb +110 -0
- data/lib/super/useful/builder.rb +25 -0
- data/lib/super/useful/enum.rb +63 -0
- data/lib/super/version.rb +3 -1
- data/lib/super/view_helper.rb +2 -19
- data/lib/tasks/super/cheat.rake +9 -0
- metadata +53 -40
- data/CONTRIBUTING.md +0 -56
- data/Rakefile +0 -34
- data/STABILITY.md +0 -50
- data/app/views/super/application/_form_field_generic.html.erb +0 -19
- data/app/views/super/application/_form_inline_errors.html.erb +0 -10
- data/app/views/super/application/_super_schema_display_show.html.erb +0 -8
- data/app/views/super/application/_super_schema_form.html.erb +0 -15
- data/docs/README.md +0 -8
- data/docs/action_text.md +0 -48
- data/docs/faq.md +0 -44
- data/docs/installation.md +0 -21
- data/docs/quick_start.md +0 -30
- data/docs/webpacker.md +0 -25
- data/docs/yard_customizations.rb +0 -41
- data/frontend/super-frontend/build.js +0 -36
- data/frontend/super-frontend/package.json +0 -20
- data/frontend/super-frontend/postcss.config.js +0 -6
- data/frontend/super-frontend/src/javascripts/super/application.js +0 -15
- data/frontend/super-frontend/src/javascripts/super/apply_template_controller.js +0 -17
- data/frontend/super-frontend/src/javascripts/super/toggle_pending_destruction_controller.js +0 -15
- data/frontend/super-frontend/src/stylesheets/super/application.css +0 -77
- data/frontend/super-frontend/tailwind.config.js +0 -15
- data/frontend/super-frontend/yarn.lock +0 -5443
- data/lib/super/controls/required.rb +0 -13
- data/lib/super/filter/plugin.rb +0 -47
- data/lib/super/navigation/automatic.rb +0 -71
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
module Super
|
|
2
|
-
class Controls
|
|
3
|
-
# Methods for `Controls` that must be defined for Super to work properly
|
|
4
|
-
module Required
|
|
5
|
-
# Specifies the model. This is a required method
|
|
6
|
-
#
|
|
7
|
-
# @return [ActiveRecord::Base]
|
|
8
|
-
def model
|
|
9
|
-
raise NotImplementedError
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
data/lib/super/filter/plugin.rb
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
module Super
|
|
2
|
-
class Filter
|
|
3
|
-
module ControllerMethods
|
|
4
|
-
def index
|
|
5
|
-
super
|
|
6
|
-
@filter_form = controls.initialize_filtering(params: params, query_params: request.GET)
|
|
7
|
-
@records = controls.filter_records(filter_form: @filter_form, records: @records)
|
|
8
|
-
@view.asides.push(:@filter_form)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class Controls
|
|
14
|
-
module Optional
|
|
15
|
-
def filters_enabled?
|
|
16
|
-
true
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def filter_schema
|
|
20
|
-
Filter.new do |fields, type|
|
|
21
|
-
Filter::Guesser.new(model: model, fields: fields, type: type).call
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
module Steps
|
|
27
|
-
def initialize_filtering(params:, query_params:)
|
|
28
|
-
if filters_enabled?
|
|
29
|
-
Super::Filter::FormObject.new(
|
|
30
|
-
model: model,
|
|
31
|
-
schema: filter_schema,
|
|
32
|
-
params: params[:q],
|
|
33
|
-
url: query_params
|
|
34
|
-
)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def filter_records(filter_form:, records:)
|
|
39
|
-
if filters_enabled? && records
|
|
40
|
-
filter_form.to_search_query(records)
|
|
41
|
-
else
|
|
42
|
-
records
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
module Super
|
|
2
|
-
class Navigation
|
|
3
|
-
# Traverses the defined Rails Routes and attempts to build a list of links.
|
|
4
|
-
# This is used for building the nav bar on each admin page.
|
|
5
|
-
class Automatic
|
|
6
|
-
def initialize(route_namespace:)
|
|
7
|
-
route_namespace = route_namespace.to_s
|
|
8
|
-
|
|
9
|
-
if route_namespace.include?("/")
|
|
10
|
-
raise "Can't be nested namespace"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
@route_namespace = route_namespace
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def each
|
|
17
|
-
if !block_given?
|
|
18
|
-
return enum_for(:each)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
navigable_namespace_routes = Rails.application.routes.routes.select do |route|
|
|
22
|
-
path_spec = route.path.spec
|
|
23
|
-
|
|
24
|
-
next if route.verb != "GET"
|
|
25
|
-
next if !path_spec.respond_to?(:right)
|
|
26
|
-
next if path_spec.right.left.to_s != @route_namespace
|
|
27
|
-
next if route.required_parts.any?
|
|
28
|
-
next if route.defaults.empty?
|
|
29
|
-
|
|
30
|
-
true
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
navigable_defaults = navigable_namespace_routes.map do |route|
|
|
34
|
-
controller_name = route.defaults[:controller] + "_controller"
|
|
35
|
-
_controller =
|
|
36
|
-
begin
|
|
37
|
-
controller_name.camelize.constantize
|
|
38
|
-
rescue NameError
|
|
39
|
-
warn("[super] Couldn't find controller: #{controller_name}")
|
|
40
|
-
next
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
route.defaults
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
grouped_navigable_defaults =
|
|
47
|
-
navigable_defaults.compact.uniq.group_by { |d| d[:controller] }
|
|
48
|
-
|
|
49
|
-
grouped_navigable_defaults.each do |controller, defaults|
|
|
50
|
-
actions = defaults.map { |d| [d[:action], d[:action]] }.to_h
|
|
51
|
-
action = actions["index"] || actions["show"]
|
|
52
|
-
|
|
53
|
-
next if action.nil?
|
|
54
|
-
|
|
55
|
-
path =
|
|
56
|
-
begin
|
|
57
|
-
Rails.application.routes.url_for(
|
|
58
|
-
controller: controller,
|
|
59
|
-
action: action,
|
|
60
|
-
only_path: true
|
|
61
|
-
)
|
|
62
|
-
rescue ActionController::UrlGenerationError
|
|
63
|
-
next
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
yield(controller.split("/").last.humanize, path)
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|