datatablesnet 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datatablesnet (1.1.5)
4
+ datatablesnet (1.1.6)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -25,7 +25,31 @@ module Datatable
25
25
  end
26
26
  end
27
27
 
28
- #Options
28
+
29
+
30
+ module_function
31
+
32
+ def template_path
33
+ path = File.expand_path('..', __FILE__)
34
+ $:.unshift(path)
35
+ path
36
+ end
37
+
38
+
39
+
40
+ # The main method for generating the necessary javascript and html to display a datatable.
41
+ # This supports both ajax and non-ajax datatables.
42
+ #
43
+ # The following ar the input parameters:
44
+ #
45
+ # * <tt>id</tt> - The html id of the datatable
46
+ # * <tt>columns</tt> - Array of columns to be displayed. Each column is represented by a hash containing
47
+ # column configuration
48
+ # * <tt>rows</tt> - Rows to be displayed if the table is non-ajax
49
+ # * <tt>options</tt> - Table options
50
+ #
51
+ # The following are the table options:
52
+ #
29
53
  # :sort_by
30
54
  # :additional_data
31
55
  # :search
@@ -37,20 +61,13 @@ module Datatable
37
61
  # :auto_width
38
62
  # :row_callback
39
63
  # :show_actions
40
- #Column Options
64
+ # :info_callback
65
+ #
66
+ # The following are Column Options
41
67
  # :name
42
68
  # :label
43
69
  # :render
44
70
  # :format
45
-
46
- module_function
47
-
48
- def template_path
49
- path = File.expand_path('..', __FILE__)
50
- $:.unshift(path)
51
- path
52
- end
53
-
54
71
  def datatable_tag id, columns = [], rows = nil, options = {}
55
72
  options_map = {:sort_by => "aaSorting",
56
73
  :search => "bFilter",
@@ -289,6 +306,14 @@ module Datatable
289
306
 
290
307
  def convert_param klass, field_name, value
291
308
  case klass.columns_hash[field_name].type
309
+ when :string
310
+ klass.validators_on(field_name).each do |validator|
311
+ if validator.instance_of?(ActiveModel::Validations::NumericalityValidator)
312
+ if validator.options[:only_integer]
313
+ value = value.to_i
314
+ end
315
+ end
316
+ end
292
317
  when :date, :datetime
293
318
  value = Date.parse(value)
294
319
  when :integer, :float, :decimal
@@ -1,3 +1,3 @@
1
1
  module Datatablesnet
2
- VERSION = "1.1.6"
2
+ VERSION = "1.1.7"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 6
9
- version: 1.1.6
8
+ - 7
9
+ version: 1.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt Fields
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-09-30 00:00:00 +03:00
17
+ date: 2011-10-04 00:00:00 +03:00
18
18
  default_executable:
19
19
  dependencies: []
20
20