jquery_notify_bar 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +12 -3
- data/Rakefile +1 -1
- data/lib/jquery_notify_bar/version.rb +1 -1
- data/lib/jquery_notify_bar/view_helpers.rb +3 -2
- data/public/javascripts/jquery.notifyBar.js +109 -0
- data/public/stylesheets/jquery.notifyBar.css +42 -0
- metadata +4 -2
data/README.rdoc
CHANGED
@@ -12,6 +12,11 @@ In your gem file add:
|
|
12
12
|
|
13
13
|
gem 'jquery_notify_bar'
|
14
14
|
|
15
|
+
You need copy this files to your stylesheets and javascripts folder
|
16
|
+
|
17
|
+
http://ustrajunior.com/assets/jquery_notify_bar/stylesheets/jquery.notifyBar.css
|
18
|
+
http://ustrajunior.com/assets/jquery_notify_bar/javascripts/jquery.notifyBar.js
|
19
|
+
|
15
20
|
==Usage
|
16
21
|
|
17
22
|
You just need add to helper in your layout page.
|
@@ -28,9 +33,13 @@ the seconde helper is to show the messages, you just need put it in your body
|
|
28
33
|
|
29
34
|
You can pass options too:
|
30
35
|
|
31
|
-
|
32
|
-
|
33
|
-
|
36
|
+
<%= jquery_notify_bar :delay => 2000 %>
|
37
|
+
<%= jquery_notify_bar :animation_speed => 'normal' %>
|
38
|
+
<%= jquery_notify_bar :cls => :success %>
|
39
|
+
|
40
|
+
or all at the same time
|
41
|
+
|
42
|
+
<%= jquery_notify_bar :delay => 2000, :animation_speed => 'normal', :cls => :success %>
|
34
43
|
|
35
44
|
This gem was inspired in the notify_bar[https://github.com/emrekutlu/notify_bar] {by İ. Emre Kutlu}[https://github.com/emrekutlu]
|
36
45
|
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module JqueryNotifyBar
|
2
2
|
module ViewHelpers
|
3
3
|
def include_jquery_notify_bar
|
4
|
-
|
5
|
-
|
4
|
+
content =
|
5
|
+
javascript_include_tag('jquery.notifyBar.js')
|
6
|
+
content << "\n#{stylesheet_link_tag('jquery.notifyBar.css')}".html_safe
|
6
7
|
end
|
7
8
|
|
8
9
|
def jquery_notify_bar(opts = {})
|
@@ -0,0 +1,109 @@
|
|
1
|
+
/*
|
2
|
+
* Notify Bar - jQuery plugin
|
3
|
+
*
|
4
|
+
* Copyright (c) 2009-2010 Dmitri Smirnov
|
5
|
+
*
|
6
|
+
* Licensed under the MIT license:
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
*
|
9
|
+
* Version: 1.2.2
|
10
|
+
*
|
11
|
+
* Project home:
|
12
|
+
* http://www.dmitri.me/blog/notify-bar
|
13
|
+
*/
|
14
|
+
|
15
|
+
/**
|
16
|
+
* param Object
|
17
|
+
*/
|
18
|
+
jQuery.notifyBar = function(settings) {
|
19
|
+
|
20
|
+
(function($) {
|
21
|
+
|
22
|
+
var bar = notifyBarNS = {};
|
23
|
+
notifyBarNS.shown = false;
|
24
|
+
|
25
|
+
if( !settings) {
|
26
|
+
settings = {};
|
27
|
+
}
|
28
|
+
// HTML inside bar
|
29
|
+
notifyBarNS.html = settings.html || "Your message here";
|
30
|
+
|
31
|
+
//How long bar will be delayed, doesn't count animation time.
|
32
|
+
notifyBarNS.delay = settings.delay || 2000;
|
33
|
+
|
34
|
+
//How long notifyBarNS bar will be slided up and down
|
35
|
+
notifyBarNS.animationSpeed = settings.animationSpeed || 200;
|
36
|
+
|
37
|
+
//Use own jquery object usually DIV, or use default
|
38
|
+
notifyBarNS.jqObject = settings.jqObject;
|
39
|
+
|
40
|
+
//Set up own class
|
41
|
+
notifyBarNS.cls = settings.cls || "";
|
42
|
+
|
43
|
+
//close button
|
44
|
+
notifyBarNS.close = settings.close || false;
|
45
|
+
|
46
|
+
if( notifyBarNS.jqObject) {
|
47
|
+
bar = notifyBarNS.jqObject;
|
48
|
+
notifyBarNS.html = bar.html();
|
49
|
+
} else {
|
50
|
+
bar = jQuery("<div></div>")
|
51
|
+
.addClass("jquery-notify-bar")
|
52
|
+
.addClass(notifyBarNS.cls)
|
53
|
+
.attr("id", "__notifyBar");
|
54
|
+
}
|
55
|
+
|
56
|
+
bar.html(notifyBarNS.html).hide();
|
57
|
+
var id = bar.attr("id");
|
58
|
+
switch (notifyBarNS.animationSpeed) {
|
59
|
+
case "slow":
|
60
|
+
asTime = 600;
|
61
|
+
break;
|
62
|
+
case "normal":
|
63
|
+
asTime = 400;
|
64
|
+
break;
|
65
|
+
case "fast":
|
66
|
+
asTime = 200;
|
67
|
+
break;
|
68
|
+
default:
|
69
|
+
asTime = notifyBarNS.animationSpeed;
|
70
|
+
}
|
71
|
+
if( bar != 'object'); {
|
72
|
+
jQuery("body").prepend(bar);
|
73
|
+
}
|
74
|
+
|
75
|
+
// Style close button in CSS file
|
76
|
+
if( notifyBarNS.close) {
|
77
|
+
bar.append(jQuery("<a href='#' class='notify-bar-close'>Close [X]</a>"));
|
78
|
+
jQuery(".notify-bar-close").click(function() {
|
79
|
+
if( bar.attr("id") == "__notifyBar") {
|
80
|
+
jQuery("#" + id).slideUp(asTime, function() { jQuery("#" + id).remove() });
|
81
|
+
} else {
|
82
|
+
jQuery("#" + id).slideUp(asTime);
|
83
|
+
}
|
84
|
+
return false;
|
85
|
+
});
|
86
|
+
}
|
87
|
+
|
88
|
+
// Check if we've got any visible bars and if we have, slide them up before showing the new one
|
89
|
+
if($('.jquery-notify-bar:visible').length > 0) {
|
90
|
+
$('.jquery-notify-bar:visible').stop().slideUp(asTime, function() {
|
91
|
+
bar.stop().slideDown(asTime);
|
92
|
+
});
|
93
|
+
} else {
|
94
|
+
bar.slideDown(asTime);
|
95
|
+
}
|
96
|
+
|
97
|
+
// Allow the user to click on the bar to close it
|
98
|
+
bar.click(function() {
|
99
|
+
$(this).slideUp(asTime);
|
100
|
+
})
|
101
|
+
|
102
|
+
// If taken from DOM dot not remove just hide
|
103
|
+
if( bar.attr("id") == "__notifyBar") {
|
104
|
+
setTimeout("jQuery('#" + id + "').stop().slideUp(" + asTime +", function() {jQuery('#" + id + "').remove()});", notifyBarNS.delay + asTime);
|
105
|
+
} else {
|
106
|
+
setTimeout("jQuery('#" + id + "').stop().slideUp(" + asTime +", function() {jQuery('#" + id + "')});", notifyBarNS.delay + asTime);
|
107
|
+
}
|
108
|
+
|
109
|
+
})(jQuery) };
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/*
|
2
|
+
* Notify Bar - jQuery plugin
|
3
|
+
*
|
4
|
+
* Copyright (c) 2009-2010 Dmitri Smirnov
|
5
|
+
*
|
6
|
+
* Licensed under the MIT license:
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
*
|
9
|
+
* Version: 1.2
|
10
|
+
*
|
11
|
+
* Project home:
|
12
|
+
* http://www.dmitri.me/blog/notify-bar
|
13
|
+
*/
|
14
|
+
|
15
|
+
.jquery-notify-bar {
|
16
|
+
width:100%;
|
17
|
+
position:fixed;
|
18
|
+
top:0;
|
19
|
+
left:0;
|
20
|
+
z-index:32768;
|
21
|
+
background-color:#efefef;
|
22
|
+
font-size:18px;
|
23
|
+
color:#000;
|
24
|
+
text-align:center;
|
25
|
+
font-family: Arial, Verdana, sans-serif;
|
26
|
+
padding:20px 0px;
|
27
|
+
border-bottom:1px solid #bbb;
|
28
|
+
cursor: pointer;
|
29
|
+
}
|
30
|
+
.jquery-notify-bar.error {
|
31
|
+
color:#f00;
|
32
|
+
background-color:#fdd;
|
33
|
+
}
|
34
|
+
.jquery-notify-bar.success {
|
35
|
+
color:#060;
|
36
|
+
background-color:#BBFFB6;
|
37
|
+
}
|
38
|
+
.notify-bar-close {
|
39
|
+
position:absolute;
|
40
|
+
left:95%;
|
41
|
+
font-size:11px;
|
42
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery_notify_bar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-07-
|
12
|
+
date: 2011-07-18 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: A simple gem to include jquery.notifyBar to your rails app.
|
15
15
|
email:
|
@@ -28,6 +28,8 @@ files:
|
|
28
28
|
- lib/jquery_notify_bar/railtie.rb
|
29
29
|
- lib/jquery_notify_bar/version.rb
|
30
30
|
- lib/jquery_notify_bar/view_helpers.rb
|
31
|
+
- public/javascripts/jquery.notifyBar.js
|
32
|
+
- public/stylesheets/jquery.notifyBar.css
|
31
33
|
homepage: http://ustrajunior.com/apps/jquery_notify_bar
|
32
34
|
licenses: []
|
33
35
|
post_install_message:
|