effective_datatables 4.29.0 → 4.30.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -3
- data/app/assets/javascripts/effective_datatables/initialize.js.coffee +1 -1
- data/app/assets/stylesheets/effective_datatables/_overrides.bootstrap4.scss +9 -0
- data/app/helpers/effective_datatables_helper.rb +1 -0
- data/app/helpers/effective_datatables_private_helper.rb +12 -0
- data/app/models/effective/datatable.rb +5 -0
- data/config/effective_datatables.rb +4 -2
- data/lib/effective_datatables/version.rb +1 -1
- data/lib/effective_datatables.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 101202eb8e7251895835506090dbee19f994e4db1bed1ba263f8bed9226c45de
|
4
|
+
data.tar.gz: c10bbed1cddf86a46782924d42eb1a081eb4fef692a9eb1a4ab9e76520522c4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac57919edf6575dc47ed971f8cec6d60afa6783095f2098cafa8d89ba43cad4283c87bafcef402880fdac90a5d91c2b00a887753da11cbbf77b82f8e9325be23
|
7
|
+
data.tar.gz: 505c45e8a0034dda6a99120f65cabf601886627bac22c23148cc4cd7fc217c1c08235ba92d65522064eeaa014c7c18a179ca9d711585093309cbb1897d956bdb
|
data/README.md
CHANGED
@@ -43,6 +43,7 @@ Please check out [Effective Datatables 3.x](https://github.com/code-and-effect/e
|
|
43
43
|
* [bulk_actions_col](#bulk_actions_col)
|
44
44
|
* [actions_col](#actions_col)
|
45
45
|
* [length](#length)
|
46
|
+
* [length_menu](#length_menu)
|
46
47
|
* [order](#order)
|
47
48
|
* [reorder](#reorder)
|
48
49
|
* [aggregate](#aggregate)
|
@@ -228,7 +229,7 @@ class PostsDatatable < Effective::Datatable
|
|
228
229
|
# The user's selected filters, search, sort, length, column visibility and pagination settings are saved between visits
|
229
230
|
# on a per-table basis and can be Reset with a button
|
230
231
|
datatable do
|
231
|
-
length 25 # 5, 10, 25, 50, 100, 500
|
232
|
+
length 25 # 5, 10, 25, 50, 100, 500
|
232
233
|
order :updated_at, :desc
|
233
234
|
|
234
235
|
# Renders a column of checkboxes to select items for any bulk_actions
|
@@ -614,7 +615,7 @@ MyApp::UsersTable.new(namespace: :my_app)
|
|
614
615
|
|
615
616
|
## length
|
616
617
|
|
617
|
-
Sets the default number of rows per page.
|
618
|
+
Sets the default number of rows per page.
|
618
619
|
|
619
620
|
When not specified, effective_datatables uses the default as per the `config/initializers/effective_datatables.rb` or 25.
|
620
621
|
|
@@ -622,6 +623,18 @@ When not specified, effective_datatables uses the default as per the `config/ini
|
|
622
623
|
length 100
|
623
624
|
```
|
624
625
|
|
626
|
+
## length_menu
|
627
|
+
|
628
|
+
You can specify the length menu values in `config/initializers/effective_datatables.rb` or per datatable.
|
629
|
+
|
630
|
+
To override the default, add the method to your datatable
|
631
|
+
|
632
|
+
```
|
633
|
+
def length_menu
|
634
|
+
[5, 10, 25, 50]
|
635
|
+
end
|
636
|
+
```
|
637
|
+
|
625
638
|
## order
|
626
639
|
|
627
640
|
Sets the default order of table rows. The first argument is the column, the second the direction.
|
@@ -1332,7 +1345,7 @@ class TimeEntriesPerClientReport < Effective::Datatable
|
|
1332
1345
|
end
|
1333
1346
|
|
1334
1347
|
datatable do
|
1335
|
-
length
|
1348
|
+
length 50
|
1336
1349
|
|
1337
1350
|
col :client
|
1338
1351
|
|
@@ -53,7 +53,7 @@ initializeDataTables = (target) ->
|
|
53
53
|
displayStart: datatable.data('display-start')
|
54
54
|
iDisplayLength: datatable.data('display-length')
|
55
55
|
language: datatable.data('language')
|
56
|
-
lengthMenu:
|
56
|
+
lengthMenu: datatable.data('length-menu')
|
57
57
|
order: datatable.data('display-order')
|
58
58
|
processing: true
|
59
59
|
responsive: true
|
@@ -255,6 +255,15 @@ table.dataTable {
|
|
255
255
|
th.col-decimal, td.col-decimal { text-align: right; }
|
256
256
|
th.col-right, td.col-right { text-align: right; }
|
257
257
|
|
258
|
+
th.col-th-left { text-align: left !important; }
|
259
|
+
td.col-td-left { text-align: left !important; }
|
260
|
+
|
261
|
+
th.col-th-center { text-align: center !important; }
|
262
|
+
td.col-td-center { text-align: center !important; }
|
263
|
+
|
264
|
+
th.col-th-right { text-align: right !important; }
|
265
|
+
td.col-td-right { text-align: right !important; }
|
266
|
+
|
258
267
|
td.col-bulk_actions {
|
259
268
|
label {
|
260
269
|
cursor: pointer;
|
@@ -67,6 +67,7 @@ module EffectiveDatatablesHelper
|
|
67
67
|
'display-start' => datatable.display_start,
|
68
68
|
'inline' => inline.to_s,
|
69
69
|
'language' => EffectiveDatatables.language(I18n.locale),
|
70
|
+
'length-menu' => datatable_length_menu(datatable),
|
70
71
|
'options' => input_js.to_json,
|
71
72
|
'reorder' => datatable.reorder?.to_s,
|
72
73
|
'reorder-index' => (datatable.columns[:_reorder][:index] if datatable.reorder?).to_s,
|
@@ -29,6 +29,18 @@ module EffectiveDatatablesPrivateHelper
|
|
29
29
|
render('/effective/datatables/buttons', datatable: datatable, search: search).gsub("'", '"').html_safe
|
30
30
|
end
|
31
31
|
|
32
|
+
def datatable_length_menu(datatable)
|
33
|
+
length_menu = datatable.length_menu
|
34
|
+
|
35
|
+
if length_menu.present?
|
36
|
+
raise('expected datatable length_menu to be an Array of Integers') unless length_menu.kind_of?(Array) && length_menu.all? { |i| i.kind_of?(Integer) }
|
37
|
+
end
|
38
|
+
|
39
|
+
length_menu ||= [5, 10, 25, 50, 100, 250, 500]
|
40
|
+
|
41
|
+
[length_menu, length_menu.map(&:to_s)]
|
42
|
+
end
|
43
|
+
|
32
44
|
def datatable_new_resource_button(datatable, name, column)
|
33
45
|
return unless datatable.inline? && (column[:actions][:new] != false)
|
34
46
|
|
@@ -211,6 +211,11 @@ module Effective
|
|
211
211
|
Array(attributes[:class] || EffectiveDatatables.html_class).join(' ').presence
|
212
212
|
end
|
213
213
|
|
214
|
+
# An array of integers [5, 10, 25, 50, 100, 250, 500]
|
215
|
+
def length_menu
|
216
|
+
EffectiveDatatables.length_menu
|
217
|
+
end
|
218
|
+
|
214
219
|
def to_param
|
215
220
|
"#{self.class.name.underscore.parameterize}-#{[self.class, attributes].hash.abs.to_s.last(12)}"
|
216
221
|
end
|
@@ -21,8 +21,10 @@ EffectiveDatatables.setup do |config|
|
|
21
21
|
# end
|
22
22
|
config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) }
|
23
23
|
|
24
|
-
#
|
25
|
-
|
24
|
+
# Display x per page options
|
25
|
+
config.length_menu = [5, 10, 25, 50, 100, 250, 500]
|
26
|
+
|
27
|
+
# Default number of entries shown per page. Must be in the length_menu.
|
26
28
|
config.default_length = 25
|
27
29
|
|
28
30
|
# Default class used on the <table> tag
|
data/lib/effective_datatables.rb
CHANGED
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: 4.
|
4
|
+
version: 4.30.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: 2024-
|
11
|
+
date: 2024-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|