cd2_tabs 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/cd2_tabs_cookies.js +25 -14
- data/lib/cd2_tabs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 758dd47d6312c7fea53920a804283e1e01134c9f
|
4
|
+
data.tar.gz: e3ccc21084a7fbc98253c004cd605d735c17f3e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2d52ebaf511b74ae0c9b6506e45a9b7d3905042713caa1c8373c13b5aa6b43c51a0eb3487f36321abf52384ff69aee0fb3f3dd43079dc0f2b0adaa58090dcf3
|
7
|
+
data.tar.gz: 00cd09c0bddb72d84a60c149aa14d00ea3c771b59fa449ab20b925a17fcd5a5a524471835e60833122157819eeeacfa15ca2fb33a9a667e9d8985126469ecca8
|
@@ -1,25 +1,36 @@
|
|
1
1
|
//= require jscookie
|
2
2
|
|
3
|
-
$(function
|
4
|
-
|
5
|
-
|
3
|
+
$(function() {
|
4
|
+
var cookieName = "tab_" + window.location.pathname;
|
5
|
+
var cookieTab = Cookies.get(cookieName);
|
6
6
|
|
7
|
-
|
7
|
+
if (typeof cookieTab !== 'undefined' && cookieTab.length > 0) {
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
// Switching tabs on ajax load & switch tab on page load
|
10
|
+
$(document).ajaxComplete(function(event, request, settings) {
|
11
|
+
$(".tabs_container input[value='" + cookieTab + "']").prop("checked", true);
|
12
|
+
});
|
13
|
+
|
14
|
+
$(".tabs_container input[value='" + cookieTab + "']").prop("checked", true);
|
13
15
|
|
14
|
-
|
16
|
+
}
|
15
17
|
|
16
|
-
|
18
|
+
// Setting on load
|
19
|
+
if ($('.tabs_container:first-of-type > .tab_controller')[0] != $('.tabs_container:first-of-type > .tab_controller:checked').get()[0]) {
|
20
|
+
|
21
|
+
Cookies.set(cookieName, $('.tabs_container:first-of-type > .tab_controller:checked').attr('value'), {
|
22
|
+
expires: 0.01
|
23
|
+
});
|
17
24
|
|
18
|
-
|
19
|
-
$("body").on("click", ".tab_heads_container label", function(){
|
25
|
+
}
|
20
26
|
|
21
|
-
|
27
|
+
// Delegated event listener for tab heads for when ajax loading
|
28
|
+
$("body").on("click", ".tab_heads_container label", function() {
|
22
29
|
|
23
|
-
|
30
|
+
Cookies.set(cookieName, $(this).attr('class'), {
|
31
|
+
expires: 0.01
|
32
|
+
});
|
33
|
+
|
34
|
+
});
|
24
35
|
|
25
36
|
})
|
data/lib/cd2_tabs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cd2_tabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CD2
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|