fooltip 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/fooltip/link.png +0 -0
- data/app/assets/javascripts/fooltip/application.js +1 -0
- data/app/assets/javascripts/fooltip/containers.js +9 -0
- data/app/assets/stylesheets/fooltip/application.css +1 -0
- data/app/assets/stylesheets/fooltip/containers.css.sass +18 -0
- data/app/controllers/fooltip/containers_controller.rb +9 -0
- data/app/helpers/fooltip/containers_helper.rb +4 -0
- data/app/models/fooltip/association.rb +10 -0
- data/app/models/fooltip/container.rb +8 -0
- data/app/models/fooltip/link.rb +26 -0
- data/app/models/fooltip/popup.rb +9 -0
- data/app/uploaders/fooltip/image_uploader.rb +56 -0
- data/app/views/fooltip/containers/show.html.haml +15 -0
- data/app/views/layouts/fooltip/application.html.haml +3 -1
- data/config/routes.rb +1 -0
- data/db/migrate/20130402091259_create_fooltip_tables.rb +56 -0
- data/lib/fooltip/active_record.rb +13 -0
- data/lib/fooltip/version.rb +1 -1
- data/lib/fooltip.rb +8 -2
- metadata +85 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7a37dce1585dd375392716d29e39f6ae9c98ff9
|
4
|
+
data.tar.gz: 8e8a2f892bec54aba5477d4d9b6268493e694d5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1bd5e9fcc08da2358370633229acc89938b2a67f94130d632b1f2f9e9813215b21493ca1752bb968a4ccbd6f723e4f62352cbcee87263f8fb1e1921d26439e8
|
7
|
+
data.tar.gz: 5723fe42fac1c38d6e4e627b17152b66df2b6ac818a1f05c5664b2648aa272b5c312648f83c96e3730c1d177708a263ed976e48a8cca2225a075b8aa864f2d5e
|
Binary file
|
@@ -0,0 +1,18 @@
|
|
1
|
+
.fooltip-container
|
2
|
+
width: 800px
|
3
|
+
height: 500px
|
4
|
+
position: relative
|
5
|
+
image
|
6
|
+
float: left
|
7
|
+
.popover
|
8
|
+
max-width: none
|
9
|
+
|
10
|
+
.fooltip-link-container
|
11
|
+
position: absolute
|
12
|
+
|
13
|
+
.fooltip-link
|
14
|
+
display: block
|
15
|
+
position: absolute
|
16
|
+
height: 32px
|
17
|
+
width: 32px
|
18
|
+
background: url(image-path("fooltip/link.png")) no-repeat top left
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Fooltip
|
2
|
+
class Association < ::ActiveRecord::Base
|
3
|
+
belongs_to :owner, polymorphic: true
|
4
|
+
belongs_to :container
|
5
|
+
|
6
|
+
validates :owner_id, presence: true, uniqueness: { scope: [:owner_type, :container_id] }
|
7
|
+
validates :owner_type, presence: true
|
8
|
+
validates :container_id, presence: true
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fooltip
|
2
|
+
class Link < ::ActiveRecord::Base
|
3
|
+
PLACEMENT_MAPPINGS = { 1 => 'top', 2 => 'right', 3 => 'bottom', 4 => 'left' }
|
4
|
+
TRIGGER_MAPPINGS = { 1 => 'click', 2 => 'hover', 3 => 'focus', 4 => 'manual' }
|
5
|
+
|
6
|
+
attr_accessible :placement, :trigger, :x, :y
|
7
|
+
belongs_to :container
|
8
|
+
belongs_to :popup
|
9
|
+
|
10
|
+
validates :container, presence: true
|
11
|
+
validates :popup, presence: true
|
12
|
+
validates :placement, presence: true
|
13
|
+
validates :trigger, presence: true
|
14
|
+
validates :x, presence: true
|
15
|
+
validates :y, presence: true
|
16
|
+
|
17
|
+
def placement_string
|
18
|
+
PLACEMENT_MAPPINGS[placement] || 'right'
|
19
|
+
end
|
20
|
+
|
21
|
+
def trigger_string
|
22
|
+
TRIGGER_MAPPINGS[trigger] || 'focus'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Fooltip
|
2
|
+
class Popup < ::ActiveRecord::Base
|
3
|
+
translates :title, :content, fallbacks_for_empty_translations: true
|
4
|
+
attr_accessible :content, :title, :identifier, :min_width, :min_height,
|
5
|
+
:max_width, :max_height
|
6
|
+
has_many :links, dependent: :destroy
|
7
|
+
validates :identifier, presence: true
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Fooltip
|
4
|
+
class ImageUploader < CarrierWave::Uploader::Base
|
5
|
+
|
6
|
+
# Include RMagick or MiniMagick support:
|
7
|
+
# include CarrierWave::RMagick
|
8
|
+
# include CarrierWave::MiniMagick
|
9
|
+
|
10
|
+
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
|
11
|
+
# include Sprockets::Helpers::RailsHelper
|
12
|
+
# include Sprockets::Helpers::IsolatedHelper
|
13
|
+
|
14
|
+
# Choose what kind of storage to use for this uploader:
|
15
|
+
storage :file
|
16
|
+
# storage :fog
|
17
|
+
|
18
|
+
# Override the directory where uploaded files will be stored.
|
19
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
20
|
+
def store_dir
|
21
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
25
|
+
# def default_url
|
26
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
27
|
+
# # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
28
|
+
#
|
29
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
30
|
+
# end
|
31
|
+
|
32
|
+
# Process files as they are uploaded:
|
33
|
+
# process :scale => [200, 300]
|
34
|
+
#
|
35
|
+
# def scale(width, height)
|
36
|
+
# # do something
|
37
|
+
# end
|
38
|
+
|
39
|
+
# Create different versions of your uploaded files:
|
40
|
+
# version :thumb do
|
41
|
+
# process :scale => [50, 50]
|
42
|
+
# end
|
43
|
+
|
44
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
45
|
+
def extension_white_list
|
46
|
+
%w(jpg jpeg gif png)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Override the filename of the uploaded files:
|
50
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
51
|
+
# def filename
|
52
|
+
# "something.jpg" if original_filename
|
53
|
+
# end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
.page-header
|
2
|
+
%h1= @container.title
|
3
|
+
|
4
|
+
.row-fluid
|
5
|
+
.fooltip-container
|
6
|
+
- @container.links.each do |link|
|
7
|
+
%span{ id: "fooltip-link-#{link.id}", class: "fooltip-link-container" }
|
8
|
+
= link_to '', 'javascript:void(0);', class: "fooltip-link", data: { content: "", placement: link.placement_string, toggle: "popover", :"original-title" => link.popup.title || '', html: true, trigger: link.trigger_string }, style: "top: #{link.y}px; left: #{link.x}px;"
|
9
|
+
.content{ style: "display: none;" }
|
10
|
+
.fooltip-popup{ style: "min-width: #{link.popup.min_width}px; min-height: #{link.popup.min_height}px; max-width: #{link.popup.max_width}px; max-height: #{link.popup.max_height}px;" }
|
11
|
+
= raw link.popup.content
|
12
|
+
= image_tag @container.image_url
|
13
|
+
|
14
|
+
.row-fluid
|
15
|
+
%p.lead= @container.description
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
class CreateFooltipTables < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def up
|
4
|
+
create_table :fooltip_containers do |t|
|
5
|
+
t.string :image
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
Fooltip::Container.create_translation_table!({
|
9
|
+
title: :string,
|
10
|
+
description: :text
|
11
|
+
})
|
12
|
+
|
13
|
+
create_table :fooltip_associations do |t|
|
14
|
+
t.string :owner_type
|
15
|
+
t.integer :owner_id
|
16
|
+
t.references :container
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
|
20
|
+
create_table :fooltip_popups do |t|
|
21
|
+
t.string :identifier
|
22
|
+
t.integer :min_height
|
23
|
+
t.integer :min_width
|
24
|
+
t.integer :max_height
|
25
|
+
t.integer :max_width
|
26
|
+
t.timestamps
|
27
|
+
end
|
28
|
+
Fooltip::Popup.create_translation_table!({
|
29
|
+
title: :string,
|
30
|
+
content: :text
|
31
|
+
})
|
32
|
+
|
33
|
+
create_table :fooltip_links do |t|
|
34
|
+
t.references :container
|
35
|
+
t.references :popup
|
36
|
+
t.integer :placement
|
37
|
+
t.integer :trigger
|
38
|
+
t.integer :x
|
39
|
+
t.integer :y
|
40
|
+
t.timestamps
|
41
|
+
end
|
42
|
+
add_index :fooltip_links, :container_id
|
43
|
+
add_index :fooltip_links, :popup_id
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def down
|
48
|
+
drop_table :fooltip_links
|
49
|
+
Fooltip::Popup.drop_translation_table!
|
50
|
+
drop_table :fooltip_popups
|
51
|
+
drop_table :fooltip_associations
|
52
|
+
Fooltip::Container.drop_translation_table!
|
53
|
+
drop_table :fooltip_containers
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Fooltip
|
2
|
+
module ActiveRecord
|
3
|
+
|
4
|
+
def has_fooltips(options = {})
|
5
|
+
#options.assert_valid_keys(:x)
|
6
|
+
|
7
|
+
attr_accessible :fooltip_ids
|
8
|
+
has_many :fooltips, class_name: "Fooltip::Association", as: :owner, source: "Fooltip::Container"
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
data/lib/fooltip/version.rb
CHANGED
data/lib/fooltip.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
require "globalize3"
|
2
|
+
require "carrierwave"
|
3
|
+
require "haml"
|
4
|
+
require "jquery-rails"
|
5
|
+
require "sass-rails"
|
6
|
+
require "bootstrap-sass"
|
2
7
|
require "fooltip/engine"
|
8
|
+
require "fooltip/active_record"
|
3
9
|
|
4
10
|
module Fooltip
|
5
11
|
#include ActiveSupport::Configurable
|
6
12
|
|
7
13
|
#config.x = :X
|
8
14
|
#config_accessor :x
|
9
|
-
|
10
|
-
#autoload :MyModule, 'fooltip/my_module'
|
11
15
|
end
|
16
|
+
|
17
|
+
ActiveRecord::Base.extend(Fooltip::ActiveRecord)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fooltip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Intesys S.r.l.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -39,6 +39,76 @@ dependencies:
|
|
39
39
|
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 0.3.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: carrierwave
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.8.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.8.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: haml
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: sass-rails
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.1'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3.1'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: jquery-rails
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 1.0.0
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 1.0.0
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: bootstrap-sass
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '2.0'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '2.0'
|
42
112
|
description: Fooltip - when a tooltip just isn't enough.
|
43
113
|
email:
|
44
114
|
- daniel.jonasson@intesys.it
|
@@ -47,15 +117,28 @@ extensions: []
|
|
47
117
|
extra_rdoc_files: []
|
48
118
|
files:
|
49
119
|
- app/controllers/fooltip/application_controller.rb
|
120
|
+
- app/controllers/fooltip/containers_controller.rb
|
121
|
+
- app/uploaders/fooltip/image_uploader.rb
|
122
|
+
- app/views/fooltip/containers/show.html.haml
|
50
123
|
- app/views/layouts/fooltip/application.html.haml
|
124
|
+
- app/models/fooltip/popup.rb
|
125
|
+
- app/models/fooltip/association.rb
|
126
|
+
- app/models/fooltip/container.rb
|
127
|
+
- app/models/fooltip/link.rb
|
128
|
+
- app/helpers/fooltip/containers_helper.rb
|
51
129
|
- app/helpers/fooltip/application_helper.rb
|
130
|
+
- app/assets/javascripts/fooltip/containers.js
|
52
131
|
- app/assets/javascripts/fooltip/application.js
|
53
132
|
- app/assets/stylesheets/fooltip/application.css
|
133
|
+
- app/assets/stylesheets/fooltip/containers.css.sass
|
134
|
+
- app/assets/images/fooltip/link.png
|
54
135
|
- config/routes.rb
|
136
|
+
- db/migrate/20130402091259_create_fooltip_tables.rb
|
55
137
|
- lib/tasks/fooltip_tasks.rake
|
56
138
|
- lib/tasks/testing_tasks.rake
|
57
139
|
- lib/fooltip/engine.rb
|
58
140
|
- lib/fooltip/version.rb
|
141
|
+
- lib/fooltip/active_record.rb
|
59
142
|
- lib/fooltip.rb
|
60
143
|
- MIT-LICENSE
|
61
144
|
- Rakefile
|