happyerrorsnotices 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in happydatepicker.gemspec
4
+ gemspec
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,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,7 @@
1
+ #notices
2
+
3
+ / %a{class: 'close', href: '#'} x
4
+ - unless flash[:notice].blank?
5
+ %p.notice= flash[:notice]
6
+ - unless flash[:error].blank?
7
+ %p.error= flash[:error]
@@ -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,6 @@
1
+ module Happyerrorsnotices
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Happyerrorsnotices
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'happyerrorsnotices/rails/engine'
2
+ require 'happyerrorsnotices/rails/version'
3
+
4
+ module Happyerrorsnotices
5
+ module Rails
6
+ end
7
+ 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,3 @@
1
+ // Place all the styles related to the errors controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -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: []