refine-rails 2.11.0 → 2.11.2

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.
@@ -9,18 +9,20 @@
9
9
  %>
10
10
 
11
11
  <% if @refine_filter.criteria_limit_reached? %>
12
- <button disabled class="refine--add-group-button" type="button" title="<%= t(".criteria_limit", criteria_limit: @refine_filter.criteria_limit) %>">
13
- <span class="icon material-icons-outlined refine--icon-sm">add</span>
14
- <span class="refine--add-group-button-label"><%= t(".group") %></span>
15
- </button>
12
+ <div class="refine--add-group-wrapper">
13
+ <button disabled class="refine--add-group-button" type="button" title="<%= t(".criteria_limit", criteria_limit: @refine_filter.criteria_limit) %>">
14
+ <span class="refine--add-group-button-label"><%= t(".group") %></span>
15
+ </button>
16
+ </div>
16
17
  <% else %>
17
18
  <%= render "refine/inline/filters/popup",
18
19
  frame_id: dom_id(criterion),
19
20
  src: refine_inline_criteria_path(criterion.to_params) do
20
21
  %>
21
- <button class="refine--add-group-button" type="button" data-action="click->refine--popup#show">
22
- <span class="icon material-icons-outlined refine--icon-sm">add</span>
23
- <span class="refine--add-group-button-label"><%= t(".group") %></span>
24
- </button>
22
+ <div class="refine--add-group-wrapper">
23
+ <button class="refine--add-group-button" type="button" data-action="click->refine--popup#show">
24
+ <span class="refine--add-group-button-label"><%= t(".group") %></span>
25
+ </button>
26
+ </div>
25
27
  <% end %>
26
28
  <% end %>
@@ -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
- <div class="refine--group-join"><%= t("refine.inline.filters.or") %></div>
21
- <% end %>
22
-
23
- <%= render "refine/inline/filters/group", group: group %>
18
+ <div class="refine--group-join"><%= t("refine.inline.filters.or") %></div>
19
+ <% end %>
20
+ <%= render "refine/inline/filters/group", group: group, group_count: groups.count, condition_count: group.count %>
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
 
@@ -58,7 +58,8 @@ en:
58
58
  or_button: "+ Add OR Group"
59
59
  filter: "Filter"
60
60
  criteria_limit: "You can only create up to %{criteria_limit} filter conditions"
61
- save_filter: "Save Filter"
61
+ save_filter: "Save"
62
+ clear_filter: "Clear"
62
63
  or: "or"
63
64
  clear: "clear"
64
65
  inputs:
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
@@ -1,5 +1,5 @@
1
1
  module Refine
2
2
  module Rails
3
- VERSION = "2.11.0"
3
+ VERSION = "2.11.2"
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.0
4
+ version: 2.11.2
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-08-21 00:00:00.000000000 Z
12
+ date: 2024-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -145,6 +145,7 @@ files:
145
145
  - app/views/refine/inline/criteria/new.turbo_stream.erb
146
146
  - app/views/refine/inline/filters/_add_first_condition_button.html.erb
147
147
  - app/views/refine/inline/filters/_and_button.html.erb
148
+ - app/views/refine/inline/filters/_clear_button.html.erb
148
149
  - app/views/refine/inline/filters/_criterion.html.erb
149
150
  - app/views/refine/inline/filters/_group.html.erb
150
151
  - app/views/refine/inline/filters/_or_button.html.erb