fancynotifications 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +72 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/fancynotifications.gemspec +28 -0
- data/lib/fancynotifications.rb +5 -0
- data/lib/fancynotifications/version.rb +3 -0
- data/vendor/assets/javascripts/fancynotifications.js +12 -0
- data/vendor/assets/stylesheets/fancynotifications.scss +26 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 83ed006d065aa3b04702e59d0007469fb5527492
|
4
|
+
data.tar.gz: 1f03929172962d6de1edbd70cf017d6288c17c5c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 02497ff00498daae4282356684c9b9f5e73bd2c52b5dc09c1b572cdaef6b3111154edcb32d5827b022574d2d08369ded5641d0ee12c9afa46c646cbf1efda1bd
|
7
|
+
data.tar.gz: bb5d8a0171ab36672d0310d862c254cb6476c2277d64d3aada1896481fbed0c78eeb04fd6adad53de6221679df159df21ff3f740cc5b11dd305a0832ab2bfcad
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# Fancy Notifications
|
2
|
+
|
3
|
+
This gem was created to make better flash notifications in my Ruby on Rails applications. To use it follow the installation instructions below. Big thanks to [Mackenzie Child of Unicasts](http://unicasts.com) for inispiring and much of the CSS work in his screencasts. He did the majority of the brains, I just turned it into a gem and plan to add some additional features.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'fancynotifications'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install fancynotifications
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
In your SCSS file add
|
24
|
+
|
25
|
+
```scss
|
26
|
+
@import 'fancynotifications';
|
27
|
+
```
|
28
|
+
|
29
|
+
In your Javascript file
|
30
|
+
|
31
|
+
```javascript
|
32
|
+
//= require fancynotifications
|
33
|
+
```
|
34
|
+
|
35
|
+
To display the flash notifications in your application.html.erb( or whichever layout) file
|
36
|
+
```erb
|
37
|
+
<% flash.each do |key, value| %>
|
38
|
+
<div id="notice_wrapper">
|
39
|
+
<div class="<%= key %>">
|
40
|
+
<a class="alert_close">(X)</a>
|
41
|
+
<%= value %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
<% end %>
|
45
|
+
```
|
46
|
+
|
47
|
+
The important thing to keep in mind is the Javascript looks for the notice_wrapper div and the alert_close class.
|
48
|
+
|
49
|
+
The key allows us to style specific types of Flash notices in Rails. Such as "error", "notice", or "success".
|
50
|
+
|
51
|
+
### Override Options
|
52
|
+
To override the text color or background of the notifications add this above your SCSS import statement.
|
53
|
+
|
54
|
+
```scss
|
55
|
+
$notification_text: #FFFFFF;
|
56
|
+
$notification_background: rgba(201, 70, 70, 0.85);
|
57
|
+
|
58
|
+
```
|
59
|
+
|
60
|
+
## Development
|
61
|
+
|
62
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
63
|
+
|
64
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
65
|
+
|
66
|
+
## Contributing
|
67
|
+
|
68
|
+
1. Fork it ( https://github.com/[my-github-username]/fancynotifications/fork )
|
69
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
70
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
71
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
72
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "fancynotifications"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fancynotifications/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fancynotifications"
|
8
|
+
spec.version = Fancynotifications::VERSION
|
9
|
+
spec.authors = ["Andrew Fomera"]
|
10
|
+
spec.email = ["andrew@zerlex.net"]
|
11
|
+
|
12
|
+
spec.summary = "Fancy Notifications for your Flash Messages"
|
13
|
+
spec.description = "Fancy Notifications adds nice flash Notifications for your rails applications"
|
14
|
+
spec.homepage = "https://github.com/king601/fancynotifications"
|
15
|
+
|
16
|
+
spec.add_runtime_dependency 'sass', '>= 3.3.0'
|
17
|
+
spec.add_runtime_dependency 'font-awesome-rails'
|
18
|
+
# Dev Dependencies
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
20
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
21
|
+
|
22
|
+
|
23
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
spec.bindir = "exe"
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
//Fancy Notification Hide the NoticeWrapper
|
2
|
+
$(document).ready(function() {
|
3
|
+
setTimeout(function() {
|
4
|
+
$("#notice_wrapper").fadeOut("slow", function() {
|
5
|
+
$(this).remove();
|
6
|
+
})
|
7
|
+
}, 4500 );
|
8
|
+
$(".alert_close").click(function(e) {
|
9
|
+
e.preventDefault();
|
10
|
+
$("#notice_wrapper").remove();
|
11
|
+
})
|
12
|
+
});
|
@@ -0,0 +1,26 @@
|
|
1
|
+
$notification_text: #FFFFFF !default;
|
2
|
+
$notification_background: rgba(201, 70, 70, 0.85) !default;
|
3
|
+
|
4
|
+
#notice_wrapper {
|
5
|
+
position: absolute;
|
6
|
+
top: 0;
|
7
|
+
width: 100%;
|
8
|
+
z-index: 999;
|
9
|
+
background: $notification_background;
|
10
|
+
.alert, .notice {
|
11
|
+
padding: 2.5rem 0;
|
12
|
+
text-align: center;
|
13
|
+
margin: 0;
|
14
|
+
font-size: 1.25rem;
|
15
|
+
font-weight: 700;
|
16
|
+
color: $notification_text;
|
17
|
+
letter-spacing: 1px;
|
18
|
+
}
|
19
|
+
.alert_close {
|
20
|
+
float: right;
|
21
|
+
padding-right: 4rem;
|
22
|
+
font-size: 1.35rem;
|
23
|
+
color: $notification_text;
|
24
|
+
text-decoration: none;
|
25
|
+
}
|
26
|
+
}
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fancynotifications
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Fomera
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sass
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.3.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.3.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: font-awesome-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description: Fancy Notifications adds nice flash Notifications for your rails applications
|
70
|
+
email:
|
71
|
+
- andrew@zerlex.net
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- README.md
|
79
|
+
- Rakefile
|
80
|
+
- bin/console
|
81
|
+
- bin/setup
|
82
|
+
- fancynotifications.gemspec
|
83
|
+
- lib/fancynotifications.rb
|
84
|
+
- lib/fancynotifications/version.rb
|
85
|
+
- vendor/assets/javascripts/fancynotifications.js
|
86
|
+
- vendor/assets/stylesheets/fancynotifications.scss
|
87
|
+
homepage: https://github.com/king601/fancynotifications
|
88
|
+
licenses: []
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.4.5
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Fancy Notifications for your Flash Messages
|
110
|
+
test_files: []
|