peteonrails-simple_tooltips 0.0.1

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/INSTRUCTIONS ADDED
@@ -0,0 +1,17 @@
1
+ The Simple Tooltips plugin is now installed.
2
+
3
+ Please be sure that your application layout templates (where you want to use tooltips)
4
+ have the following code in them:
5
+
6
+ yield :head
7
+ yield :javascript
8
+
9
+ Ensure that yield :javascript appears after Prototype or jQuery are loaded.
10
+
11
+ To make a tooltip, do this in your views:
12
+
13
+ <div id="needs_tooltip">
14
+ Some content
15
+ </div>
16
+
17
+ <%= tooltip_for('needs_tooltip', 'This will be displayed when you mouseover Some content.') %>
data/LICENSE ADDED
@@ -0,0 +1 @@
1
+ MIT License
data/README ADDED
File without changes
@@ -0,0 +1,33 @@
1
+ module TooltipHelper
2
+ def tooltip_for(id, tip)
3
+
4
+ js = <<-EOJS
5
+ Event.observe($('#{id}'), 'mouseover', function () {
6
+ $('tooltip').innerHTML= "#{tip}"
7
+ $('tooltip').show()
8
+ return false
9
+ });
10
+
11
+ Event.observe($('#{id}'), 'mouseout', function (){
12
+ $('tooltip').hide()
13
+ });
14
+
15
+ document.observe('mousemove', function (e) {
16
+ if ($('tooltip').visible())
17
+ {
18
+ $('tooltip').setStyle('left: ' + e.pointerX() + 'px;');
19
+ $('tooltip').setStyle('top: ' + (e.pointerY() - 30) + 'px;');
20
+ }
21
+ });
22
+ EOJS
23
+ content_for :javascript do
24
+ javascript_tag js
25
+ end
26
+
27
+ content_for :head do
28
+ stylesheet_link_tag 'tooltip'
29
+ end
30
+
31
+ "<div id='tooltip' style='display: none'></div>"
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ # Mostly pinched from http://github.com/ryanb/nifty-generators/tree/master
2
+
3
+ Rails::Generator::Commands::Base.class_eval do
4
+ def file_contains?(relative_destination, line)
5
+ File.read(destination_path(relative_destination)).include?(line)
6
+ end
7
+ end
8
+
9
+ Rails::Generator::Commands::Create.class_eval do
10
+ def insert_into(file, line)
11
+ logger.insert "#{line} into #{file}"
12
+ unless options[:pretend] || file_contains?(file, line)
13
+ gsub_file file, /^(class|module) .+$/ do |match|
14
+ "#{match}\n #{line}"
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ Rails::Generator::Commands::Destroy.class_eval do
21
+ def insert_into(file, line)
22
+ logger.remove "#{line} from #{file}"
23
+ unless options[:pretend]
24
+ gsub_file file, "\n #{line}", ''
25
+ end
26
+ end
27
+ end
28
+
29
+ Rails::Generator::Commands::List.class_eval do
30
+ def insert_into(file, line)
31
+ logger.insert "#{line} into #{file}"
32
+ end
33
+ end
@@ -0,0 +1,8 @@
1
+ #tooltip {
2
+ position: absolute;
3
+ border: #ef7527 1px solid;
4
+ width: 150px;
5
+ padding: 5px;
6
+ background-color: #ffebce;
7
+ z-index: 100;
8
+ filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=115); }
@@ -0,0 +1,10 @@
1
+ /* This file is copied into yourapp/public/stylesheets/sass from the plugin every time your application starts. Do not edit this file. */
2
+
3
+ #tooltip
4
+ :position absolute
5
+ :border #000 1px solid
6
+ :width 150px
7
+ :padding 5px
8
+ :background-color #777
9
+ :z-index 100
10
+ filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=115)
@@ -0,0 +1,12 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
2
+ class TooltipGenerator < Rails::Generator::Base
3
+ def manifest
4
+ record do |m|
5
+ m.file "tooltip.css", "public/stylesheets/tooltip.css"
6
+ m.file "tooltip.sass", "public/stylesheets/tooltip.sass"
7
+ m.insert_into "app/controllers/application_controller.rb", "helper :tooltip"
8
+ m.insert_into "app/layouts/application.html.haml", "= yield :javascript"
9
+ m.readme "INSTRUCTIONS"
10
+ end
11
+ end
12
+ end
data/rails/init.rb ADDED
@@ -0,0 +1 @@
1
+ # Copy assets
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: peteonrails-simple_tooltips
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Peter Jackson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-16 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: pete @nospam@ peteonrails.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ files:
25
+ - app/helpers/tooltip_helper.rb
26
+ - generators/lib/insert_commands.rb
27
+ - generators/tooltip_generator.rb
28
+ - generators/templates/tooltip.css
29
+ - generators/templates/tooltip.sass
30
+ - rails/init.rb
31
+ - LICENSE
32
+ - INSTRUCTIONS
33
+ - README
34
+ has_rdoc: true
35
+ homepage:
36
+ licenses:
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.3.5
58
+ signing_key:
59
+ specification_version: 2
60
+ summary: A package for dead simple tooltips in the style that I like.
61
+ test_files: []
62
+