refine-rails 2.10.1 → 2.11.1
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/assets/javascripts/refine-stimulus.esm.js.map +1 -1
- data/app/assets/javascripts/refine-stimulus.js.map +1 -1
- data/app/assets/javascripts/refine-stimulus.modern.js.map +1 -1
- data/app/assets/javascripts/refine-stimulus.umd.js.map +1 -1
- data/app/assets/stylesheets/index.css +68 -9
- data/app/assets/stylesheets/index.tailwind.css +76 -16
- data/app/controllers/refine/inline/criteria_controller.rb +17 -4
- data/app/models/refine/conditions/condition.rb +1 -0
- data/app/models/refine/conditions/has_icon.rb +24 -0
- data/app/models/refine/filter.rb +4 -0
- data/app/views/refine/blueprints/_condition_select.html.erb +3 -1
- data/app/views/refine/inline/criteria/_condition_list_item.html.erb +27 -0
- data/app/views/refine/inline/criteria/index.html.erb +4 -32
- data/app/views/refine/inline/filters/_and_button.html.erb +2 -2
- data/app/views/refine/inline/filters/_clear_button.html.erb +13 -0
- data/app/views/refine/inline/filters/_criterion.html.erb +6 -1
- data/app/views/refine/inline/filters/_group.html.erb +7 -13
- data/app/views/refine/inline/filters/_show.html.erb +17 -17
- data/config/locales/en/refine.en.yml +2 -1
- data/config/routes.rb +3 -1
- data/lib/refine/rails/version.rb +1 -1
- metadata +5 -2
@@ -1203,20 +1203,23 @@
|
|
1203
1203
|
.refine--filter-wrapper {
|
1204
1204
|
font-size: 14px;
|
1205
1205
|
display: flex;
|
1206
|
-
flex-direction: column;
|
1206
|
+
/* flex-direction: column; */
|
1207
1207
|
gap: 12px;
|
1208
1208
|
margin-top: 12px;
|
1209
1209
|
}
|
1210
1210
|
|
1211
1211
|
.refine--filter-row {
|
1212
1212
|
display: flex;
|
1213
|
+
width: 100%;
|
1213
1214
|
gap: 10px;
|
1214
1215
|
row-gap: 15px;
|
1215
1216
|
align-items: center;
|
1216
|
-
|
1217
|
+
align-items: start;
|
1218
|
+
justify-content: space-between;
|
1217
1219
|
}
|
1218
1220
|
|
1219
1221
|
.refine--groups-wrapper {
|
1222
|
+
flex-grow: 1;
|
1220
1223
|
display: flex;
|
1221
1224
|
gap: 10px;
|
1222
1225
|
row-gap: 15px;
|
@@ -1224,6 +1227,11 @@
|
|
1224
1227
|
flex-wrap: wrap;
|
1225
1228
|
}
|
1226
1229
|
|
1230
|
+
.refine--filter-control-group {
|
1231
|
+
text-wrap: nowrap;
|
1232
|
+
display: flex;
|
1233
|
+
}
|
1234
|
+
|
1227
1235
|
.refine--group-join, .refine--condition-join {
|
1228
1236
|
position: relative;
|
1229
1237
|
padding: 5px 0;
|
@@ -1250,6 +1258,7 @@
|
|
1250
1258
|
position: relative;
|
1251
1259
|
padding: 0 10px;
|
1252
1260
|
align-items: center;
|
1261
|
+
flex-wrap: wrap;
|
1253
1262
|
&:before , &:after {
|
1254
1263
|
content: "";
|
1255
1264
|
position: absolute;
|
@@ -1304,13 +1313,58 @@
|
|
1304
1313
|
text-decoration: none;
|
1305
1314
|
}
|
1306
1315
|
|
1307
|
-
.refine--condition-pill-wrapper
|
1316
|
+
.refine--condition-pill-wrapper {
|
1308
1317
|
display: flex;
|
1309
1318
|
align-items: center;
|
1310
1319
|
gap: 5px;
|
1311
1320
|
position: relative;
|
1312
1321
|
}
|
1313
1322
|
|
1323
|
+
.refine--condition-pill-start {
|
1324
|
+
padding: 0 0 0 10px;
|
1325
|
+
&:before {
|
1326
|
+
content: "";
|
1327
|
+
position: absolute;
|
1328
|
+
left: -10px;
|
1329
|
+
top: -2px;
|
1330
|
+
bottom: -2px;
|
1331
|
+
border: 2px solid #eee;
|
1332
|
+
width: 3px;
|
1333
|
+
}
|
1334
|
+
&:hover {
|
1335
|
+
&:before{
|
1336
|
+
border-color: #aaa;
|
1337
|
+
}
|
1338
|
+
}
|
1339
|
+
&:before {
|
1340
|
+
border-radius: 6px 0 0 6px;
|
1341
|
+
left: 0;
|
1342
|
+
border-right: none;
|
1343
|
+
}
|
1344
|
+
}
|
1345
|
+
|
1346
|
+
.refine--condition-pill-end {
|
1347
|
+
padding: 0 10px 0 0;
|
1348
|
+
&:after {
|
1349
|
+
content: "";
|
1350
|
+
position: absolute;
|
1351
|
+
right: -10px;
|
1352
|
+
top: -6px;
|
1353
|
+
bottom: -6px;
|
1354
|
+
border: 2px solid #eee;
|
1355
|
+
width: 3px;
|
1356
|
+
}
|
1357
|
+
&:hover {
|
1358
|
+
&:after {
|
1359
|
+
border-color: #aaa;
|
1360
|
+
}
|
1361
|
+
}
|
1362
|
+
&:after {
|
1363
|
+
border-radius: 0 6px 6px 0;
|
1364
|
+
border-left: none;
|
1365
|
+
}
|
1366
|
+
}
|
1367
|
+
|
1314
1368
|
.refine--condition-pill {
|
1315
1369
|
background-color: #fff;
|
1316
1370
|
border: 1px solid #bbb;
|
@@ -1634,10 +1688,6 @@ input.refine--text-condition-input:focus {
|
|
1634
1688
|
text-decoration: none;
|
1635
1689
|
}
|
1636
1690
|
|
1637
|
-
.refine--save-filter-link-label {
|
1638
|
-
border-bottom: 1px dotted #111;
|
1639
|
-
}
|
1640
|
-
|
1641
1691
|
/*
|
1642
1692
|
*********************************************
|
1643
1693
|
Inline Final Styles
|
@@ -1670,6 +1720,7 @@ input.refine--text-condition-input:focus {
|
|
1670
1720
|
padding: 5px;
|
1671
1721
|
align-items: center;
|
1672
1722
|
background-color: #fff;
|
1723
|
+
position: relative;
|
1673
1724
|
&:disabled {
|
1674
1725
|
color: #111;
|
1675
1726
|
background-color: #f8f8f8;
|
@@ -1681,6 +1732,10 @@ input.refine--text-condition-input:focus {
|
|
1681
1732
|
}
|
1682
1733
|
}
|
1683
1734
|
|
1735
|
+
.refine--add-group-button {
|
1736
|
+
margin-left: 10px;
|
1737
|
+
}
|
1738
|
+
|
1684
1739
|
.refine--has-many-groups .refine--add-button-label {
|
1685
1740
|
display: none;
|
1686
1741
|
}
|
@@ -1791,16 +1846,20 @@ button.refine--apply-button {
|
|
1791
1846
|
}
|
1792
1847
|
}
|
1793
1848
|
|
1794
|
-
.refine--save-filter-link {
|
1849
|
+
.refine--save-filter-link, .refine--clear-filter-link {
|
1795
1850
|
display: flex;
|
1796
1851
|
align-items: center;
|
1797
1852
|
gap: 5px;
|
1798
1853
|
font-size: 14px;
|
1799
|
-
padding: 3px 0;
|
1854
|
+
padding: 3px 0 3px 10px;
|
1800
1855
|
border: 1px solid transparent;
|
1801
1856
|
border-radius: 6px;
|
1802
1857
|
}
|
1803
1858
|
|
1859
|
+
.refine--save-filter-link-label, .refine--clear-filter-link-label {
|
1860
|
+
border-bottom: 1px dotted #111;
|
1861
|
+
}
|
1862
|
+
|
1804
1863
|
.refine--save-filter-input-wrapper {
|
1805
1864
|
display: flex;
|
1806
1865
|
gap: 5px;
|
@@ -382,20 +382,23 @@
|
|
382
382
|
.refine--filter-wrapper {
|
383
383
|
font-size: 14px;
|
384
384
|
display: flex;
|
385
|
-
flex-direction: column;
|
385
|
+
/* flex-direction: column; */
|
386
386
|
gap: 12px;
|
387
387
|
margin-top: 12px;
|
388
388
|
}
|
389
389
|
|
390
390
|
.refine--filter-row {
|
391
391
|
display: flex;
|
392
|
+
width: 100%;
|
392
393
|
gap: 10px;
|
393
394
|
row-gap: 15px;
|
394
395
|
align-items: center;
|
395
|
-
|
396
|
+
align-items: start;
|
397
|
+
justify-content: space-between;
|
396
398
|
}
|
397
399
|
|
398
400
|
.refine--groups-wrapper {
|
401
|
+
flex-grow: 1;
|
399
402
|
display: flex;
|
400
403
|
gap: 10px;
|
401
404
|
row-gap: 15px;
|
@@ -403,6 +406,11 @@
|
|
403
406
|
flex-wrap: wrap;
|
404
407
|
}
|
405
408
|
|
409
|
+
.refine--filter-control-group {
|
410
|
+
text-wrap: nowrap;
|
411
|
+
display: flex;
|
412
|
+
}
|
413
|
+
|
406
414
|
.refine--group-join, .refine--condition-join {
|
407
415
|
position: relative;
|
408
416
|
padding: 5px 0;
|
@@ -429,6 +437,7 @@
|
|
429
437
|
position: relative;
|
430
438
|
padding: 0 10px;
|
431
439
|
align-items: center;
|
440
|
+
flex-wrap: wrap;
|
432
441
|
|
433
442
|
&:before , &:after {
|
434
443
|
content: "";
|
@@ -484,13 +493,59 @@
|
|
484
493
|
text-decoration: none;
|
485
494
|
}
|
486
495
|
|
487
|
-
.refine--condition-pill-wrapper
|
496
|
+
.refine--condition-pill-wrapper {
|
488
497
|
display: flex;
|
489
498
|
align-items: center;
|
490
499
|
gap: 5px;
|
491
500
|
position: relative;
|
492
501
|
}
|
493
502
|
|
503
|
+
.refine--condition-pill-start {
|
504
|
+
padding: 0 0 0 10px;
|
505
|
+
&:before {
|
506
|
+
content: "";
|
507
|
+
position: absolute;
|
508
|
+
left: -10px;
|
509
|
+
top: -2px;
|
510
|
+
bottom: -2px;
|
511
|
+
border: 2px solid #eee;
|
512
|
+
width: 3px;
|
513
|
+
}
|
514
|
+
&:hover {
|
515
|
+
&:before{
|
516
|
+
border-color: #aaa;
|
517
|
+
}
|
518
|
+
}
|
519
|
+
&:before {
|
520
|
+
border-radius: 6px 0 0 6px;
|
521
|
+
left: 0;
|
522
|
+
border-right: none;
|
523
|
+
}
|
524
|
+
|
525
|
+
}
|
526
|
+
|
527
|
+
.refine--condition-pill-end {
|
528
|
+
padding: 0 10px 0 0;
|
529
|
+
&:after {
|
530
|
+
content: "";
|
531
|
+
position: absolute;
|
532
|
+
right: -10px;
|
533
|
+
top: -6px;
|
534
|
+
bottom: -6px;
|
535
|
+
border: 2px solid #eee;
|
536
|
+
width: 3px;
|
537
|
+
}
|
538
|
+
&:hover {
|
539
|
+
&:after {
|
540
|
+
border-color: #aaa;
|
541
|
+
}
|
542
|
+
}
|
543
|
+
&:after {
|
544
|
+
border-radius: 0 6px 6px 0;
|
545
|
+
border-left: none;
|
546
|
+
}
|
547
|
+
}
|
548
|
+
|
494
549
|
.refine--condition-pill {
|
495
550
|
background-color: #fff;
|
496
551
|
border: 1px solid #bbb;
|
@@ -805,9 +860,6 @@ input.refine--text-condition-input:focus {
|
|
805
860
|
text-decoration: none;
|
806
861
|
}
|
807
862
|
|
808
|
-
.refine--save-filter-link-label {
|
809
|
-
border-bottom: 1px dotted #111;
|
810
|
-
}
|
811
863
|
/*
|
812
864
|
*********************************************
|
813
865
|
Inline Final Styles
|
@@ -821,14 +873,14 @@ input.refine--text-condition-input:focus {
|
|
821
873
|
|
822
874
|
.refine--add-condition-button.refine--add-first-condition-button,
|
823
875
|
.refine--add-condition-group-button.refine--add-first-condition-button {
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
876
|
+
border: 1px dotted #aaa;
|
877
|
+
padding-right: 8px;
|
878
|
+
line-height: 16px;
|
879
|
+
&:hover {
|
880
|
+
background-color: #fff;
|
881
|
+
border-style: solid;
|
882
|
+
color: #111;
|
883
|
+
}
|
832
884
|
}
|
833
885
|
|
834
886
|
.refine--add-condition-button, .refine--add-group-button {
|
@@ -840,6 +892,7 @@ input.refine--text-condition-input:focus {
|
|
840
892
|
padding: 5px;
|
841
893
|
align-items: center;
|
842
894
|
background-color: #fff;
|
895
|
+
position: relative;
|
843
896
|
&:disabled {
|
844
897
|
color: #111;
|
845
898
|
background-color: #f8f8f8;
|
@@ -851,6 +904,10 @@ input.refine--text-condition-input:focus {
|
|
851
904
|
}
|
852
905
|
}
|
853
906
|
|
907
|
+
.refine--add-group-button {
|
908
|
+
margin-left: 10px;
|
909
|
+
}
|
910
|
+
|
854
911
|
.refine--has-many-groups .refine--add-button-label {
|
855
912
|
display: none;
|
856
913
|
}
|
@@ -955,16 +1012,19 @@ button.refine--apply-button {
|
|
955
1012
|
}
|
956
1013
|
}
|
957
1014
|
|
958
|
-
.refine--save-filter-link {
|
1015
|
+
.refine--save-filter-link, .refine--clear-filter-link {
|
959
1016
|
display: flex;
|
960
1017
|
align-items: center;
|
961
1018
|
gap: 5px;
|
962
1019
|
font-size: 14px;
|
963
|
-
padding: 3px 0;
|
1020
|
+
padding: 3px 0 3px 10px;
|
964
1021
|
border: 1px solid transparent;
|
965
1022
|
border-radius: 6px;
|
966
1023
|
}
|
967
1024
|
|
1025
|
+
.refine--save-filter-link-label, .refine--clear-filter-link-label {
|
1026
|
+
border-bottom: 1px dotted #111;
|
1027
|
+
}
|
968
1028
|
.refine--save-filter-input-wrapper {
|
969
1029
|
display: flex;
|
970
1030
|
gap: 5px;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
class Refine::Inline::CriteriaController < ApplicationController
|
2
2
|
layout false
|
3
3
|
before_action :set_refine_filter
|
4
|
-
|
5
4
|
# List available conditions for new criteria
|
6
5
|
# Carries position and index forward
|
7
6
|
def index
|
@@ -88,8 +87,18 @@ class Refine::Inline::CriteriaController < ApplicationController
|
|
88
87
|
handle_filter_update(@refine_filter.to_stable_id)
|
89
88
|
end
|
90
89
|
|
90
|
+
def clear
|
91
|
+
@refine_filter.clear_blueprint!
|
92
|
+
@criterion = Refine::Inline::Criterion.new(criterion_params.merge(refine_filter: @refine_filter))
|
93
|
+
handle_filter_update()
|
94
|
+
end
|
95
|
+
|
91
96
|
private
|
92
97
|
|
98
|
+
def set_blank_filter
|
99
|
+
@refine_filter = Refine::Rails.configuration.stabilizer_classes[:url].new
|
100
|
+
end
|
101
|
+
|
93
102
|
def set_refine_filter
|
94
103
|
@refine_filter ||= Refine::Rails.configuration.stabilizer_classes[:url]
|
95
104
|
.new
|
@@ -131,12 +140,14 @@ class Refine::Inline::CriteriaController < ApplicationController
|
|
131
140
|
end
|
132
141
|
|
133
142
|
# either directly redirect or emit a `filter-submit-success` event
|
134
|
-
def handle_filter_update(stable_id)
|
143
|
+
def handle_filter_update(stable_id=nil)
|
135
144
|
# update_stable_id in url
|
136
145
|
uri = URI(request.referrer)
|
137
146
|
new_query_ar = URI.decode_www_form(String(uri.query))
|
138
147
|
new_query_ar.reject! { |(k, _v)| k == "stable_id" }
|
139
|
-
|
148
|
+
if stable_id
|
149
|
+
new_query_ar << ["stable_id", stable_id]
|
150
|
+
end
|
140
151
|
uri.query = URI.encode_www_form(new_query_ar)
|
141
152
|
|
142
153
|
respond_to do |format|
|
@@ -146,7 +157,9 @@ class Refine::Inline::CriteriaController < ApplicationController
|
|
146
157
|
@refine_client_id = @criterion.client_id
|
147
158
|
render :create
|
148
159
|
end
|
149
|
-
format.html
|
160
|
+
format.html do
|
161
|
+
redirect_to uri.to_s
|
162
|
+
end
|
150
163
|
end
|
151
164
|
end
|
152
165
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Refine::Conditions::HasIcon
|
2
|
+
def icon_class
|
3
|
+
@icon_class ||= nil
|
4
|
+
end
|
5
|
+
|
6
|
+
def icon_template
|
7
|
+
@icon_template ||= {}
|
8
|
+
end
|
9
|
+
|
10
|
+
def with_icon_class(icon_class)
|
11
|
+
@icon_class = icon_class
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def with_icon_template(template_path:, locals: {})
|
16
|
+
@icon_template = { template_path: template_path, locals: locals }
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def has_icon?
|
21
|
+
icon_class.present? || !icon_template.empty?
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/app/models/refine/filter.rb
CHANGED
@@ -65,7 +65,9 @@
|
|
65
65
|
value="<%= condition_option[:id] %>"
|
66
66
|
<% if selected_condition_id == condition_option[:id] %>selected<% end %>
|
67
67
|
title="<%= condition_option[:display] %>"
|
68
|
-
|
68
|
+
>
|
69
|
+
<%= condition_option[:display] %>
|
70
|
+
</option>
|
69
71
|
<% end %>
|
70
72
|
</optgroup>
|
71
73
|
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%
|
2
|
+
category ||= nil
|
3
|
+
|
4
|
+
data = {
|
5
|
+
controller: "refine--turbo-stream-link",
|
6
|
+
action: "refine--turbo-stream-link#visit",
|
7
|
+
refine__typeahead_list_target: "listItem",
|
8
|
+
list_item_value: condition.display,
|
9
|
+
}
|
10
|
+
if category && category.present?
|
11
|
+
data[:category] = category
|
12
|
+
end
|
13
|
+
%>
|
14
|
+
<%= link_to(
|
15
|
+
new_refine_inline_criterion_url(@criterion.to_params.deep_merge(refine_inline_criterion: {condition_id: condition.id})),
|
16
|
+
{
|
17
|
+
class: "refine--condition-list-item",
|
18
|
+
}.merge(data: data)) do %>
|
19
|
+
<% if condition.has_icon? %>
|
20
|
+
<% if condition.icon_class.present? %>
|
21
|
+
<i class="<%= condition.icon_class %>"></i>
|
22
|
+
<% else %>
|
23
|
+
<%= render partial: condition.icon_template[:template_path], locals: condition.icon_template[:locals] %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<%= condition.display %>
|
27
|
+
<% end %>
|
@@ -43,49 +43,21 @@
|
|
43
43
|
<div class="refine--condition-list">
|
44
44
|
<% if uncategorized_conditions&.any? %>
|
45
45
|
<% uncategorized_conditions.each do |condition| %>
|
46
|
-
<%=
|
47
|
-
|
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 %>
|
46
|
+
<%= render partial: "condition_list_item", locals: {condition: condition } %>
|
47
|
+
<% end %>
|
57
48
|
<% end %>
|
58
49
|
|
59
50
|
<% if recommended_conditions.any? %>
|
60
51
|
<b data-refine--typeahead-list-target="recommended"><%= t('.recommended') %></b>
|
61
52
|
<% recommended_conditions.each do |condition| %>
|
62
|
-
<%=
|
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
|
-
list_item_value: condition.display
|
70
|
-
}
|
71
|
-
%>
|
53
|
+
<%= render partial: "condition_list_item", locals: {condition: condition } %>
|
72
54
|
<% end %>
|
73
55
|
<% end %>
|
74
56
|
|
75
57
|
<% categorized_conditions.each do |(category, conditions)| %>
|
76
58
|
<b data-refine--typeahead-list-target="category"><%= category %></b>
|
77
59
|
<% conditions.each do |condition| %>
|
78
|
-
<%=
|
79
|
-
new_refine_inline_criterion_url(@criterion.to_params.deep_merge(refine_inline_criterion: {condition_id: condition.id})),
|
80
|
-
class: "refine--condition-list-item",
|
81
|
-
data: {
|
82
|
-
controller: "refine--turbo-stream-link",
|
83
|
-
action: "refine--turbo-stream-link#visit",
|
84
|
-
refine__typeahead_list_target: "listItem",
|
85
|
-
list_item_value: condition.display,
|
86
|
-
category: category
|
87
|
-
}
|
88
|
-
%>
|
60
|
+
<%= render partial: "condition_list_item", locals: {condition: condition, category: category } %>
|
89
61
|
<% end %>
|
90
62
|
<% end %>
|
91
63
|
</div>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
%>
|
10
10
|
|
11
11
|
<% if @refine_filter.criteria_limit_reached? %>
|
12
|
-
<button disabled class="refine--add-condition-button" type="button" title="<%= t(".criteria_limit", criteria_limit: @refine_filter.criteria_limit) %>">
|
12
|
+
<button disabled class="refine--add-condition-button refine--group-last-item refine--condition-pill-end" type="button" title="<%= t(".criteria_limit", criteria_limit: @refine_filter.criteria_limit) %>">
|
13
13
|
<span class="icon material-icons-outlined refine--icon-sm">add</span>
|
14
14
|
<span class="refine--add-button-label"><%= t("refine.inline.filters.and_button.condition") %></span>
|
15
15
|
</button>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
frame_id: dom_id(criterion),
|
19
19
|
src: refine_inline_criteria_path(criterion.to_params) do
|
20
20
|
%>
|
21
|
-
<button class="refine--add-condition-button" type="button" data-action="click->refine--popup#show">
|
21
|
+
<button class="refine--add-condition-button refine--group-last-item refine--condition-pill-end" type="button" data-action="click->refine--popup#show">
|
22
22
|
<span class="icon material-icons-outlined refine--icon-sm">add</span>
|
23
23
|
<span class="refine--add-button-label"><%= t("refine.inline.filters.and_button.condition") %></span>
|
24
24
|
</button>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%
|
2
|
+
criterion = Refine::Inline::Criterion.new(
|
3
|
+
stable_id: @refine_filter.to_stable_id,
|
4
|
+
client_id: @refine_client_id,
|
5
|
+
)
|
6
|
+
%>
|
7
|
+
|
8
|
+
<%= link_to clear_refine_inline_criteria_path(criterion.to_params), method: :post,
|
9
|
+
class: "refine--clear-filter-link", data: {turbo_stream: true, turbo_method: :post} do %>
|
10
|
+
<span class="material-icons-outlined refine--icon-sm">clear</span>
|
11
|
+
<span class="refine--clear-filter-link-label"><%= t('refine.inline.filters.clear_filter') %></span>
|
12
|
+
<% end %>
|
13
|
+
|
@@ -1,10 +1,15 @@
|
|
1
1
|
<%# Filter Pill partial %>
|
2
|
+
<%
|
3
|
+
pill_class = if placement == 0
|
4
|
+
"refine--condition-pill-start"
|
5
|
+
end
|
6
|
+
%>
|
2
7
|
|
3
8
|
<%= render "refine/inline/filters/popup",
|
4
9
|
frame_id: dom_id(criterion) do
|
5
10
|
%>
|
6
11
|
|
7
|
-
<div class="refine--condition-pill-wrapper">
|
12
|
+
<div class="refine--condition-pill-wrapper <%= pill_class %>">
|
8
13
|
<div class="refine--condition-pill">
|
9
14
|
<%= link_to criterion.condition_display, edit_refine_inline_criterion_path(criterion.position, criterion.to_params), class: "refine--condition-pill-name", data: {controller: "refine--turbo-stream-link", action: "refine--turbo-stream-link#visit"} %>
|
10
15
|
<div class="refine--remove-condition"></div>
|
@@ -1,13 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<div class="refine--
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<%= render "refine/inline/filters/criterion", criterion: criterion %>
|
9
|
-
<% end %>
|
10
|
-
</div>
|
11
|
-
<%= render "refine/inline/filters/and_button", position: group.last.position + 1 %>
|
12
|
-
</div>
|
13
|
-
</div>
|
1
|
+
<% group.each.with_index do |criterion, i| %>
|
2
|
+
<% unless i == 0 %>
|
3
|
+
<div class="refine--condition-join"><%= t(".and") %></div>
|
4
|
+
<% end %>
|
5
|
+
<%= render "refine/inline/filters/criterion", criterion: criterion, placement: i, size: group.length %>
|
6
|
+
<% end %>
|
7
|
+
<%= render "refine/inline/filters/and_button", position: group.last.position + 1 %>
|
@@ -1,38 +1,38 @@
|
|
1
1
|
<%
|
2
2
|
groups = Refine::Inline::Criterion.groups_from_filter(@refine_filter, client_id: @refine_client_id, stable_id: @refine_stable_id)
|
3
3
|
|
4
|
+
root_data = (defined?(data) && data) || {}
|
5
|
+
|
4
6
|
main_row_class = class_names "refine--filter-row" => true,
|
5
7
|
"refine--has-many-groups" => groups.many?
|
6
8
|
%>
|
7
9
|
|
8
|
-
<%= tag.div class: "refine--filter-wrapper", id: "refine-inline-filter-#{@refine_client_id}" do %>
|
10
|
+
<%= tag.div class: "refine--filter-wrapper", id: "refine-inline-filter-#{@refine_client_id}", data: root_data do %>
|
9
11
|
<%= tag.div class: main_row_class do %>
|
10
12
|
<% if @refine_filter.blueprint.empty? %>
|
11
|
-
<%= render "refine/inline/filters/add_first_condition_button", position: 0, btn_class: "
|
12
|
-
refine--add-first-condition-btn" %>
|
13
|
+
<%= render "refine/inline/filters/add_first_condition_button", position: 0, btn_class: "refine--add-first-condition-btn" %>
|
13
14
|
<% else %>
|
14
|
-
<div class="refine--filter-label">
|
15
|
-
<%= t('refine.inline.filters.filter') %>:
|
16
|
-
</div>
|
17
15
|
<div class="refine--groups-wrapper">
|
18
16
|
<% groups.each.with_index do |group, i| %>
|
19
17
|
<% unless i == 0 %>
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
<div class="refine--group-join"><%= t("refine.inline.filters.or") %></div>
|
19
|
+
<% end %>
|
20
|
+
<%= render "refine/inline/filters/group", group: group %>
|
21
|
+
<% if i == groups.length - 1 %>
|
22
|
+
<%= render "refine/inline/filters/or_button", position: @refine_filter.blueprint.length %>
|
23
|
+
<% end %>
|
24
24
|
<% end %>
|
25
25
|
|
26
|
-
<div class="refine--group">
|
27
|
-
<div class="refine--group-conditions-wrapper">
|
28
|
-
<%= render "refine/inline/filters/or_button", position: @refine_filter.blueprint.length %>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
<%= render "refine/inline/filters/save_button" %>
|
32
|
-
|
33
26
|
</div>
|
34
27
|
<% end %>
|
28
|
+
<% if @refine_filter.blueprint&.any? %>
|
29
|
+
<div class="refine--filter-control-group">
|
30
|
+
<%= render "refine/inline/filters/clear_button" %>
|
31
|
+
<%= render "refine/inline/filters/save_button" %>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
35
34
|
<% end %>
|
35
|
+
|
36
36
|
<% end %>
|
37
37
|
|
38
38
|
|
data/config/routes.rb
CHANGED
@@ -8,7 +8,9 @@ Rails.application.routes.draw do
|
|
8
8
|
post "find", on: :collection
|
9
9
|
end
|
10
10
|
namespace :inline do
|
11
|
-
resources :criteria, except: [:show]
|
11
|
+
resources :criteria, except: [:show] do
|
12
|
+
post "clear", on: :collection
|
13
|
+
end
|
12
14
|
resources :stored_filters, only: [:index, :new, :create] do
|
13
15
|
post "find", on: :collection
|
14
16
|
end
|