social_stream 0.11.1 → 0.11.2
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/.gitignore +1 -0
- data/base/app/assets/images/tipsy.gif +0 -0
- data/base/app/assets/javascripts/activities.js.erb +23 -0
- data/base/app/assets/javascripts/invitations.js +7 -0
- data/base/app/assets/javascripts/profiles.js +4 -1
- data/base/app/assets/stylesheets/activities.css.scss +10 -5
- data/base/app/assets/stylesheets/base.css.scss +3 -2
- data/base/app/assets/stylesheets/frontpage.css.scss +2 -1
- data/base/app/assets/stylesheets/header.css.scss +5 -4
- data/base/app/controllers/groups_controller.rb +0 -6
- data/base/app/controllers/search_controller.rb +0 -4
- data/base/app/controllers/users_controller.rb +1 -6
- data/base/app/models/activity.rb +21 -7
- data/base/app/models/actor.rb +5 -3
- data/base/app/views/activities/_new.html.erb +13 -3
- data/base/app/views/activities/_options.html.erb +13 -4
- data/base/app/views/conversations/show.html.erb +1 -1
- data/base/app/views/conversations/show.js.erb +1 -1
- data/base/app/views/devise/registrations/edit.html.erb +1 -1
- data/base/app/views/devise/registrations/new.html.erb +1 -1
- data/base/app/views/devise/shared/_links.erb +6 -6
- data/base/app/views/frontpage/index.html.erb +3 -3
- data/base/app/views/groups/_new.html.erb +1 -1
- data/base/app/views/groups/show.html.erb +0 -5
- data/base/app/views/invitations/_new.html.erb +0 -5
- data/base/app/views/layouts/_header.erb +5 -44
- data/base/app/views/layouts/_header_signed_in.erb +44 -0
- data/base/app/views/layouts/_header_signed_out.erb +36 -0
- data/base/app/views/layouts/frontpage.html.erb +1 -1
- data/base/app/views/messages/_form.html.erb +3 -3
- data/base/app/views/messages/new.html.erb +2 -2
- data/base/app/views/messages/new.js.erb +1 -1
- data/base/app/views/posts/create.js.erb +2 -0
- data/base/app/views/profiles/edit.html.erb +6 -4
- data/base/app/views/search/index.html.erb +0 -4
- data/base/app/views/users/show.html.erb +0 -5
- data/base/config/locales/en.yml +33 -4
- data/base/config/locales/es.yml +33 -4
- data/base/lib/generators/social_stream/base/templates/initializer.rb +3 -0
- data/base/lib/social_stream-base.rb +4 -1
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/models/object.rb +2 -1
- data/base/social_stream-base.gemspec +3 -3
- data/base/spec/dummy/config/initializers/social_stream.rb +3 -0
- data/base/vendor/assets/javascripts/jquery.tipsy.js +104 -0
- data/base/vendor/assets/stylesheets/tipsy.css +7 -0
- data/events/app/views/frontpage/index.html.erb +3 -3
- data/events/config/locales/en.yml +1 -0
- data/events/lib/social_stream/events/version.rb +1 -1
- data/events/social_stream-events.gemspec +1 -1
- data/lib/social_stream/version.rb +1 -1
- data/social_stream.gemspec +2 -2
- metadata +15 -22
- data/base/app/assets/images/frontpage/join.gif +0 -0
- data/base/app/assets/stylesheets/ad_next.png +0 -0
- data/base/app/assets/stylesheets/ad_prev.png +0 -0
- data/base/app/assets/stylesheets/ad_scroll_back.png +0 -0
- data/base/app/assets/stylesheets/ad_scroll_forward.png +0 -0
- data/base/app/assets/stylesheets/jquery.ad-gallery.css +0 -171
- data/base/app/assets/stylesheets/loader.gif +0 -0
- data/base/app/views/frontpage/_header.html.erb +0 -30
- data/base/app/views/frontpage/_social_networks.html.erb +0 -5
- data/base/app/views/groups/_show_frontpage.html.erb +0 -11
- data/base/app/views/search/_index_frontpage.html.erb +0 -13
- data/base/app/views/users/_show_frontpage.html.erb +0 -11
@@ -0,0 +1,44 @@
|
|
1
|
+
<div id="headerFront">
|
2
|
+
<div class="banner_top banner_top_height">
|
3
|
+
<div id="header_left">
|
4
|
+
<div id="logo_txt">
|
5
|
+
<%= link_to(image_tag('header-logo.png', :alt => t('site.name')), root_path) %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
<% if user_signed_in? %>
|
9
|
+
<%= render :partial => 'layouts/search' %>
|
10
|
+
<%end%>
|
11
|
+
<div id="header_right">
|
12
|
+
<% if user_signed_in? %>
|
13
|
+
<div class="menu_list menu_white" id="menu_home">
|
14
|
+
<ul>
|
15
|
+
<li>
|
16
|
+
<%= link_to(t('home'), root_path)%>
|
17
|
+
</li>
|
18
|
+
<li class="pipe">·</li>
|
19
|
+
<li>
|
20
|
+
<%= link_to(t('profile.one'), current_subject)%>
|
21
|
+
</li>
|
22
|
+
<li class="pipe">·</li>
|
23
|
+
<li>
|
24
|
+
<%= link_to(t('message.other'), conversations_path) %>
|
25
|
+
<span id="header_inbox_count">
|
26
|
+
<%= link_to(current_subject.mailbox.inbox(:unread => true).count.to_s, conversations_path) %>
|
27
|
+
</span>
|
28
|
+
</li>
|
29
|
+
<li class="pipe">·</li>
|
30
|
+
<li>
|
31
|
+
<span id="header_notifications">
|
32
|
+
<%= link_to( current_subject.mailbox.notifications.not_trashed.unread.count.to_s, notifications_path) %>
|
33
|
+
</span>
|
34
|
+
</li>
|
35
|
+
<li class="pipe">·</li>
|
36
|
+
<li>
|
37
|
+
<%= render :partial => 'layouts/header_dropdown_menu' %>
|
38
|
+
</li>
|
39
|
+
</ul>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<div id="headerFront">
|
2
|
+
<div class="banner_top">
|
3
|
+
<div id="logo">
|
4
|
+
<%= link_to(image_tag('logo.png', :alt => t('site.name')), '/'); %>
|
5
|
+
</div>
|
6
|
+
<% unless params[:controller].eql? 'devise/sessions' and params[:action].eql? 'new' %>
|
7
|
+
<div class="div_login">
|
8
|
+
<%= form_for User.new, :as => :user, :url => user_session_path do |f| -%>
|
9
|
+
<div id="login_data">
|
10
|
+
<div class="login_data_block">
|
11
|
+
<span><%= f.label :email %></span>
|
12
|
+
<%= f.email_field :email, :class => "input_username" %>
|
13
|
+
</div>
|
14
|
+
<div class="login_data_block">
|
15
|
+
<span><%= f.label :password %></span>
|
16
|
+
<%= f.password_field :password, :class => "input_username" %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="login_data_block">
|
20
|
+
<%= f.submit t(:sign_in), :class => 'other_blue'%>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
<div class="options">
|
24
|
+
<%= link_to t('sign_up'), new_user_registration_path, :class => "register_link" %>
|
25
|
+
<span>|</span>
|
26
|
+
<%= link_to t('forgot_password'), new_user_password_path, :class => "register_link" %>
|
27
|
+
<span>|</span>
|
28
|
+
<%= link_to image_tag('btn/facebook.png'), user_omniauth_authorize_path(:facebook), :class => "menu_icon" %>
|
29
|
+
<%= link_to image_tag('btn/linkedin.png'), user_omniauth_authorize_path(:linked_in), :class => "menu_icon" %>
|
30
|
+
</div>
|
31
|
+
<% end -%>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
<br class="clearfloat" />
|
35
|
+
</div>
|
36
|
+
</div>
|
@@ -14,20 +14,20 @@
|
|
14
14
|
<% end %>
|
15
15
|
<div class="block">
|
16
16
|
<div class="form_row">
|
17
|
-
<%= label_tag
|
17
|
+
<%= label_tag t('mailboxer.form.recipients') %>
|
18
18
|
</div>
|
19
19
|
<div class="form_row">
|
20
20
|
<%= select_tag :_recipients, "", :class => "required form_tag" %>
|
21
21
|
|
22
22
|
</div>
|
23
23
|
<div class="form_row">
|
24
|
-
|
24
|
+
<%= label_tag t('mailboxer.form.subject') %>
|
25
25
|
</div>
|
26
26
|
<div class="form_row">
|
27
27
|
<%= text_field_tag :subject,nil, :class => "required form_tag" %>
|
28
28
|
</div>
|
29
29
|
<div class="form_row">
|
30
|
-
|
30
|
+
<%= label_tag t('mailboxer.form.body') %>
|
31
31
|
</div>
|
32
32
|
<div class="form_row" id="ck_editor" >
|
33
33
|
<%= text_area_tag :body, nil,:rows =>6, :cols=> 53, :class => "required form_tag", :maxlength => 5000 %>
|
@@ -24,14 +24,14 @@
|
|
24
24
|
|
25
25
|
$("#body").cleditor({
|
26
26
|
width:493,
|
27
|
-
controls: "<%=
|
27
|
+
controls: "<%= SocialStream.cleditor_controls %>"
|
28
28
|
});
|
29
29
|
|
30
30
|
<% unless @recipient.nil? %>
|
31
31
|
$("#_recipients").trigger("addItem",[{"title": "<%= truncate_name @recipient.name %>", "value": "<%= @recipient.id %>"}]);
|
32
32
|
<% end %>
|
33
33
|
|
34
|
-
$(".new_message").validate();
|
34
|
+
$(".new_message").validate({errorClass: "validation_error"});
|
35
35
|
|
36
36
|
<% end %>
|
37
37
|
|
@@ -25,4 +25,4 @@ var recipients = $("#_recipients").fcbkcomplete({
|
|
25
25
|
$("#_recipients").trigger("addItem",[{"title": "<%= @recipient.name %>", "value": "<%= @recipient.id %>"}]);
|
26
26
|
<% end %>
|
27
27
|
|
28
|
-
$(".new_message").validate();
|
28
|
+
$(".new_message").validate({errorClass: "validation_error"});
|
@@ -37,7 +37,7 @@ end %>
|
|
37
37
|
<% if !params[:section].present? or params[:section].eql?("tags") %>
|
38
38
|
<% content_for :javascript do %>
|
39
39
|
$(function() {
|
40
|
-
$(".new_group").validate();
|
40
|
+
$(".new_group").validate({errorClass: "validation_error"});
|
41
41
|
});
|
42
42
|
$("#profile_actor_attributes_tag_list").fcbkcomplete({
|
43
43
|
json_url: "<%= tags_path(:format => :json) %>",
|
@@ -95,7 +95,7 @@ end %>
|
|
95
95
|
<div class="form_label">
|
96
96
|
<%= f.label t('profile.' + current_subject.class.to_s.downcase + '.birthday')%>
|
97
97
|
</div>
|
98
|
-
<div class="form_field">
|
98
|
+
<div class="form_field" id="form_select">
|
99
99
|
<%= date_select "profile", "birthday", :order => [:day, :month, :year], :end_year=> Date.today.year,
|
100
100
|
:start_year=> (Date.today.year - 100), :prompt => { :day => 'Day', :month => 'Month', :year => 'Year' } %>
|
101
101
|
</div>
|
@@ -119,8 +119,10 @@ end %>
|
|
119
119
|
</div>
|
120
120
|
</div>
|
121
121
|
|
122
|
-
<div class="form_row
|
123
|
-
|
122
|
+
<div class="form_row">
|
123
|
+
<div class="form_label">
|
124
|
+
<%= f.label t('profile.' + current_subject.class.to_s.downcase + '.about') %>
|
125
|
+
</div>
|
124
126
|
</div>
|
125
127
|
<div class="form_row">
|
126
128
|
<%= f.text_area :description, :maxlength => 200, :rows => 10, :class => "form_tag_long" %>
|
data/base/config/locales/en.yml
CHANGED
@@ -15,16 +15,35 @@ en:
|
|
15
15
|
new: "New password"
|
16
16
|
retype: "Retype new password"
|
17
17
|
privacy: "Privacy"
|
18
|
+
activerecord:
|
19
|
+
attributes:
|
20
|
+
user:
|
21
|
+
email: "Email"
|
22
|
+
name: "Name"
|
23
|
+
password: "Password"
|
24
|
+
password_confirmation: "Confirm password"
|
25
|
+
remember_me: "Remember me"
|
18
26
|
activity:
|
19
27
|
audience:
|
20
|
-
|
21
|
-
|
28
|
+
hidden:
|
29
|
+
summary: "Restricted"
|
30
|
+
full: "Shared with contacts of %{audience}"
|
31
|
+
public:
|
32
|
+
summary: "Public"
|
33
|
+
full: "Shared with all the Internet"
|
34
|
+
visible:
|
35
|
+
summary: "Restricted"
|
36
|
+
full: "Shared with %{audience}"
|
22
37
|
confirm_delete: "Delete activity?"
|
23
38
|
delete: "Delete"
|
24
39
|
last: "Last Activities"
|
25
40
|
like: "I like"
|
26
41
|
one: "Activity"
|
27
42
|
other: "Activities"
|
43
|
+
privacy:
|
44
|
+
contacts:
|
45
|
+
user: "Contacts of %{receiver}"
|
46
|
+
group: "Members of %{receiver}"
|
28
47
|
sending: "Sending"
|
29
48
|
title: "Activities"
|
30
49
|
to_comment: "Comment"
|
@@ -60,8 +79,6 @@ en:
|
|
60
79
|
create: "Create"
|
61
80
|
save: "Save"
|
62
81
|
update: "Update"
|
63
|
-
cleditor:
|
64
|
-
controls: "bold italic underline strikethrough subscript superscript | size style | bullets | image link unlink"
|
65
82
|
comment:
|
66
83
|
input: "Write a comment..."
|
67
84
|
confirm_delete: "Delete comment?"
|
@@ -108,6 +125,13 @@ en:
|
|
108
125
|
delete:
|
109
126
|
confirm: Delete %{element}}?
|
110
127
|
devise:
|
128
|
+
links:
|
129
|
+
sign_in: "Sign in"
|
130
|
+
sign_up: "Sign up"
|
131
|
+
forgot_password: "Forgot you password?"
|
132
|
+
confirmation_instructions: "Didn't receive confirmation instructions?"
|
133
|
+
unlock_instructions: "Didn't receive unlock instructions?"
|
134
|
+
sign_in_with: "Sign in with %{provider}"
|
111
135
|
passwords:
|
112
136
|
confirm: "Confirm password"
|
113
137
|
forgot: "Forgot your password?"
|
@@ -137,6 +161,7 @@ en:
|
|
137
161
|
default: "Meet"
|
138
162
|
sentence1: "Meet interesting people and groups"
|
139
163
|
sentence2: "Find last activity of your contacts"
|
164
|
+
register: "Register now!"
|
140
165
|
share:
|
141
166
|
default: "Share"
|
142
167
|
sentence1: "Your proyects and activities"
|
@@ -192,6 +217,10 @@ en:
|
|
192
217
|
base: "You are here"
|
193
218
|
separator: " > "
|
194
219
|
mailboxer:
|
220
|
+
form:
|
221
|
+
body: "Body"
|
222
|
+
recipients: "Recipients"
|
223
|
+
subject: "Subject"
|
195
224
|
message_mailer:
|
196
225
|
subject_new: "%{subject}"
|
197
226
|
subject_reply: "%{subject}"
|
data/base/config/locales/es.yml
CHANGED
@@ -15,16 +15,35 @@ es:
|
|
15
15
|
new: "Nueva contraseña"
|
16
16
|
retype: "Repetir nueva contraseña"
|
17
17
|
privacy: "Privacidad"
|
18
|
+
activerecord:
|
19
|
+
attributes:
|
20
|
+
user:
|
21
|
+
email: "Correo"
|
22
|
+
name: "Nombre"
|
23
|
+
password: "Contraseña"
|
24
|
+
password_confirmation: "Confirmar contraseña"
|
25
|
+
remember_me: "Recuérdame"
|
18
26
|
activity:
|
19
27
|
audience:
|
20
|
-
|
21
|
-
|
28
|
+
hidden:
|
29
|
+
summary: "Restringido"
|
30
|
+
full: "Compartido con contactos de %{audience}"
|
31
|
+
public:
|
32
|
+
summary: "Público"
|
33
|
+
full: "Accesible por toda Internet"
|
34
|
+
visible:
|
35
|
+
summary: "Restringido"
|
36
|
+
full: "Compartido con %{audience}"
|
22
37
|
confirm_delete: "¿Borrar actividad?"
|
23
38
|
delete: "Borrar"
|
24
39
|
last: "Últimas actividades"
|
25
40
|
like: "Me gusta"
|
26
41
|
one: "Actividad"
|
27
42
|
other: "Actividades"
|
43
|
+
privacy:
|
44
|
+
contacts:
|
45
|
+
user: "Contactos de %{receiver}"
|
46
|
+
group: "Integrantes de %{receiver}"
|
28
47
|
sending: "Enviando"
|
29
48
|
title: "Actividades"
|
30
49
|
to_comment: "Comentar"
|
@@ -59,8 +78,6 @@ es:
|
|
59
78
|
cancel: "Cancelar"
|
60
79
|
save: "Guardar"
|
61
80
|
update: "Actualizar"
|
62
|
-
cleditor:
|
63
|
-
controls: "negrita cursiva subrayado tachado subíndice superíndice | tamaño estilo | lista | imagen enlazar desenlazar"
|
64
81
|
comment:
|
65
82
|
input: "Comentar..."
|
66
83
|
confirm_delete: "¿Borrar commentario?"
|
@@ -107,6 +124,13 @@ es:
|
|
107
124
|
delete:
|
108
125
|
confirm: "¿Borrar %{element}}?"
|
109
126
|
devise:
|
127
|
+
links:
|
128
|
+
sign_in: "Entrar"
|
129
|
+
sign_up: "Registrarse"
|
130
|
+
forgot_password: "¿Olvidaste tu contraseña?"
|
131
|
+
confirmation_instructions: "¿No recibiste instrucciones de confirmación?"
|
132
|
+
unlock_instructions: "¿No recibiste instrucciones de desbloqueo?"
|
133
|
+
sign_in_with: "Entrar con %{provider}"
|
110
134
|
passwords:
|
111
135
|
confirm: "Confirmar contraseña"
|
112
136
|
forgot: "¿Olvidaste tu contraseña?"
|
@@ -134,6 +158,7 @@ es:
|
|
134
158
|
default: "Encuentra"
|
135
159
|
sentence1: "Descubre grupos y gente interesante"
|
136
160
|
sentence2: "Encuentra la última actividad de tus contactos"
|
161
|
+
register: "¡Inscríbete ahora!"
|
137
162
|
share:
|
138
163
|
default: "Comparte"
|
139
164
|
sentence1: "Tus proyectos y actividades"
|
@@ -189,6 +214,10 @@ es:
|
|
189
214
|
base: "Estás aquí"
|
190
215
|
separator: " > "
|
191
216
|
mailboxer:
|
217
|
+
form:
|
218
|
+
body: "Mensaje"
|
219
|
+
recipients: "Para"
|
220
|
+
subject: "Asunto"
|
192
221
|
message_mailer:
|
193
222
|
subject_new: "%{subject}"
|
194
223
|
subject_reply: "%{subject}"
|
@@ -26,4 +26,7 @@ SocialStream.setup do |config|
|
|
26
26
|
#
|
27
27
|
# config.quick_search_models = [:user, :group]
|
28
28
|
# config.extended_search_models = [:user, :group]
|
29
|
+
|
30
|
+
# Cleditor controls. It is used in new message editor, for example
|
31
|
+
# config.cleditor_controls = "bold italic underline strikethrough subscript superscript | size style | bullets | image link unlink"
|
29
32
|
end
|
@@ -84,7 +84,10 @@ module SocialStream
|
|
84
84
|
|
85
85
|
mattr_accessor :extended_search_models
|
86
86
|
@@extended_search_models = [ :user, :group, :post ]
|
87
|
-
|
87
|
+
|
88
|
+
mattr_accessor :cleditor_controls
|
89
|
+
@@cleditor_controls = "bold italic underline strikethrough subscript superscript | size style | bullets | image link unlink"
|
90
|
+
|
88
91
|
class << self
|
89
92
|
def setup
|
90
93
|
yield self
|
@@ -73,8 +73,9 @@ module SocialStream
|
|
73
73
|
if _contact_id.nil?
|
74
74
|
nil
|
75
75
|
else
|
76
|
+
# FIXME: repeated in Activity#fill_relations
|
76
77
|
if _contact.reflexive?
|
77
|
-
|
78
|
+
_contact.sender.relation_customs.map(&:id)
|
78
79
|
else
|
79
80
|
_contact.
|
80
81
|
receiver.
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
# Slug generation
|
27
27
|
s.add_runtime_dependency('stringex', '~> 1.3.0')
|
28
28
|
# Avatar attachments
|
29
|
-
s.add_runtime_dependency('avatars_for_rails', '~> 0.1.
|
29
|
+
s.add_runtime_dependency('avatars_for_rails', '~> 0.1.4')
|
30
30
|
# jQuery
|
31
31
|
s.add_runtime_dependency('jquery-rails', '~> 1.0.9')
|
32
32
|
# Authorization
|
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
# OAuth provider
|
39
39
|
s.add_runtime_dependency('oauth-plugin','~> 0.4.0.pre1')
|
40
40
|
# Messages
|
41
|
-
s.add_runtime_dependency('mailboxer','~> 0.5.
|
41
|
+
s.add_runtime_dependency('mailboxer','~> 0.5.4')
|
42
42
|
# Tagging
|
43
43
|
s.add_runtime_dependency('acts-as-taggable-on','~> 2.0.6')
|
44
44
|
# HTML Forms
|
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
|
|
50
50
|
# Modernizr.js javascript library
|
51
51
|
s.add_runtime_dependency('modernizr-rails', '~> 2.0.6')
|
52
52
|
# Sphinx search engine
|
53
|
-
s.add_runtime_dependency('thinking-sphinx', '~> 2.0.
|
53
|
+
s.add_runtime_dependency('thinking-sphinx', '~> 2.0.8')
|
54
54
|
#Syntactically Awesome Stylesheets
|
55
55
|
s.add_runtime_dependency('sass-rails', '~> 3.1.0')
|
56
56
|
|
@@ -26,4 +26,7 @@ SocialStream.setup do |config|
|
|
26
26
|
#
|
27
27
|
# config.quick_search_models = [:user, :group]
|
28
28
|
# config.extended_search_models = [:user, :group]
|
29
|
+
|
30
|
+
# Cleditor controls. It is used in new message editor, for example
|
31
|
+
# config.cleditor_controls = "bold italic underline strikethrough subscript superscript | size style | bullets | image link unlink"
|
29
32
|
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
(function($) {
|
2
|
+
$.fn.tipsy = function(options) {
|
3
|
+
|
4
|
+
options = $.extend({}, $.fn.tipsy.defaults, options);
|
5
|
+
|
6
|
+
return this.each(function() {
|
7
|
+
|
8
|
+
var opts = $.fn.tipsy.elementOptions(this, options);
|
9
|
+
|
10
|
+
$(this).hover(function() {
|
11
|
+
|
12
|
+
$.data(this, 'cancel.tipsy', true);
|
13
|
+
|
14
|
+
var tip = $.data(this, 'active.tipsy');
|
15
|
+
if (!tip) {
|
16
|
+
tip = $('<div class="tipsy"><div class="tipsy-inner"/></div>');
|
17
|
+
tip.css({position: 'absolute', zIndex: 100000});
|
18
|
+
$.data(this, 'active.tipsy', tip);
|
19
|
+
}
|
20
|
+
|
21
|
+
if ($(this).attr('title') || typeof($(this).attr('original-title')) != 'string') {
|
22
|
+
$(this).attr('original-title', $(this).attr('title') || '').removeAttr('title');
|
23
|
+
}
|
24
|
+
|
25
|
+
var title;
|
26
|
+
if (typeof opts.title == 'string') {
|
27
|
+
title = $(this).attr(opts.title == 'title' ? 'original-title' : opts.title);
|
28
|
+
} else if (typeof opts.title == 'function') {
|
29
|
+
title = opts.title.call(this);
|
30
|
+
}
|
31
|
+
|
32
|
+
tip.find('.tipsy-inner')[opts.html ? 'html' : 'text'](title || opts.fallback);
|
33
|
+
|
34
|
+
var pos = $.extend({}, $(this).offset(), {width: this.offsetWidth, height: this.offsetHeight});
|
35
|
+
tip.get(0).className = 'tipsy'; // reset classname in case of dynamic gravity
|
36
|
+
tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
|
37
|
+
var actualWidth = tip[0].offsetWidth, actualHeight = tip[0].offsetHeight;
|
38
|
+
var gravity = (typeof opts.gravity == 'function') ? opts.gravity.call(this) : opts.gravity;
|
39
|
+
|
40
|
+
switch (gravity.charAt(0)) {
|
41
|
+
case 'n':
|
42
|
+
tip.css({top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-north');
|
43
|
+
break;
|
44
|
+
case 's':
|
45
|
+
tip.css({top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-south');
|
46
|
+
break;
|
47
|
+
case 'e':
|
48
|
+
tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}).addClass('tipsy-east');
|
49
|
+
break;
|
50
|
+
case 'w':
|
51
|
+
tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}).addClass('tipsy-west');
|
52
|
+
break;
|
53
|
+
}
|
54
|
+
|
55
|
+
if (opts.fade) {
|
56
|
+
tip.css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: 0.8});
|
57
|
+
} else {
|
58
|
+
tip.css({visibility: 'visible'});
|
59
|
+
}
|
60
|
+
|
61
|
+
}, function() {
|
62
|
+
$.data(this, 'cancel.tipsy', false);
|
63
|
+
var self = this;
|
64
|
+
setTimeout(function() {
|
65
|
+
if ($.data(this, 'cancel.tipsy')) return;
|
66
|
+
var tip = $.data(self, 'active.tipsy');
|
67
|
+
if (opts.fade) {
|
68
|
+
tip.stop().fadeOut(function() { $(this).remove(); });
|
69
|
+
} else {
|
70
|
+
tip.remove();
|
71
|
+
}
|
72
|
+
}, 100);
|
73
|
+
|
74
|
+
});
|
75
|
+
|
76
|
+
});
|
77
|
+
|
78
|
+
};
|
79
|
+
|
80
|
+
// Overwrite this method to provide options on a per-element basis.
|
81
|
+
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
82
|
+
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
83
|
+
// (remember - do not modify 'options' in place!)
|
84
|
+
$.fn.tipsy.elementOptions = function(ele, options) {
|
85
|
+
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
86
|
+
};
|
87
|
+
|
88
|
+
$.fn.tipsy.defaults = {
|
89
|
+
fade: false,
|
90
|
+
fallback: '',
|
91
|
+
gravity: 'n',
|
92
|
+
html: false,
|
93
|
+
title: 'title'
|
94
|
+
};
|
95
|
+
|
96
|
+
$.fn.tipsy.autoNS = function() {
|
97
|
+
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
98
|
+
};
|
99
|
+
|
100
|
+
$.fn.tipsy.autoWE = function() {
|
101
|
+
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
102
|
+
};
|
103
|
+
|
104
|
+
})(jQuery);
|