social_stream-base 0.6.3 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/stylesheets/base.css +1 -0
- data/app/assets/stylesheets/contacts.css +2 -1
- data/app/assets/stylesheets/fcbkComplete.css +1 -1
- data/app/assets/stylesheets/header.css +2 -2
- data/app/assets/stylesheets/messages.css +3 -3
- data/app/assets/stylesheets/{spheres.css → relation_customs.css} +0 -0
- data/app/controllers/contacts_controller.rb +9 -4
- data/app/controllers/messages_controller.rb +69 -68
- data/app/controllers/relation/customs_controller.rb +1 -11
- data/app/helpers/activities_helper.rb +1 -2
- data/app/helpers/notifications_helper.rb +3 -2
- data/app/helpers/permissions_helper.rb +5 -5
- data/app/helpers/subjects_helper.rb +9 -0
- data/app/helpers/toolbar_helper.rb +10 -89
- data/app/models/activity.rb +39 -15
- data/app/models/actor.rb +30 -71
- data/app/models/contact.rb +15 -0
- data/app/models/group.rb +1 -3
- data/app/models/permission.rb +9 -72
- data/app/models/profile.rb +7 -2
- data/app/models/relation/custom.rb +6 -33
- data/app/models/relation.rb +15 -39
- data/app/models/user.rb +5 -1
- data/app/views/activities/_new.html.erb +5 -2
- data/app/views/activities/_options.html.erb +2 -2
- data/app/views/activities/_walls.html.erb +1 -1
- data/app/views/contacts/_contact.html.erb +3 -3
- data/app/views/contacts/_form.html.erb +14 -20
- data/app/views/contacts/_index.html.erb +1 -1
- data/app/views/contacts/_suggestions.html.erb +1 -13
- data/app/views/contacts/destroy.js.erb +6 -0
- data/app/views/contacts/edit.html.erb +1 -1
- data/app/views/conversations/_conversation.html.erb +1 -1
- data/app/views/groups/_group.html.erb +1 -1
- data/app/views/groups/_index.html.erb +1 -1
- data/app/views/groups/show.html.erb +1 -1
- data/app/views/invitation_mailer/send_invitation.html.erb +17 -6
- data/app/views/invitation_mailer/send_invitation.text.erb +7 -2
- data/app/views/layouts/_representation.html.erb +10 -6
- data/app/views/layouts/_settings.html.erb +1 -1
- data/app/views/messages/_message.html.erb +1 -1
- data/app/views/messages/new.html.erb +1 -1
- data/app/views/notifications/_notification.html.erb +7 -3
- data/app/views/objects/_new.html.erb +0 -6
- data/app/views/profiles/edit.html.erb +5 -9
- data/app/views/relation/customs/_form.html.erb +2 -2
- data/app/views/{spheres → relation/customs}/_jquery.erb +0 -58
- data/app/views/relation/customs/_list.html.erb +9 -26
- data/app/views/relation/customs/create.js.erb +2 -3
- data/app/views/relation/customs/index.html.erb +67 -0
- data/app/views/users/_index.html.erb +1 -1
- data/app/views/users/show.html.erb +1 -1
- data/config/locales/en.yml +16 -41
- data/config/routes.rb +1 -6
- data/db/migrate/20110705103202_empty_ties_count.rb +4 -0
- data/db/migrate/20110712090343_remove_spheres.rb +30 -0
- data/db/migrate/20110712142140_remove_permission_function.rb +26 -0
- data/lib/generators/social_stream/base/install_generator.rb +4 -0
- data/lib/generators/social_stream/base/templates/mailboxer_custom.rb +13 -0
- data/lib/generators/social_stream/base/templates/navigation.rb +4 -0
- data/lib/generators/social_stream/base/templates/relations.yml +14 -20
- data/lib/social_stream/ability.rb +1 -2
- data/lib/social_stream/base/version.rb +1 -1
- data/lib/social_stream/migration_finder.rb +19 -0
- data/lib/social_stream/toolbar_config.rb +113 -0
- data/lib/social_stream-base.rb +1 -0
- data/lib/tasks/db/populate.rake +1 -1
- data/social_stream-base.gemspec +4 -2
- data/spec/controllers/contacts_controller_spec.rb +1 -1
- data/spec/controllers/permissions_controller_spec.rb +1 -2
- data/spec/controllers/posts_controller_spec.rb +2 -2
- data/spec/controllers/relation_customs_controller_spec.rb +69 -62
- data/spec/dummy/config/database.yml +7 -0
- data/spec/dummy/config/relations.yml +14 -20
- data/spec/factories/relation_custom.rb +1 -1
- data/spec/factories/tie.rb +4 -0
- data/spec/models/activity_spec.rb +11 -2
- data/spec/models/user_spec.rb +68 -9
- data/spec/spec_helper.rb +0 -3
- data/spec/support/db.rb +9 -0
- data/spec/support/migrations.rb +3 -12
- metadata +19 -25
- data/app/controllers/spheres_controller.rb +0 -12
- data/app/models/sphere.rb +0 -9
- data/app/views/relation/customs/_index.html.erb +0 -28
- data/app/views/relation/customs/index.js.erb +0 -2
- data/app/views/spheres/_form.html.erb +0 -28
- data/app/views/spheres/_list.html.erb +0 -19
- data/app/views/spheres/create.js.erb +0 -20
- data/app/views/spheres/index.html.erb +0 -74
- data/spec/controllers/spheres_controller_spec.rb +0 -116
- data/spec/factories/sphere.rb +0 -5
- data/spec/models/relation_custom_spec.rb +0 -14
@@ -1,36 +1,19 @@
|
|
1
|
-
<table class="tableCheckBoxOptions">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<p>
|
8
|
-
<div id="slider-range"></div>
|
9
|
-
</p>
|
10
|
-
</div>
|
11
|
-
</td>
|
12
|
-
</tr>
|
13
|
-
|
14
|
-
<% order = 0 %>
|
15
|
-
<% list.sort.each do |r| %>
|
16
|
-
<tr><td>
|
17
|
-
<div contain=<%= dom_id r %> class="checkboxOptionLeft">
|
18
|
-
<input id=<%= dom_id r %> type="checkbox"/>
|
19
|
-
<label for="<%= dom_id r %>" order="<%= order %>"><%= r.name %></label>
|
1
|
+
<table class="tableCheckBoxOptions">
|
2
|
+
<% list.each do |r| %>
|
3
|
+
<%= raw cycle("<tr><td>", "<td>", :name => "begin_cell") %>
|
4
|
+
<div contain="<%= dom_id(r) %>" class="checkboxOptionLeft">
|
5
|
+
<input id=<%= dom_id(r) %> type="checkbox"/>
|
6
|
+
<label for=<%= dom_id(r) %>><%=r.name%></label>
|
20
7
|
</div>
|
21
|
-
</td></tr>
|
22
|
-
<% order += 1 %>
|
8
|
+
<%= raw cycle("</td>", "</td></tr>", :name => "end_cell") %>
|
23
9
|
<% end %>
|
24
10
|
|
25
|
-
|
11
|
+
<%= raw("</tr>") if list.size.odd? %>
|
12
|
+
|
26
13
|
</table>
|
27
14
|
|
28
15
|
<%= javascript_tag do %>
|
29
16
|
$(function() {
|
30
|
-
relations = <%= list.sort.reverse.map{ |r| h(r.name) }.to_json.html_safe %>;
|
31
|
-
|
32
17
|
$('input[id^="relation_custom"]').checkBox();
|
33
|
-
|
34
|
-
initSlider();
|
35
18
|
})
|
36
19
|
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if @custom.errors.present? %>
|
2
2
|
$('#new_relation_custom_input_block').html("<%= escape_javascript render(:partial => 'relation/customs/form') %>");
|
3
3
|
<% else %>
|
4
|
-
// Hide #permissions
|
4
|
+
// Hide #relations and #permissions
|
5
5
|
$('#permissions').html("");
|
6
6
|
$('#permissions').hide();
|
7
7
|
|
@@ -10,9 +10,8 @@
|
|
10
10
|
$('#new_relation_custom_input_block').hide();
|
11
11
|
$('#new_relation_custom_title_block').show();
|
12
12
|
|
13
|
-
|
14
13
|
// Refresh list
|
15
|
-
$('#
|
14
|
+
$('#relation_customs_list').html("<%= escape_javascript render(:partial => 'relation/customs/list', :object => current_subject.relation_customs) %>");
|
16
15
|
|
17
16
|
// Select relation_custom
|
18
17
|
$('#' + '<%= dom_id @custom %>').checkBox('changeCheckStatus', true);
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<% content_for :headers do %>
|
2
|
+
<%= stylesheet_link_tag "relation_customs.css", :media => "screen, projection" %>
|
3
|
+
<%= javascript_include_tag 'ui.checkbox'%>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<% toolbar :profile => current_subject, :option => 'contacts' %>
|
7
|
+
|
8
|
+
<%= javascript_tag do %>
|
9
|
+
<%= render :partial => 'relation/customs/jquery' %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<div id="wrapper_section">
|
13
|
+
|
14
|
+
<p class="pageTitle"><%= t 'relation_custom.title' %></p>
|
15
|
+
|
16
|
+
<div id="relation_customs" class="privacy_block_section first_block_section">
|
17
|
+
<p class="sectionTitle"><%= t 'relation_custom.choose' %></p>
|
18
|
+
|
19
|
+
<div class="privacy_add_element">
|
20
|
+
<div id="new_relation_custom_title_block">
|
21
|
+
<a href="#"><span id="new_relation_custom_title" class="privacy_span_new"><%= t('relation_custom.new') %></span></a>
|
22
|
+
</div>
|
23
|
+
<div id="new_relation_custom_input_block">
|
24
|
+
<%= render :partial => 'relation/customs/form' %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<%= javascript_tag do %>
|
29
|
+
$(function() {
|
30
|
+
$("#new_relation_custom_input_block").hide();
|
31
|
+
|
32
|
+
$("#new_relation_custom_title").click(function() {
|
33
|
+
$("#new_relation_custom_title_block").hide();
|
34
|
+
$("#new_relation_custom_input_block").show();
|
35
|
+
});
|
36
|
+
|
37
|
+
$("#loading").hide();
|
38
|
+
|
39
|
+
$("#loading").ajaxStart(function(){
|
40
|
+
$(this).show();
|
41
|
+
});
|
42
|
+
|
43
|
+
$("#loading").ajaxStop(function(){
|
44
|
+
$(this).hide();
|
45
|
+
});
|
46
|
+
|
47
|
+
})
|
48
|
+
<% end %>
|
49
|
+
|
50
|
+
<div id="relation_customs_list">
|
51
|
+
<%= render :partial => 'relation/customs/list', :object => @customs %>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
<div id="permissions" class="privacy_block_section">
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="loading"></div>
|
61
|
+
|
62
|
+
<%= javascript_tag do %>
|
63
|
+
$(function() {
|
64
|
+
$("#permissions").hide();
|
65
|
+
})
|
66
|
+
<% end %>
|
67
|
+
</div>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<% end %>
|
18
18
|
|
19
19
|
<%= location(link_to(image_tag("btn/btn_profile.png", :class => "btn_config")+t('profile.one')+": "+
|
20
|
-
content_tag(:span, ( sanitize @user.name), :class=>"name_group")))%>
|
20
|
+
content_tag(:span, ( truncate_name sanitize @user.name), :class=>"name_group")))%>
|
21
21
|
|
22
22
|
<% toolbar :profile => @user %>
|
23
23
|
|
data/config/locales/en.yml
CHANGED
@@ -150,8 +150,6 @@ en:
|
|
150
150
|
help: "Help"
|
151
151
|
helpers:
|
152
152
|
submit:
|
153
|
-
sphere:
|
154
|
-
create: "Save"
|
155
153
|
relation_custom:
|
156
154
|
create: "Save"
|
157
155
|
home: "Home"
|
@@ -162,6 +160,7 @@ en:
|
|
162
160
|
error: "Your request was unprocessable"
|
163
161
|
invited: " has invited you to SocialStream!"
|
164
162
|
join: "Invite other people to join SocialStream!"
|
163
|
+
join_me: "Join me at SocialStream!"
|
165
164
|
one: "Invitation"
|
166
165
|
other: "Invitations"
|
167
166
|
success: "Your invitations have successfully been sent"
|
@@ -236,7 +235,7 @@ en:
|
|
236
235
|
public:
|
237
236
|
other: "Everybody"
|
238
237
|
representation:
|
239
|
-
action: "
|
238
|
+
action: "as"
|
240
239
|
change: "Change"
|
241
240
|
service:
|
242
241
|
one: "Service"
|
@@ -245,46 +244,25 @@ en:
|
|
245
244
|
description:
|
246
245
|
brief:
|
247
246
|
create:
|
248
|
-
activity:
|
249
|
-
same_level: "Post to wall"
|
250
|
-
destroy:
|
251
|
-
activity:
|
252
|
-
nil: "Delete activities in wall"
|
247
|
+
activity: "Post to wall"
|
253
248
|
follow:
|
254
|
-
nil:
|
255
|
-
nil: "Follow their activity"
|
249
|
+
nil: "Follow their activity"
|
256
250
|
read:
|
257
|
-
activity:
|
258
|
-
same_and_lower_levels: "Read wall"
|
251
|
+
activity: "Read wall"
|
259
252
|
represent:
|
260
|
-
nil:
|
261
|
-
nil: "Represent"
|
253
|
+
nil: "Represent"
|
262
254
|
detailed:
|
263
255
|
create:
|
264
|
-
activity:
|
265
|
-
same_level: "Post to \"%{sphere}\" wall at %{relation} level"
|
266
|
-
same_and_lower_levels: "Post to \"%{sphere}\" wall as %{relations} and %{public}"
|
267
|
-
destroy:
|
268
|
-
activity:
|
269
|
-
nil: "Delete the activities posted to \"%{sphere}\" wall by this %{relation}"
|
256
|
+
activity: "Post to \"%{relation}\" wall"
|
270
257
|
follow:
|
271
|
-
nil:
|
272
|
-
nil: "Activities of the contacts at %{relation} level will appear in our home wall"
|
258
|
+
nil: "Activities of the contacts at %{relation} will appear in our home wall"
|
273
259
|
read:
|
274
|
-
activity:
|
275
|
-
|
276
|
-
tie:
|
277
|
-
same_and_lower_levels:
|
278
|
-
"See contacts in levels: %{relations} and %{public}"
|
260
|
+
activity: "Read posts in \"%{relation}\" wall"
|
261
|
+
tie: "See contacts in levels: %{relations} and %{public}"
|
279
262
|
represent:
|
280
|
-
nil:
|
281
|
-
nil: "Represent me/us in the website"
|
282
|
-
update:
|
283
|
-
activity:
|
284
|
-
nil: "Update the wall activities posted by %{relation}"
|
285
|
-
weak_star_ties: "Update the wall activities posted in levels %{relations} and %{public}"
|
263
|
+
nil: "Represent me/us in the website"
|
286
264
|
of_relation:
|
287
|
-
choose: "
|
265
|
+
choose: "2. Permissions in <strong>%{name}</strong> level"
|
288
266
|
privacy:
|
289
267
|
intro: "Contacts at <strong>%{relation}</strong> level are only allowed to:"
|
290
268
|
rule:
|
@@ -295,11 +273,12 @@ en:
|
|
295
273
|
one: "Product"
|
296
274
|
other: "Products"
|
297
275
|
relation_custom:
|
298
|
-
|
299
|
-
|
300
|
-
new: "+ New
|
276
|
+
title: "Privacy & context"
|
277
|
+
choose: "1. Choose stream"
|
278
|
+
new: "+ New stream"
|
301
279
|
relation_public:
|
302
280
|
name: "Public"
|
281
|
+
required: "* These fields are required"
|
303
282
|
settings:
|
304
283
|
error: "Some errors raised when saving your changes"
|
305
284
|
for: "Settings for"
|
@@ -325,10 +304,6 @@ en:
|
|
325
304
|
sign_out: "Sign out"
|
326
305
|
sign_up: "Sign up"
|
327
306
|
socialstream: "SocialStream"
|
328
|
-
sphere:
|
329
|
-
title: "Privacy & context"
|
330
|
-
choose: "1. Choose sphere"
|
331
|
-
new: '+ New sphere'
|
332
307
|
sure: "Are you sure?"
|
333
308
|
time:
|
334
309
|
ago: "%{time} ago"
|
data/config/routes.rb
CHANGED
@@ -2,10 +2,14 @@ class EmptyTiesCount < ActiveRecord::Migration
|
|
2
2
|
def up
|
3
3
|
change_column :contacts, :ties_count, :integer, :default => 0
|
4
4
|
|
5
|
+
ts_status = Contact.record_timestamps
|
5
6
|
Contact.record_timestamps = false
|
7
|
+
|
6
8
|
Contact.all.each do |c|
|
7
9
|
c.update_attribute(:ties_count, 0) if c.ties_count.nil?
|
8
10
|
end
|
11
|
+
|
12
|
+
Contact.record_timestamps = ts_status
|
9
13
|
end
|
10
14
|
|
11
15
|
def down
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class RemoveSpheres < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_foreign_key "relations", :name => "relations_on_sphere_id"
|
4
|
+
|
5
|
+
remove_foreign_key "spheres", :name => "spheres_on_actor_id"
|
6
|
+
|
7
|
+
remove_column :relations, :sphere_id
|
8
|
+
|
9
|
+
drop_table :spheres
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
add_column :relations, :sphere_id, :integer
|
14
|
+
|
15
|
+
add_index "relations", "sphere_id"
|
16
|
+
|
17
|
+
create_table "spheres", :force => true do |t|
|
18
|
+
t.string "name"
|
19
|
+
t.integer "actor_id"
|
20
|
+
t.datetime "created_at"
|
21
|
+
t.datetime "updated_at"
|
22
|
+
end
|
23
|
+
|
24
|
+
add_index "spheres", "actor_id"
|
25
|
+
|
26
|
+
add_foreign_key "relations", "spheres", :name => "relations_on_sphere_id"
|
27
|
+
|
28
|
+
add_foreign_key "spheres", "actors", :name => "spheres_on_actor_id"
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class RemovePermissionFunction < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_column :permissions, :function
|
4
|
+
|
5
|
+
ts = RelationPermission.record_timestamps
|
6
|
+
RelationPermission.record_timestamps = false
|
7
|
+
|
8
|
+
Permission.all.each do |p|
|
9
|
+
q = Permission.find_by_action_and_object p.action, p.object
|
10
|
+
|
11
|
+
next if p == q
|
12
|
+
|
13
|
+
p.relation_permissions.each do |rp|
|
14
|
+
rp.update_attribute :permission_id, q.id
|
15
|
+
end
|
16
|
+
|
17
|
+
p.reload.destroy
|
18
|
+
end
|
19
|
+
|
20
|
+
RelationPermission.record_timestamps = ts
|
21
|
+
end
|
22
|
+
|
23
|
+
def down
|
24
|
+
add_column :permissions, :function, :string
|
25
|
+
end
|
26
|
+
end
|
@@ -44,6 +44,10 @@ class SocialStream::Base::InstallGenerator < Rails::Generators::Base #:nodoc:
|
|
44
44
|
copy_file 'navigation.rb', 'config/navigation.rb'
|
45
45
|
end
|
46
46
|
|
47
|
+
def create_mailboxer_custom_config
|
48
|
+
copy_file 'mailboxer_custom.rb', 'config/initializers/mailboxer.rb'
|
49
|
+
end
|
50
|
+
|
47
51
|
def create_migration_file
|
48
52
|
require 'rake'
|
49
53
|
Rails.application.load_tasks
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Mailboxer.setup do |config|
|
2
|
+
|
3
|
+
#Configures if you applications uses or no the email sending for Notifications and Messages
|
4
|
+
config.uses_emails = true
|
5
|
+
|
6
|
+
#Configures the default from for the email sent for Messages and Notifications of Mailboxer
|
7
|
+
config.default_from = "no-reply@mailboxer.com"
|
8
|
+
|
9
|
+
#Configures the methods needed by mailboxer
|
10
|
+
config.email_method = :mailboxer_email
|
11
|
+
#config.name_method = :name
|
12
|
+
#config.should_email_method = :should_email?
|
13
|
+
end
|
@@ -11,35 +11,29 @@ user:
|
|
11
11
|
friend:
|
12
12
|
name: friend
|
13
13
|
permissions:
|
14
|
-
- [ follow ]
|
15
|
-
- [ create, activity
|
16
|
-
- [ read, activity
|
17
|
-
sphere: personal
|
14
|
+
- [ follow ]
|
15
|
+
- [ create, activity ]
|
16
|
+
- [ read, activity ]
|
18
17
|
acquaintance:
|
19
18
|
name: acquaintance
|
20
|
-
parent: friend # friend relation is stronger than acquaintance
|
21
19
|
permissions:
|
22
|
-
- [ read, activity
|
23
|
-
|
24
|
-
|
25
|
-
name: partner
|
20
|
+
- [ read, activity ]
|
21
|
+
colleague:
|
22
|
+
name: colleague
|
26
23
|
permissions:
|
27
|
-
- [
|
28
|
-
|
24
|
+
- [ follow ]
|
25
|
+
- [ create, activity ]
|
26
|
+
- [ read, activity ]
|
29
27
|
|
30
28
|
group:
|
31
29
|
member:
|
32
30
|
name: member
|
33
31
|
permissions:
|
34
|
-
- [ represent ]
|
35
|
-
- [ create, activity
|
36
|
-
- [ read, activity
|
37
|
-
- [ read, tie
|
38
|
-
sphere: organization
|
32
|
+
- [ represent ]
|
33
|
+
- [ create, activity ]
|
34
|
+
- [ read, activity ]
|
35
|
+
- [ read, tie ]
|
39
36
|
partner:
|
40
37
|
name: partner
|
41
|
-
parent: member # member is stronger than partner
|
42
38
|
permissions:
|
43
|
-
- [ read, activity
|
44
|
-
sphere: external_relations
|
45
|
-
|
39
|
+
- [ read, activity ]
|
@@ -93,8 +93,7 @@ module SocialStream
|
|
93
93
|
end
|
94
94
|
|
95
95
|
# Privacy
|
96
|
-
can [:create, :read, :update, :destroy],
|
97
|
-
can [:create, :read, :update, :destroy], Relation::Custom, :sphere => { :actor_id => subject.try(:actor_id) }
|
96
|
+
can [:create, :read, :update, :destroy], Relation::Custom, :actor_id => subject.try(:actor_id)
|
98
97
|
end
|
99
98
|
end
|
100
99
|
end
|