social_stream-base 0.9.6 → 0.9.7
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/app/assets/images/arrow-end.png +0 -0
- data/app/assets/images/arrow-start.png +0 -0
- data/app/assets/images/arrow.png +0 -0
- data/app/assets/javascripts/layouts.js +0 -1
- data/app/assets/stylesheets/frontpage.css +2 -2
- data/app/assets/stylesheets/location.css +36 -0
- data/app/helpers/location_helper.rb +3 -5
- data/app/helpers/toolbar_helper.rb +5 -6
- data/app/views/avatars/index.html.erb +2 -2
- data/app/views/contacts/edit.html.erb +2 -2
- data/app/views/conversations/_show.html.erb +2 -2
- data/app/views/conversations/index.html.erb +1 -3
- data/app/views/devise/registrations/edit.html.erb +1 -1
- data/app/views/frontpage/_header.html.erb +1 -1
- data/app/views/home/index.html.erb +1 -2
- data/app/views/invitation_mailer/send_invitation.html.erb +1 -1
- data/app/views/invitation_mailer/send_invitation.text.erb +2 -2
- data/app/views/invitations/new.html.erb +1 -1
- data/app/views/layouts/_footer.html.erb +1 -1
- data/app/views/layouts/_header.erb +1 -1
- data/app/views/layouts/application.html.erb +1 -1
- data/app/views/layouts/frontpage.html.erb +1 -1
- data/app/views/location/_location_body.html.erb +18 -0
- data/app/views/message_mailer/new_message_email.html.erb +2 -2
- data/app/views/message_mailer/new_message_email.text.erb +1 -1
- data/app/views/message_mailer/reply_message_email.html.erb +2 -2
- data/app/views/message_mailer/reply_message_email.text.erb +1 -1
- data/app/views/messages/new.html.erb +2 -2
- data/app/views/profiles/edit.html.erb +6 -6
- data/app/views/profiles/show.html.erb +1 -2
- data/app/views/users/index.html.erb +1 -1
- data/app/views/users/show.html.erb +1 -2
- data/config/locales/en.yml +7 -6
- data/lib/social_stream-base.rb +4 -1
- data/lib/social_stream/base.rb +6 -0
- data/lib/social_stream/base/version.rb +1 -1
- data/lib/social_stream/toolbar_config/base.rb +87 -0
- data/lib/tasks/workers.rake +163 -0
- metadata +11 -5
- data/lib/social_stream/toolbar_config.rb +0 -99
Binary file
|
Binary file
|
Binary file
|
@@ -19,8 +19,8 @@ span.find{ padding-right:5px;}
|
|
19
19
|
#login{ padding-top: 5px;}
|
20
20
|
.instructions{text-align: left; padding-bottom: 5px;}
|
21
21
|
#remember{padding-left:22%; text-align: left;}
|
22
|
-
#user_password_confirmation{vertical-align: 30%;}
|
23
|
-
#user_password_confirmation_label {padding-top: 0;}
|
22
|
+
#welcome #user_password_confirmation{vertical-align: 30%;}
|
23
|
+
#welcome #user_password_confirmation_label {padding-top: 0;}
|
24
24
|
#welcome{ margin: 50px auto 50px auto; width:330px; padding:20px; border: 4px solid #BDC7D8;
|
25
25
|
background-color: white;-moz-border-radius: 20px;
|
26
26
|
-webkit-border-radius: 20px; border-radius: 20px;}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#map_location .first{
|
2
|
+
background: transparent url("/assets/arrow-start.png") no-repeat top left;
|
3
|
+
display: inline-block;
|
4
|
+
height: 23px;
|
5
|
+
margin-left: 5px;
|
6
|
+
}
|
7
|
+
#map_location .first span{
|
8
|
+
margin-left:5px;
|
9
|
+
}
|
10
|
+
#map_location .last{
|
11
|
+
margin-left: 5px;
|
12
|
+
}
|
13
|
+
#map_location .last a{
|
14
|
+
font-size: inherit;
|
15
|
+
}
|
16
|
+
#map_location .mid{
|
17
|
+
background: transparent url("/assets/arrow.png") no-repeat top right;
|
18
|
+
}
|
19
|
+
#map_location .penultimate{
|
20
|
+
background: transparent url("/assets/arrow-end.png") no-repeat top right;
|
21
|
+
}
|
22
|
+
#map_location .mid, #map_location .penultimate{
|
23
|
+
color: white;
|
24
|
+
padding-left:5px;
|
25
|
+
padding-right: 12px;
|
26
|
+
}
|
27
|
+
#map_location .last, #map_location .mid, #map_location .penultimate{
|
28
|
+
display: inline-block;
|
29
|
+
font-size: 13px;
|
30
|
+
height: 23px;
|
31
|
+
line-height: 23px;
|
32
|
+
}
|
33
|
+
#map_location .mid a, #map_location .penultimate a{
|
34
|
+
color: inherit;
|
35
|
+
font-size: inherit;
|
36
|
+
}
|
@@ -16,15 +16,13 @@ module LocationHelper
|
|
16
16
|
# partial => location/_location.html.erb
|
17
17
|
#
|
18
18
|
# Example:
|
19
|
-
# Render a location with
|
19
|
+
# Render a location with two leves depth:
|
20
20
|
#
|
21
21
|
# <%= location(link_to(leve1.name, level1.url),link_to(leve2.name, level2.url)) %>
|
22
22
|
#
|
23
23
|
def location(*stack)
|
24
|
-
|
25
|
-
stack
|
26
|
-
location_body << t('location.separator') + level
|
27
|
-
}
|
24
|
+
|
25
|
+
location_body = render :partial => "location/location_body", :locals=>{:stack => stack}
|
28
26
|
|
29
27
|
location_div = capture do
|
30
28
|
render :partial => "location/location", :locals=>{:location_body => location_body}
|
@@ -1,4 +1,7 @@
|
|
1
1
|
module ToolbarHelper
|
2
|
+
# Configuration of toolbar items
|
3
|
+
include SocialStream::ToolbarConfig
|
4
|
+
|
2
5
|
# Define the toolbar content for your view. There are two typical cases, depending on the value of
|
3
6
|
# options[:profile]
|
4
7
|
# * If present, render the profile menu for the {SocialStream::Models::Subject subject}
|
@@ -82,21 +85,17 @@ module ToolbarHelper
|
|
82
85
|
|
83
86
|
#Prints the home toolbar menu.
|
84
87
|
def home_toolbar_menu
|
85
|
-
|
88
|
+
render_items home_toolbar_items
|
86
89
|
end
|
87
90
|
|
88
91
|
#Prints the home profile menu.
|
89
92
|
def profile_toolbar_menu(subject=current_subject)
|
90
|
-
|
93
|
+
render_items profile_toolbar_items(subject)
|
91
94
|
end
|
92
95
|
|
93
|
-
|
94
96
|
#Renders array of navigation items with simple_navigation
|
95
97
|
def render_items(items)
|
96
98
|
menu = render_navigation :items => items
|
97
99
|
return raw menu
|
98
100
|
end
|
99
|
-
|
100
|
-
|
101
|
-
include SocialStream::ToolbarConfig
|
102
101
|
end
|
@@ -21,8 +21,8 @@
|
|
21
21
|
<% end %>
|
22
22
|
|
23
23
|
<%= location(
|
24
|
-
link_to(
|
25
|
-
link_to(
|
24
|
+
link_to(t('menu.information'), [current_subject,:profile]),
|
25
|
+
link_to(t('avatar.other'), avatars_path)
|
26
26
|
) %>
|
27
27
|
|
28
28
|
<%= render :partial => 'list' %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% toolbar :profile => @contact.receiver_subject, :option => 'contacts' %>
|
2
2
|
|
3
|
-
<% location link_to(
|
4
|
-
|
3
|
+
<% location link_to(t("contact.#{ @contact.action }.title", :name => @contact.receiver.name),
|
4
|
+
edit_contact_path(@contact.to_param)) %>
|
5
5
|
|
6
6
|
<%= render :partial => 'form' %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= location(
|
2
|
-
link_to(
|
3
|
-
link_to(
|
2
|
+
link_to(t('message.' + @box), conversations_path(:box => @box),:remote => true),
|
3
|
+
link_to(truncate(@conversation.subject, :length => 45), conversation_path(@conversation.id,:box => @box,:page => params[:page]))
|
4
4
|
) %>
|
5
5
|
|
6
6
|
<br class="clearfloat" />
|
@@ -10,9 +10,7 @@
|
|
10
10
|
$('.pagination a').attr('data-remote', 'true');
|
11
11
|
<% end %>
|
12
12
|
|
13
|
-
<%= location(
|
14
|
-
link_to(image_tag("btn/message_" + @box + ".png", :class => "menu_icon")+t('message.' + @box), conversations_path(:box => @box),:remote => true)
|
15
|
-
) %>
|
13
|
+
<%= location(link_to(t('message.' + @box), conversations_path(:box => @box),:remote => true)) %>
|
16
14
|
|
17
15
|
<% toolbar :option => :messages %>
|
18
16
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div id="headerFront">
|
2
2
|
<div class="banner_top">
|
3
|
-
<div id="logo"><%= link_to(image_tag('logo.png', :alt => t('
|
3
|
+
<div id="logo"><%= link_to(image_tag('logo.png', :alt => t('site.name')), '/'); %></div>
|
4
4
|
<div class="div_login">
|
5
5
|
<%= form_for User.new, :as => :user, :url => user_session_path do |f| -%>
|
6
6
|
<span><%= f.label :email %></span>
|
@@ -2,8 +2,7 @@
|
|
2
2
|
<% render :partial => 'sidebar' %>
|
3
3
|
<% end %>
|
4
4
|
|
5
|
-
<%= location(link_to(
|
6
|
-
content_tag(:span, ( sanitize current_subject.name), :class=>"name_group")))%>
|
5
|
+
<%= location(link_to(t('home')+": "+ truncate_name(sanitize current_subject.name)))%>
|
7
6
|
|
8
7
|
<% toolbar %>
|
9
8
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<div>
|
8
8
|
<div>
|
9
9
|
<div style="padding: 10px 5px 5px 5px;">
|
10
|
-
<span id="name" style="font-weight: bold;"><%= @sender.name %></span> has invited you to <%= link_to( t('
|
10
|
+
<span id="name" style="font-weight: bold;"><%= @sender.name %></span> has invited you to <%= link_to( t('site.name'), new_user_registration_url)%>
|
11
11
|
</div>
|
12
12
|
<div style="position: static;padding: 5px; border: #2A3890 solid 2px; background-color: #E1EEF5; margin:10px; min-height: 125px; width: 500px;">
|
13
13
|
<div style="float:left; margin-right:7px; border: thin solid #D4E4EA; background-color: white; max-height: 119px;">
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= @sender.name %> has invited you to <%= t('
|
1
|
+
<%= @sender.name %> has invited you to <%= t('site.name')%>: <%= new_user_registration_url%>
|
2
2
|
|
3
3
|
<% if @message.blank? %>
|
4
4
|
<%= t('invitation.join_me')%>
|
@@ -17,4 +17,4 @@
|
|
17
17
|
|
18
18
|
<%= t('frontpage.collaborate.default')%>:
|
19
19
|
<%= t('frontpage.collaborate.sentence1') %>
|
20
|
-
<%= t('frontpage.collaborate.sentence2') %>
|
20
|
+
<%= t('frontpage.collaborate.sentence2') %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class="banner_top banner_top_height">
|
3
3
|
<div id="header_left">
|
4
4
|
<div id="logo_txt">
|
5
|
-
<%= link_to(image_tag('header-logo.png', :alt => t('
|
5
|
+
<%= link_to(image_tag('header-logo.png', :alt => t('site.name')), root_path) %>
|
6
6
|
</div>
|
7
7
|
<% if user_signed_in? %>
|
8
8
|
<div class="menu_list menu_white" id="menu_home">
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<html lang="en">
|
4
4
|
<head>
|
5
5
|
<meta charset="utf-8">
|
6
|
-
<title><%= yield(:title).empty? ? t('
|
6
|
+
<title><%= yield(:title).empty? ? t('site.name') : yield(:title)%></title>
|
7
7
|
<meta name="keywords" content="<%= t('profile.tags.default') %><%= yield(:keywords) %>" >
|
8
8
|
<meta name="description" content= "<%= yield(:description).empty? ? t('frontpage.main_title') : yield(:description) %>" >
|
9
9
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<html lang="en">
|
4
4
|
<head>
|
5
5
|
<meta charset="utf-8">
|
6
|
-
<title><%= yield(:title).empty? ? t('
|
6
|
+
<title><%= yield(:title).empty? ? t('site.name') : yield(:title)%></title>
|
7
7
|
<meta name="keywords" content="<%= yield(:keywords).empty? ? t('profile.tags.default') : yield(:keywords) %>" >
|
8
8
|
<meta name="description" content= "<%= yield(:description).empty? ? "Home" : yield(:description) %>" >
|
9
9
|
<%= stylesheet_link_tag "application" %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
<% aux='<div class="last">' + stack.last + '</div>' %>
|
3
|
+
<% if stack.count >1 %>
|
4
|
+
<% aux.insert(0, '<div class="penultimate">'+ stack.last(2).first + '</div>') %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% if stack.count >2 %>
|
8
|
+
<% stack.first(stack.count - 2).reverse.collect {|level|
|
9
|
+
aux.insert(0, '<div class="mid">'+ level + '</div>')
|
10
|
+
} %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% if stack.count ==1 %>
|
14
|
+
<% aux.insert(0, '<div class="first"><span class="penultimate">'+ t('location.base') + '</span></div>') %>
|
15
|
+
<% else %>
|
16
|
+
<% aux.insert(0, '<div class="first"><span class="mid">'+ t('location.base') + '</span></div>') %>
|
17
|
+
<% end%>
|
18
|
+
<%= raw aux %>
|
@@ -27,9 +27,9 @@
|
|
27
27
|
</div>
|
28
28
|
<div style="padding: 10px 5px 5px 5px;">
|
29
29
|
<p>
|
30
|
-
<%= link_to((t('message.look')+" at "+t('
|
30
|
+
<%= link_to((t('message.look')+" at "+t('site.name')), conversation_url(@message.conversation))%>
|
31
31
|
</p>
|
32
32
|
</div>
|
33
33
|
</div>
|
34
34
|
</body>
|
35
|
-
</html>
|
35
|
+
</html>
|
@@ -5,4 +5,4 @@
|
|
5
5
|
<%= @message.body.html_safe? ? @message.body : strip_tags(@message.body) %>
|
6
6
|
-----------------------------------------------
|
7
7
|
|
8
|
-
<%=t('message.look')%> at <%= t('
|
8
|
+
<%=t('message.look')%> at <%= t('site.name')%>: <%=conversation_url(@message.conversation)%>.
|
@@ -27,9 +27,9 @@
|
|
27
27
|
</div>
|
28
28
|
<div style="padding: 10px 5px 5px 5px;">
|
29
29
|
<p>
|
30
|
-
<%= link_to t('message.look'), conversation_url(@message.conversation)%> at <%= t('
|
30
|
+
<%= link_to t('message.look'), conversation_url(@message.conversation)%> at <%= t('site.name')%>
|
31
31
|
</p>
|
32
32
|
</div>
|
33
33
|
</div>
|
34
34
|
</body>
|
35
|
-
</html>
|
35
|
+
</html>
|
@@ -5,4 +5,4 @@
|
|
5
5
|
"<%= @message.body.html_safe? ? @message.body : strip_tags(@message.body) %>"
|
6
6
|
-----------------------------------------------
|
7
7
|
|
8
|
-
<%=t('message.look')%> at <%= t('
|
8
|
+
<%=t('message.look')%> at <%= t('site.name')%>: <%=conversation_url(@message.conversation)%>.
|
@@ -8,8 +8,8 @@
|
|
8
8
|
<% toolbar :option => :messages %>
|
9
9
|
|
10
10
|
<%= location(
|
11
|
-
link_to(
|
12
|
-
link_to(
|
11
|
+
link_to(t('message.other'), conversations_path,:remote => true),
|
12
|
+
link_to(t('message.new'), new_message_path, :remote => true)
|
13
13
|
) %>
|
14
14
|
|
15
15
|
<% content_for :javascript do %>
|
@@ -7,25 +7,25 @@
|
|
7
7
|
<%if params[:section].present?
|
8
8
|
case params[:section]
|
9
9
|
when "about_me"
|
10
|
-
level2 = link_to(
|
10
|
+
level2 = link_to( t('profile.' + current_subject.class.to_s.downcase + '.info'),
|
11
11
|
:controller => :profiles , :action => :edit, :section => "about_me")
|
12
12
|
when "contact_info"
|
13
|
-
level2 = link_to(
|
13
|
+
level2 = link_to(t('profile.contact'),
|
14
14
|
:controller => :profiles , :action => :edit, :section => "contact_info")
|
15
15
|
when "my_experience"
|
16
|
-
level2 = link_to(
|
16
|
+
level2 = link_to(t('profile.' + current_subject.class.to_s.downcase + '.experience'),
|
17
17
|
:controller => :profiles , :action => :edit, :section => "my_experience")
|
18
18
|
when "tags"
|
19
|
-
level2 = link_to(
|
19
|
+
level2 = link_to(t('profile.' + current_subject.class.to_s.downcase + '.tags'),
|
20
20
|
:controller => :profiles , :action => :edit, :section => "tags")
|
21
21
|
end
|
22
22
|
else
|
23
|
-
level2 = link_to(
|
23
|
+
level2 = link_to(t('profile.one'),
|
24
24
|
:controller => :profiles , :action => :edit)
|
25
25
|
end %>
|
26
26
|
|
27
27
|
<%= location(
|
28
|
-
link_to(
|
28
|
+
link_to(t('menu.information'), [current_subject, :profile]),
|
29
29
|
level2
|
30
30
|
) %>
|
31
31
|
<div class="space_center"></div>
|
@@ -18,8 +18,7 @@
|
|
18
18
|
<% toolbar :profile => @profile.subject %>
|
19
19
|
|
20
20
|
|
21
|
-
<%= location(link_to(
|
22
|
-
[@profile.subject, :profile])) %>
|
21
|
+
<%= location(link_to(t('menu.information'), [@profile.subject, :profile])) %>
|
23
22
|
|
24
23
|
|
25
24
|
<%= render :partial => "profile" %>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<%= render :partial => "users/sidebar_index" %>
|
9
9
|
<% end %>
|
10
10
|
|
11
|
-
<%= location(
|
11
|
+
<%= location(t('browse') +": "+
|
12
12
|
content_tag(:b ,content_tag(:span, t('user.other'), :id=>'name_group')) + ", "+
|
13
13
|
link_to(t('group.by'),groups_path))%>
|
14
14
|
|
@@ -16,8 +16,7 @@
|
|
16
16
|
<%= render :partial => 'sidebar_index' %>
|
17
17
|
<% end %>
|
18
18
|
|
19
|
-
<%= location(link_to(
|
20
|
-
content_tag(:span, ( truncate_name sanitize @user.name), :class=>"name_group")))%>
|
19
|
+
<%= location(link_to(t('profile.one')+": "+truncate_name(sanitize @user.name)))%>
|
21
20
|
|
22
21
|
<% toolbar :profile => @user %>
|
23
22
|
|
data/config/locales/en.yml
CHANGED
@@ -152,7 +152,7 @@ en:
|
|
152
152
|
participants: "Participants"
|
153
153
|
groups: "Groups"
|
154
154
|
tags: "Tags"
|
155
|
-
main_title: "
|
155
|
+
main_title: "Social Stream is a core for building social network websites."
|
156
156
|
meet:
|
157
157
|
default: "Meet"
|
158
158
|
sentence1: "Meet interesting people and groups"
|
@@ -195,9 +195,9 @@ en:
|
|
195
195
|
invitation:
|
196
196
|
e-mails: "E-mail addresses"
|
197
197
|
error: "Your request was unprocessable"
|
198
|
-
invited: " has invited you to
|
199
|
-
join: "Invite other people to join
|
200
|
-
join_me: "Join me at
|
198
|
+
invited: " has invited you to Social Stream!"
|
199
|
+
join: "Invite other people to join Social Stream!"
|
200
|
+
join_me: "Join me at Social Stream!"
|
201
201
|
one: "Invitation"
|
202
202
|
other: "Invitations"
|
203
203
|
toolbar: "Invite"
|
@@ -371,7 +371,8 @@ en:
|
|
371
371
|
sign_in: "Sign in"
|
372
372
|
sign_out: "Sign out"
|
373
373
|
sign_up: "Sign up"
|
374
|
-
|
374
|
+
site:
|
375
|
+
name: "Social Stream"
|
375
376
|
subject:
|
376
377
|
this_is_you: "This is you!"
|
377
378
|
sure: "Are you sure?"
|
@@ -383,5 +384,5 @@ en:
|
|
383
384
|
other: "Users"
|
384
385
|
all: "All users"
|
385
386
|
all_n: "All users (%{count})"
|
386
|
-
welcome: "Welcome to
|
387
|
+
welcome: "Welcome to Social Stream!"
|
387
388
|
|
data/lib/social_stream-base.rb
CHANGED
@@ -45,7 +45,6 @@ module SocialStream
|
|
45
45
|
autoload :Populate, 'social_stream/populate'
|
46
46
|
autoload :Relations, 'social_stream/relations'
|
47
47
|
autoload :TestHelpers, 'social_stream/test_helpers'
|
48
|
-
autoload :ToolbarConfig, 'social_stream/toolbar_config'
|
49
48
|
|
50
49
|
module Controllers
|
51
50
|
autoload :Helpers, 'social_stream/controllers/helpers'
|
@@ -61,6 +60,10 @@ module SocialStream
|
|
61
60
|
autoload :Controllers, 'social_stream/test_helpers/controllers'
|
62
61
|
end
|
63
62
|
|
63
|
+
module ToolbarConfig
|
64
|
+
autoload :Base, 'social_stream/toolbar_config/base'
|
65
|
+
end
|
66
|
+
|
64
67
|
mattr_accessor :subjects
|
65
68
|
@@subjects = [ :user, :group ]
|
66
69
|
|
data/lib/social_stream/base.rb
CHANGED
@@ -24,6 +24,12 @@ module SocialStream
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
initializer "social_stream-base.toolbar_config" do
|
28
|
+
SocialStream::ToolbarConfig.module_eval do
|
29
|
+
include SocialStream::ToolbarConfig::Base
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
27
33
|
initializer "social_stream-base.avatars_for_rails" do
|
28
34
|
AvatarsForRails.setup do |config|
|
29
35
|
config.avatarable_model = :actor
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module SocialStream
|
2
|
+
module ToolbarConfig
|
3
|
+
module Base
|
4
|
+
# Base toolbar items
|
5
|
+
def home_toolbar_items
|
6
|
+
Array.new.tap do |items|
|
7
|
+
# Messages
|
8
|
+
items << {
|
9
|
+
:key => :messages,
|
10
|
+
:name => image_tag("btn/new.png")+t('message.other')+' (' + current_subject.mailbox.inbox(:unread => true).count.to_s + ')',
|
11
|
+
:url => "#",
|
12
|
+
:options => {:link => {:id => "messages_menu"}},
|
13
|
+
:items => [
|
14
|
+
{ :key => :message_new,
|
15
|
+
:name => image_tag("btn/message_new.png")+ t('message.new'),
|
16
|
+
:url => new_message_path,
|
17
|
+
:options => {:link =>{:remote=> false}}},
|
18
|
+
{ :key => :message_inbox,
|
19
|
+
:name => image_tag("btn/message_inbox.png")+t('message.inbox')+' (' + current_subject.mailbox.inbox(:unread => true).count.to_s + ')',
|
20
|
+
:url => conversations_path,
|
21
|
+
:options => {:link =>{:remote=> false}}},
|
22
|
+
{ :key => :message_sentbox,
|
23
|
+
:name => image_tag("btn/message_sentbox.png")+t('message.sentbox'),
|
24
|
+
:url => conversations_path(:box => :sentbox),
|
25
|
+
:options => {:link =>{:remote=> false}}},
|
26
|
+
{ :key => :message_trash,
|
27
|
+
:name => image_tag("btn/message_trash.png")+t('message.trash'),
|
28
|
+
:url => conversations_path(:box => :trash)}
|
29
|
+
]
|
30
|
+
}
|
31
|
+
|
32
|
+
#Contacts
|
33
|
+
items << {
|
34
|
+
:key => :contacts,
|
35
|
+
:name => image_tag("btn/btn_friend.png")+t('contact.other'),
|
36
|
+
:url => "#",
|
37
|
+
:options => {:link => {:id => "contacts_menu"}},
|
38
|
+
:items => [
|
39
|
+
{:key => :invitations, :name => image_tag("btn/btn_friend.png")+t('contact.current'), :url => contacts_path},
|
40
|
+
{:key => :contacts_graph, :name => image_tag("btn/btn_friend.png")+t('contact.graph.one'), :url => ties_path},
|
41
|
+
{:key => :invitations, :name => image_tag("btn/btn_friend.png")+t('contact.pending.other'), :url => contacts_path(:pending=>true)},
|
42
|
+
{:key => :invitations, :name => image_tag("btn/btn_invitation.png")+t('invitation.toolbar'), :url => new_invitation_path}
|
43
|
+
]
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Builds the default profile toolbar items
|
49
|
+
def profile_toolbar_items(subject = current_subject)
|
50
|
+
Array.new.tap do |items|
|
51
|
+
#Information button
|
52
|
+
items << {
|
53
|
+
:key => :subject_info,
|
54
|
+
:name => image_tag("btn/btn_edit.png")+t('menu.information'),
|
55
|
+
:url => [subject, :profile]
|
56
|
+
}
|
57
|
+
|
58
|
+
if subject != current_subject
|
59
|
+
#Like button
|
60
|
+
items << {
|
61
|
+
:key => :like_button,
|
62
|
+
:name => link_like_params(subject)[0],
|
63
|
+
:url => link_like_params(subject)[1],
|
64
|
+
:options => {:link => link_like_params(subject)[2]}
|
65
|
+
}
|
66
|
+
|
67
|
+
if user_signed_in?
|
68
|
+
#Relation button
|
69
|
+
items << {
|
70
|
+
:key => :subject_relation,
|
71
|
+
:name => image_tag("btn/btn_friend.png") + current_subject.contact_to!(subject).status,
|
72
|
+
:url => edit_contact_path(current_subject.contact_to!(subject))
|
73
|
+
}
|
74
|
+
|
75
|
+
#Send message button
|
76
|
+
items << {:key => :send_message,
|
77
|
+
:name => image_tag("btn/btn_send.png")+t('message.send'),
|
78
|
+
:url => new_message_path(:receiver => subject.slug)
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
@@ -0,0 +1,163 @@
|
|
1
|
+
# Rake task to launch multiple Resque workers in development/production with simple management included
|
2
|
+
|
3
|
+
require 'resque/tasks' # Require Resque tasks
|
4
|
+
|
5
|
+
namespace :workers do
|
6
|
+
|
7
|
+
# = $ rake workers:start
|
8
|
+
#
|
9
|
+
# Launch multiple Resque workers with the Rails environment loaded,
|
10
|
+
# so they have access to your models, etc.
|
11
|
+
#
|
12
|
+
# Each worker is being run in their own separate process (_not_ thread).
|
13
|
+
#
|
14
|
+
# On clean shutdown (SIGINT / Ctrl-C, SIGQUIT, SIGTERM), the task will clean
|
15
|
+
# after itself: kill its workers and delete PID files, when appropriate. It
|
16
|
+
# will deal fine with already dead workers.
|
17
|
+
#
|
18
|
+
#
|
19
|
+
# Default options like COUNT can and should be over-ridden when invoking, of course:
|
20
|
+
#
|
21
|
+
# $ rake workers:start COUNT=10 QUEUE=my_queue
|
22
|
+
#
|
23
|
+
#
|
24
|
+
# To daemonize, simply run with nohup:
|
25
|
+
#
|
26
|
+
# $ nohup rake workers:start > log/workers.log 2>&1 &
|
27
|
+
#
|
28
|
+
#
|
29
|
+
# You can and should set up your monitoring tool to watch for process with PID
|
30
|
+
# from `cat tmp/pids/resque/master.pid`.
|
31
|
+
#
|
32
|
+
# For proper monitoring of _individual_ workers, use provided examples for God or Monit:
|
33
|
+
# http://github.com/defunkt/resque/blob/master/examples/.
|
34
|
+
#
|
35
|
+
#
|
36
|
+
# A task for killing all workers on the machine (`rake workers:killall`) is also provided,
|
37
|
+
# for pruning orphaned workers etc.
|
38
|
+
#
|
39
|
+
desc "Run and manage group of Resque workers with some default options"
|
40
|
+
task :start => :environment do
|
41
|
+
|
42
|
+
# - CONFIGURATION ----
|
43
|
+
ENV['QUEUE'] ||= '*'
|
44
|
+
ENV['COUNT'] ||= '3'
|
45
|
+
# --------------------
|
46
|
+
|
47
|
+
def queue
|
48
|
+
ENV['QUEUE']
|
49
|
+
end
|
50
|
+
|
51
|
+
def count
|
52
|
+
ENV['COUNT']
|
53
|
+
end
|
54
|
+
|
55
|
+
def Process.exists?(pid)
|
56
|
+
kill(0, pid.to_i) rescue false
|
57
|
+
end
|
58
|
+
|
59
|
+
def pid_directory
|
60
|
+
@pid_directory ||= Rails.root.join('tmp', 'pids', "resque")
|
61
|
+
end
|
62
|
+
|
63
|
+
def pid_directory_for_group
|
64
|
+
@pid_directory_for_group ||= Rails.root.join('tmp', 'pids', "resque", queue)
|
65
|
+
end
|
66
|
+
|
67
|
+
def group_master_pid
|
68
|
+
File.read pid_directory.join("#{queue}.pid").to_s rescue nil
|
69
|
+
end
|
70
|
+
|
71
|
+
def group?
|
72
|
+
!group_master_pid || group_master_pid.to_s == Process.pid.to_s
|
73
|
+
end
|
74
|
+
|
75
|
+
def group_running?
|
76
|
+
Process.exists?(group_master_pid)
|
77
|
+
end
|
78
|
+
|
79
|
+
def kill_worker(pid)
|
80
|
+
Process.kill("QUIT", pid)
|
81
|
+
puts "Killed worker with PID #{pid}"
|
82
|
+
rescue Errno::ESRCH => e
|
83
|
+
puts " STALE worker with PID #{pid}"
|
84
|
+
end
|
85
|
+
|
86
|
+
def kill_workers
|
87
|
+
@pids.each { |pid| kill_worker(pid) }
|
88
|
+
end
|
89
|
+
|
90
|
+
def kill_workers_and_remove_pids_for_group
|
91
|
+
Dir.glob(pid_directory_for_group.join('worker_*.pid').to_s) do |pidfile|
|
92
|
+
begin
|
93
|
+
pid = pidfile[/(\d+)\.pid/, 1].to_i
|
94
|
+
kill_worker(pid)
|
95
|
+
ensure
|
96
|
+
FileUtils.rm pidfile, :force => true
|
97
|
+
end
|
98
|
+
end
|
99
|
+
if group_master_pid
|
100
|
+
FileUtils.rm pid_directory.join("#{queue}.pid").to_s
|
101
|
+
FileUtils.rm_rf pid_directory_for_group.to_s
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def shutdown
|
106
|
+
puts "\n*** Exiting"
|
107
|
+
if group?
|
108
|
+
kill_workers_and_remove_pids_for_group
|
109
|
+
else
|
110
|
+
kill_workers
|
111
|
+
end
|
112
|
+
exit(0)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Clean up after dead group from before -- and become one
|
116
|
+
unless group_running?
|
117
|
+
puts "--- Cleaning up after previous group (PID: #{group_master_pid})"
|
118
|
+
kill_workers_and_remove_pids_for_group
|
119
|
+
end
|
120
|
+
|
121
|
+
# Handle exit
|
122
|
+
trap('INT') { shutdown }
|
123
|
+
trap('QUIT') { shutdown }
|
124
|
+
trap('TERM') { shutdown }
|
125
|
+
trap('KILL') { shutdown }
|
126
|
+
trap('SIGKILL') { shutdown }
|
127
|
+
|
128
|
+
puts "=== Launching #{ENV['COUNT']} worker(s) on '#{ENV['QUEUE']}' queue(s) with PID #{Process.pid}"
|
129
|
+
|
130
|
+
# Launch workers in separate processes, saving their PIDs
|
131
|
+
@pids = []
|
132
|
+
ENV['COUNT'].to_i.times do
|
133
|
+
@pids << Process.fork { Rake::Task['resque:work'].invoke }
|
134
|
+
end
|
135
|
+
|
136
|
+
if group?
|
137
|
+
# Make sure we have directory for pids
|
138
|
+
FileUtils.mkdir_p pid_directory.to_s
|
139
|
+
FileUtils.mkdir_p pid_directory_for_group.to_s
|
140
|
+
# Create PID files for workers
|
141
|
+
File.open( pid_directory.join("#{queue}.pid").to_s, 'w' ) do |f| f.write Process.pid end
|
142
|
+
@pids.each do |pid|
|
143
|
+
File.open( pid_directory_for_group.join("worker_#{pid}.pid").to_s, 'w' ) { |f| f.write pid }
|
144
|
+
end
|
145
|
+
# Stay in foreground, if any of our workers dies, we'll get killed so Monit/God etc can come to the resq^Hcue
|
146
|
+
Process.wait
|
147
|
+
else
|
148
|
+
# Stay in foreground, if any of our workers dies, continue running
|
149
|
+
Process.waitall
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
desc "Kill ALL workers on this machine"
|
154
|
+
task :kilall do
|
155
|
+
require 'resque'
|
156
|
+
Resque::Worker.all.each do |worker|
|
157
|
+
puts "Shutting down worker #{worker}"
|
158
|
+
host, pid, queues = worker.id.split(':')
|
159
|
+
Process.kill("QUIT", pid.to_i)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_stream-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 7
|
10
|
+
version: 0.9.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- GING - DIT - UPM
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-09-
|
19
|
+
date: 2011-09-23 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -470,6 +470,9 @@ files:
|
|
470
470
|
- app/assets/images/HTML5_Semantics.png
|
471
471
|
- app/assets/images/HTML5_Styling.png
|
472
472
|
- app/assets/images/Jcrop.gif
|
473
|
+
- app/assets/images/arrow-end.png
|
474
|
+
- app/assets/images/arrow-start.png
|
475
|
+
- app/assets/images/arrow.png
|
473
476
|
- app/assets/images/big-logo.png
|
474
477
|
- app/assets/images/boxy/boxy-ne.png
|
475
478
|
- app/assets/images/boxy/boxy-nw.png
|
@@ -651,6 +654,7 @@ files:
|
|
651
654
|
- app/assets/stylesheets/images/ui-icons_888888_256x240.png
|
652
655
|
- app/assets/stylesheets/images/ui-icons_cd0a0a_256x240.png
|
653
656
|
- app/assets/stylesheets/invitations.css
|
657
|
+
- app/assets/stylesheets/location.css
|
654
658
|
- app/assets/stylesheets/menu.css
|
655
659
|
- app/assets/stylesheets/messages.css
|
656
660
|
- app/assets/stylesheets/profiles.css
|
@@ -806,6 +810,7 @@ files:
|
|
806
810
|
- app/views/likes/create.js.erb
|
807
811
|
- app/views/likes/destroy.js.erb
|
808
812
|
- app/views/location/_location.html.erb
|
813
|
+
- app/views/location/_location_body.html.erb
|
809
814
|
- app/views/message_mailer/new_message_email.html.erb
|
810
815
|
- app/views/message_mailer/new_message_email.text.erb
|
811
816
|
- app/views/message_mailer/reply_message_email.html.erb
|
@@ -918,9 +923,10 @@ files:
|
|
918
923
|
- lib/social_stream/populate.rb
|
919
924
|
- lib/social_stream/test_helpers.rb
|
920
925
|
- lib/social_stream/test_helpers/controllers.rb
|
921
|
-
- lib/social_stream/toolbar_config.rb
|
926
|
+
- lib/social_stream/toolbar_config/base.rb
|
922
927
|
- lib/tasks/db/populate.rake
|
923
928
|
- lib/tasks/resque.rake
|
929
|
+
- lib/tasks/workers.rake
|
924
930
|
- social_stream-base.gemspec
|
925
931
|
- spec/controllers/comments_controller_spec.rb
|
926
932
|
- spec/controllers/contacts_controller_spec.rb
|
@@ -1,99 +0,0 @@
|
|
1
|
-
module SocialStream
|
2
|
-
module ToolbarConfig
|
3
|
-
#Prints the default home toolbar menu
|
4
|
-
def default_home_toolbar_menu
|
5
|
-
items = Array.new
|
6
|
-
|
7
|
-
#Messages
|
8
|
-
items << {:key => :messages,
|
9
|
-
:name => image_tag("btn/new.png")+t('message.other')+' (' + current_subject.mailbox.inbox(:unread => true).count.to_s + ')',
|
10
|
-
:url => "#",
|
11
|
-
:options => {:link => {:id => "messages_menu"}},
|
12
|
-
:items => [
|
13
|
-
{:key => :message_new, :name => image_tag("btn/message_new.png")+ t('message.new'), :url => new_message_path, :options => {:link =>{:remote=> false}}},
|
14
|
-
{:key => :message_inbox, :name => image_tag("btn/message_inbox.png")+t('message.inbox')+' (' + current_subject.mailbox.inbox(:unread => true).count.to_s + ')',
|
15
|
-
:url => conversations_path, :options => {:link =>{:remote=> false}}},
|
16
|
-
{:key => :message_sentbox, :name => image_tag("btn/message_sentbox.png")+t('message.sentbox'), :url => conversations_path(:box => :sentbox), :options => {:link =>{:remote=> false}}},
|
17
|
-
{:key => :message_trash, :name => image_tag("btn/message_trash.png")+t('message.trash'), :url => conversations_path(:box => :trash)}
|
18
|
-
]}
|
19
|
-
|
20
|
-
#Documents if present
|
21
|
-
if SocialStream.activity_forms.include? :document
|
22
|
-
items << {:key => :resources,
|
23
|
-
:name => image_tag("btn/btn_resource.png",:class =>"menu_icon")+t('resource.mine'),
|
24
|
-
:url => "#",
|
25
|
-
:options => {:link => {:id => "resources_menu"}},
|
26
|
-
:items => [
|
27
|
-
{:key => :resources_documents,:name => image_tag("btn/btn_document.png")+t('document.title'),:url => documents_path},
|
28
|
-
{:key => :resources_pictures,:name => image_tag("btn/btn_gallery.png")+t('picture.title'),:url => pictures_path},
|
29
|
-
{:key => :resources_videos,:name => image_tag("btn/btn_video.png")+t('video.title'),:url => videos_path},
|
30
|
-
{:key => :resources_audios,:name => image_tag("btn/btn_audio.png")+t('audio.title'),:url => audios_path}
|
31
|
-
]}
|
32
|
-
end
|
33
|
-
|
34
|
-
#Contacts
|
35
|
-
items << {:key => :contacts,
|
36
|
-
:name => image_tag("btn/btn_friend.png")+t('contact.other'),
|
37
|
-
:url => "#",
|
38
|
-
:options => {:link => {:id => "contacts_menu"}},
|
39
|
-
:items => [
|
40
|
-
{:key => :invitations, :name => image_tag("btn/btn_friend.png")+t('contact.current'), :url => contacts_path},
|
41
|
-
{:key => :contacts_graph, :name => image_tag("btn/btn_friend.png")+t('contact.graph.one'), :url => ties_path},
|
42
|
-
{:key => :invitations, :name => image_tag("btn/btn_friend.png")+t('contact.pending.other'), :url => contacts_path(:pending=>true)},
|
43
|
-
{:key => :invitations, :name => image_tag("btn/btn_invitation.png")+t('invitation.toolbar'), :url => new_invitation_path}
|
44
|
-
]}
|
45
|
-
|
46
|
-
render_items items
|
47
|
-
end
|
48
|
-
|
49
|
-
#Prints the default profile toolbar menu
|
50
|
-
def default_profile_toolbar_menu(subject = current_subject)
|
51
|
-
items = Array.new
|
52
|
-
#Information button
|
53
|
-
items << {:key => :subject_info,
|
54
|
-
:name => image_tag("btn/btn_edit.png")+t('menu.information'),
|
55
|
-
:url => [subject, :profile]
|
56
|
-
}
|
57
|
-
|
58
|
-
if subject!=current_subject
|
59
|
-
#Like button
|
60
|
-
items << {:key => :like_button,
|
61
|
-
:name => link_like_params(subject)[0],
|
62
|
-
:url => link_like_params(subject)[1],
|
63
|
-
:options => {:link => link_like_params(subject)[2]}}
|
64
|
-
|
65
|
-
if user_signed_in?
|
66
|
-
#Relation button
|
67
|
-
items << {:key => :subject_relation,
|
68
|
-
:name => image_tag("btn/btn_friend.png") + current_subject.contact_to!(subject).status,
|
69
|
-
:url => edit_contact_path(current_subject.contact_to!(subject))
|
70
|
-
}
|
71
|
-
#Send message button
|
72
|
-
items << {:key => :send_message,
|
73
|
-
:name => image_tag("btn/btn_send.png")+t('message.send'),
|
74
|
-
:url => new_message_path(:receiver => subject.slug)
|
75
|
-
}
|
76
|
-
end
|
77
|
-
end
|
78
|
-
#Documents if present
|
79
|
-
if SocialStream.activity_forms.include? :document
|
80
|
-
if subject == current_subject
|
81
|
-
resources_label = t('resource.mine')
|
82
|
-
else
|
83
|
-
resources_label = t('resource.title')
|
84
|
-
end
|
85
|
-
items << {:key => :resources,
|
86
|
-
:name => image_tag("btn/btn_resource.png",:class =>"menu_icon")+resources_label,
|
87
|
-
:url => "#",
|
88
|
-
:options => {:link => {:id => "resources_menu"}},
|
89
|
-
:items => [
|
90
|
-
{:key => :resources_documents,:name => image_tag("btn/btn_document.png")+t('document.title'),:url => polymorphic_path([subject, Document.new])},
|
91
|
-
{:key => :resources_pictures,:name => image_tag("btn/btn_gallery.png")+t('picture.title'),:url => polymorphic_path([subject, Picture.new])},
|
92
|
-
{:key => :resources_videos,:name => image_tag("btn/btn_video.png")+t('video.title'),:url => polymorphic_path([subject, Video.new])},
|
93
|
-
{:key => :resources_audios,:name => image_tag("btn/btn_audio.png")+t('audio.title'),:url => polymorphic_path([subject, Audio.new])}
|
94
|
-
]}
|
95
|
-
end
|
96
|
-
render_items items
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|