jreject-rails 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27ba6714fe2a2f4b79d68c7323b2eb4077d11140
|
4
|
+
data.tar.gz: fae0fa528124c3175d62af5ec8eeb31cc28ba49f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29cfd1d93f317c6d2a432b551cc2d4c416dd7d666e564d8e4f0f721d20ee36594d554da1e36c3339a63e5324bb5b5c333694a0532d004fcb99e6cc76543c39df
|
7
|
+
data.tar.gz: ae96e6ceac0e13e7b447febafc195443b707c47844c95fa8702892a2d100283a527fc325c83f130b6866c1ea6e9bff09bfd107da4ce41b4604fd16ef8082f1e4
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Or install it yourself as:
|
|
19
19
|
Now you need to edit your app/assets/javascripts/application.js file and add the following line:
|
20
20
|
``` javascript
|
21
21
|
//= require jquery
|
22
|
-
//= require
|
22
|
+
//= require jreject-rails
|
23
23
|
```
|
24
24
|
|
25
25
|
And then edit your `app/assets/stylesheets/application.css` file to look something like:
|
@@ -36,7 +36,7 @@ And then edit your `app/assets/stylesheets/application.css` file to look somethi
|
|
36
36
|
With the gem installed and included in your asset manifests, you can now use JReject as you normally would.
|
37
37
|
|
38
38
|
``` javascript
|
39
|
-
$.
|
39
|
+
$.rejectRails();
|
40
40
|
```
|
41
41
|
|
42
42
|
## Contributing
|
data/lib/jreject-rails/engine.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
module JReject
|
2
2
|
module Rails
|
3
|
-
class Engine < ::Rails::Engine
|
3
|
+
class Engine < ::Rails::Engine
|
4
|
+
initializer 'jreject-rails.assets.precompile', group: :all do |app|
|
5
|
+
app.config.assets.precompile += %W(
|
6
|
+
jreject/*.js
|
7
|
+
jreject/*.css
|
8
|
+
jreject/*.gif
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
4
12
|
end
|
5
13
|
end
|
@@ -37,29 +37,38 @@ $.reject = function(options) {
|
|
37
37
|
// Text below the icon
|
38
38
|
text: 'Google Chrome',
|
39
39
|
// URL For icon/text link
|
40
|
-
url: 'http://www.google.com/chrome/'
|
40
|
+
url: 'http://www.google.com/chrome/',
|
41
|
+
// Custom browser icon url
|
42
|
+
iconUrl: null
|
41
43
|
// (Optional) Use "allow" to customized when to show this option
|
42
44
|
// Example: to show chrome only for IE users
|
43
|
-
// allow: { all: false, msie: true }
|
45
|
+
// allow: { all: false, msie: true },
|
44
46
|
},
|
45
47
|
firefox: {
|
46
48
|
text: 'Mozilla Firefox',
|
47
|
-
url: 'http://www.mozilla.com/firefox/'
|
49
|
+
url: 'http://www.mozilla.com/firefox/',
|
50
|
+
iconUrl: null
|
48
51
|
},
|
49
52
|
safari: {
|
50
53
|
text: 'Safari',
|
51
|
-
url: 'http://www.apple.com/safari/download/'
|
54
|
+
url: 'http://www.apple.com/safari/download/',
|
55
|
+
iconUrl: null
|
52
56
|
},
|
53
57
|
opera: {
|
54
58
|
text: 'Opera',
|
55
|
-
url: 'http://www.opera.com/download/'
|
59
|
+
url: 'http://www.opera.com/download/',
|
60
|
+
iconUrl: null
|
56
61
|
},
|
57
62
|
msie: {
|
58
63
|
text: 'Internet Explorer',
|
59
|
-
url: 'http://www.microsoft.com/windows/Internet-explorer/'
|
64
|
+
url: 'http://www.microsoft.com/windows/Internet-explorer/',
|
65
|
+
iconUrl: null
|
60
66
|
}
|
61
67
|
},
|
62
68
|
|
69
|
+
// Custom background image url
|
70
|
+
backgroundImageUrl: null,
|
71
|
+
|
63
72
|
// Pop-up Window Text
|
64
73
|
header: 'Did you know that your Internet Browser is out of date?',
|
65
74
|
|
@@ -93,9 +102,8 @@ $.reject = function(options) {
|
|
93
102
|
expires: 0
|
94
103
|
},
|
95
104
|
|
96
|
-
// Path where images are located
|
97
|
-
|
98
|
-
imagePath: "<%= image_path('jreject/background_browser.gif').gsub /background_browser.*/, '' %>",
|
105
|
+
// Path where default images are located
|
106
|
+
imagePath: './images/',
|
99
107
|
// Background color for overlay
|
100
108
|
overlayBgColor: '#000',
|
101
109
|
// Background transparency (0-1)
|
@@ -365,16 +373,16 @@ $.reject = function(options) {
|
|
365
373
|
});
|
366
374
|
|
367
375
|
element.find('#jr_inner li').css({ // Browser list items (li)
|
368
|
-
background: 'transparent url("'+
|
369
|
-
'no-repeat scroll left top'
|
376
|
+
background: 'transparent url("'+(opts.backgroundImageUrl ? opts.backgroundImageUrl : opts.imagePath+'background_browser.gif') +'") '+'no-repeat scroll left top'
|
370
377
|
});
|
371
378
|
|
372
379
|
element.find('#jr_inner li .jr_icon').each(function() {
|
373
380
|
// Dynamically sets the icon background image
|
374
381
|
var self = $(this);
|
375
|
-
self.
|
376
|
-
|
377
|
-
|
382
|
+
var browser = self.parent('li').attr('id').replace(/jr_/,'');
|
383
|
+
var browserImage = opts.browserInfo[browser].iconUrl ? opts.browserInfo[browser].iconUrl : opts.imagePath+'browser_'+browser+'.gif';
|
384
|
+
|
385
|
+
self.css('background','transparent url('+browserImage+')'+' no-repeat scroll left top');
|
378
386
|
|
379
387
|
// Send link clicks to openBrowserLinks
|
380
388
|
self.click(function () {
|
@@ -0,0 +1,46 @@
|
|
1
|
+
//= require jquery.reject
|
2
|
+
|
3
|
+
(function($) {
|
4
|
+
$.rejectRails = function(options) {
|
5
|
+
var opts = $.extend(true, {
|
6
|
+
browserInfo: { // Settings for which browsers to display
|
7
|
+
chrome: {
|
8
|
+
// Text below the icon
|
9
|
+
text: 'Google Chrome',
|
10
|
+
// URL For icon/text link
|
11
|
+
url: 'http://www.google.com/chrome/',
|
12
|
+
// Custom browser icon url
|
13
|
+
iconUrl: "<%= asset_url('jreject/browser_chrome.gif') %>"
|
14
|
+
// (Optional) Use "allow" to customized when to show this option
|
15
|
+
// Example: to show chrome only for IE users
|
16
|
+
// allow: { all: false, msie: true },
|
17
|
+
},
|
18
|
+
firefox: {
|
19
|
+
text: 'Mozilla Firefox',
|
20
|
+
url: 'http://www.mozilla.com/firefox/',
|
21
|
+
iconUrl: "<%= asset_url('jreject/browser_firefox.gif') %>"
|
22
|
+
},
|
23
|
+
safari: {
|
24
|
+
text: 'Safari',
|
25
|
+
url: 'http://www.apple.com/safari/download/',
|
26
|
+
iconUrl: "<%= asset_url('jreject/browser_safari.gif') %>"
|
27
|
+
},
|
28
|
+
opera: {
|
29
|
+
text: 'Opera',
|
30
|
+
url: 'http://www.opera.com/download/',
|
31
|
+
iconUrl: "<%= asset_url('jreject/browser_opera.gif') %>"
|
32
|
+
},
|
33
|
+
msie: {
|
34
|
+
text: 'Internet Explorer',
|
35
|
+
url: 'http://www.microsoft.com/windows/Internet-explorer/',
|
36
|
+
iconUrl: "<%= asset_url('jreject/browser_msie.gif') %>"
|
37
|
+
}
|
38
|
+
},
|
39
|
+
|
40
|
+
// Custom background image url
|
41
|
+
backgroundImageUrl: "<%= asset_url('jreject/background_browser.gif') %>"
|
42
|
+
}, options);
|
43
|
+
|
44
|
+
$.reject(opts);
|
45
|
+
};
|
46
|
+
})(jQuery);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jreject-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Sharshenov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -47,7 +47,8 @@ files:
|
|
47
47
|
- vendor/assets/images/jreject/browser_msie.gif
|
48
48
|
- vendor/assets/images/jreject/browser_opera.gif
|
49
49
|
- vendor/assets/images/jreject/browser_safari.gif
|
50
|
-
- vendor/assets/javascripts/jquery.reject.js
|
50
|
+
- vendor/assets/javascripts/jquery.reject.js
|
51
|
+
- vendor/assets/javascripts/jreject-rails.js.erb
|
51
52
|
- vendor/assets/stylesheets/jquery.reject.css
|
52
53
|
homepage: https://github.com/sharshenov/jreject-rails
|
53
54
|
licenses:
|