refine-rails 2.9.14 → 2.10.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b10da95439ebbfb430380582aeb607bbc56e065fdd85168d755fd1165a665e81
|
|
4
|
+
data.tar.gz: a67a503d0142ffcd6b6400661407749f13a205e2640df94f294b9597cabc6cd6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e777469805d700bf202f4bef49870725e20c08f8ab7486b00d2395801c843caf62b35fbfd786f78364a5b4523c3b6d542cb93a2a7743ce756bcc87be0ac77dde
|
|
7
|
+
data.tar.gz: d6299c4843f0b56f3b6b3221106759960b39447cf07e293b89ce99fec79fd36f40ec6546252ce9d9c45a139b6ea49ec3384ff52332c55648aaf9f3d6ab0dec31
|
data/app/models/refine/filter.rb
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
conditions.filter { |c| c[:meta][:category] == category}
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
categories
|
|
8
|
+
# If an ordering has been defined for categories, use that, otherwise use the order in which they appear in the sorted conditions
|
|
9
|
+
categories = (@refine_filter.has_category_ordering?) ? @refine_filter.category_order : conditions.map { |c| c[:meta][:category] }.uniq.compact
|
|
10
|
+
|
|
11
|
+
recommended_conditions = conditions.select { |c| c[:meta][:recommended] }
|
|
9
12
|
|
|
10
13
|
# Note that the stimulus controllers set default condition id for new conditions
|
|
11
14
|
# so this is only for rare cases where it gets unset
|
|
@@ -40,6 +43,19 @@
|
|
|
40
43
|
><%= condition_option[:display] %></option>
|
|
41
44
|
<% end %>
|
|
42
45
|
</optgroup>
|
|
46
|
+
|
|
47
|
+
<% if recommended_conditions&.any? %>
|
|
48
|
+
<optgroup class="divider" label="<%= t(".recommended") %>">
|
|
49
|
+
<% recommended_conditions.each do |condition_option| %>
|
|
50
|
+
<option
|
|
51
|
+
value="<%= condition_option[:id] %>"
|
|
52
|
+
<% if selected_condition_id == condition_option[:id] %>selected<% end %>
|
|
53
|
+
title="<%= condition_option[:display] %>"
|
|
54
|
+
><%= condition_option[:display] %></option>
|
|
55
|
+
<% end %>
|
|
56
|
+
</optgroup>
|
|
57
|
+
<% end %>
|
|
58
|
+
|
|
43
59
|
<% categories.each do |category| %>
|
|
44
60
|
<optgroup class="divider" label="<%= category %>">
|
|
45
61
|
<% conditions_for_category.call(category).each do |condition_option| %>
|
|
@@ -2,9 +2,19 @@
|
|
|
2
2
|
# a hash mapping Category => [array, of, conditions], sorted by category
|
|
3
3
|
categorized_conditions = @conditions
|
|
4
4
|
.group_by {|c| c.meta[:category].presence}
|
|
5
|
-
.sort_by
|
|
5
|
+
.sort_by do |(category, _conditions)|
|
|
6
|
+
if @refine_filter.has_category_ordering?
|
|
7
|
+
@refine_filter.category_order.index(category) || Float::INFINITY
|
|
8
|
+
else
|
|
9
|
+
category.to_s.downcase
|
|
10
|
+
end
|
|
11
|
+
end
|
|
6
12
|
.to_h
|
|
7
13
|
|
|
14
|
+
recommended_conditions = @conditions
|
|
15
|
+
.select { |c| c.meta[:recommended] }
|
|
16
|
+
.sort_by {|recommended| recommended.to_s.downcase }
|
|
17
|
+
|
|
8
18
|
# an array of uncategorized conditions
|
|
9
19
|
uncategorized_conditions = categorized_conditions.delete(nil)
|
|
10
20
|
%>
|
|
@@ -31,17 +41,34 @@
|
|
|
31
41
|
<div class="refine--separator-m0"></div>
|
|
32
42
|
|
|
33
43
|
<div class="refine--condition-list">
|
|
34
|
-
<% uncategorized_conditions
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
<% if uncategorized_conditions&.any? %>
|
|
45
|
+
<% uncategorized_conditions.each do |condition| %>
|
|
46
|
+
<%= link_to condition.display,
|
|
47
|
+
new_refine_inline_criterion_url(@criterion.to_params.deep_merge(refine_inline_criterion: {condition_id: condition.id})),
|
|
48
|
+
class: "refine--condition-list-item",
|
|
49
|
+
data: {
|
|
50
|
+
controller: "refine--turbo-stream-link",
|
|
51
|
+
action: "refine--turbo-stream-link#visit",
|
|
52
|
+
refine__typeahead_list_target: "listItem",
|
|
53
|
+
list_item_value: condition.display
|
|
54
|
+
}
|
|
55
|
+
%>
|
|
56
|
+
<% end %>
|
|
57
|
+
<% end %>
|
|
58
|
+
|
|
59
|
+
<% if recommended_conditions.any? %>
|
|
60
|
+
<b data-refine--typeahead-list-target="recommended"><%= t('.recommended') %></b>
|
|
61
|
+
<% recommended_conditions.each do |condition| %>
|
|
62
|
+
<%= link_to condition.display,
|
|
63
|
+
new_refine_inline_criterion_url(@criterion.to_params.deep_merge(refine_inline_criterion: {condition_id: condition.id})),
|
|
64
|
+
class: "refine--condition-list-item",
|
|
65
|
+
data: {
|
|
66
|
+
controller: "refine--turbo-stream-link",
|
|
67
|
+
action: "refine--turbo-stream-link#visit",
|
|
68
|
+
refine__typeahead_list_target: "listItem",
|
|
69
|
+
}
|
|
70
|
+
%>
|
|
71
|
+
<% end %>
|
|
45
72
|
<% end %>
|
|
46
73
|
|
|
47
74
|
<% categorized_conditions.each do |(category, conditions)| %>
|
|
@@ -66,6 +66,10 @@ en:
|
|
|
66
66
|
days: "days"
|
|
67
67
|
and: "and"
|
|
68
68
|
|
|
69
|
+
blueprints:
|
|
70
|
+
condition_select:
|
|
71
|
+
recommended: "Recommended"
|
|
72
|
+
|
|
69
73
|
refine_blueprints:
|
|
70
74
|
add_and:
|
|
71
75
|
add_and: "AND"
|
|
@@ -184,5 +188,8 @@ en:
|
|
|
184
188
|
filters:
|
|
185
189
|
add_first_condition_button:
|
|
186
190
|
filter: "Filter"
|
|
191
|
+
criteria:
|
|
192
|
+
index:
|
|
193
|
+
recommended: "Recommended"
|
|
187
194
|
load_button:
|
|
188
195
|
load_filter: "Load Filter"
|
data/lib/refine/rails/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: refine-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Colleen Schnettler
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2024-
|
|
12
|
+
date: 2024-08-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|