jquery_notify_bar 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1,17 @@
1
- *.gem
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 CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in jquery_notify_bar.gemspec
4
4
  gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Jose Carlos Ustra Junior
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,106 @@
1
+ #JqueryNotifyBar
2
+
3
+ This is a simple ruby gem to include jquery.nofityBar from [Dmitri Smirnov](http://github.com/dknight/jQuery-Notify-bar) to your rails app.
4
+
5
+ jquery.notifyBar is a twitter like notification bar.
6
+
7
+ With this gem, all your flash messages will be showed in the nofity bar.
8
+
9
+ ## Installation
10
+
11
+ In your gem file add:
12
+
13
+ ```ruby
14
+ gem 'jquery_notify_bar'
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ### Rails 3.0
20
+
21
+ Add this files to your javascripts and stylesheets folders
22
+ ```
23
+ https://raw.github.com/ustrajunior/jquery_notify_bar/master/app/assets/javascripts/jquery.notify_bar.js
24
+ https://raw.github.com/ustrajunior/jquery_notify_bar/master/app/assets/stylesheets/jquery.notify_bar.css
25
+ ```
26
+
27
+ in the head section of your application.html.erb add this helper
28
+
29
+ ```rhtml
30
+ <%= jquery_notify_bar_assets %>
31
+ ```
32
+
33
+ ### Rails 3.1
34
+ On your application.js add
35
+
36
+ ```
37
+ //= require jquery.notify_bar
38
+ ```
39
+
40
+ On your application.css add
41
+
42
+ ```
43
+ *= require jquery.notify_bar
44
+ ```
45
+
46
+ ### In your application.html
47
+
48
+ ```rhtml
49
+ <%= jquery_notify_bar(flash) %>
50
+ ```
51
+
52
+ Remember to add the helper after
53
+
54
+ ```rhtml
55
+ <%= javascript_include_tag "application" %>
56
+ ```
57
+
58
+ Because it depends of jQuery.
59
+
60
+ ### Parameters
61
+
62
+ You can pass options too:
63
+
64
+ ```
65
+ :cls => :success
66
+ :animation_speed => 'normal'
67
+ :delay => 2000
68
+ ```
69
+
70
+ or all at the same time
71
+
72
+ ```rhtml
73
+ <%= jquery_notify_bar(flash, :cls => :success, :animation_speed => 'normal', :delay => 2000) %>
74
+ ```
75
+
76
+ ## TODO ##
77
+
78
+ * write rspec and jasmine tests
79
+ * improve the css
80
+
81
+ ## Maintainer ##
82
+
83
+ * José Carlos Ustra Júnior (http://ustrajunior.com)
84
+
85
+ ## License ##
86
+
87
+ (The MIT License)
88
+
89
+ Permission is hereby granted, free of charge, to any person obtaining
90
+ a copy of this software and associated documentation files (the
91
+ 'Software'), to deal in the Software without restriction, including
92
+ without limitation the rights to use, copy, modify, merge, publish,
93
+ distribute, sublicense, and/or sell copies of the Software, and to
94
+ permit persons to whom the Software is furnished to do so, subject to
95
+ the following conditions:
96
+
97
+ The above copyright notice and this permission notice shall be
98
+ included in all copies or substantial portions of the Software.
99
+
100
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
101
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
102
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
103
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
104
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
105
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
106
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1 +1,2 @@
1
- require 'bundler/gem_tasks'
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -1,20 +1,21 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "jquery_notify_bar/version"
2
+ require File.expand_path('../lib/jquery_notify_bar/version', __FILE__)
4
3
 
5
- Gem::Specification.new do |s|
6
- s.name = "jquery_notify_bar"
7
- s.version = JqueryNotifyBar::VERSION
8
- s.authors = ["Jose Carlos Ustra Junior"]
9
- s.email = ["contato@ustrajunior.com"]
10
- s.homepage = "http://ustrajunior.com/apps/jquery_notify_bar"
11
- s.summary = %q{jquery.notifyBar in your app}
12
- s.description = %q{A simple gem to include jquery.notifyBar to your rails app.}
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Jose Carlos Ustra Junior"]
6
+ gem.email = ["ustrajunior@gmail.com"]
7
+ gem.description = "A simple gem to include jquery.notifyBar to your rails app."
8
+ gem.summary = "jquery.notifyBar in your app"
9
+ gem.homepage = "http://ustrajunior.com/apps/jquery_notify_bar"
13
10
 
14
- s.rubyforge_project = "jquery_notify_bar"
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "jquery_notify_bar"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = JqueryNotifyBar::VERSION
17
+
18
+ gem.add_development_dependency 'rake'
19
+ gem.add_development_dependency 'rspec', '~> 2.8.0'
20
+ gem.add_development_dependency 'jasmine', '>= 1.1.1'
20
21
  end
@@ -1,2 +1,2 @@
1
1
  require "jquery_notify_bar/version"
2
- require 'jquery_notify_bar/railtie' if defined?(Rails)
2
+ require "jquery_notify_bar/engine" if defined? Rails
@@ -1,6 +1,8 @@
1
- require 'jquery_notify_bar/view_helpers'
1
+ require "jquery_notify_bar/view_helpers"
2
+
2
3
  module JqueryNotifyBar
3
- class Railtie < Rails::Railtie
4
+ class Engine < Rails::Engine
5
+ # Adds the ViewHelpers into ActionView::Base
4
6
  initializer "jquery_notify_bar.view_helpers" do
5
7
  ActionView::Base.send :include, ViewHelpers
6
8
  end
@@ -1,3 +1,3 @@
1
1
  module JqueryNotifyBar
2
- VERSION = "0.0.4"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -1,24 +1,29 @@
1
1
  module JqueryNotifyBar
2
2
  module ViewHelpers
3
- def include_jquery_notify_bar
4
- content =
5
- javascript_include_tag('jquery.notifyBar.js')
6
- content << "\n#{stylesheet_link_tag('jquery.notifyBar.css')}".html_safe
3
+ def jquery_notify_bar_assets
4
+ content = javascript_include_tag('jquery.notify_bar.js')
5
+ content += stylesheet_link_tag('jquery.notify_bar.css')
6
+ content.html_safe
7
7
  end
8
-
9
- def jquery_notify_bar(key, msg, opts = {})
10
- opts.reverse_merge! :flash => :notice, :delay => 2000, :animation_speed => 'normal', :cls => 'notice'
11
- content_tag :div, msg, :class => [key, " message"], :id => "notice_ #{key}"
12
- javascript_tag do
13
- %($(function () {
14
- $.notifyBar({
15
- html: '#{msg}',
16
- delay: #{opts[:delay]},
17
- animationSpeed: '#{opts[:animation_speed]}',
18
- cls: '#{opts[:cls]}'
19
- });
20
- });)
8
+
9
+ def jquery_notify_bar(flash, opts = {})
10
+ content = ''
11
+ unless flash.blank?
12
+ flash.each do |key, msg|
13
+ opts.reverse_merge! :flash => :notice, :delay => 2000, :animation_speed => 'normal', :cls => (key == :notice ? "success" : "error")
14
+ content += javascript_tag do
15
+ %($(function () {
16
+ $.notifyBar({
17
+ html: '#{msg}',
18
+ delay: #{opts[:delay]},
19
+ animationSpeed: '#{opts[:animation_speed]}',
20
+ cls: '#{opts[:cls]}'
21
+ });
22
+ });)
23
+ end
24
+ end
21
25
  end
22
- end
26
+ content.html_safe
27
+ end
23
28
  end
24
29
  end
@@ -0,0 +1,3 @@
1
+ describe("JqueryNotifyBar", function() {
2
+
3
+ });
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ Bundler.require(:default)
4
+
5
+ RSpec.configure do |config|
6
+ end
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
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,59 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-26 00:00:00.000000000 -03:00
13
- default_executable:
14
- dependencies: []
12
+ date: 2012-07-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 2.8.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.8.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: jasmine
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.1.1
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.1
15
62
  description: A simple gem to include jquery.notifyBar to your rails app.
16
63
  email:
17
- - contato@ustrajunior.com
64
+ - ustrajunior@gmail.com
18
65
  executables: []
19
66
  extensions: []
20
67
  extra_rdoc_files: []
@@ -22,16 +69,18 @@ files:
22
69
  - .gitignore
23
70
  - Gemfile
24
71
  - Gemfile.lock
25
- - README.rdoc
72
+ - LICENSE
73
+ - README.md
26
74
  - Rakefile
75
+ - app/assets/javascripts/jquery.notify_bar.js
76
+ - app/assets/stylesheets/jquery.notify_bar.css
27
77
  - jquery_notify_bar.gemspec
28
78
  - lib/jquery_notify_bar.rb
29
- - lib/jquery_notify_bar/railtie.rb
79
+ - lib/jquery_notify_bar/engine.rb
30
80
  - lib/jquery_notify_bar/version.rb
31
81
  - lib/jquery_notify_bar/view_helpers.rb
32
- - public/javascripts/jquery.notifyBar.js
33
- - public/stylesheets/jquery.notifyBar.css
34
- has_rdoc: true
82
+ - spec/javascripts/jquery_notify_bar_spec.js
83
+ - spec/spec_helper.rb
35
84
  homepage: http://ustrajunior.com/apps/jquery_notify_bar
36
85
  licenses: []
37
86
  post_install_message:
@@ -51,9 +100,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
100
  - !ruby/object:Gem::Version
52
101
  version: '0'
53
102
  requirements: []
54
- rubyforge_project: jquery_notify_bar
55
- rubygems_version: 1.6.2
103
+ rubyforge_project:
104
+ rubygems_version: 1.8.24
56
105
  signing_key:
57
106
  specification_version: 3
58
107
  summary: jquery.notifyBar in your app
59
- test_files: []
108
+ test_files:
109
+ - spec/javascripts/jquery_notify_bar_spec.js
110
+ - spec/spec_helper.rb
data/README.rdoc DELETED
@@ -1,46 +0,0 @@
1
- =JqueryNotifyBar
2
-
3
- This is a simple ruby gem to include jquery.nofityBar from {Dmitri Smirnov}[http://github.com/dknight/jQuery-Notify-bar] to your rails app.
4
-
5
- jquery.notifyBar is a twitter like notification bar.
6
-
7
- With this gem, all your flash messages will be showed in the nofity bar. Visit the {demo page}[http://www.dmitri.me/misc/notify/] on Dmitri's website
8
-
9
- ==Installation
10
-
11
- In your gem file add:
12
-
13
- gem 'jquery_notify_bar'
14
-
15
- You need copy this files to your stylesheets and javascripts folder
16
-
17
- https://github.com/ustrajunior/jquery_notify_bar/blob/master/public/javascripts/jquery.notifyBar.js
18
- https://github.com/ustrajunior/jquery_notify_bar/blob/master/public/stylesheets/jquery.notifyBar.css
19
-
20
- ==Usage
21
-
22
- You just need add to helper in your layout page.
23
-
24
- The first one you need put in your head section. It will include the required css and javascripts files.
25
-
26
- <%= include_jquery_notify_bar %>
27
-
28
- the seconde helper is to show the messages, you just need put it in your body
29
-
30
- <%= jquery_notify_bar %>
31
-
32
- ==Parameters
33
-
34
- You can pass options too:
35
-
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 %>
43
-
44
- This gem was inspired in the notify_bar[https://github.com/emrekutlu/notify_bar] {by İ. Emre Kutlu}[https://github.com/emrekutlu]
45
-
46
- Copyright (c) 2011 {Jose Carlos Ustra Junior}[http://ustrajunior.com], released under the MIT license