effective_datatables 1.5.1 → 1.6.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8857fc86c5d3eef83588add994b4ba7e61edfd7
|
4
|
+
data.tar.gz: ea235e3ec7aa3749bed5abc7d0ef3cf769dcefc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e063515e21a8cb62ac464cd8ee51617c466fd23f84d04cac01aff49691de37406161369a865638c197c13ccd2ad699e955e2905774cd192c45eb8c0cd489c10
|
7
|
+
data.tar.gz: 4b84bfe945e48fbfb7a2ce2531d54c9f125c2c8d62b4d9c835ac98692f67aaa29fb195f459a2b98a2b40eaca293db95d4ed501c09c8ca19cde78d166d497175d
|
@@ -31,7 +31,24 @@ module Effective
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def array_column(name, options = {}, proc = nil, &block)
|
34
|
-
table_column(name, options.merge({:array_column => true}), proc, &block)
|
34
|
+
table_column(name, options.merge!({:array_column => true}), proc, &block)
|
35
|
+
end
|
36
|
+
|
37
|
+
def actions_column(options = {}, proc = nil, &block)
|
38
|
+
show = options.fetch(:show, false)
|
39
|
+
edit = options.fetch(:edit, true)
|
40
|
+
destroy = options.fetch(:destroy, true)
|
41
|
+
name = options.fetch(:name, 'actions')
|
42
|
+
|
43
|
+
opts = {
|
44
|
+
sortable: false,
|
45
|
+
filter: false,
|
46
|
+
partial: '/effective/datatables/actions_column',
|
47
|
+
partial_local: :resource,
|
48
|
+
partial_locals: { show_action: show, edit_action: edit, destroy_action: destroy }
|
49
|
+
}
|
50
|
+
|
51
|
+
table_column(name, opts, proc, &block)
|
35
52
|
end
|
36
53
|
|
37
54
|
def array_columns(*names)
|
@@ -296,12 +313,22 @@ module Effective
|
|
296
313
|
rendered = {}
|
297
314
|
table_columns.each do |name, opts|
|
298
315
|
if opts[:partial]
|
316
|
+
locals = {
|
317
|
+
datatable: self,
|
318
|
+
table_column: table_columns[name],
|
319
|
+
controller_namespace: view.controller_path.split('/')[0...-1].map { |path| path.downcase.to_sym if path.present? }.compact,
|
320
|
+
show_action: (opts[:partial_locals] || {})[:show_action],
|
321
|
+
edit_action: (opts[:partial_locals] || {})[:edit_action],
|
322
|
+
destroy_action: (opts[:partial_locals] || {})[:destroy_action]
|
323
|
+
}
|
324
|
+
locals.merge!(opts[:partial_locals]) if opts[:partial_locals]
|
325
|
+
|
299
326
|
rendered[name] = (render(
|
300
327
|
:partial => opts[:partial],
|
301
328
|
:as => opts[:partial_local],
|
302
329
|
:collection => collection,
|
303
330
|
:formats => :html,
|
304
|
-
:locals =>
|
331
|
+
:locals => locals,
|
305
332
|
:spacer_template => '/effective/datatables/spacer_template',
|
306
333
|
) || '').split('EFFECTIVEDATATABLESSPACER')
|
307
334
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- if show_action
|
2
|
+
- url = (polymorphic_path([*controller_namespace, resource]) rescue nil) || (polymorphic_path(resource) rescue nil)
|
3
|
+
%a{href: (url || '#'), title: 'Show'}
|
4
|
+
%span.glyphicon.glyphicon-eye-open
|
5
|
+
|
6
|
+
- if edit_action
|
7
|
+
- url = (edit_polymorphic_path([*controller_namespace, resource]) rescue nil) || (edit_polymorphic_path(resource) rescue nil)
|
8
|
+
%a{href: (url || '#'), title: 'Edit'}
|
9
|
+
%span.glyphicon.glyphicon-edit
|
10
|
+
|
11
|
+
- if destroy_action
|
12
|
+
- url = (polymorphic_path([*controller_namespace, resource]) rescue nil) || (polymorphic_path(resource) rescue nil)
|
13
|
+
%a{href: (polymorphic_path([*controller_namespace, resource]) rescue '#'), title: 'Delete', data: {method: :delete, confirm: 'Are you sure?'}}
|
14
|
+
%span.glyphicon.glyphicon-trash
|
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: 1.
|
4
|
+
version: 1.6.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: 2015-06-
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- app/models/effective/active_record_datatable_tool.rb
|
124
124
|
- app/models/effective/array_datatable_tool.rb
|
125
125
|
- app/models/effective/datatable.rb
|
126
|
+
- app/views/effective/datatables/_actions_column.html.haml
|
126
127
|
- app/views/effective/datatables/_datatable.html.haml
|
127
128
|
- app/views/effective/datatables/_spacer_template.html
|
128
129
|
- config/routes.rb
|