refine-rails 2.11.3 → 2.11.5

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: da49445eb684d8187ebe0ba05aa919d6293ec55e63e7df2dad3e58051712e901
4
- data.tar.gz: d732551892233793e9cf3fbba13143b59698fb27a4029c8635a9202e2ca9b5b2
3
+ metadata.gz: e921dba424ec4dd695b208763935dbd6f9b5b0425995aa3276c5b08cac46b155
4
+ data.tar.gz: 10b4c51b19762c45072ee21408241557e870eb09b5f5028f7cc5bf11c9a99745
5
5
  SHA512:
6
- metadata.gz: b46d8c7809b3c0fa10a1122b2ff16b81e4fdbf36100a426a822c928eccb3d30d6c75b7a073abee80c46a9345b960cf04936cb59d0e77e4373df4484371a17fd4
7
- data.tar.gz: cb90e961a890efaa351999f60279380ebc51f7bd7e28bd9856f19856b074c0c8b7a39a06e405f70be95525426af76adb6f0f98d57332b5c72469b65160e9e8b9
6
+ metadata.gz: 32d2d1e47bd7572142ccd90f6ab23c721bdf0b240646f4b5b1d7140077ed4edac83f2729e33f29fd3c14e91215feea31c4d6006b65edf4828c10862a8cfbc4c3
7
+ data.tar.gz: 812d9a29cc85ed48f8932f7aab31aee12dd5a793499c5f496b30582f1b95c7a4748f9362c891b8914cd043491b364a0de4d1c039df68d385b11d9a09b4976a3d
@@ -1239,12 +1239,24 @@
1239
1239
  flex-wrap: wrap;
1240
1240
  display: flex;
1241
1241
  align-items: center;
1242
+ justify-content: end;
1242
1243
  }
1243
1244
 
1244
- @media (max-width: 960px) {
1245
+ @media (max-width: 1525px) {
1245
1246
  .refine--filter-control-group {
1246
- justify-content: end;
1247
- width: 25%;
1247
+ width: 24%;
1248
+ }
1249
+ }
1250
+
1251
+ @media (max-width: 1200px) {
1252
+ .refine--filter-control-group {
1253
+ width: 30%;
1254
+ }
1255
+ }
1256
+
1257
+ @media (max-width: 1100px) {
1258
+ .refine--filter-control-group {
1259
+ width: 40%;
1248
1260
  }
1249
1261
  }
1250
1262
 
@@ -1265,6 +1277,14 @@
1265
1277
  text-align: left;
1266
1278
  }
1267
1279
 
1280
+ .refine--group-join {
1281
+ &:hover {
1282
+ .refine--remove-group {
1283
+ display: block;
1284
+ }
1285
+ }
1286
+ }
1287
+
1268
1288
  .refine--group {
1269
1289
  display: flex;
1270
1290
  gap: 10px;
@@ -1383,7 +1403,7 @@
1383
1403
  padding: 4px;
1384
1404
  }
1385
1405
 
1386
- .refine--remove-condition {
1406
+ .refine--remove-condition, .refine--remove-group {
1387
1407
  display: none;
1388
1408
  color: #fff;
1389
1409
  padding: 0px 2px 0px 2px;
@@ -1400,12 +1420,11 @@
1400
1420
  .icon.refine--icon-sm {
1401
1421
  padding: 2px 0 ;
1402
1422
  }
1403
- }
1404
-
1405
- &:hover {
1406
- border-color: #999;
1407
- .remove-applied-condition {
1408
- display: block;
1423
+ &:hover {
1424
+ border-color: #999;
1425
+ .remove-applied-condition {
1426
+ display: block;
1427
+ }
1409
1428
  }
1410
1429
  }
1411
1430
 
@@ -418,12 +418,23 @@
418
418
  flex-wrap: wrap;
419
419
  display: flex;
420
420
  align-items: center;
421
+ justify-content: end;
421
422
  }
422
423
 
423
- @media (max-width: 960px) {
424
+
425
+ @media (max-width: 1525px) {
426
+ .refine--filter-control-group {
427
+ width: 24%;
428
+ }
429
+ }
430
+ @media (max-width: 1200px) {
431
+ .refine--filter-control-group {
432
+ width: 30%;
433
+ }
434
+ }
435
+ @media (max-width: 1100px) {
424
436
  .refine--filter-control-group {
425
- justify-content: end;
426
- width: 25%;
437
+ width: 40%;
427
438
  }
428
439
  }
429
440
 
@@ -444,6 +455,14 @@
444
455
  text-align: left;
445
456
  }
446
457
 
458
+ .refine--group-join {
459
+ &:hover {
460
+ .refine--remove-group {
461
+ display: block;
462
+ }
463
+ }
464
+ }
465
+
447
466
  .refine--group {
448
467
  display: flex;
449
468
  gap: 10px;
@@ -563,7 +582,7 @@
563
582
  padding: 4px;
564
583
  }
565
584
 
566
- .refine--remove-condition {
585
+ .refine--remove-condition, .refine--remove-group {
567
586
  display: none;
568
587
  color: #fff;
569
588
  padding: 0px 2px 0px 2px;
@@ -580,15 +599,15 @@
580
599
  .icon.refine--icon-sm {
581
600
  padding: 2px 0 ;
582
601
  }
583
-
584
- }
585
- &:hover {
586
- border-color: #999;
587
- .remove-applied-condition {
588
- display: block;
602
+ &:hover {
603
+ border-color: #999;
604
+ .remove-applied-condition {
605
+ display: block;
606
+ }
589
607
  }
590
608
  }
591
609
 
610
+
592
611
  .refine--condition-value-wrapper {
593
612
  position: absolute;
594
613
  top: 100%;
@@ -93,12 +93,17 @@ class Refine::Inline::CriteriaController < ApplicationController
93
93
  handle_filter_update()
94
94
  end
95
95
 
96
- private
96
+ def merge_groups
97
+ @criterion = Refine::Inline::Criterion.new(criterion_params.merge(refine_filter: @refine_filter))
98
+ Refine::Filters::BlueprintEditor
99
+ .new(@refine_filter.blueprint)
100
+ .change_conjunction(criterion_params[:position].to_i - 1, "and")
97
101
 
98
- def set_blank_filter
99
- @refine_filter = Refine::Rails.configuration.stabilizer_classes[:url].new
102
+ handle_filter_update(@refine_filter.to_stable_id)
100
103
  end
101
104
 
105
+ private
106
+
102
107
  def set_refine_filter
103
108
  @refine_filter ||= Refine::Rails.configuration.stabilizer_classes[:url]
104
109
  .new
@@ -59,6 +59,14 @@ class Refine::Filters::BlueprintEditor
59
59
  blueprint[index][:input] = input
60
60
  end
61
61
 
62
+ def change_conjunction(index, conjunction_word)
63
+ if conjunction_word == "and"
64
+ blueprint[index][:word] = "and"
65
+ elsif conjunction_word == "or"
66
+ blueprint[index][:word] = "or"
67
+ end
68
+ end
69
+
62
70
  def delete(index)
63
71
  # To support 'groups' there is some complicated logic for deleting criterion.
64
72
  #
@@ -9,10 +9,10 @@
9
9
  <%= link_to refine_inline_criterion_path(criterion.position, criterion.to_params), class: "refine--remove-condition", data: {turbo_method: :delete, controller: "refine--turbo-stream-link", action: "refine--turbo-stream-link#visit"} do %>
10
10
  <span class="material-icons-outlined refine--icon-sm">clear</span>
11
11
  <% end %>
12
- <%= link_to edit_refine_inline_criterion_path(criterion.position, criterion.to_params), class:"refine--condition-pill-button", data: {controller: "refine--turbo-stream-link", action: "refine--turbo-stream-link#visit"} do %>
12
+ <%= link_to edit_refine_inline_criterion_path(criterion.position, criterion.to_params), class:"refine--condition-pill-button", data: {controller: "refine--turbo-stream-link", action: "refine--turbo-stream-link#visit refine--popup#show"} do %>
13
13
  <div class="refine--condition-pill-name"><%= criterion.condition_display %></div>
14
14
  <div class="refine--condition-value-clause"><%= criterion.clause_display %></div>
15
- <div class="refine--condition-value-self" title="<%= criterion.human_readable_value %>">
15
+ <div class="refine--condition-value-self" title="<%= criterion.human_readable_value %>" data-controller="tooltip" data-tooltip-content-value="<%= criterion.human_readable_value %>">
16
16
  <%= criterion.human_readable_value %>
17
17
  </div>
18
18
  <% end %>
@@ -0,0 +1,16 @@
1
+ <% group_position ||= 0 %>
2
+
3
+ <% unless group_position == 0 %>
4
+ <% if render_stack %>
5
+ <div class="refine--group-join-stack">
6
+ <% end %>
7
+ <div class="refine--group-join">
8
+ <%= t("refine.inline.filters.or") %>
9
+ <%= link_to merge_groups_refine_inline_criteria_path(group.first.to_params), class: "refine--remove-group", data: {turbo_method: :post, controller: "refine--turbo-stream-link", action: "refine--turbo-stream-link#visit"} do %>
10
+ <span class="material-icons-outlined refine--icon-sm">clear</span>
11
+ <% end %>
12
+ </div>
13
+ <% if render_stack %>
14
+ </div>
15
+ <% end %>
16
+ <% end %>
@@ -15,15 +15,7 @@
15
15
  <% else %>
16
16
  <div class="refine--groups-wrapper">
17
17
  <% groups.each.with_index do |group, i| %>
18
- <% unless i == 0 %>
19
- <% if render_stack %>
20
- <div class="refine--group-join-stack">
21
- <% end %>
22
- <div class="refine--group-join"><%= t("refine.inline.filters.or") %></div>
23
- <% if render_stack %>
24
- </div>
25
- <% end %>
26
- <% end %>
18
+ <%= render "refine/inline/filters/or_separator", group: group, group_position: i, render_stack: render_stack %>
27
19
  <%= render "refine/inline/filters/group", group: group, group_count: groups.count, condition_count: group.count, render_stack: render_stack %>
28
20
  <% if i == groups.length - 1 %>
29
21
  <%= render "refine/inline/filters/or_button", position: @refine_filter.blueprint.length %>
data/config/routes.rb CHANGED
@@ -9,6 +9,7 @@ Rails.application.routes.draw do
9
9
  end
10
10
  namespace :inline do
11
11
  resources :criteria, except: [:show] do
12
+ post "merge_groups", on: :collection
12
13
  post "clear", on: :collection
13
14
  end
14
15
  resources :stored_filters, only: [:index, :new, :create] do
@@ -1,5 +1,5 @@
1
1
  module Refine
2
2
  module Rails
3
- VERSION = "2.11.3"
3
+ VERSION = "2.11.5"
4
4
  end
5
5
  end
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.11.3
4
+ version: 2.11.5
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-09-11 00:00:00.000000000 Z
12
+ date: 2024-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -149,6 +149,7 @@ files:
149
149
  - app/views/refine/inline/filters/_criterion.html.erb
150
150
  - app/views/refine/inline/filters/_group.html.erb
151
151
  - app/views/refine/inline/filters/_or_button.html.erb
152
+ - app/views/refine/inline/filters/_or_separator.html.erb
152
153
  - app/views/refine/inline/filters/_popup.html.erb
153
154
  - app/views/refine/inline/filters/_save_button.html.erb
154
155
  - app/views/refine/inline/filters/_show.html.erb