datatables_rails 0.0.2 → 0.1.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.
- data/lib/datatables_rails.rb +24 -0
- metadata +5 -5
data/lib/datatables_rails.rb
CHANGED
@@ -1,4 +1,28 @@
|
|
1
1
|
module DatatablesRails
|
2
|
+
module Out
|
3
|
+
class << self
|
4
|
+
def javascript(id, opts, source, cols)
|
5
|
+
dt_opts = []
|
6
|
+
dt_opts << "'bProcessing': true" if opts.has_key?('processing')
|
7
|
+
dt_opts << "'bJQueryUI': true" if opts.has_key?('jqueryui')
|
8
|
+
dt_opts << "'bPaginate': true" if opts.has_key?('paginate')
|
9
|
+
dt_opts << "'sAjaxSource': '#{source}'"
|
10
|
+
columns = []
|
11
|
+
cols.each do |col|
|
12
|
+
columns << "{'mDataProp' : '#{col}'}"
|
13
|
+
end
|
14
|
+
dt_opts << "'aoColumns': [ #{columns.join(',')} ]"
|
15
|
+
|
16
|
+
html = []
|
17
|
+
html << "<script>"
|
18
|
+
html << "$(document).ready(function() { "
|
19
|
+
html << "$('##{id}').dataTable( { #{dt_opts.join(',')} } );"
|
20
|
+
html << "});"
|
21
|
+
html << "</script>"
|
22
|
+
p html.join
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
2
26
|
class Structify
|
3
27
|
attr_accessor :struct
|
4
28
|
def initialize(data)
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.2
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Rendek
|
@@ -15,10 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-12-01 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
|
-
description: A wrapper around datatables to return the proper JSON datastructures
|
21
|
+
description: A wrapper around datatables to return the proper JSON datastructures and output html
|
22
22
|
email: josh@bluescripts.net
|
23
23
|
executables: []
|
24
24
|
|
@@ -60,6 +60,6 @@ rubyforge_project:
|
|
60
60
|
rubygems_version: 1.8.10
|
61
61
|
signing_key:
|
62
62
|
specification_version: 3
|
63
|
-
summary: A wrapper around datatables to return the proper JSON datastructures
|
63
|
+
summary: A wrapper around datatables to return the proper JSON datastructures and output html
|
64
64
|
test_files: []
|
65
65
|
|