effective_datatables 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46c6bd508e444a1f4d8bf7c6076bcc3885e5bf99
4
- data.tar.gz: 3188dca9b7172fe41c80d514a49975ee6d7eee44
3
+ metadata.gz: 008015d3e0eee31f97cee6a004c806fb52fbb2d5
4
+ data.tar.gz: 3cd65ca8bd24f4dff5fcda583fddce94a3e64544
5
5
  SHA512:
6
- metadata.gz: 6619d02959a4c5f48300477daec85d2a39ab0e01240281e52cc26f7d58f451e7a305846d085b82eb6c7722ada044ebd0babbbe77cee5c3330812ec075b52bc14
7
- data.tar.gz: 3d93e98a7919a064d2556c6f2479a46a5f5c21bd6e8b00ea7a833874f5048d9b8d0248d980f05e81d8425e0632fcbaff3c9e9624bb6e1f40bcc6f24e1de3569d
6
+ metadata.gz: 424ebcf833f830200a85057ca79e83b1ee6f43892cb91a1fcc688e9877ea01b231499097a05083183ee9677adf18697da0ac3e851982999c2e6166396de21471
7
+ data.tar.gz: 6a1c85b2c91d434a5ec3fb83b3c9f39ca976d5684612b01be1981c58919ae03aed7acd7fbee05b312095d6724a70efa505901aff25e2bb95549c5615afea2888
@@ -4,7 +4,9 @@ module Effective
4
4
 
5
5
  # This will respond to both a GET and a POST
6
6
  def show
7
- @datatable = find_datatable(params[:id]).try(:new, params[:attributes])
7
+ attributes = (params[:attributes].presence || {}).merge(referer: request.referer)
8
+
9
+ @datatable = find_datatable(params[:id]).try(:new, attributes)
8
10
  @datatable.view = view_context if !@datatable.nil?
9
11
 
10
12
  EffectiveDatatables.authorized?(self, :index, @datatable.try(:collection_class) || @datatable.try(:class))
@@ -66,7 +66,7 @@ module Effective
66
66
  locals = HashWithIndifferentAccess.new(
67
67
  datatable: self,
68
68
  table_column: table_columns[name],
69
- controller_namespace: view.controller_path.split('/')[0...-1].map { |path| path.downcase.to_sym if path.present? }.compact,
69
+ controller_namespace: controller_namespace,
70
70
  show_action: (opts[:partial_locals] || {})[:show_action],
71
71
  edit_action: (opts[:partial_locals] || {})[:edit_action],
72
72
  destroy_action: (opts[:partial_locals] || {})[:destroy_action],
@@ -200,6 +200,20 @@ module Effective
200
200
  collection
201
201
  end
202
202
 
203
+ private
204
+
205
+ def controller_namespace
206
+ @controller_namespace ||= (
207
+ path = if attributes[:referer].present?
208
+ URI(attributes[:referer]).path
209
+ else
210
+ view.controller_path
211
+ end
212
+
213
+ path.split('/')[0...-1].map { |path| path.downcase.to_sym if path.present? }.compact
214
+ )
215
+ end
216
+
203
217
  end # / Rendering
204
218
  end
205
219
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '2.3.0'.freeze
2
+ VERSION = '2.3.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
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: 2016-02-05 00:00:00.000000000 Z
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails