jquery-tablesorter-deduper-rails 0.1
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
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9be095429092a51b159e9e8e4b7e3557e3186e2b
|
4
|
+
data.tar.gz: eeb87091e9116b4bd6a9fa874287d7a65a5b8a3f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f4b331deb8fbcf93cf68756b624ec947908d99ad9384fcf72e6eae01401f7d8d81835c479c55a18021163217dd6d0b6178f94237f0aa5ac6172402e550f426ed
|
7
|
+
data.tar.gz: 35890be0929db1b6f53261ee614fe335600e5004c305c1932dec3198889827f74adb13fc97632302aa1574ae26b0a5fe3f2ca49571321c1b1155857851cd2a17
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
### About
|
2
|
+
|
3
|
+
This gem is to include [jquery.tablesorter.deduper](https://github.com/grych/jquery.tablesorter.deduper) into Rails assets pipeline.
|
4
|
+
|
5
|
+
DeDuper is a Tablesorter widget to hide duplicated values in columns
|
6
|
+
|
7
|
+
#### Before:
|
8
|
+
|
9
|
+
+------+--------+
|
10
|
+
| John | Smith |
|
11
|
+
| John | Doe |
|
12
|
+
| Ted | Doe |
|
13
|
+
+------+--------+
|
14
|
+
|
15
|
+
#### After:
|
16
|
+
|
17
|
+
+------+--------+
|
18
|
+
| John | Smith |
|
19
|
+
| | Doe |
|
20
|
+
| Ted | |
|
21
|
+
+------+--------+
|
22
|
+
|
23
|
+
## [Example Page](http://www.tg.pl/deduper/ "DeDup example")
|
24
|
+
|
25
|
+
## 1. Add to Gemfile:
|
26
|
+
|
27
|
+
gem 'jquery-tablesorter-deduper-rails'
|
28
|
+
|
29
|
+
## 2. Add to application.js
|
30
|
+
|
31
|
+
//= require jquery.tablesorter.deduper
|
32
|
+
|
33
|
+
## 3. Define a style for "hidden" elements:
|
34
|
+
|
35
|
+
<style type="text/css">
|
36
|
+
.barely-visible {
|
37
|
+
color: rgba(0, 0, 0, 0.1);
|
38
|
+
}
|
39
|
+
</style>
|
40
|
+
|
41
|
+
## 4. Add widget to the tablesorter:
|
42
|
+
|
43
|
+
$("table").tablesorter({
|
44
|
+
theme: 'default',
|
45
|
+
widgets: ['zebra', 'deduper'],
|
46
|
+
widgetOptions : {
|
47
|
+
dupClass : 'barely-visible',
|
48
|
+
dupCompareFunction: function(x, y) {
|
49
|
+
return x.toLowerCase() == y.toLowerCase();
|
50
|
+
}
|
51
|
+
}
|
52
|
+
});
|
53
|
+
|
54
|
+
### Options:
|
55
|
+
|
56
|
+
* dupClass, default:
|
57
|
+
'light': class for duplicated elements
|
58
|
+
* dupCompareFuction, default: function(x, y) {return x.toLowerCase() == y.toLowerCase();}: function for comparing strings
|
59
|
+
|
60
|
+
## CREDITS
|
61
|
+
(c) 2015 Tomek "Grych" Gryszkiewicz
|
62
|
+
|
63
|
+
grych@tg.pl
|
64
|
+
|
65
|
+
https://github.com/grych/jquery.tablesorter.deduper
|
66
|
+
|
67
|
+
MIT License
|
68
|
+
|
@@ -0,0 +1,98 @@
|
|
1
|
+
// DeDup JQuery tablesorter plugin
|
2
|
+
// version 0.1
|
3
|
+
// (c) 2015 Tomek 'Grych' Gryszkiewicz, grych@tg.pl
|
4
|
+
// MIT License
|
5
|
+
// https://github.com/grych/dedup
|
6
|
+
//
|
7
|
+
// DeDup is a Tablesorter widget to hide duplicated values in columns
|
8
|
+
//
|
9
|
+
// #### Before:
|
10
|
+
//
|
11
|
+
// +------+--------+
|
12
|
+
// | John | Smith |
|
13
|
+
// | John | Doe |
|
14
|
+
// | Ted | Doe |
|
15
|
+
// +------+--------+
|
16
|
+
//
|
17
|
+
// #### After:
|
18
|
+
//
|
19
|
+
// +------+--------+
|
20
|
+
// | John | Smith |
|
21
|
+
// | | Doe |
|
22
|
+
// | Ted | |
|
23
|
+
// +------+--------+
|
24
|
+
//
|
25
|
+
// ## [Example Page](http://www.tg.pl/deduper/ "DeDup example")
|
26
|
+
//
|
27
|
+
// ## 1. Include this widget:
|
28
|
+
//
|
29
|
+
// <script type="text/javascript" src="jquery.tablesorter.deduper.js"></script>
|
30
|
+
//
|
31
|
+
// ## 2. Define a style for "hidden" elements:
|
32
|
+
//
|
33
|
+
// <style type="text/css">
|
34
|
+
// .barely-visible {
|
35
|
+
// color: rgba(0, 0, 0, 0.1);
|
36
|
+
// }
|
37
|
+
// </style>
|
38
|
+
//
|
39
|
+
// ## 3. Add widget to the tablesorter:
|
40
|
+
//
|
41
|
+
// $("table").tablesorter({
|
42
|
+
// theme: 'default',
|
43
|
+
// widgets: ['zebra', 'deduper'],
|
44
|
+
// widgetOptions : {
|
45
|
+
// dupClass : 'barely-visible',
|
46
|
+
// dupCompareFunction: function(x, y) {
|
47
|
+
// return x.toLowerCase() == y.toLowerCase();
|
48
|
+
// }
|
49
|
+
// }
|
50
|
+
// });
|
51
|
+
//
|
52
|
+
// ### Options:
|
53
|
+
//
|
54
|
+
// * dupClass, default:
|
55
|
+
// 'light': class for duplicated elements
|
56
|
+
// * dupCompareFuction, default: function(x, y) {return x.toLowerCase() == y.toLowerCase();}: function for comparing strings
|
57
|
+
//
|
58
|
+
// ## CREDITS
|
59
|
+
// (c) 2015 Tomek "Grych" Gryszkiewicz
|
60
|
+
// grych@tg.pl
|
61
|
+
// https://github.com/grych/dedup
|
62
|
+
// MIT License
|
63
|
+
//
|
64
|
+
$(function() {
|
65
|
+
$.tablesorter.addWidget({
|
66
|
+
id: "deduper",
|
67
|
+
priority: 10,
|
68
|
+
options: {
|
69
|
+
dupClass : 'light',
|
70
|
+
dupCompareFunction: function(x, y) {
|
71
|
+
return x.toLowerCase() == y.toLowerCase();
|
72
|
+
}
|
73
|
+
},
|
74
|
+
// format is called on init and when a sorting has finished
|
75
|
+
format: function(table, c, wo) {
|
76
|
+
// remove dupClass from all rows prior to sort
|
77
|
+
$("td." + wo.dupClass, table).removeClass(wo.dupClass);
|
78
|
+
// initialize the previous row array with $.prototype values (needed to compare first row)
|
79
|
+
var before_row = Array.apply(null, Array(c.columns)).map($.prototype.valueOf,$.prototype);
|
80
|
+
// only visible rows
|
81
|
+
c.$tbodies.children('tr:visible').each(function() {
|
82
|
+
$("td", this).each(function(i) {
|
83
|
+
if ( wo.dupCompareFunction(before_row[i].text(), $(this).text()) ) {
|
84
|
+
$(this).addClass(wo.dupClass);
|
85
|
+
}
|
86
|
+
});
|
87
|
+
// gets this row and save it into the Array of JQuery objects
|
88
|
+
before_row = $("td", this).map(function() {
|
89
|
+
return $(this);
|
90
|
+
}).get();
|
91
|
+
});
|
92
|
+
|
93
|
+
},
|
94
|
+
remove: function(table, c){
|
95
|
+
$("td." + wo.dupClass, table).removeClass(wo.wo.dupClass);
|
96
|
+
}
|
97
|
+
});
|
98
|
+
});
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery-tablesorter-deduper-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tomek 'Grych' Gryszkiewicz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jquery-tablesorter
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.17.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.17'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.17.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: railties
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
description: Gemified jquery.tablesorter.deduper - https://github.com/grych/jquery.tablesorter.deduper
|
48
|
+
email:
|
49
|
+
- grych@tg.pl
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- README.md
|
55
|
+
- lib/jquery-tablesorter-deduper-rails.rb
|
56
|
+
- lib/jquery-tablesorter-deduper-rails/version.rb
|
57
|
+
- vendor/assets/javascripts/jquery.tablesorter.deduper.js
|
58
|
+
homepage: https://github.com/grych/jquery-tablesorter-deduper-rails
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.9.3
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.4.5
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Gemified jquery.tablesorter.deduper - https://github.com/grych/jquery.tablesorter.deduper
|
82
|
+
test_files: []
|