tipsy-rails 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ tmp
3
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source :gemcutter
2
+
3
+ # Specify your gem's dependencies in jquery-rails.gemspec
4
+ gemspec
5
+ # Rails is already being pulled in through gemspec
6
+ # gem "rails", :git => "git://github.com/rails/rails.git"
7
+ gem "rack", :git => "git://github.com/rack/rack.git"
8
+ gem "sprockets", :git => "git://github.com/sstephenson/sprockets.git"
9
+ gem "i18n", "0.6.0beta1"
@@ -0,0 +1,120 @@
1
+ GIT
2
+ remote: git://github.com/rack/rack.git
3
+ revision: a9beb476b27914794743d0677b327d5bafb5e8a3
4
+ specs:
5
+ rack (1.2.1)
6
+
7
+ GIT
8
+ remote: git://github.com/rails/rails.git
9
+ revision: 2fbbd08616c25dc2931eca914349dd2161766f69
10
+ specs:
11
+ actionmailer (3.1.0.beta)
12
+ actionpack (= 3.1.0.beta)
13
+ mail (~> 2.3.0)
14
+ actionpack (3.1.0.beta)
15
+ activemodel (= 3.1.0.beta)
16
+ activesupport (= 3.1.0.beta)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ i18n (~> 0.6.0beta1)
20
+ rack (~> 1.2.1)
21
+ rack-cache (~> 1.0.0)
22
+ rack-mount (~> 0.7.2)
23
+ rack-test (~> 0.5.7)
24
+ sprockets (~> 2.0.0.beta.2)
25
+ tzinfo (~> 0.3.23)
26
+ activemodel (3.1.0.beta)
27
+ activesupport (= 3.1.0.beta)
28
+ bcrypt-ruby (~> 2.1.4)
29
+ builder (~> 3.0.0)
30
+ i18n (~> 0.6.0beta1)
31
+ activerecord (3.1.0.beta)
32
+ activemodel (= 3.1.0.beta)
33
+ activesupport (= 3.1.0.beta)
34
+ arel (~> 2.1.0)
35
+ tzinfo (~> 0.3.23)
36
+ activeresource (3.1.0.beta)
37
+ activemodel (= 3.1.0.beta)
38
+ activesupport (= 3.1.0.beta)
39
+ activesupport (3.1.0.beta)
40
+ multi_json (~> 1.0.0)
41
+ rails (3.1.0.beta)
42
+ actionmailer (= 3.1.0.beta)
43
+ actionpack (= 3.1.0.beta)
44
+ activerecord (= 3.1.0.beta)
45
+ activeresource (= 3.1.0.beta)
46
+ activesupport (= 3.1.0.beta)
47
+ bundler (~> 1.0)
48
+ railties (= 3.1.0.beta)
49
+ railties (3.1.0.beta)
50
+ actionpack (= 3.1.0.beta)
51
+ activesupport (= 3.1.0.beta)
52
+ rack-ssl (~> 1.3.2)
53
+ rake (>= 0.8.7)
54
+ thor (~> 0.14.4)
55
+
56
+ GIT
57
+ remote: git://github.com/sstephenson/sprockets.git
58
+ revision: c4800417792744c11eb1fb888bbe9a3a82859952
59
+ specs:
60
+ sprockets (2.0.0.beta.2)
61
+ hike (~> 1.0)
62
+ rack (~> 1.0)
63
+ tilt (~> 1.0)
64
+
65
+ PATH
66
+ remote: .
67
+ specs:
68
+ jquery-rails (0.3)
69
+ rails (~> 3.1)
70
+ thor (~> 0.14.4)
71
+
72
+ GEM
73
+ remote: http://rubygems.org/
74
+ specs:
75
+ addressable (2.2.4)
76
+ arel (2.1.0)
77
+ bcrypt-ruby (2.1.4)
78
+ builder (3.0.0)
79
+ crack (0.1.8)
80
+ erubis (2.7.0)
81
+ hike (1.0.0)
82
+ i18n (0.6.0beta1)
83
+ mail (2.3.0)
84
+ i18n (>= 0.4.0)
85
+ mime-types (~> 1.16)
86
+ treetop (~> 1.4.8)
87
+ mime-types (1.16)
88
+ multi_json (1.0.0)
89
+ polyglot (0.3.1)
90
+ rack-cache (1.0.1)
91
+ rack (>= 0.4)
92
+ rack-mount (0.7.2)
93
+ rack (>= 1.0.0)
94
+ rack-ssl (1.3.2)
95
+ rack
96
+ rack-test (0.5.7)
97
+ rack (>= 1.0)
98
+ rake (0.8.7)
99
+ rspec (1.3.1)
100
+ thor (0.14.6)
101
+ tilt (1.3)
102
+ treetop (1.4.9)
103
+ polyglot (>= 0.3.1)
104
+ tzinfo (0.3.27)
105
+ webmock (1.6.2)
106
+ addressable (>= 2.2.2)
107
+ crack (>= 0.1.7)
108
+
109
+ PLATFORMS
110
+ ruby
111
+
112
+ DEPENDENCIES
113
+ bundler (~> 1.0.0)
114
+ i18n (= 0.6.0beta1)
115
+ jquery-rails!
116
+ rack!
117
+ rails!
118
+ rspec (~> 1.3)
119
+ sprockets!
120
+ webmock (~> 1.6.2)
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 Nick Ragaz
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+ # tipsy-rails
2
+
3
+ This gem provides the jQuery Tipsy plugin for your Rails 3.1 app.
4
+
5
+ For more information about Tipsy, visit http://onehackoranother.com/projects/jquery/tipsy/
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1 @@
1
+ require 'tipsy/rails'
@@ -0,0 +1,6 @@
1
+ module Tipsy
2
+ module Rails
3
+ require 'tipsy/rails/engine'
4
+ require 'tipsy/rails/version'
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Tipsy
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Tipsy
2
+ module Rails
3
+ VERSION = "1.0.2"
4
+ TIPSY_VERSION = "1.0.0a"
5
+ end
6
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/tipsy/rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "tipsy-rails"
6
+ s.version = Tipsy::Rails::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Nick Ragaz"]
9
+ s.email = ["nick.ragaz@gmail.com"]
10
+ s.homepage = "http://rubygems.org/gems/tipsy-rails"
11
+ s.summary = "Use the Tipsy jQuery plugin with Rails 3.1"
12
+ s.description = "This gem provides the Tipsy jQuery plugin for your Rails 3.1 application."
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+
16
+ s.add_dependency "railties", "~> 3.0"
17
+ s.add_dependency "thor", "~> 0.14"
18
+ s.add_development_dependency "bundler", "~> 1.0.0"
19
+ s.add_development_dependency "rails", "~> 3.0"
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
23
+ s.require_path = 'lib'
24
+ end
@@ -0,0 +1,202 @@
1
+ // tipsy, facebook style tooltips for jquery
2
+ // version 1.0.0a
3
+ // (c) 2008-2010 jason frame [jason@onehackoranother.com]
4
+ // released under the MIT license
5
+
6
+ (function($) {
7
+
8
+ function Tipsy(element, options) {
9
+ this.$element = $(element);
10
+ this.options = options;
11
+ this.enabled = true;
12
+ this.fixTitle();
13
+ }
14
+
15
+ Tipsy.prototype = {
16
+ show: function() {
17
+ var title = this.getTitle();
18
+ if (title && this.enabled) {
19
+ var $tip = this.tip();
20
+
21
+ $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
22
+ $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
23
+ $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
24
+
25
+ var pos = $.extend({}, this.$element.offset(), {
26
+ width: this.$element[0].offsetWidth,
27
+ height: this.$element[0].offsetHeight
28
+ });
29
+
30
+ var actualWidth = $tip[0].offsetWidth, actualHeight = $tip[0].offsetHeight;
31
+ var gravity = (typeof this.options.gravity == 'function')
32
+ ? this.options.gravity.call(this.$element[0])
33
+ : this.options.gravity;
34
+
35
+ var tp;
36
+ switch (gravity.charAt(0)) {
37
+ case 'n':
38
+ tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
39
+ break;
40
+ case 's':
41
+ tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
42
+ break;
43
+ case 'e':
44
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
45
+ break;
46
+ case 'w':
47
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
48
+ break;
49
+ }
50
+
51
+ if (gravity.length == 2) {
52
+ if (gravity.charAt(1) == 'w') {
53
+ tp.left = pos.left + pos.width / 2 - 15;
54
+ } else {
55
+ tp.left = pos.left + pos.width / 2 - actualWidth + 15;
56
+ }
57
+ }
58
+
59
+ $tip.css(tp).addClass('tipsy-' + gravity);
60
+
61
+ if (this.options.fade) {
62
+ $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
63
+ } else {
64
+ $tip.css({visibility: 'visible', opacity: this.options.opacity});
65
+ }
66
+ }
67
+ },
68
+
69
+ hide: function() {
70
+ if (this.options.fade) {
71
+ this.tip().stop().fadeOut(function() { $(this).remove(); });
72
+ } else {
73
+ this.tip().remove();
74
+ }
75
+ },
76
+
77
+ fixTitle: function() {
78
+ var $e = this.$element;
79
+ if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
80
+ $e.attr('original-title', $e.attr('title') || '').removeAttr('title');
81
+ }
82
+ },
83
+
84
+ getTitle: function() {
85
+ var title, $e = this.$element, o = this.options;
86
+ this.fixTitle();
87
+ var title, o = this.options;
88
+ if (typeof o.title == 'string') {
89
+ title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
90
+ } else if (typeof o.title == 'function') {
91
+ title = o.title.call($e[0]);
92
+ }
93
+ title = ('' + title).replace(/(^\s*|\s*$)/, "");
94
+ return title || o.fallback;
95
+ },
96
+
97
+ tip: function() {
98
+ if (!this.$tip) {
99
+ this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
100
+ }
101
+ return this.$tip;
102
+ },
103
+
104
+ validate: function() {
105
+ if (!this.$element[0].parentNode) {
106
+ this.hide();
107
+ this.$element = null;
108
+ this.options = null;
109
+ }
110
+ },
111
+
112
+ enable: function() { this.enabled = true; },
113
+ disable: function() { this.enabled = false; },
114
+ toggleEnabled: function() { this.enabled = !this.enabled; }
115
+ };
116
+
117
+ $.fn.tipsy = function(options) {
118
+
119
+ if (options === true) {
120
+ return this.data('tipsy');
121
+ } else if (typeof options == 'string') {
122
+ var tipsy = this.data('tipsy');
123
+ if (tipsy) tipsy[options]();
124
+ return this;
125
+ }
126
+
127
+ options = $.extend({}, $.fn.tipsy.defaults, options);
128
+
129
+ function get(ele) {
130
+ var tipsy = $.data(ele, 'tipsy');
131
+ if (!tipsy) {
132
+ tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
133
+ $.data(ele, 'tipsy', tipsy);
134
+ }
135
+ return tipsy;
136
+ }
137
+
138
+ function enter() {
139
+ var tipsy = get(this);
140
+ tipsy.hoverState = 'in';
141
+ if (options.delayIn == 0) {
142
+ tipsy.show();
143
+ } else {
144
+ tipsy.fixTitle();
145
+ setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
146
+ }
147
+ };
148
+
149
+ function leave() {
150
+ var tipsy = get(this);
151
+ tipsy.hoverState = 'out';
152
+ if (options.delayOut == 0) {
153
+ tipsy.hide();
154
+ } else {
155
+ setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
156
+ }
157
+ };
158
+
159
+ if (!options.live) this.each(function() { get(this); });
160
+
161
+ if (options.trigger != 'manual') {
162
+ var binder = options.live ? 'live' : 'bind',
163
+ eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
164
+ eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
165
+ this[binder](eventIn, enter)[binder](eventOut, leave);
166
+ }
167
+
168
+ return this;
169
+
170
+ };
171
+
172
+ $.fn.tipsy.defaults = {
173
+ delayIn: 0,
174
+ delayOut: 0,
175
+ fade: false,
176
+ fallback: '',
177
+ gravity: 'n',
178
+ html: false,
179
+ live: false,
180
+ offset: 0,
181
+ opacity: 0.8,
182
+ title: 'title',
183
+ trigger: 'hover'
184
+ };
185
+
186
+ // Overwrite this method to provide options on a per-element basis.
187
+ // For example, you could store the gravity in a 'tipsy-gravity' attribute:
188
+ // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
189
+ // (remember - do not modify 'options' in place!)
190
+ $.fn.tipsy.elementOptions = function(ele, options) {
191
+ return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
192
+ };
193
+
194
+ $.fn.tipsy.autoNS = function() {
195
+ return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
196
+ };
197
+
198
+ $.fn.tipsy.autoWE = function() {
199
+ return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
200
+ };
201
+
202
+ })(jQuery);
@@ -0,0 +1,69 @@
1
+ .tipsy {
2
+ padding: 5px;
3
+ font-size: 12px;
4
+ line-height: 15px;
5
+ position: absolute;
6
+ z-index: 100000;
7
+ }
8
+ .tipsy-inner {
9
+ padding: 5px 8px 4px 8px;
10
+ background-color: black;
11
+ color: white;
12
+ max-width: 200px;
13
+ text-align: center;
14
+ }
15
+ .tipsy-inner {
16
+ border-radius: 3px;
17
+ -moz-border-radius: 3px;
18
+ -webkit-border-radius: 3px;
19
+ }
20
+ .tipsy-arrow {
21
+ position: absolute;
22
+ background: url(image-path('tipsy/tipsy.gif')) no-repeat top left;
23
+ width: 9px;
24
+ height: 5px;
25
+ }
26
+ .tipsy-n .tipsy-arrow {
27
+ top: 0;
28
+ left: 50%;
29
+ margin-left: -4px;
30
+ }
31
+ .tipsy-nw .tipsy-arrow {
32
+ top: 0;
33
+ left: 10px;
34
+ }
35
+ .tipsy-ne .tipsy-arrow {
36
+ top: 0;
37
+ right: 10px;
38
+ }
39
+ .tipsy-s .tipsy-arrow {
40
+ bottom: 0;
41
+ left: 50%;
42
+ margin-left: -4px;
43
+ background-position: bottom left;
44
+ }
45
+ .tipsy-sw .tipsy-arrow {
46
+ bottom: 0;
47
+ left: 10px;
48
+ background-position: bottom left;
49
+ }
50
+ .tipsy-se .tipsy-arrow {
51
+ bottom: 0;
52
+ right: 10px;
53
+ background-position: bottom left;
54
+ }
55
+ .tipsy-e .tipsy-arrow {
56
+ top: 50%;
57
+ margin-top: -4px;
58
+ right: 0;
59
+ width: 5px;
60
+ height: 9px;
61
+ background-position: top right;
62
+ }
63
+ .tipsy-w .tipsy-arrow {
64
+ top: 50%;
65
+ margin-top: -4px;
66
+ left: 0;
67
+ width: 5px;
68
+ height: 9px;
69
+ }
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tipsy-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Nick Ragaz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-08-12 00:00:00.000000000 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: railties
17
+ requirement: &70170312783340 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '3.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *70170312783340
26
+ - !ruby/object:Gem::Dependency
27
+ name: thor
28
+ requirement: &70170312782880 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.14'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *70170312782880
37
+ - !ruby/object:Gem::Dependency
38
+ name: bundler
39
+ requirement: &70170312782420 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 1.0.0
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *70170312782420
48
+ - !ruby/object:Gem::Dependency
49
+ name: rails
50
+ requirement: &70170312781960 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '3.0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *70170312781960
59
+ description: This gem provides the Tipsy jQuery plugin for your Rails 3.1 application.
60
+ email:
61
+ - nick.ragaz@gmail.com
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - .gitignore
67
+ - Gemfile
68
+ - Gemfile.lock
69
+ - LICENSE
70
+ - README.md
71
+ - Rakefile
72
+ - lib/tipsy-rails.rb
73
+ - lib/tipsy/rails.rb
74
+ - lib/tipsy/rails/engine.rb
75
+ - lib/tipsy/rails/version.rb
76
+ - tipsy-rails.gemspec
77
+ - vendor/assets/images/tipsy/tipsy.gif
78
+ - vendor/assets/javascripts/tipsy.js
79
+ - vendor/assets/stylesheets/tipsy.css.scss
80
+ has_rdoc: true
81
+ homepage: http://rubygems.org/gems/tipsy-rails
82
+ licenses: []
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: 1.3.6
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 1.6.2
102
+ signing_key:
103
+ specification_version: 3
104
+ summary: Use the Tipsy jQuery plugin with Rails 3.1
105
+ test_files: []