showandtell 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/LICENSE.txt +7 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/lib/assets/javascripts/showandtell/activate.js +3 -0
- data/lib/assets/javascripts/showandtell/index.js +5 -0
- data/lib/assets/javascripts/showandtell/jquery.fancy-notifications.js +69 -0
- data/lib/assets/stylesheets/showandtell/index.css +3 -0
- data/lib/assets/stylesheets/showandtell/jquery.fancy-notifications.css +29 -0
- data/lib/showandtell/version.rb +3 -0
- data/lib/showandtell.rb +8 -0
- data/lib/showandtell_version.rb +3 -0
- data/showandtell.gemspec +14 -0
- metadata +68 -0
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) J-P Teti
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Showandtell
|
2
|
+
## Simple, nicer Rails notifications
|
3
|
+
|
4
|
+
Showandtell provides an incredibly easy way to integrate [fancy-rails-notifications](https://github.com/mluckeneder/fancy-rails-notifications) into your Rails 3.1+ app.
|
5
|
+
|
6
|
+
1. Add `gem 'showandtell'` to your Gemfile
|
7
|
+
2. Add `//=require showandtell` to your app/assets/javascripts/application.js
|
8
|
+
3. Add `*= require showandtell` to your app/assets/stylesheets/application.css
|
9
|
+
4. Done.
|
10
|
+
|
11
|
+
Note that your notifications must have a class of `flash` and an id of `flash_severity` where severity is the type of notification - notice, alert, etc. The appropriate code for this is:
|
12
|
+
|
13
|
+
<% flash.each do |name, msg| %>
|
14
|
+
<%= content_tag :div, msg, :id => "flash_#{name}", :class=>"flash" %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
### Bug Reports
|
18
|
+
|
19
|
+
If you run into a bug, please start by searching the [GitHub issue tracker page](https://github.com/roboteti/showandtell/issues). If you find one matching your problem, please feel free to add to the discussion. If you can't find one, please [create a new issue](https://github.com/roboteti/showandtell/issues/new).
|
20
|
+
|
21
|
+
### Contributing
|
22
|
+
- Fork the project on GitHub.
|
23
|
+
- Make your changes.
|
24
|
+
- Open a pull request. Let me know what you did and why you did it. Unless there is a really good reason for it, please don't tell me *how* you did it. That should be fairly evident from the new code. Assuming the request makes sense, I'll pull your changes.
|
25
|
+
|
26
|
+
### Credits
|
27
|
+
- Gem created by [J-P Teti](http://jpteti.com)
|
28
|
+
- [fancy-rails-notifications](https://github.com/mluckeneder/fancy-rails-notifications) by [mluckeneder](https://github.com/mluckeneder).
|
29
|
+
|
30
|
+
### License
|
31
|
+
Licensed under the [MIT license](https://github.com/roboteti/showandtell/blob/master/LICENSE.txt).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,69 @@
|
|
1
|
+
// =======================================================================
|
2
|
+
// Fancy jQuery Notifications
|
3
|
+
//
|
4
|
+
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
5
|
+
//
|
6
|
+
//
|
7
|
+
// Requires: jquery
|
8
|
+
//
|
9
|
+
// Author: Michael Luckeneder (https://github.com/mluckeneder)
|
10
|
+
//
|
11
|
+
//
|
12
|
+
// =======================================================================
|
13
|
+
|
14
|
+
(function( $ ){
|
15
|
+
var $closeTimeout;
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
var setupNotificationBehavior = function(){
|
20
|
+
$(".flash").click(function(){
|
21
|
+
$.FancyNotifications.close();
|
22
|
+
$(this).slideUp('slow');
|
23
|
+
});
|
24
|
+
$('.flash').slideDown('slow');
|
25
|
+
$closeTimeout = setTimeout("$('.flash').slideUp('slow',function(){ $(this).remove();});","3000");
|
26
|
+
};
|
27
|
+
|
28
|
+
|
29
|
+
$.FancyNotifications = function() {
|
30
|
+
setupNotificationBehavior();
|
31
|
+
};
|
32
|
+
|
33
|
+
$.FancyNotifications.error = function(message){
|
34
|
+
$.FancyNotifications.close();
|
35
|
+
this.showMessage("error", message);
|
36
|
+
};
|
37
|
+
|
38
|
+
$.FancyNotifications.alert = function(message){
|
39
|
+
$.FancyNotifications.close();
|
40
|
+
this.showMessage("alert", message);
|
41
|
+
};
|
42
|
+
|
43
|
+
$.FancyNotifications.notice = function(message){
|
44
|
+
$.FancyNotifications.close();
|
45
|
+
this.showMessage("notice", message);
|
46
|
+
};
|
47
|
+
|
48
|
+
$.FancyNotifications.showMessage = function(type,message){
|
49
|
+
var $div = $("<div></div>");
|
50
|
+
$div.attr("class","flash");
|
51
|
+
$div.attr("id", "flash_"+type);
|
52
|
+
$div.hide();
|
53
|
+
$div.html(message);
|
54
|
+
|
55
|
+
$('body').prepend($div);
|
56
|
+
|
57
|
+
setupNotificationBehavior();
|
58
|
+
};
|
59
|
+
|
60
|
+
$.FancyNotifications.close = function(){
|
61
|
+
clearTimeout($closeTimeout);
|
62
|
+
$('.flash').slideUp('slow',function(){ $(this).remove();});
|
63
|
+
};
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
})( jQuery );
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#flash_error {
|
2
|
+
background-color:#FCC;
|
3
|
+
}
|
4
|
+
#flash_alert{
|
5
|
+
background-color:#FFE5CC;
|
6
|
+
}
|
7
|
+
|
8
|
+
|
9
|
+
#flash_notice {
|
10
|
+
background-color:#CFC;
|
11
|
+
}
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
.flash {
|
16
|
+
font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
|
17
|
+
cursor:pointer;
|
18
|
+
display:none;
|
19
|
+
width:100%;
|
20
|
+
text-align:center;
|
21
|
+
padding-top:0.5em;
|
22
|
+
padding-bottom:0.5em;
|
23
|
+
font-size:1.3em;
|
24
|
+
position:fixed;
|
25
|
+
top:0;
|
26
|
+
height:1.3em;
|
27
|
+
left:0;
|
28
|
+
z-index:10000;
|
29
|
+
}
|
data/lib/showandtell.rb
ADDED
data/showandtell.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require './lib/showandtell_version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'showandtell'
|
5
|
+
s.version = Showandtell::VERSION
|
6
|
+
s.author = 'J-P Teti (fancy-rails-notifications by mluckender)'
|
7
|
+
s.email = 'roboteti@gmail.com'
|
8
|
+
s.homepage = "http://roboteti.github.com/showandtell"
|
9
|
+
s.summary = 'Simple, nicer Rails notifications'
|
10
|
+
|
11
|
+
s.add_dependency 'jquery-rails'
|
12
|
+
|
13
|
+
s.files = Dir["#{File.dirname(__FILE__)}/**/*"]
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: showandtell
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- J-P Teti (fancy-rails-notifications by mluckender)
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: jquery-rails
|
16
|
+
requirement: &8808370 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *8808370
|
25
|
+
description:
|
26
|
+
email: roboteti@gmail.com
|
27
|
+
executables: []
|
28
|
+
extensions: []
|
29
|
+
extra_rdoc_files: []
|
30
|
+
files:
|
31
|
+
- ./Gemfile
|
32
|
+
- ./lib/assets/javascripts/showandtell/activate.js
|
33
|
+
- ./lib/assets/javascripts/showandtell/index.js
|
34
|
+
- ./lib/assets/javascripts/showandtell/jquery.fancy-notifications.js
|
35
|
+
- ./lib/assets/stylesheets/showandtell/index.css
|
36
|
+
- ./lib/assets/stylesheets/showandtell/jquery.fancy-notifications.css
|
37
|
+
- ./lib/showandtell/version.rb
|
38
|
+
- ./lib/showandtell.rb
|
39
|
+
- ./lib/showandtell_version.rb
|
40
|
+
- ./LICENSE.txt
|
41
|
+
- ./Rakefile
|
42
|
+
- ./README.md
|
43
|
+
- ./showandtell.gemspec
|
44
|
+
homepage: http://roboteti.github.com/showandtell
|
45
|
+
licenses: []
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.8.10
|
65
|
+
signing_key:
|
66
|
+
specification_version: 3
|
67
|
+
summary: Simple, nicer Rails notifications
|
68
|
+
test_files: []
|