effective_resources 2.27.13 → 2.28.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: db7931f75996f9af33249386222e89073d1ce23ba56730386da85e53b54aad28
4
- data.tar.gz: 2172b9d9d4665e14e0e045251515efdb9a6377aa377b0ac2bb241c6b5a608a22
3
+ metadata.gz: 4229845a5685455eaf623f5d8f6516735d3d414c76be408db9e86df50dc1c477
4
+ data.tar.gz: 5f0171e49a79cd0cdc7b1438f2c91ab6f52d99efa29a818636bf6593610832ed
5
5
  SHA512:
6
- metadata.gz: fcf8db9aa7051cb0ed428d19365a9d2c523f705f0e754a7708061df841cb8a4285aded7a90b116367d8f6a83d223425785fe924f2bef1acd71450edb1acadb37
7
- data.tar.gz: 8ea3b73ba641c57fb8d091965fa11d1c5b9aacc1ceecfe0c1f4329bd9bddeb98162bf37c73bb6354130223e3b0198378ac2f73e57a21045c6be8fbf6995f5eb0
6
+ metadata.gz: ee066f39b9632ebb46cf77d47f96334c433360dadd9a60e41faffa30e1cc4dad249e5903faa67c7196cc0c8a8762b54cda94c02e218bda9cad36556015e0cb9e
7
+ data.tar.gz: 13cf2ff5ccb197c951ffedd77ed1cc3d96872a81327903072fd6a4ef852fed53f51587704d7928350ea8f6d7450301660ce51876172897843ad2d0012808ac56
@@ -255,5 +255,30 @@ module Effective
255
255
  end
256
256
  end
257
257
 
258
+ def nested_datatable_action(action = nil)
259
+ Rails.logger.info "Processed by Effective::CrudController#nested_datatable_action"
260
+
261
+ raise('expected a GET request') unless request.get?
262
+ raise('expected @datatable to be present') if @datatable.nil?
263
+
264
+ action ||= action_name
265
+
266
+ EffectiveResources.authorize!(self, :index, @datatable)
267
+ @page_title ||= @datatable.datatable_name
268
+
269
+ respond_to do |format|
270
+ format.html do
271
+ html_template = action if template_present?(action, format: :html)
272
+ render(html_template || 'index')
273
+ end
274
+
275
+ format.js do
276
+ html_template = [controller_path, action].join('/') if template_present?(action, format: :html)
277
+ template = template_present?(action) ? action : 'nested_datatable_action'
278
+
279
+ render(template, formats: :js, locals: { action: action, html_template: html_template })
280
+ end
281
+ end
282
+ end
258
283
  end
259
284
  end
@@ -0,0 +1,5 @@
1
+ <% if local_assigns[:html_template].present? %>
2
+ EffectiveForm.remote_form_payload = "<%= j(render(template: local_assigns[:html_template], formats: :html)) %>";
3
+ <% else %>
4
+ EffectiveForm.remote_form_payload = "<%= j(render_datatable(@datatable, nested: true)) %>";
5
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.27.13'.freeze
2
+ VERSION = '2.28.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.27.13
4
+ version: 2.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-24 00:00:00.000000000 Z
11
+ date: 2025-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -267,6 +267,7 @@ files:
267
267
  - app/views/application/edit.js.erb
268
268
  - app/views/application/index.html.haml
269
269
  - app/views/application/member_action.js.erb
270
+ - app/views/application/nested_datatable_action.js.erb
270
271
  - app/views/application/new.html.haml
271
272
  - app/views/application/new.js.erb
272
273
  - app/views/application/show.html.haml