Flashatron 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/Flashatron.gemspec +59 -0
- data/MIT-LICENSE +21 -0
- data/README.md +39 -0
- data/Rakefile +36 -0
- data/VERSION +1 -0
- data/app/views/_flashatron.js.erb +6 -0
- data/app/views/layouts/application.js.erb +2 -0
- data/init.rb +4 -0
- data/lib/Flashatron.rb +12 -0
- data/lib/generators/USAGE +8 -0
- data/lib/generators/flashatron_generator.rb +30 -0
- data/spec/Flashatron_spec.rb +7 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +91 -0
data/.document
ADDED
data/.gitignore
ADDED
data/Flashatron.gemspec
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{Flashatron}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Dan Williams"]
|
12
|
+
s.date = %q{2010-02-27}
|
13
|
+
s.description = %q{Handle your flash notices etc via javascript. Why would you want to do this? It lets you easily handle flash notices from ajax calls.}
|
14
|
+
s.email = %q{dan.williams@itthugs.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".document",
|
20
|
+
".gitignore",
|
21
|
+
"Flashatron.gemspec",
|
22
|
+
"MIT-LICENSE",
|
23
|
+
"README.md",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"app/views/_flashatron.js.erb",
|
27
|
+
"app/views/layouts/application.js.erb",
|
28
|
+
"init.rb",
|
29
|
+
"lib/Flashatron.rb",
|
30
|
+
"lib/generators/USAGE",
|
31
|
+
"lib/generators/flashatron_generator.rb",
|
32
|
+
"spec/Flashatron_spec.rb",
|
33
|
+
"spec/spec.opts",
|
34
|
+
"spec/spec_helper.rb"
|
35
|
+
]
|
36
|
+
s.homepage = %q{http://github.com/deedubs/Flashatron}
|
37
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = %q{1.3.6}
|
40
|
+
s.summary = %q{There's a JS in my Flash Message}
|
41
|
+
s.test_files = [
|
42
|
+
"spec/Flashatron_spec.rb",
|
43
|
+
"spec/spec_helper.rb"
|
44
|
+
]
|
45
|
+
|
46
|
+
if s.respond_to? :specification_version then
|
47
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
48
|
+
s.specification_version = 3
|
49
|
+
|
50
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2009 Dan Williams
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Flashatron #
|
2
|
+
|
3
|
+
Handle your flash notices etc via javascript. Why would you want to do this? It lets you easily handle flash notices from ajax calls
|
4
|
+
|
5
|
+
## Installation ##
|
6
|
+
|
7
|
+
add flashatron to your 'Gemfile' and bundle install
|
8
|
+
|
9
|
+
## Useage ##
|
10
|
+
|
11
|
+
add to the bottom of your layout:
|
12
|
+
|
13
|
+
### :erb ###
|
14
|
+
|
15
|
+
<script type='text/javascript'>
|
16
|
+
//<![CDATA[
|
17
|
+
<%= render_flashes %>
|
18
|
+
});
|
19
|
+
//]]>
|
20
|
+
</script>
|
21
|
+
|
22
|
+
### :haml ###
|
23
|
+
|
24
|
+
:javascript
|
25
|
+
= render_flashes
|
26
|
+
|
27
|
+
### Note on Patches/Pull Requests ###
|
28
|
+
|
29
|
+
* Fork the project.
|
30
|
+
* Make your feature addition or bug fix.
|
31
|
+
* Add tests for it. This is important so I don't break it in a
|
32
|
+
future version unintentionally.
|
33
|
+
* Commit, do not mess with rakefile, version, or history.
|
34
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
35
|
+
* Send me a pull request. Bonus points for topic branches.
|
36
|
+
|
37
|
+
## Copyright ##
|
38
|
+
|
39
|
+
Copyright (c) 2010 Dan Williams. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "Flashatron"
|
8
|
+
gem.summary = %Q{There's a JS in my Flash Message}
|
9
|
+
gem.description = %Q{Handle your flash notices etc via javascript. Why would you want to do this? It lets you easily handle flash notices from ajax calls.}
|
10
|
+
gem.email = "dan.williams@itthugs.com"
|
11
|
+
gem.homepage = "http://github.com/deedubs/Flashatron"
|
12
|
+
gem.authors = ["Dan Williams"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'spec/rake/spectask'
|
22
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
+
spec.libs << 'lib' << 'spec'
|
24
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
+
spec.rcov = true
|
31
|
+
end
|
32
|
+
|
33
|
+
task :spec => :check_dependencies
|
34
|
+
|
35
|
+
task :default => :spec
|
36
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/init.rb
ADDED
data/lib/Flashatron.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Flashatron
|
2
|
+
module Flashatron
|
3
|
+
module ViewHelper
|
4
|
+
def render_flashes
|
5
|
+
render '/flashatron', :format => :js
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
ActionView::Helpers::AssetTagHelper.register_javascript_include_default('flashatron')
|
11
|
+
|
12
|
+
ActionView::Base.send :include, Flashatron::ViewHelper
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class FlashatronGenerator < Rails::Generators::Base
|
2
|
+
def self.source_root
|
3
|
+
@source_root ||= File.expand_path('../templates', __FILE__)
|
4
|
+
end
|
5
|
+
|
6
|
+
|
7
|
+
def create_js_file
|
8
|
+
create_file "public/javascripts/flashatron.js" do
|
9
|
+
<<-JS
|
10
|
+
var Flashatron = {
|
11
|
+
transitionTime: 500,
|
12
|
+
display: function (flash_message) {
|
13
|
+
var message = $('<div style="display:none">' + flash_message.text + '</div>');
|
14
|
+
$('#flash_' + flash_message.level, '#flashes').append(message);
|
15
|
+
message.show(this.transitionTime);
|
16
|
+
},
|
17
|
+
notice: function (flash_message) {
|
18
|
+
this.display($.extend({level: 'notice'}, flash_message));
|
19
|
+
},
|
20
|
+
error: function (flash_message) {
|
21
|
+
this.display($.extend({level: 'error'}, flash_message));
|
22
|
+
},
|
23
|
+
success: function (flash_message) {
|
24
|
+
this.display($.extend({level: 'success'}, flash_message));
|
25
|
+
}
|
26
|
+
}
|
27
|
+
JS
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Flashatron
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Dan Williams
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-02-27 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 9
|
31
|
+
version: 1.2.9
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
description: Handle your flash notices etc via javascript. Why would you want to do this? It lets you easily handle flash notices from ajax calls.
|
35
|
+
email: dan.williams@itthugs.com
|
36
|
+
executables: []
|
37
|
+
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files:
|
41
|
+
- README.md
|
42
|
+
files:
|
43
|
+
- .document
|
44
|
+
- .gitignore
|
45
|
+
- Flashatron.gemspec
|
46
|
+
- MIT-LICENSE
|
47
|
+
- README.md
|
48
|
+
- Rakefile
|
49
|
+
- VERSION
|
50
|
+
- app/views/_flashatron.js.erb
|
51
|
+
- app/views/layouts/application.js.erb
|
52
|
+
- init.rb
|
53
|
+
- lib/Flashatron.rb
|
54
|
+
- lib/generators/USAGE
|
55
|
+
- lib/generators/flashatron_generator.rb
|
56
|
+
- spec/Flashatron_spec.rb
|
57
|
+
- spec/spec.opts
|
58
|
+
- spec/spec_helper.rb
|
59
|
+
has_rdoc: true
|
60
|
+
homepage: http://github.com/deedubs/Flashatron
|
61
|
+
licenses: []
|
62
|
+
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options:
|
65
|
+
- --charset=UTF-8
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
requirements: []
|
83
|
+
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 1.3.6
|
86
|
+
signing_key:
|
87
|
+
specification_version: 3
|
88
|
+
summary: There's a JS in my Flash Message
|
89
|
+
test_files:
|
90
|
+
- spec/Flashatron_spec.rb
|
91
|
+
- spec/spec_helper.rb
|