snaptable 0.4.1 → 0.4.2

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: 20f9633b41fc538dc77dba4154ce3d1b9a522709
4
- data.tar.gz: 76655d7a4aa739236dd9d66885b48fe2ad7be782
3
+ metadata.gz: 4d90948e9e4ed20529bb677f38a20a20870f4e7e
4
+ data.tar.gz: 64b84059140e0aa2bb8f016dc254de78972f024b
5
5
  SHA512:
6
- metadata.gz: 8c49ec09a34087c57054217c5e96f1cb6cdae817e2bf4218300a9abd78e264177e9e40872ee0222301bab9cc3c96aeb00af166c6ec84c5b44b1c00d26e8f1817
7
- data.tar.gz: 344f4ab353d7a555083b4dbfb5421f4cad791ff13769116d134331a0876af035d435a4b3b315eddcdf5ffffe837ed9c3f3083bc8b5e854fdb4ee161ac15025b9
6
+ metadata.gz: 9cc953f194fd841a1c2d5cbb16f735ef32d1e356b7bfdcac37869cb2036b28fc4ec2c1098e7fbc9037f55662f3dedf223268f5d64eca07503f3521ec7f620bd4
7
+ data.tar.gz: 5926bb8d3b316bb45408b58267966fd505a0832775ab6f72466bee2121f9803d0ed2b7642cf2da3b7652c1097a2b6fa9e41bd5712559742de80435362e875a1b
data/README.md CHANGED
@@ -18,8 +18,6 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install snaptable
20
20
 
21
- The gem also requires jQuery.
22
-
23
21
  ## Usage
24
22
 
25
23
  ### Basic table
@@ -0,0 +1,44 @@
1
+ /* Admin table */
2
+
3
+ function snapifyTable() {
4
+
5
+ var snaptable = $('#snaptable')
6
+
7
+ var tableButtons = snaptable.find('.table_buttons'),
8
+ editButton = tableButtons.find('a[class="edit"]'),
9
+ deleteButton = tableButtons.find('a[class="delete"]'),
10
+ path = window.location.pathname + '/';
11
+
12
+ // add ajax to the pagination
13
+ snaptable.on("click", ".pagination a", function() {
14
+ $.getScript(this.href);
15
+ return false;
16
+ });
17
+
18
+ // line clickable
19
+ snaptable.on("click", "tbody tr", function(e) {
20
+ var id = $(this).data('url') ;
21
+ if ( typeof id !== 'undefined' && !$(this).hasClass('selected') ) {
22
+ $('tr.selected').removeClass('selected');
23
+ $(this).addClass('selected');
24
+ deleteButton.add(editButton).addClass("on");
25
+ editButton.attr('href', path + id + '/edit');
26
+ deleteButton.attr('href', path + id);
27
+ }
28
+ });
29
+
30
+ // Double click
31
+ snaptable.on("dblclick", "tbody tr", function() {
32
+ var id = $(this).data('url');
33
+ if ( typeof id !== 'undefined' ) {
34
+ window.location = path + id + '/edit';
35
+ }
36
+ });
37
+
38
+ }
39
+
40
+ $(document).on("ready page:load", function() {
41
+
42
+ snapifyTable();
43
+
44
+ });
@@ -1,44 +1,14 @@
1
- /* Admin table */
2
-
3
- function snapifyTable() {
4
-
5
- var snaptable = $('#snaptable')
6
-
7
- var tableButtons = snaptable.find('.table_buttons'),
8
- editButton = tableButtons.find('a[class="edit"]'),
9
- deleteButton = tableButtons.find('a[class="delete"]'),
10
- path = window.location.pathname + '/';
11
-
12
- // add ajax to the pagination
13
- snaptable.on("click", ".pagination a", function() {
14
- $.getScript(this.href);
15
- return false;
16
- });
17
-
18
- // line clickable
19
- snaptable.on("click", "tbody tr", function(e) {
20
- var id = $(this).data('url') ;
21
- if ( typeof id !== 'undefined' && !$(this).hasClass('selected') ) {
22
- $('tr.selected').removeClass('selected');
23
- $(this).addClass('selected');
24
- deleteButton.add(editButton).addClass("on");
25
- editButton.attr('href', path + id + '/edit');
26
- deleteButton.attr('href', path + id);
27
- }
28
- });
29
-
30
- // Double click
31
- snaptable.on("dblclick", "tbody tr", function() {
32
- var id = $(this).data('url');
33
- if ( typeof id !== 'undefined' ) {
34
- window.location = path + id + '/edit';
35
- }
36
- });
37
-
38
- }
39
-
40
- $(document).on("ready page:load", function() {
41
-
42
- snapifyTable();
43
-
44
- });
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require_tree ./snaptable
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree ./snaptable
13
+ */
@@ -1,5 +1,5 @@
1
1
  module Snaptable
2
2
  module Rails
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module Snaptable
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
data/snaptable.gemspec CHANGED
@@ -25,4 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency "rails", ">= 4.2.0"
26
26
  spec.add_dependency "railties", ">= 4.2.0"
27
27
  spec.add_dependency "will_paginate", ">= 3.0.0"
28
+ spec.add_dependency "sass-rails", "~> 4.0.3"
29
+ spec.add_dependency "jquery-rails"
28
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - khcr
@@ -80,6 +80,34 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 3.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: sass-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 4.0.3
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 4.0.3
97
+ - !ruby/object:Gem::Dependency
98
+ name: jquery-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  description: A gem that generate HTML tables from your models in order to display
84
112
  them in your admin views.
85
113
  email:
@@ -95,7 +123,9 @@ files:
95
123
  - README.md
96
124
  - Rakefile
97
125
  - app/assets/javascripts/snaptable.js
98
- - app/assets/stylesheets/snaptable.css.scss
126
+ - app/assets/javascripts/snaptable/table.js
127
+ - app/assets/stylesheets/snaptable.css
128
+ - app/assets/stylesheets/snaptable/table.css.scss
99
129
  - app/views/application/_buttons.html.erb
100
130
  - app/views/application/_search_field.html.erb
101
131
  - app/views/base.html.erb