Skip to content

Update Datatables and support for kaminari #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
6c4309a
- support kaminari
Nov 15, 2011
909f1c3
- added kaminari dependency
Nov 15, 2011
2cbe05b
kaminari support
Nov 15, 2011
f744d3a
fix total_entries
Nov 15, 2011
75954c9
fix for kaminari
Nov 15, 2011
8a55db5
fix coffee script bug
Nov 15, 2011
61e35e6
fix typo
Nov 15, 2011
a6556b6
-fix indentation
Nov 15, 2011
776c3ac
- update read me
Nov 15, 2011
eaa55ba
update to data tables 1.8.2
Nov 15, 2011
036e82e
- Update data tables to 1.8.2
Nov 15, 2011
a47942e
remove kaminari dependency
Nov 15, 2011
8ebb866
- use ransack for search
Nov 15, 2011
b894cfc
ransack instead of metasearch
Nov 15, 2011
83f6028
use metaSearch
Nov 15, 2011
e2ddefd
- remote will_paginate
Nov 15, 2011
7de9f51
move back to data tables 1.8.1
Nov 15, 2011
7098d23
change script back
Nov 15, 2011
352cbf2
fix indentation
Nov 15, 2011
77a6aa2
-upgrade to datatables 1.8.2
Nov 16, 2011
b86c228
Merge branch 'master' of github.com:artellectual/simple_datatables
Nov 16, 2011
9329bf2
will paginate support
Nov 16, 2011
4497d5f
- version bump
Nov 16, 2011
1a3d2e8
added fn reload ajax plugin
Dec 1, 2011
ad4973c
add support for column filter
Dec 1, 2011
2730a11
remove columnfilter
Dec 2, 2011
396f8c5
added row grouping
Dec 2, 2011
1737e70
remove row grouping
Dec 2, 2011
4b65186
fdfd
Dec 2, 2011
9848d0f
move simple_datatables to app for easier development
Dec 2, 2011
0a303b8
update fnFilter function
Dec 2, 2011
6b03087
fnSetFilteringDisplayFix
Dec 2, 2011
423689a
update delay plugin
Dec 2, 2011
5d5795c
update delay filter
Dec 2, 2011
e4083c8
update filtering delay
Dec 2, 2011
f728f3e
support for search types
Dec 2, 2011
c588f82
switch split key
Dec 2, 2011
4e9fcbb
fix coffee script isse
Dec 2, 2011
399d897
fix bug
Dec 2, 2011
064516f
fdsfs
Dec 2, 2011
405bace
more search option
Dec 2, 2011
dbb36dc
added fnFilterClear
Dec 22, 2011
a94f583
include fnFilterClear
Dec 22, 2011
15887a1
change project to rails-datatables
Dec 22, 2011
6b01338
change project to rails-datatables
Dec 22, 2011
1eaff2c
update gem file
Dec 22, 2011
4aebe51
change name of assets
Dec 22, 2011
d4e357b
change name
Dec 22, 2011
c369161
Update README.rdoc
leereilly Apr 3, 2012
d154622
Merge pull request #1 from leereilly/master
Apr 6, 2012
3493eeb
Made rails version dependency more liberal to allow Rails 3.1 up unti…
seabre May 27, 2012
76f0762
Changed '//= require rails-datatables' to '//= require rails_datatabl…
seabre May 27, 2012
0fb649a
Merge pull request #2 from seabre/master
zacksiri Oct 11, 2012
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ pkg/*
*.gem
.bundle
*.swp

vendor/assets/javascripts/.DS_Store
.DS_Store
vendor/.DS_Store
vendor/assets/.DS_Store
126 changes: 61 additions & 65 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,111 +1,107 @@
PATH
remote: .
specs:
simple_datatables (0.1)
meta_search
rails (~> 3.1.0.rc5)
will_paginate (~> 3.0.pre2)

PATH
remote: jsonify-rails
specs:
jsonify-rails (0.0.6)
actionpack (~> 3.1.0.rc4)
jsonify
rails-datatables (0.3.0)
jsonify-rails
meta_search (~> 1.1.0)
rails (~> 3.1.0)

GEM
remote: http://rubygems.org/
specs:
actionmailer (3.1.0.rc5)
actionpack (= 3.1.0.rc5)
actionmailer (3.1.1)
actionpack (= 3.1.1)
mail (~> 2.3.0)
actionpack (3.1.0.rc5)
activemodel (= 3.1.0.rc5)
activesupport (= 3.1.0.rc5)
actionpack (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.1)
rack-cache (~> 1.0.2)
rack-mount (~> 0.8.1)
rack-test (~> 0.6.0)
sprockets (~> 2.0.0.beta.12)
activemodel (3.1.0.rc5)
activesupport (= 3.1.0.rc5)
bcrypt-ruby (~> 2.1.4)
rack (~> 1.3.2)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.2)
activemodel (3.1.1)
activesupport (= 3.1.1)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.0.rc5)
activemodel (= 3.1.0.rc5)
activesupport (= 3.1.0.rc5)
arel (~> 2.1.4)
activerecord (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activeresource (3.1.0.rc5)
activemodel (= 3.1.0.rc5)
activesupport (= 3.1.0.rc5)
activesupport (3.1.0.rc5)
activeresource (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
activesupport (3.1.1)
multi_json (~> 1.0)
arel (2.1.4)
bcrypt-ruby (2.1.4-x86-mingw32)
arel (2.2.1)
builder (3.0.0)
erubis (2.7.0)
hike (1.2.0)
hike (1.2.1)
i18n (0.6.0)
jsonify (0.1.0)
json (1.6.1)
jsonify (0.2.0)
jsonify-rails (0.2.0)
actionpack
jsonify (>= 0.2.0)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
meta_search (0.5.4)
actionpack (>= 3.0.0.beta4)
activerecord (>= 3.0.0.beta4)
activesupport (>= 3.0.0.beta4)
arel (>= 0.4.0)
mime-types (1.16)
multi_json (1.0.3)
polyglot (0.3.2)
rack (1.3.2)
rack-cache (1.0.2)
meta_search (1.1.1)
actionpack (~> 3.1.0)
activerecord (~> 3.1.0)
activesupport (~> 3.1.0)
polyamorous (~> 0.5.0)
mime-types (1.17.2)
multi_json (1.0.4)
polyamorous (0.5.0)
activerecord (~> 3.0)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack (>= 0.4)
rack-mount (0.8.1)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.1.0.rc5)
actionmailer (= 3.1.0.rc5)
actionpack (= 3.1.0.rc5)
activerecord (= 3.1.0.rc5)
activeresource (= 3.1.0.rc5)
activesupport (= 3.1.0.rc5)
rails (3.1.1)
actionmailer (= 3.1.1)
actionpack (= 3.1.1)
activerecord (= 3.1.1)
activeresource (= 3.1.1)
activesupport (= 3.1.1)
bundler (~> 1.0)
railties (= 3.1.0.rc5)
railties (3.1.0.rc5)
actionpack (= 3.1.0.rc5)
activesupport (= 3.1.0.rc5)
railties (= 3.1.1)
railties (3.1.1)
actionpack (= 3.1.1)
activesupport (= 3.1.1)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.9.1)
sprockets (2.0.0.beta.13)
rake (0.9.2.2)
rdoc (3.11)
json (~> 1.4)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.14.6)
tilt (1.3.2)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.29)
will_paginate (3.0.pre4)
tzinfo (0.3.31)

PLATFORMS
ruby
x86-mingw32

DEPENDENCIES
jsonify-rails!
simple_datatables!
rails-datatables!
15 changes: 9 additions & 6 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
= Simple Datatables
= Simple Datatables for Kaminari

This fork works with kaminari gem!

Connects two awesome plugins - Datatables for Jquery and Meta Search together for Rails 3.1

== Install

Add the following to your Gemfile to install simple datatables:

gem 'simple_datatables'
gem 'rails_datatables'

After bundle install add this line to rails 3.1 assets pipeline and restart server:

//= require simple_datatables
//= require rails_datatables

Installation completed.

Expand All @@ -24,12 +26,12 @@ There are two ways to map awesome Datatables plugin request fields for Rails.
This gem provides interface for the second way.
To use it you should do the following easy three steps:

Create simple meta_search and will_paginate (optionally) controller action as usual and add ".datatables" format
Create simple meta_search and kaminari (optionally) controller action as usual and add ".datatables" format

respond_to :html, :datatables

def search
@products = Product.search(params[:search]).paginate(:page => params[:page], :per_page=>params[:per_page])
@products = Product.search(params[:search]).page(params[:page]).per(params[:per_page])
respond_with @products
end

Expand All @@ -48,14 +50,15 @@ This gem uses:

This gem provides integration with:
* will_paginate for nice pagination request syntax mapping
* kaminari for pagination as well it works with both so choose either one not both.

Gem works only with rails 3.1.

Gem includes datatables library and fnSetFilteringDelay plugin so you haven't include it by yourself.

== Pagination

Simple_datatables is compatible with will_paginate. Datatables will provide you "page" and "per_page" request params.
Rails-Datatables is compatible with Kaminari AND Will paginate. Datatables will provide you "page" and "per_page" request params.

If you do not use pagination do not forget to save search result to some variable with meta_search relation method:

Expand Down
6 changes: 5 additions & 1 deletion app/views/layouts/application.datatables.jsonify
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ instance_variables.each do |vn|
break;
end

if v.respond_to?('total_entries')
if v.respond_to?('total_count')
total_entries = v.total_count
current_page_entries = v.size
break
elsif v.respond_to?('total_entries')
total_entries = v.total_entries
current_page_entries = v.size
break
Expand Down
4 changes: 2 additions & 2 deletions lib/simple_datatables.rb → lib/rails_datatables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Mime::Type.register "application/json", :datatables

module SimpleDatatables
module RailsDatatables
module Rails
require 'simple_datatables/engine'
require 'rails_datatables/engine'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'jsonify-rails'
require 'meta_search'

module SimpleDatatables
module RailsDatatables
module Rails
class Engine < ::Rails::Engine
end
Expand Down
3 changes: 3 additions & 0 deletions lib/rails_datatables/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module RailsDatatables
VERSION = "0.3.0"
end
3 changes: 0 additions & 3 deletions lib/simple_datatables/version.rb

This file was deleted.

23 changes: 23 additions & 0 deletions rails_datatables.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$:.push File.expand_path("../lib", __FILE__)
require "rails_datatables/version"

Gem::Specification.new do |s|
s.name = "rails_datatables"
s.version = RailsDatatables::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Grigory", "Zack"]
s.email = ["sakchai@artellectual.com"]
s.homepage = "http://github.com/artellectual/rails-datatables"
s.summary = %q{Rails datatables to rails mapping using meta_search, will_paginage / Kaminari and jsonify}
s.description = %q{Rails datatables to rails mapping using meta_search, will_paginage / Kaminari and jsonify}

s.rubyforge_project = "data_table"

s.files = `git ls-files`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_dependency "rails", [">= 3.1.0","< 4.0.0"]
s.add_dependency "meta_search", '~> 1.1.0'
s.add_dependency "jsonify-rails"
end
24 changes: 0 additions & 24 deletions simple_datatables.gemspec

This file was deleted.

Loading