ajax-datatables-rails 1.2.0 → 1.3.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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +120 -0
- data/.rubocop.yml +3 -1
- data/Appraisals +7 -13
- data/CHANGELOG.md +23 -2
- data/README.md +51 -70
- data/ajax-datatables-rails.gemspec +11 -5
- data/doc/migrate.md +44 -0
- data/doc/webpack.md +4 -1
- data/gemfiles/{rails_5.2.3.gemfile → rails_5.2.4.gemfile} +1 -1
- data/gemfiles/{rails_6.0.1.gemfile → rails_6.0.3.gemfile} +1 -1
- data/gemfiles/{rails_5.0.7.gemfile → rails_6.1.0.gemfile} +3 -3
- data/lib/ajax-datatables-rails.rb +0 -16
- data/lib/ajax-datatables-rails/base.rb +38 -13
- data/lib/ajax-datatables-rails/datatable.rb +6 -0
- data/lib/ajax-datatables-rails/datatable/column.rb +59 -21
- data/lib/ajax-datatables-rails/datatable/column/date_filter.rb +1 -1
- data/lib/ajax-datatables-rails/datatable/column/search.rb +2 -2
- data/lib/ajax-datatables-rails/datatable/datatable.rb +17 -3
- data/lib/ajax-datatables-rails/datatable/simple_order.rb +7 -5
- data/lib/ajax-datatables-rails/error.rb +9 -0
- data/lib/ajax-datatables-rails/orm.rb +6 -0
- data/lib/ajax-datatables-rails/orm/active_record.rb +9 -10
- data/lib/ajax-datatables-rails/version.rb +1 -1
- data/spec/ajax-datatables-rails/base_spec.rb +77 -120
- data/spec/ajax-datatables-rails/datatable/column_spec.rb +30 -10
- data/spec/ajax-datatables-rails/datatable/datatable_spec.rb +61 -22
- data/spec/ajax-datatables-rails/datatable/simple_order_spec.rb +11 -9
- data/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb +352 -257
- data/spec/ajax-datatables-rails/orm/active_record_sort_records_spec.rb +4 -4
- data/spec/install_oracle.sh +4 -4
- data/spec/spec_helper.rb +10 -19
- data/spec/support/datatables/complex_datatable.rb +29 -0
- data/spec/support/datatables/complex_datatable_array.rb +14 -0
- data/spec/support/{datatable_cond_date.rb → datatables/datatable_cond_date.rb} +0 -0
- data/spec/support/{datatable_cond_numeric.rb → datatables/datatable_cond_numeric.rb} +0 -0
- data/spec/support/{datatable_cond_proc.rb → datatables/datatable_cond_proc.rb} +0 -0
- data/spec/support/{datatable_cond_string.rb → datatables/datatable_cond_string.rb} +0 -0
- data/spec/support/datatables/datatable_cond_unknown.rb +5 -0
- data/spec/support/{datatable_order_nulls_last.rb → datatables/datatable_order_nulls_last.rb} +0 -0
- data/spec/support/{test_helpers.rb → helpers/params.rb} +8 -46
- data/spec/support/{test_models.rb → models/user.rb} +0 -0
- metadata +53 -49
- data/.travis.yml +0 -57
- data/gemfiles/rails_5.1.7.gemfile +0 -11
- data/lib/ajax-datatables-rails/configuration.rb +0 -10
- data/lib/generators/datatable/config_generator.rb +0 -19
- data/lib/generators/datatable/templates/ajax_datatables_rails_config.rb +0 -9
- data/spec/ajax-datatables-rails/configuration_spec.rb +0 -34
- data/spec/ajax-datatables-rails/extended_spec.rb +0 -19
data/.travis.yml
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
---
|
2
|
-
os: linux
|
3
|
-
dist: xenial
|
4
|
-
|
5
|
-
language: ruby
|
6
|
-
cache: bundler
|
7
|
-
rvm:
|
8
|
-
- 2.7.1
|
9
|
-
- 2.6.6
|
10
|
-
- 2.5.8
|
11
|
-
- 2.4.10
|
12
|
-
- ruby-head
|
13
|
-
|
14
|
-
gemfile:
|
15
|
-
- gemfiles/rails_5.0.7.gemfile
|
16
|
-
- gemfiles/rails_5.1.7.gemfile
|
17
|
-
- gemfiles/rails_5.2.3.gemfile
|
18
|
-
- gemfiles/rails_6.0.1.gemfile
|
19
|
-
|
20
|
-
services:
|
21
|
-
- postgresql
|
22
|
-
- mysql
|
23
|
-
|
24
|
-
addons:
|
25
|
-
postgresql: '9.6'
|
26
|
-
|
27
|
-
before_install:
|
28
|
-
- sh -c "if [ '$DB_ADAPTER' = 'mysql2' ]; then mysql -e 'create database ajax_datatables_rails;'; fi"
|
29
|
-
- sh -c "if [ '$DB_ADAPTER' = 'postgresql' ]; then psql -c 'create database ajax_datatables_rails;' -U postgres; fi"
|
30
|
-
- sh -c "if [ '$DB_ADAPTER' = 'oracle_enhanced' ]; then ./spec/install_oracle.sh; fi"
|
31
|
-
|
32
|
-
env:
|
33
|
-
global:
|
34
|
-
- ORACLE_COOKIE=sqldev
|
35
|
-
- ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
|
36
|
-
- ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
|
37
|
-
- ORACLE_SID=XE
|
38
|
-
jobs:
|
39
|
-
- DB_ADAPTER=postgresql
|
40
|
-
- DB_ADAPTER=mysql2
|
41
|
-
- DB_ADAPTER=sqlite3
|
42
|
-
- DB_ADAPTER=oracle_enhanced
|
43
|
-
|
44
|
-
jobs:
|
45
|
-
exclude:
|
46
|
-
- rvm: 2.4.10
|
47
|
-
gemfile: gemfiles/rails_6.0.1.gemfile
|
48
|
-
allow_failures:
|
49
|
-
- rvm: ruby-head
|
50
|
-
|
51
|
-
before_script:
|
52
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
53
|
-
- chmod +x ./cc-test-reporter
|
54
|
-
- ./cc-test-reporter before-build
|
55
|
-
|
56
|
-
after_script:
|
57
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "5.1.7"
|
6
|
-
gem "activerecord-oracle_enhanced-adapter", "~> 1.8.0"
|
7
|
-
gem "sqlite3", "~> 1.3.0"
|
8
|
-
gem "mysql2"
|
9
|
-
gem "ruby-oci8" if ENV["DB_ADAPTER"] == "oracle_enhanced"
|
10
|
-
|
11
|
-
gemspec path: "../"
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails/generators'
|
4
|
-
|
5
|
-
module Datatable
|
6
|
-
module Generators
|
7
|
-
class ConfigGenerator < ::Rails::Generators::Base
|
8
|
-
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
9
|
-
desc <<~DESC
|
10
|
-
Description:
|
11
|
-
Creates an initializer file for AjaxDatatablesRails configuration at config/initializers.
|
12
|
-
DESC
|
13
|
-
|
14
|
-
def copy_config_file
|
15
|
-
template 'ajax_datatables_rails_config.rb', 'config/initializers/ajax_datatables_rails.rb'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
AjaxDatatablesRails.configure do |config|
|
4
|
-
# available options for db_adapter are: :pg, :mysql, :mysql2, :sqlite, :sqlite3
|
5
|
-
# config.db_adapter = :pg
|
6
|
-
|
7
|
-
# Or you can use your rails environment adapter if you want a generic dev and production
|
8
|
-
# config.db_adapter = Rails.configuration.database_configuration[Rails.env]['adapter'].to_sym
|
9
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe AjaxDatatablesRails do
|
4
|
-
describe 'configurations' do
|
5
|
-
context 'configurable from outside' do
|
6
|
-
before(:each) do
|
7
|
-
AjaxDatatablesRails.configure do |config|
|
8
|
-
config.db_adapter = :mysql
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should have custom value' do
|
13
|
-
expect(AjaxDatatablesRails.config.db_adapter).to eq(:mysql)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe AjaxDatatablesRails::Configuration do
|
20
|
-
let(:config) { AjaxDatatablesRails::Configuration.new }
|
21
|
-
|
22
|
-
describe 'default config' do
|
23
|
-
it 'default db_adapter should :postgresql' do
|
24
|
-
expect(config.db_adapter).to eq(:postgresql)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe 'custom config' do
|
29
|
-
it 'should accept db_adapter custom value' do
|
30
|
-
config.db_adapter = :mysql
|
31
|
-
expect(config.db_adapter).to eq(:mysql)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe AjaxDatatablesRails::Base do
|
4
|
-
describe 'it can transform search value before asking the database' do
|
5
|
-
let(:datatable) { DatatableWithFormater.new(sample_params) }
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
create(:user, username: 'johndoe', email: 'johndoe@example.com', last_name: 'DOE')
|
9
|
-
create(:user, username: 'msmith', email: 'mary.smith@example.com', last_name: 'SMITH')
|
10
|
-
datatable.params[:columns]['3'][:search][:value] = 'doe'
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should filter records' do
|
14
|
-
expect(datatable.data.size).to eq 1
|
15
|
-
item = datatable.data.first
|
16
|
-
expect(item[:last_name]).to eq 'DOE'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|