jquery-datatables-rails 3.0.0 → 3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ca11d8aeb50210204b7e77bb8e1e97f896c2cb1
4
- data.tar.gz: ca675097df780258be6de80ebbce4e638893a6bf
3
+ metadata.gz: f12b8a96c19bfa8112335d906ef37e7a809a72d0
4
+ data.tar.gz: b7e964cf7c1540a0716233ee62657c7261ca7d22
5
5
  SHA512:
6
- metadata.gz: 272b904d03a7ccbf8bb94af7addd12a7c6e01e8012d17c6ba027e696c914496228f7a9d6286dec386e61146732e963206e314aedbf487846676ab4b61e81fedb
7
- data.tar.gz: 9e64a787991fdd21f07b327cff8da3a972803d6d83c8a7ea4a9179c39a452860ca2fb879573ffa5307b0877b03091cf7590e7c1e913b8148f8cca942b0be973f
6
+ metadata.gz: d2c5ae66457c69106ed25640dc700624aaa9d352ecc40b87f1570175608d6c736497cdbf7593d81ca3378935fea15f47de6b346d5d9871b4b731d20e2a1ebba1
7
+ data.tar.gz: e2bb1554f06040d2bf08671a0de9850650aeea4dd0e0051c853d5440103789da06d21f38c46b542413cee793f8e350ca76da6f4af676e3721576e375a1c8c646
@@ -0,0 +1,75 @@
1
+ require 'rails/generators'
2
+
3
+ module Jquery
4
+ module Datatables
5
+ module Generators
6
+ class InstallGenerator < ::Rails::Generators::Base
7
+ desc "This generator installs jQuery dataTables to the Asset Pipeline"
8
+ argument :style, :type => :string, :default => 'regular'
9
+
10
+ def add_assets
11
+ js_manifest = 'app/assets/javascripts/application.js'
12
+ css_manifest = 'app/assets/stylesheets/application.css'
13
+ js_strings = js_assets_map[style.to_sym].join
14
+
15
+ insert_into_file js_manifest, js_strings, :after => "jquery_ujs\n" if File.exists?(js_manifest)
16
+ insert_css_strings(css_manifest) if File.exists?(css_manifest)
17
+ end
18
+
19
+ private
20
+ def insert_css_strings(css_manifest)
21
+ content = File.read(css_manifest)
22
+ css_strings = css_assets_map[style.to_sym].join
23
+
24
+ if requires_tree(content)
25
+ insert_into_file css_manifest, css_strings, :after => "require_tree .\n"
26
+ elsif requires_self(content)
27
+ insert_into_file css_manifest, css_strings, :before => " *= require_self\n"
28
+ else
29
+ insert_into_file css_manifest, css_strings, :before => " */"
30
+ end
31
+ end
32
+
33
+ def requires_tree(content)
34
+ content.match(/require_tree\s+\.\s*$/)
35
+ end
36
+
37
+ def requires_self(content)
38
+ content.match(/require_self\s*$/)
39
+ end
40
+
41
+ def js_assets_map
42
+ {
43
+ :regular => ["//= require dataTables/jquery.dataTables\n"],
44
+ :bootstrap2 => [
45
+ "//= require dataTables/jquery.dataTables\n",
46
+ "//= require dataTables/bootstrap/2/jquery.dataTables.bootstrap\n"
47
+ ],
48
+ :bootstrap3 => [
49
+ "//= require dataTables/jquery.dataTables\n",
50
+ "//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap\n"
51
+ ],
52
+ :foundation => [
53
+ "//= require dataTables/jquery.dataTables\n",
54
+ "//= require dataTables/jquery.dataTables.foundation\n"
55
+ ],
56
+ :responsive => [
57
+ "//= require dataTables/jquery.dataTables\n",
58
+ "//= require dataTables/extras/jquery.dataTables.responsive\n"
59
+ ]
60
+ }
61
+ end
62
+
63
+ def css_assets_map
64
+ {
65
+ :regular => [" *= require dataTables/jquery.dataTables\n"],
66
+ :bootstrap2 => [" *= require dataTables/bootstrap/2/jquery.dataTables.bootstrap\n"],
67
+ :bootstrap3 => [" *= require dataTables/bootstrap/3/jquery.dataTables.bootstrap\n"],
68
+ :foundation => [" *= require dataTables/jquery.dataTables.foundation\n"],
69
+ :responsive => [" *= require dataTables/extras/jquery.dataTables.responsive\n"]
70
+ }
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Datatables
3
3
  module Rails
4
- VERSION = "3.0.0"
4
+ VERSION = "3.1.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-datatables-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Wenglewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-29 00:00:00.000000000 Z
11
+ date: 2014-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails
@@ -38,6 +38,48 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: actionpack
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '3.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '3.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
41
83
  description: ''
42
84
  email:
43
85
  - robin@wenglewski.de
@@ -124,6 +166,7 @@ files:
124
166
  - app/assets/stylesheets/dataTables/src/demo_table.css
125
167
  - app/assets/stylesheets/dataTables/src/demo_table_jui.css
126
168
  - app/assets/stylesheets/dataTables/src/jquery.dataTables_themeroller.css
169
+ - lib/generators/jquery/datatables/install_generator.rb
127
170
  - lib/jquery-datatables-rails.rb
128
171
  - lib/jquery/datatables/rails/engine.rb
129
172
  - lib/jquery/datatables/rails/version.rb