michael_hintbuble 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ *.gem
data/.specification ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: michael_hintbuble
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 5
10
+ version: 0.1.5
11
+ platform: ruby
12
+ authors:
13
+ - Coroutine
14
+ - Tim Lowrimore
15
+ - John Dugan
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2010-10-10 00:00:00 -05:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: actionpack
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 11
32
+ segments:
33
+ - 2
34
+ - 3
35
+ - 4
36
+ version: 2.3.4
37
+ type: :runtime
38
+ version_requirements: *id001
39
+ - !ruby/object:Gem::Dependency
40
+ name: activesupport
41
+ prerelease: false
42
+ requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 11
48
+ segments:
49
+ - 2
50
+ - 3
51
+ - 4
52
+ version: 2.3.4
53
+ type: :development
54
+ version_requirements: *id002
55
+ description: Michael HintBuble allows you to generate hint bubbles and tooltips in Rails applications using the same syntax used for rendering templates.
56
+ email: gems@coroutine.com
57
+ executables: []
58
+
59
+ extensions: []
60
+
61
+ extra_rdoc_files:
62
+ - README.rdoc
63
+ files:
64
+ - .gitignore
65
+ - .specification
66
+ - MIT-LICENSE
67
+ - README.rdoc
68
+ - Rakefile
69
+ - VERSION
70
+ - generators/michael_hintbuble/michael_hintbuble_generator.rb
71
+ - generators/michael_hintbuble/templates/michael_hintbuble.css
72
+ - generators/michael_hintbuble/templates/michael_hintbuble.js
73
+ - generators/michael_hintbuble/templates/michael_hintbuble_pointer.png
74
+ - init.rb
75
+ - lib/generators/michael_hintbuble/michael_hintbuble_generator.rb
76
+ - lib/generators/michael_hintbuble/templates/michael_hintbuble.css
77
+ - lib/generators/michael_hintbuble/templates/michael_hintbuble.js
78
+ - lib/generators/michael_hintbuble/templates/michael_hintbuble_pointer.png
79
+ - lib/michael_hintbuble.rb
80
+ - lib/michael_hintbuble/helpers.rb
81
+ - michael_hintbuble.gemspec
82
+ - rails/init.rb
83
+ - test/michael_hintbuble/helpers_test.rb
84
+ - test/test_helper.rb
85
+ has_rdoc: true
86
+ homepage: http://github.com/coroutine/michael_hintbuble
87
+ licenses: []
88
+
89
+ post_install_message:
90
+ rdoc_options:
91
+ - --charset=UTF-8
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ requirements: []
113
+
114
+ rubyforge_project:
115
+ rubygems_version: 1.3.7
116
+ signing_key:
117
+ specification_version: 3
118
+ summary: Dead simple, beautiful hint bubbles for Rails.
119
+ test_files:
120
+ - test/michael_hintbuble/helpers_test.rb
121
+ - test/test_helper.rb
122
+
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Coroutine LLC
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.
data/README.rdoc ADDED
@@ -0,0 +1,201 @@
1
+ = Michael Hintbuble
2
+
3
+ Hiya.
4
+
5
+ I'm Michael Hintbuble. A lot of people confuse me with the singer who rose to fame singing jazz
6
+ standards, but I'm a different guy altogether.
7
+
8
+ Don't get me wrong, that Michael and I are into a lot of the same things, like dating Emily Blunt and
9
+ opening fictitious restaurants with Jon Hamm. But while that Michael spent his career focused on smooth
10
+ vocal stylings and making ladies of all nationalities swoon, I only care about one thing.
11
+
12
+ <b>Freakin' Hint Bubbles</b>.
13
+
14
+ If you're a Rails developer who wants to use hint bubbles but doesn't want to mess with Javascript, I
15
+ suggest you get yourself a firmer grip on your knickers.
16
+
17
+ Check it. If you want my hint bubble anchored to an element in one of your views, here's what you do:
18
+
19
+ # Define the target
20
+ <div id="restaurant_header">Hamm and Buble</div>
21
+
22
+ # Create and attach the bubble
23
+ <%= render_bubble :restaurant_header,
24
+ :position => :right, :event_names => [:mouseover],
25
+ :partial => "map", :locals => { :address => @restaurant.address } %>
26
+
27
+ That's pretty much it. Did you notice how <tt>render_bubble</tt> takes the same options as
28
+ <tt>render</tt>? The content for your bubble can just be a regular old partial.
29
+
30
+ Boom.
31
+
32
+ What's that, you want a few more details? You got it, bro.
33
+
34
+ <tt>render_bubble</tt> always needs the unique id for the target element as its first argument. After
35
+ that, it will take the same options as <tt>ActionController::Base#render</tt>. It'll also take a few
36
+ more, namely:
37
+
38
+ * <tt>:class</tt> - the css style to assign to the outermost div container (defaults to "michael_hintbuble_bubble")
39
+ * <tt>:style</tt> - additional css style assignments for the outermost div container (defaults to "")
40
+ * <tt>:position</tt> - css-style value that specifies the hint bubble's relative position, e.g., top, bottom, right, or left (defaults to right)
41
+ * <tt>:event_names</tt> - an array of strings specifying the events that should trigger the display of the hint bubble (accepts focus and/or mouseover)
42
+ * <tt>:before_show</tt> - a Javascript function that will be invoked before the hint bubble is shown
43
+ * <tt>:after_show</tt> - a Javascript function that will be invoked after the hint bubble has been shown
44
+ * <tt>:before_hide</tt> - a Javascript function that will be invoked before the hint bubble is hidden
45
+ * <tt>:after_hide</tt> - a Javascript function that will be invoked after the hint bubble has been hidden
46
+ * <tt>&block</tt> - HTML markup that will be automatically converted to render's inline option
47
+
48
+ Here's an example using the <tt>before_show</tt> option with block notation:
49
+
50
+ # Define the target
51
+ <div id="cry_for_help">I have a feeling that he's standing right behind me.</div>
52
+
53
+ # Create and attach the bubble
54
+ <%= render_bubble :cry_for_help, :position => :bottom, :before_show => "function() { JonHamm.eyes.goBlack(); }" %>
55
+ <div>You are on the thinnest of ice.</div>
56
+ <% end %>
57
+
58
+ If you need more help than that, maybe you should just look at the source code. There are a ton of comments
59
+ in there.
60
+
61
+
62
+ Cheers,
63
+
64
+ Michael Hintbuble
65
+
66
+
67
+
68
+ == Multiple Hint Bubble Styles
69
+
70
+ If you need to style more than one kind of hint bubble (e.g., one style for tooltips, one style for errors), just
71
+ use the <tt>:class</tt> option to set a new css class name on the outermost div. That'll give you a logical anchor
72
+ around which you can restyle all the interior classes.
73
+
74
+ Please note that the blocking iframe is automatically given a class name equal to the outermost div's class name plus
75
+ the string "_frame".
76
+
77
+ By default, the top-level class assignments are "michael_hintbuble_bubble" and "michael_hintbuble_bubble_frame".
78
+
79
+ If you set the <tt>:class</tt> option to <tt>:error_bubble</tt>, the top-level class assignments will be
80
+ "error_bubble" and "errorbubble_frame".
81
+
82
+ The <tt>:style</tt> option can be used to provide one-off styling, as needed.
83
+
84
+
85
+
86
+ == Positioning Notes
87
+
88
+ Windows get resized, documents and divs scroll, stuff happens. Sometimes the area in which you intended for a
89
+ hint bubble to appear ends up off the viewport. Which kind of screws the whole hint bubble UI pattern.
90
+
91
+ Good thing I'm so friendly. Here's what I can do to help.
92
+
93
+ If you tell me to position the bubble to one side of the target and the bubble can't fit in the viewport over
94
+ there, I'll just place it on the opposite side. If it doesn't fit over there either, I'll just give up and
95
+ put it where you told me in the first place. I'm not a mindreader, you know.
96
+
97
+
98
+
99
+ == IE6 Support
100
+
101
+ I'm not what you'd call a huge fan of IE6, so I don't provide a blocking
102
+ iframe for my hint bubbles by default. But I can. You just need to ask nicely.
103
+
104
+ At the top of the generated javascript file, just change the obviously-named property
105
+ hanging right off of the main namespace. Like this.
106
+
107
+ MichaelHintbuble.SUPPORT_IE6_BULLSHIT = true;
108
+
109
+ That's it. I do the rest.
110
+
111
+
112
+
113
+ == Helpful Links
114
+
115
+ * <b>Repository:</b> http://github.com/coroutine/michael_hintbuble
116
+ * <b>Gem:</b> http://rubygems.org/gems/michael_hintbuble
117
+ * <b>Authors:</b> http://coroutine.com
118
+
119
+
120
+
121
+ == Prerequisites
122
+
123
+ If you want to come fly with me, you'll need to invite the other members of my trio, Prototype and Scriptaculous.
124
+
125
+ But since I was designed as a Rails extension, chances are you already have my bandmates
126
+ in the mix.
127
+
128
+ * <b>Prototype:</b> http://prototypejs.org
129
+ * <b>Scriptaculous:</b> http://script.aculo.us
130
+
131
+
132
+
133
+ == Installation & Generators (Rails 2)
134
+
135
+ Install me from RubyGems.org and add a gem dependency in the appropriate file.
136
+
137
+ $ gem install michael_hintbuble
138
+
139
+ Or install me as a plugin.
140
+
141
+ $ script/plugin install git://github.com/coroutine/michael_hintbuble.git
142
+
143
+ Either way, then generate the required javascript file and the starter
144
+ stylesheet and image.
145
+
146
+ $ script/generate michael_hintbuble
147
+
148
+
149
+
150
+ == Installation & Generators (Rails 3)
151
+
152
+ Install me from RubyGems.org by adding a gem dependency to your Gemfile. Bundler does
153
+ the rest.
154
+
155
+ gem "michael_hintbuble"
156
+
157
+ $ bundle install
158
+
159
+ Then generate the required javascript file and the starter stylesheet and image.
160
+
161
+ $ rails g michael_hintbuble
162
+
163
+
164
+
165
+ == Gemroll
166
+
167
+ If you think I'm awesome, you should check out my soulmate
168
+ {Kenny Dialoggins}[http://github.com/coroutine/kenny_dialoggins].
169
+
170
+ Other gems by Coroutine include:
171
+
172
+ * {acts_as_current}[http://github.com/coroutine/acts_as_current]
173
+ * {acts_as_label}[http://github.com/coroutine/acts_as_label]
174
+ * {acts_as_list_with_sti_support}[http://github.com/coroutine/acts_as_list_with_sti_support]
175
+ * {delayed_form_observer}[http://github.com/coroutine/delayed_form_observer]
176
+ * {tiny_navigation}[http://github.com/coroutine/tiny_navigation]
177
+
178
+
179
+
180
+ == License
181
+
182
+ Copyright (c) 2010 {Coroutine LLC}[http://coroutine.com].
183
+
184
+ Permission is hereby granted, free of charge, to any person obtaining
185
+ a copy of this software and associated documentation files (the
186
+ "Software"), to deal in the Software without restriction, including
187
+ without limitation the rights to use, copy, modify, merge, publish,
188
+ distribute, sublicense, and/or sell copies of the Software, and to
189
+ permit persons to whom the Software is furnished to do so, subject to
190
+ the following conditions:
191
+
192
+ The above copyright notice and this permission notice shall be
193
+ included in all copies or substantial portions of the Software.
194
+
195
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
196
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
197
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
198
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
199
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
200
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
201
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ require "rake"
2
+ require "rake/testtask"
3
+ require "rake/rdoctask"
4
+ require "jeweler"
5
+
6
+
7
+ desc "Default: run tests."
8
+ task :default => [:test]
9
+
10
+
11
+ desc "Test the plugin."
12
+ Rake::TestTask.new(:test) do |t|
13
+ t.libs << "lib"
14
+ t.pattern = "test/**/*_test.rb"
15
+ t.verbose = true
16
+ end
17
+
18
+
19
+ desc "Generate documentation for the plugin."
20
+ Rake::RDocTask.new(:rdoc) do |rdoc|
21
+ rdoc.rdoc_dir = "rdoc"
22
+ rdoc.title = "michael_hintbuble"
23
+ rdoc.options << "--line-numbers --inline-source"
24
+ rdoc.rdoc_files.include("README")
25
+ rdoc.rdoc_files.include("lib/**/*.rb")
26
+ end
27
+
28
+
29
+ begin
30
+ Jeweler::Tasks.new do |gemspec|
31
+ gemspec.authors = ["Coroutine", "Tim Lowrimore", "John Dugan"]
32
+ gemspec.description = "Michael HintBuble allows you to generate hint bubbles and tooltips in Rails applications using the same syntax used for rendering templates."
33
+ gemspec.email = "gems@coroutine.com"
34
+ gemspec.homepage = "http://github.com/coroutine/michael_hintbuble"
35
+ gemspec.name = "michael_hintbuble"
36
+ gemspec.summary = "Dead simple, beautiful hint bubbles for Rails."
37
+
38
+ gemspec.add_dependency("actionpack", ">=2.3.4")
39
+ gemspec.add_development_dependency("activesupport", ">=2.3.4")
40
+
41
+ gemspec.files.include("generators/**/*", "lib/**/*")
42
+ gemspec.files.include("test/**/*")
43
+ end
44
+ Jeweler::GemcutterTasks.new
45
+ rescue LoadError
46
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
47
+ end
48
+
49
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,13 @@
1
+ class MichaelHintbubleGenerator < Rails::Generator::Base
2
+
3
+ # This method copies stylesheet and javascript files to the
4
+ # corresponding public directories.
5
+ #
6
+ def manifest
7
+ record do |m|
8
+ m.file "michael_hintbuble_pointer.png", "public/images/michael_hintbuble_pointer.png"
9
+ m.file "michael_hintbuble.css", "public/stylesheets/michael_hintbuble.css"
10
+ m.file "michael_hintbuble.js", "public/javascripts/michael_hintbuble.js"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,48 @@
1
+ /**
2
+ * These styles are provided as examples. Feel free to change them however you like.
3
+ * Go ahead, see if we fucking care.
4
+ */
5
+
6
+ .michael_hintbuble_bubble_frame {
7
+ position: absolute;
8
+ border: none;
9
+ z-index: 1;
10
+ filter: alpha(opacity=0); /* really only needed if ie6 suport is enabled */
11
+ }
12
+
13
+ .michael_hintbuble_bubble {
14
+ position: absolute;
15
+ top: 0;
16
+ left: 0;
17
+ z-index: 2;
18
+ filter: alpha(opacity=100); /* really only needed if ie6 suport is enabled */
19
+ width: 240px;
20
+ }
21
+ .michael_hintbuble_bubble .container {
22
+ margin: 2px;
23
+ padding: 8px;
24
+ font-size: .85em;
25
+ }
26
+ .michael_hintbuble_bubble .container .content {
27
+ padding: 8px;
28
+ background: #333;
29
+ color: #FFF;
30
+ border-radius: 2px;
31
+ -moz-border-radius: 2px;
32
+ -webkit-border-radius: 2px;
33
+ }
34
+ .michael_hintbuble_bubble .bottom,
35
+ .michael_hintbuble_bubble .left,
36
+ .michael_hintbuble_bubble .right,
37
+ .michael_hintbuble_bubble .top {
38
+ background: url('../images/michael_hintbuble_pointer.png') no-repeat bottom;
39
+ }
40
+ .michael_hintbuble_bubble .bottom {
41
+ background-position: top;
42
+ }
43
+ .michael_hintbuble_bubble .left {
44
+ background-position: right;
45
+ }
46
+ .michael_hintbuble_bubble .right {
47
+ background-position: left;
48
+ }