happyerrorsnotices 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +54 -0
- data/Rakefile +2 -0
- data/app/views/layouts/_errorsnotices.html.haml +7 -0
- data/happyerrorsnotices.gemspec +15 -0
- data/lib/happyerrorsnotices/rails/engine.rb +6 -0
- data/lib/happyerrorsnotices/rails/version.rb +5 -0
- data/lib/happyerrorsnotices/rails.rb +7 -0
- data/lib/happyerrorsnotices.rb +1 -0
- data/vendor/assets/javascripts/errors.js.coffee +11 -0
- data/vendor/assets/javascripts/notices.js.coffee +16 -0
- data/vendor/assets/stylesheets/errors.css.scss +3 -0
- data/vendor/assets/stylesheets/notices.css.scss +33 -0
- metadata +60 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Fabio Russo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Happyerrorsnotices
|
2
|
+
|
3
|
+
A simple ready made notices and errors implementation for use within coffeescript or rails
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'happyerrorsnotices'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle install
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install happyerrorsnotices
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
in application.js you need:
|
22
|
+
|
23
|
+
//=require errors
|
24
|
+
//=require notices
|
25
|
+
|
26
|
+
in application.css you need to include
|
27
|
+
|
28
|
+
*=require errors
|
29
|
+
*=require notices
|
30
|
+
|
31
|
+
And include this partial in your view:
|
32
|
+
|
33
|
+
= render partial: 'layouts/errorsnotices'
|
34
|
+
|
35
|
+
From within a coffeescript file you can show a notice/error like this:
|
36
|
+
|
37
|
+
n = new Notices
|
38
|
+
n.setMessage "This is a notice!"
|
39
|
+
n.show()
|
40
|
+
|
41
|
+
e = new Errors
|
42
|
+
e.setErrorMessage "Error message!"
|
43
|
+
e.show()
|
44
|
+
|
45
|
+
Also the flash[:error] and flash[:notice] messages from your controllers will be shown the same way
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create new Pull Request
|
54
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/happyerrorsnotices/rails/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Fabio Russo"]
|
6
|
+
gem.email = ["fabio@objectivesheep.com"]
|
7
|
+
gem.platform = Gem::Platform::RUBY
|
8
|
+
gem.description = %q{A simple flash errors and notices with jquery for rails}
|
9
|
+
gem.summary = ""
|
10
|
+
gem.homepage = "http://objectivesheep.com"
|
11
|
+
gem.require_paths = ["lib"]
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.name = "happyerrorsnotices"
|
14
|
+
gem.version = Happyerrorsnotices::Rails::VERSION
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'happyerrorsnotices/rails'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class @Errors
|
2
|
+
|
3
|
+
constructor: ->
|
4
|
+
$("#notices p.error").remove()
|
5
|
+
|
6
|
+
setErrorMessage: (msg) ->
|
7
|
+
$("#notices p.error").remove()
|
8
|
+
$("#notices p.notice").remove()
|
9
|
+
$("#notices").show().append "<p class=\"error\">" + msg + "</p>"
|
10
|
+
$("#notices").delay(3000)
|
11
|
+
$("#notices").fadeOut("fast")
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class @Notices
|
2
|
+
|
3
|
+
show: ->
|
4
|
+
$("#notices").show() if $("#notices p").length
|
5
|
+
$("#notices .close").click ->
|
6
|
+
$("#notices").hide()
|
7
|
+
$(this).siblings().remove()
|
8
|
+
$("#notices").delay(4000)
|
9
|
+
$("#notices").fadeOut("fast")
|
10
|
+
|
11
|
+
setMessage: (msg) ->
|
12
|
+
$("#notices p.error").remove()
|
13
|
+
$("#notices p.notice").remove()
|
14
|
+
$("#notices").show().append "<p class=\"notice\">" + msg + "</p>"
|
15
|
+
$("#notices").delay(3000)
|
16
|
+
$("#notices").fadeOut("fast")
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#notices
|
2
|
+
{
|
3
|
+
text-align: center;
|
4
|
+
display: none;
|
5
|
+
position: relative;
|
6
|
+
background-color: #FF8623;
|
7
|
+
font-size: 14px;
|
8
|
+
padding: 10px;
|
9
|
+
margin: 35px auto;
|
10
|
+
color: white;
|
11
|
+
width: 800px;
|
12
|
+
|
13
|
+
min-height: 18px;
|
14
|
+
-moz-border-radius: 6px;
|
15
|
+
-webkit-border-radius: 6px;
|
16
|
+
-khtml-border-radius: 6px;
|
17
|
+
border-radius: 6px;
|
18
|
+
.close {
|
19
|
+
&:link, &:visited {
|
20
|
+
color: white;
|
21
|
+
float:right;
|
22
|
+
text-transform: uppercase;
|
23
|
+
text-decoration: none;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
p{
|
27
|
+
padding: 10px;
|
28
|
+
}
|
29
|
+
.error {
|
30
|
+
}
|
31
|
+
.notice {
|
32
|
+
}
|
33
|
+
}
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: happyerrorsnotices
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Fabio Russo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-25 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A simple flash errors and notices with jquery for rails
|
15
|
+
email:
|
16
|
+
- fabio@objectivesheep.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- app/views/layouts/_errorsnotices.html.haml
|
27
|
+
- happyerrorsnotices.gemspec
|
28
|
+
- lib/happyerrorsnotices.rb
|
29
|
+
- lib/happyerrorsnotices/rails.rb
|
30
|
+
- lib/happyerrorsnotices/rails/engine.rb
|
31
|
+
- lib/happyerrorsnotices/rails/version.rb
|
32
|
+
- vendor/assets/javascripts/errors.js.coffee
|
33
|
+
- vendor/assets/javascripts/notices.js.coffee
|
34
|
+
- vendor/assets/stylesheets/errors.css.scss
|
35
|
+
- vendor/assets/stylesheets/notices.css.scss
|
36
|
+
homepage: http://objectivesheep.com
|
37
|
+
licenses: []
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 1.8.24
|
57
|
+
signing_key:
|
58
|
+
specification_version: 3
|
59
|
+
summary: ''
|
60
|
+
test_files: []
|