easy-admin-rails 0.2.8 → 0.2.9

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: fe20f36c494b9af61f9abc239d40af0480e3bad59511365f53330a6ea444d26a
4
- data.tar.gz: b835f30d54168ecbfcec4bde29bce9e05c6b6b0c0ad6aa6eb31f2218cc97b3ad
3
+ metadata.gz: 74e3a17e7d1c33152242a68ca0b0211d72b37d5b206307721e006d09a6c07ef1
4
+ data.tar.gz: b8c3645a8c1d27de9b5c7ee20b718b9a4cc10d16b2d2a87d285d24c7228a9c62
5
5
  SHA512:
6
- metadata.gz: 7d331e82a967e87fb9149d6f6e5d609979706e341a2b6e0d2a36f5840cc5ed7d066da945b8f2a0dfec75ea59a8c2d7d56a3f972bdd28f8a79b5440450ffb15ad
7
- data.tar.gz: a0f133ba1a4ee20a5e0dae77875f215aa91c82c6555a5907591b03f6b34da790bceb4a20b8a0ef7c327ebb7a3e1c3faf691bbb6e3c08c5a32d3862bd9b80208b
6
+ metadata.gz: 19405da82b73193c8009360e481c9bac007623dbd4c36e3bea6c09f0d248547689d8eb74d4e84f2affd7da4c6f83b6ce30c9295814bb2aacb4f6f4659ef01960
7
+ data.tar.gz: fb822864ee9ac13b116385492d8c34617ab12e25660df46ac90fcd3f281768a612c99bd16ec7addf9c53b5556325e4956996681f95ad4a4ee5aacd693bb8bbee
@@ -71,9 +71,9 @@ module EasyAdmin
71
71
  else
72
72
  # For static mode, render all options
73
73
  render_option("", "All")
74
-
75
- if @field[:options]
76
- @field[:options].each do |option_value, option_label|
74
+
75
+ if resolved_options
76
+ resolved_options.each do |option_value, option_label|
77
77
  render_option(option_value, option_label)
78
78
  end
79
79
  end
@@ -108,16 +108,33 @@ module EasyAdmin
108
108
 
109
109
  def current_display_value
110
110
  return "All" if @search_params["#{filter_field_name}_eq"].blank?
111
-
112
- if @field[:options]
113
- @field[:options].each do |option_value, option_label|
111
+
112
+ if resolved_options
113
+ resolved_options.each do |option_value, option_label|
114
114
  return option_label.to_s if option_value.to_s == @search_params["#{filter_field_name}_eq"].to_s
115
115
  end
116
116
  end
117
-
117
+
118
118
  @search_params["#{filter_field_name}_eq"].to_s
119
119
  end
120
120
 
121
+ def resolved_options
122
+ return nil unless @field[:options]
123
+
124
+ if @field[:options].is_a?(Proc)
125
+ # For filters, call the Proc without parameters
126
+ # (filters don't have a specific record context like forms do)
127
+ if @field[:options].arity == 0 || @field[:options].arity == -1
128
+ @field[:options].call
129
+ else
130
+ # If Proc expects parameters, call it with nil
131
+ @field[:options].call(nil)
132
+ end
133
+ else
134
+ @field[:options]
135
+ end
136
+ end
137
+
121
138
  def render_no_results_message
122
139
  div(
123
140
  class: "select-no-results px-3 py-2 text-sm text-gray-500 text-center",
@@ -1,3 +1,3 @@
1
1
  module EasyAdmin
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy-admin-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Slaurmagan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-09-24 00:00:00.000000000 Z
11
+ date: 2025-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails