mongoid_data_table 0.1.3 → 0.1.4
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/LICENSE +20 -0
- data/README.rdoc +54 -0
- data/lib/mongoid/data_table/version.rb +1 -1
- metadata +5 -3
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Jason Dew
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
= Mongoid Data Table
|
2
|
+
|
3
|
+
Makes it easy to ship data to a jQuery DataTable.
|
4
|
+
|
5
|
+
Quick example:
|
6
|
+
|
7
|
+
in your javascript:
|
8
|
+
|
9
|
+
$(".providers-data-table").dataTable({"bJQueryUI" : true,
|
10
|
+
"bProcessing" : true,
|
11
|
+
"bAutoWidth" : false,
|
12
|
+
"sPaginationType" : "full_numbers",
|
13
|
+
"aoColumns" : [{"sType" : "html"}, null, null, null, null],
|
14
|
+
"aaSorting" : [[0, 'asc'], [1, 'asc']],
|
15
|
+
"bServerSide" : true,
|
16
|
+
"sAjaxSource" : "/providers.json" }).fnSetFilteringDelay();
|
17
|
+
|
18
|
+
Note: the fnSetFilteringDelay() call isn't required but highly recommended: http://datatables.net/plug-ins/api#fnSetFilteringDelay
|
19
|
+
|
20
|
+
in your controller:
|
21
|
+
|
22
|
+
class ProvidersController < ApplicationController
|
23
|
+
|
24
|
+
def index
|
25
|
+
respond_to do |wants|
|
26
|
+
wants.html
|
27
|
+
wants.json do
|
28
|
+
render(:json => Provider.for_data_table(self, %w(name fein category county state), %w(name fein)) do |provider|
|
29
|
+
["<%= link_to(provider, provider) %>", provider.fein, provider.category, provider.county, provider.state]
|
30
|
+
end)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
in your view (assuming HAML):
|
38
|
+
|
39
|
+
%table.providers-data-table
|
40
|
+
%thead
|
41
|
+
%tr
|
42
|
+
%th Name
|
43
|
+
%th FEIN
|
44
|
+
%th Category
|
45
|
+
%th County
|
46
|
+
%th State
|
47
|
+
|
48
|
+
%tbody
|
49
|
+
|
50
|
+
Patches welcome, enjoy!
|
51
|
+
|
52
|
+
== Copyright
|
53
|
+
|
54
|
+
Copyright (c) 2010 Jason Dew. See LICENSE for details.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_data_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jason Dew
|
@@ -144,6 +144,8 @@ files:
|
|
144
144
|
- .gitignore
|
145
145
|
- Gemfile
|
146
146
|
- Gemfile.lock
|
147
|
+
- LICENSE
|
148
|
+
- README.rdoc
|
147
149
|
- Rakefile
|
148
150
|
- lib/mongoid/data_table/base.rb
|
149
151
|
- lib/mongoid/data_table/version.rb
|