plutonium 0.15.19 → 0.15.20
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/app/views/components/table/table_component.rb +1 -1
- data/lib/generators/pu/core/assets/assets_generator.rb +1 -1
- data/lib/plutonium/resource/query_object.rb +5 -5
- data/lib/plutonium/ui/table/components/scopes_bar.rb +4 -4
- data/lib/plutonium/ui/table/resource.rb +4 -1
- data/lib/plutonium/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5630875ec6ddc198a720bed518f95ccc137da33384bd7676ff552588397bec09
|
4
|
+
data.tar.gz: f2f18c6a3e9607eaf984e42cc817a2760f66f05c5a470cf64087100ec7699c42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1000adb19a64a243302ee953c74fcf693d190025b738b884dc13c3e2431bd93ce31767d0b6f1295a433a9456fd9932c7ecfd7bfc72ff65395bdc1fb7d477704
|
7
|
+
data.tar.gz: b086a809086dd47b3b3811433a592ee3e608d5d6a22e4e2599f52add01584b078895aa2dccfcdc49172808da42e853e68ba843682b5f6891de456d4d44649643
|
@@ -108,7 +108,7 @@ module PlutoniumUi
|
|
108
108
|
label = column.label
|
109
109
|
search_object = column.search_object
|
110
110
|
|
111
|
-
if (sort_params = search_object.sort_params_for(name))
|
111
|
+
if (sort_params = search_object.sort_params_for(name, request:))
|
112
112
|
tag.div class: "inline-flex" do
|
113
113
|
concat begin
|
114
114
|
link_to(sort_params[:url], class: "flex", title: sort_params[:direction] || "Sort") do
|
@@ -62,7 +62,7 @@ module Plutonium
|
|
62
62
|
#
|
63
63
|
# @param options [Hash] The options for building the URL.
|
64
64
|
# @return [String] The constructed URL with query parameters.
|
65
|
-
def build_url(**options)
|
65
|
+
def build_url(request:, **options)
|
66
66
|
q = {}
|
67
67
|
|
68
68
|
q[:search] = options.key?(:search) ? options[:search].presence : search_query
|
@@ -74,7 +74,7 @@ module Plutonium
|
|
74
74
|
|
75
75
|
q.merge! params.slice(*filter_definitions.keys)
|
76
76
|
query_params = deep_compact({q: q}).to_param
|
77
|
-
"?#{query_params}"
|
77
|
+
"#{request.path}?#{query_params}"
|
78
78
|
end
|
79
79
|
|
80
80
|
# Applies the defined filters and sorts to the given scope.
|
@@ -99,12 +99,12 @@ module Plutonium
|
|
99
99
|
#
|
100
100
|
# @param name [Symbol, String] The name of the field to sort.
|
101
101
|
# @return [Hash, nil] The sorting parameters including URL and direction.
|
102
|
-
def sort_params_for(name)
|
102
|
+
def sort_params_for(name, request:)
|
103
103
|
return unless sort_definitions[name]
|
104
104
|
|
105
105
|
{
|
106
|
-
url: build_url(sort: name),
|
107
|
-
reset_url: build_url(sort: name, reset: true),
|
106
|
+
url: build_url(request:, sort: name),
|
107
|
+
reset_url: build_url(request:, sort: name, reset: true),
|
108
108
|
position: selected_sort_fields.index(name.to_s),
|
109
109
|
direction: selected_sort_directions[name]
|
110
110
|
}
|
@@ -18,14 +18,14 @@ module Plutonium
|
|
18
18
|
if current_scope.blank?
|
19
19
|
a(
|
20
20
|
id: "#{name}-scope",
|
21
|
-
href: current_query_object.build_url(scope: nil),
|
21
|
+
href: current_query_object.build_url(request:, scope: nil),
|
22
22
|
class:
|
23
23
|
"px-4 py-2 text-sm font-medium text-white bg-primary-700 border border-primary-700 rounded-lg hover:bg-primary-800 focus:z-10 focus:ring-2 focus:ring-primary-700 focus:text-white dark:bg-primary-600 dark:border-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
|
24
24
|
) { name.humanize }
|
25
25
|
else
|
26
26
|
a(
|
27
27
|
id: "#{name}-scope",
|
28
|
-
href: current_query_object.build_url(scope: nil),
|
28
|
+
href: current_query_object.build_url(request:, scope: nil),
|
29
29
|
class:
|
30
30
|
"px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-100 hover:text-gray-700 focus:z-10 focus:ring-2 focus:ring-gray-300 focus:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:focus:text-white"
|
31
31
|
) { name.humanize }
|
@@ -35,14 +35,14 @@ module Plutonium
|
|
35
35
|
if name == current_scope
|
36
36
|
a(
|
37
37
|
id: "#{name}-scope",
|
38
|
-
href: current_query_object.build_url(scope: name),
|
38
|
+
href: current_query_object.build_url(request:, scope: name),
|
39
39
|
class:
|
40
40
|
"px-4 py-2 text-sm font-medium text-white bg-primary-700 border border-primary-700 rounded-lg hover:bg-primary-800 focus:z-10 focus:ring-2 focus:ring-primary-700 focus:text-white dark:bg-primary-600 dark:border-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
|
41
41
|
) { name.humanize }
|
42
42
|
else
|
43
43
|
a(
|
44
44
|
id: "#{name}-scope",
|
45
|
-
href: current_query_object.build_url(scope: name),
|
45
|
+
href: current_query_object.build_url(request:, scope: name),
|
46
46
|
class:
|
47
47
|
"px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-100 hover:text-gray-700 focus:z-10 focus:ring-2 focus:ring-gray-300 focus:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:focus:text-white"
|
48
48
|
) { name.humanize }
|
@@ -66,7 +66,10 @@ module Plutonium
|
|
66
66
|
field_options = resource_definition.defined_fields[name] ? resource_definition.defined_fields[name][:options].dup : {}
|
67
67
|
field_options = field_options.merge(**column_display_options.slice(:align))
|
68
68
|
# field_options[:align] = align_field_to if align_field_to
|
69
|
-
table.column name,
|
69
|
+
table.column name,
|
70
|
+
**field_options,
|
71
|
+
sort_params: current_query_object.sort_params_for(name, request:),
|
72
|
+
&display_tag_block
|
70
73
|
end
|
71
74
|
|
72
75
|
table.actions do |wrapped_object|
|
data/lib/plutonium/version.rb
CHANGED