forest_admin_datasource_customizer 1.38.3 → 1.39.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: e4116495da7a89fa75ec8aab443b61a4dd51655bbf3ed629bf70f3e12c71503c
4
- data.tar.gz: c1e064990bb7d2055415534405d6fe11068af4610a0c5880b2f511179aff1c2c
3
+ metadata.gz: c5f2259e1f95031dd3c51234bee68d9f06f0062bbc695f774af69fbda8e6300a
4
+ data.tar.gz: 50d3a4a7acda8cad6ce1aedb315b4dcc48c4a6643ff4d02aa6b9e6969ab75933
5
5
  SHA512:
6
- metadata.gz: 2244d348bd305bbffc423a6aaeab940c81837a0b78fec90db0293893992b73db8c52c513d154ef4bb0e93a2310e0c22662b66499665562f00c7e14c3dea5ca77
7
- data.tar.gz: c3ac43c15c497348158460f389b07008c1b651584781d4f04e063d29fc347f2852ddb0f1d725061439e8dc4bc58192acfa9be308413f7084f2f3b8d17893c32c
6
+ metadata.gz: 8f3b8168feb067ecf658411090300b71e5f08dd75b6599a9b4ce8d8abb230d6e297c7f0c01ad858ffea7a83778006456ee1cf7fded95d217375ff630351a3994
7
+ data.tar.gz: 6e7db791839ed390bf985b21166cc18b980947f7932e6f4d8875a9b52e343f010b9787c503df171e6c4505b5c590594d20e1966e837bdd5e80c4850a66d1632e
@@ -263,8 +263,10 @@ module ForestAdminDatasourceCustomizer
263
263
  # .add_hook('before', 'list') do |context|
264
264
  # # Do something before the list action
265
265
  # end
266
- def add_hook(position, type, &handler)
267
- push_customization { @stack.hook.get_collection(@name).add_hook(position, type, handler) }
266
+ def add_hook(position, type, prepend: false, &handler)
267
+ push_customization do
268
+ @stack.hook.get_collection(@name).add_hook(position, type, handler, prepend: prepend)
269
+ end
268
270
  end
269
271
 
270
272
  # Add a new segment on the collection.
@@ -18,8 +18,8 @@ module ForestAdminDatasourceCustomizer
18
18
  }
19
19
  end
20
20
 
21
- def add_hook(position, type, hook)
22
- @hooks[type].add_handler(position, hook)
21
+ def add_hook(position, type, hook, prepend: false)
22
+ @hooks[type].add_handler(position, hook, prepend: prepend)
23
23
  end
24
24
 
25
25
  def create(caller, data)
@@ -17,8 +17,13 @@ module ForestAdminDatasourceCustomizer
17
17
  @after.each { |hook| hook.call(context) }
18
18
  end
19
19
 
20
- def add_handler(position, hook)
21
- position == 'After' ? @after << hook : @before << hook
20
+ # `prepend` puts the handler ahead of the ones already registered. `execute_after` stops at the
21
+ # first exception, so a handler that must run whatever a sibling does (the audit trail recording a
22
+ # write that already happened) cannot afford to be last.
23
+ def add_handler(position, hook, prepend: false)
24
+ handlers = position == 'After' ? @after : @before
25
+
26
+ prepend ? handlers.unshift(hook) : handlers.push(hook)
22
27
  end
23
28
  end
24
29
  end
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceCustomizer
2
- VERSION = "1.38.3"
2
+ VERSION = "1.39.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_customizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.38.3
4
+ version: 1.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2026-08-14 00:00:00.000000000 Z
12
+ date: 2026-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport