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.
Files changed (93) hide show
  1. data/app/assets/stylesheets/base.css +1 -0
  2. data/app/assets/stylesheets/contacts.css +2 -1
  3. data/app/assets/stylesheets/fcbkComplete.css +1 -1
  4. data/app/assets/stylesheets/header.css +2 -2
  5. data/app/assets/stylesheets/messages.css +3 -3
  6. data/app/assets/stylesheets/{spheres.css → relation_customs.css} +0 -0
  7. data/app/controllers/contacts_controller.rb +9 -4
  8. data/app/controllers/messages_controller.rb +69 -68
  9. data/app/controllers/relation/customs_controller.rb +1 -11
  10. data/app/helpers/activities_helper.rb +1 -2
  11. data/app/helpers/notifications_helper.rb +3 -2
  12. data/app/helpers/permissions_helper.rb +5 -5
  13. data/app/helpers/subjects_helper.rb +9 -0
  14. data/app/helpers/toolbar_helper.rb +10 -89
  15. data/app/models/activity.rb +39 -15
  16. data/app/models/actor.rb +30 -71
  17. data/app/models/contact.rb +15 -0
  18. data/app/models/group.rb +1 -3
  19. data/app/models/permission.rb +9 -72
  20. data/app/models/profile.rb +7 -2
  21. data/app/models/relation/custom.rb +6 -33
  22. data/app/models/relation.rb +15 -39
  23. data/app/models/user.rb +5 -1
  24. data/app/views/activities/_new.html.erb +5 -2
  25. data/app/views/activities/_options.html.erb +2 -2
  26. data/app/views/activities/_walls.html.erb +1 -1
  27. data/app/views/contacts/_contact.html.erb +3 -3
  28. data/app/views/contacts/_form.html.erb +14 -20
  29. data/app/views/contacts/_index.html.erb +1 -1
  30. data/app/views/contacts/_suggestions.html.erb +1 -13
  31. data/app/views/contacts/destroy.js.erb +6 -0
  32. data/app/views/contacts/edit.html.erb +1 -1
  33. data/app/views/conversations/_conversation.html.erb +1 -1
  34. data/app/views/groups/_group.html.erb +1 -1
  35. data/app/views/groups/_index.html.erb +1 -1
  36. data/app/views/groups/show.html.erb +1 -1
  37. data/app/views/invitation_mailer/send_invitation.html.erb +17 -6
  38. data/app/views/invitation_mailer/send_invitation.text.erb +7 -2
  39. data/app/views/layouts/_representation.html.erb +10 -6
  40. data/app/views/layouts/_settings.html.erb +1 -1
  41. data/app/views/messages/_message.html.erb +1 -1
  42. data/app/views/messages/new.html.erb +1 -1
  43. data/app/views/notifications/_notification.html.erb +7 -3
  44. data/app/views/objects/_new.html.erb +0 -6
  45. data/app/views/profiles/edit.html.erb +5 -9
  46. data/app/views/relation/customs/_form.html.erb +2 -2
  47. data/app/views/{spheres → relation/customs}/_jquery.erb +0 -58
  48. data/app/views/relation/customs/_list.html.erb +9 -26
  49. data/app/views/relation/customs/create.js.erb +2 -3
  50. data/app/views/relation/customs/index.html.erb +67 -0
  51. data/app/views/users/_index.html.erb +1 -1
  52. data/app/views/users/show.html.erb +1 -1
  53. data/config/locales/en.yml +16 -41
  54. data/config/routes.rb +1 -6
  55. data/db/migrate/20110705103202_empty_ties_count.rb +4 -0
  56. data/db/migrate/20110712090343_remove_spheres.rb +30 -0
  57. data/db/migrate/20110712142140_remove_permission_function.rb +26 -0
  58. data/lib/generators/social_stream/base/install_generator.rb +4 -0
  59. data/lib/generators/social_stream/base/templates/mailboxer_custom.rb +13 -0
  60. data/lib/generators/social_stream/base/templates/navigation.rb +4 -0
  61. data/lib/generators/social_stream/base/templates/relations.yml +14 -20
  62. data/lib/social_stream/ability.rb +1 -2
  63. data/lib/social_stream/base/version.rb +1 -1
  64. data/lib/social_stream/migration_finder.rb +19 -0
  65. data/lib/social_stream/toolbar_config.rb +113 -0
  66. data/lib/social_stream-base.rb +1 -0
  67. data/lib/tasks/db/populate.rake +1 -1
  68. data/social_stream-base.gemspec +4 -2
  69. data/spec/controllers/contacts_controller_spec.rb +1 -1
  70. data/spec/controllers/permissions_controller_spec.rb +1 -2
  71. data/spec/controllers/posts_controller_spec.rb +2 -2
  72. data/spec/controllers/relation_customs_controller_spec.rb +69 -62
  73. data/spec/dummy/config/database.yml +7 -0
  74. data/spec/dummy/config/relations.yml +14 -20
  75. data/spec/factories/relation_custom.rb +1 -1
  76. data/spec/factories/tie.rb +4 -0
  77. data/spec/models/activity_spec.rb +11 -2
  78. data/spec/models/user_spec.rb +68 -9
  79. data/spec/spec_helper.rb +0 -3
  80. data/spec/support/db.rb +9 -0
  81. data/spec/support/migrations.rb +3 -12
  82. metadata +19 -25
  83. data/app/controllers/spheres_controller.rb +0 -12
  84. data/app/models/sphere.rb +0 -9
  85. data/app/views/relation/customs/_index.html.erb +0 -28
  86. data/app/views/relation/customs/index.js.erb +0 -2
  87. data/app/views/spheres/_form.html.erb +0 -28
  88. data/app/views/spheres/_list.html.erb +0 -19
  89. data/app/views/spheres/create.js.erb +0 -20
  90. data/app/views/spheres/index.html.erb +0 -74
  91. data/spec/controllers/spheres_controller_spec.rb +0 -116
  92. data/spec/factories/sphere.rb +0 -5
  93. data/spec/models/relation_custom_spec.rb +0 -14
@@ -1,36 +1,19 @@
1
- <table class="tableCheckBoxOptions">
2
-
3
- <tr><td colspan="2"><div class="slider-header"><%= current_subject.name %></div></td></tr>
4
-
5
- <tr><td rowspan="<%= list.size + 1 %>">
6
- <div class="slider-div">
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
- <tr><td colspan="2"><div class="slider-footer"><%= t 'relation_public.name' %></div></td><tr>
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
- $('#relation_custom_list').html("<%= escape_javascript render(:partial => 'relation/customs/list', :object => @custom.sphere.customs.reload) %>");
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>
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
  <div class="sub-block">
15
15
  <div class="name black" >
16
- <%=link_to(user.name, user)%>
16
+ <%=link_to(truncate_name(user.name), user)%>
17
17
  </div>
18
18
  <div class="link">
19
19
  <%= contact_to(user) %>
@@ -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
 
@@ -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: "representing"
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
- same_and_lower_levels: "Read posts in \"%{sphere}\" wall at levels %{relations} and %{public}"
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: "3. Permissions in <strong>%{name}</strong> level"
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
- in_sphere:
299
- choose: "2. Levels in <strong>%{name}</strong> sphere"
300
- new: "+ New level"
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
@@ -27,13 +27,8 @@ Rails.application.routes.draw do
27
27
  end
28
28
  end
29
29
 
30
- resources :contacts do
31
- collection do
32
- get 'suggestion'
33
- end
34
- end
30
+ resources :contacts
35
31
 
36
- resources :spheres
37
32
  namespace "relation" do
38
33
  resources :customs
39
34
  end
@@ -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
@@ -0,0 +1,4 @@
1
+ # Configures your navigation
2
+ SimpleNavigation::Configuration.run do |navigation|
3
+
4
+ end
@@ -11,35 +11,29 @@ user:
11
11
  friend:
12
12
  name: friend
13
13
  permissions:
14
- - [ follow ] # follow the activities of the friend
15
- - [ create, activity, same_level ] # let the friend create activities
16
- - [ read, activity, same_and_lower_levels ] # friend can read activities from the other friends and below
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, same_and_lower_levels ]
23
- sphere: personal
24
- partner:
25
- name: partner
20
+ - [ read, activity ]
21
+ colleague:
22
+ name: colleague
26
23
  permissions:
27
- - [ read, activity, same_and_lower_levels ]
28
- sphere: work
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 ] # let the member act as the group
35
- - [ create, activity, same_and_lower_levels ] # let them member create activities
36
- - [ read, activity, same_and_lower_levels ] # read activities from other members
37
- - [ read, tie, same_and_lower_levels ]
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, same_and_lower_levels ]
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], Sphere, :actor_id => subject.try(:actor_id)
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