super 0.20.0 → 0.21.0
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/README.md +1 -1
- data/app/controllers/super/application_controller.rb +8 -17
- data/app/controllers/super/sitewide_controller.rb +33 -0
- data/app/controllers/super/substructure_controller.rb +41 -86
- data/app/controllers/super/view_controller.rb +55 -0
- data/app/views/super/application/_display_index.html.erb +8 -2
- data/app/views/super/application/_display_show.html.erb +10 -2
- data/app/views/super/application/_filter.html.erb +63 -59
- data/app/views/super/application/_layout.html.erb +0 -2
- data/app/views/super/application/_query.html.erb +13 -12
- data/app/views/super/application/_sort.html.erb +18 -14
- data/app/views/super/application/_view_chain.html.erb +23 -4
- data/config/locales/en.yml +3 -0
- data/lib/super/badge.rb +11 -2
- data/lib/super/cheat.rb +6 -1
- data/lib/super/display/schema_types.rb +37 -14
- data/lib/super/display.rb +5 -4
- data/lib/super/error.rb +2 -2
- data/{app/helpers → lib}/super/form_builder_helper.rb +11 -0
- data/lib/super/navigation.rb +40 -40
- data/lib/super/query.rb +61 -0
- data/lib/super/{engine.rb → railtie.rb} +7 -1
- data/lib/super/reset.rb +7 -0
- data/lib/super/schema.rb +8 -2
- data/lib/super/sort.rb +1 -3
- data/lib/super/useful/deprecations.rb +18 -0
- data/lib/super/version.rb +1 -1
- data/lib/super/view_chain.rb +14 -4
- data/lib/super.rb +8 -2
- metadata +9 -49
- data/config/routes.rb +0 -4
- data/lib/super/query/form_object.rb +0 -48
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Super
|
4
|
-
class Query
|
5
|
-
class FormObject
|
6
|
-
def initialize(model:, params:, namespace:, current_path:)
|
7
|
-
@model = model
|
8
|
-
@all_params = params.dup
|
9
|
-
@namespace = namespace
|
10
|
-
@params = params[namespace] || ActionController::Parameters.new
|
11
|
-
@path = current_path
|
12
|
-
@addons = {}
|
13
|
-
end
|
14
|
-
|
15
|
-
attr_reader :namespace
|
16
|
-
attr_reader :path
|
17
|
-
attr_reader :addons
|
18
|
-
|
19
|
-
def add(klass, namespace:, **additional_initialization_arguments)
|
20
|
-
instance = klass.new(
|
21
|
-
model: @model,
|
22
|
-
params: params_dig(namespace),
|
23
|
-
**additional_initialization_arguments
|
24
|
-
)
|
25
|
-
|
26
|
-
addons[namespace] = instance
|
27
|
-
end
|
28
|
-
|
29
|
-
def apply_changes(records)
|
30
|
-
addons.each_value do |addon|
|
31
|
-
records = addon.apply_changes(records)
|
32
|
-
end
|
33
|
-
|
34
|
-
records
|
35
|
-
end
|
36
|
-
|
37
|
-
def to_partial_path
|
38
|
-
"query"
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def params_dig(*keys)
|
44
|
-
@params.dig(*keys) || ActionController::Parameters.new
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|