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,19 +0,0 @@
1
- <table class="tableCheckBoxOptions">
2
- <% list.each do |sphere| %>
3
- <%= raw cycle("<tr><td>", "<td>", :name => "begin_cell") %>
4
- <div contain="<%= dom_id(sphere) %>" class="checkboxOptionLeft">
5
- <input id=<%= dom_id(sphere) %> type="checkbox"/>
6
- <label for=<%= dom_id(sphere) %>><%=sphere.name%></label>
7
- </div>
8
- <%= raw cycle("</td>", "</td></tr>", :name => "end_cell") %>
9
- <% end %>
10
-
11
- <%= raw("</tr>") if list.size.odd? %>
12
-
13
- </table>
14
-
15
- <%= javascript_tag do %>
16
- $(function() {
17
- $('input[id^="sphere"]').checkBox();
18
- })
19
- <% end %>
@@ -1,20 +0,0 @@
1
- <% if @sphere.errors.present? %>
2
- $('#new_sphere_input_block').html("<%= escape_javascript render(:partial => 'spheres/form') %>");
3
- <% else %>
4
- // Hide #relations and #permissions
5
- $('#permissions').html("");
6
- $('#permissions').hide();
7
- $('#relations').hide();
8
-
9
- // Restore form
10
- $('#sphere_name').val('');
11
- $('#new_sphere_input_block').hide();
12
- $('#new_sphere_title_block').show();
13
-
14
- // Refresh list
15
- $('#spheres_list').html("<%= escape_javascript render(:partial => 'spheres/list', :object => current_subject.spheres) %>");
16
-
17
- // Select sphere
18
- $('#' + '<%= dom_id @sphere %>').checkBox('changeCheckStatus', true);
19
- <% end %>
20
-
@@ -1,74 +0,0 @@
1
- <% content_for :headers do %>
2
- <%= stylesheet_link_tag "spheres.css", :media => "screen, projection" %>
3
- <%= stylesheet_link_tag "jquery.ui.slider.css", :media => "screen, projection" %>
4
- <%= stylesheet_link_tag "jquery.ui.slidertheme.css", :media => "screen, projection" %>
5
- <%= javascript_include_tag 'ui.checkbox'%>
6
- <% end %>
7
-
8
- <% toolbar :profile => current_subject, :option => 'contacts' %>
9
-
10
- <%= javascript_tag do %>
11
- <%= render :partial => 'spheres/jquery' %>
12
- <% end %>
13
-
14
- <div id="wrapper_section">
15
-
16
- <p class="pageTitle"><%= t 'sphere.title' %></p>
17
-
18
- <div id="spheres" class="privacy_block_section first_block_section">
19
- <p class="sectionTitle"><%= t 'sphere.choose' %></p>
20
-
21
- <div class="privacy_add_element">
22
- <div id="new_sphere_title_block">
23
- <a href="#"><span id="new_sphere_title" class="privacy_span_new"><%= t('sphere.new') %></span></a>
24
- </div>
25
- <div id="new_sphere_input_block">
26
- <%= render :partial => 'spheres/form' %>
27
- </div>
28
- </div>
29
-
30
- <%= javascript_tag do %>
31
- $(function() {
32
- $("#new_sphere_input_block").hide();
33
-
34
- $("#new_sphere_title").click(function() {
35
- $("#new_sphere_title_block").hide();
36
- $("#new_sphere_input_block").show();
37
- });
38
-
39
- $("#loading").hide();
40
-
41
- $("#loading").ajaxStart(function(){
42
- $(this).show();
43
- });
44
-
45
- $("#loading").ajaxStop(function(){
46
- $(this).hide();
47
- });
48
-
49
- })
50
- <% end %>
51
-
52
- <div id="spheres_list">
53
- <%= render :partial => 'spheres/list', :object => @spheres %>
54
- </div>
55
-
56
- </div>
57
-
58
-
59
- <div id="relations" class="privacy_block_section">
60
- </div>
61
-
62
-
63
- <div id="permissions" class="privacy_block_section">
64
- </div>
65
-
66
- <div id="loading"></div>
67
-
68
- <%= javascript_tag do %>
69
- $(function() {
70
- $("#relations").hide();
71
- $("#permissions").hide();
72
- })
73
- <% end %>
74
- </div>
@@ -1,116 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe SpheresController do
4
- include SocialStream::TestHelpers::Controllers
5
-
6
- render_views
7
-
8
- describe "when Anonymous" do
9
- context "faking a new sphere" do
10
- before do
11
- model_attributes[:actor_id] = Factory(:user).actor_id
12
- end
13
-
14
- it "should not create" do
15
- post :create, attributes
16
-
17
- response.should redirect_to(:new_user_session)
18
- end
19
- end
20
-
21
- context "an existing sphere" do
22
- before do
23
- @current_model = Factory(:sphere)
24
- end
25
-
26
- it "should not update" do
27
- put :update, updating_attributes
28
-
29
- assigns(:sphere).should be_blank
30
- response.should redirect_to(:new_user_session)
31
- end
32
-
33
- it_should_behave_like "Deny Destroying"
34
- end
35
- end
36
-
37
- describe "when authenticated" do
38
- before do
39
- @user = Factory(:user)
40
-
41
- sign_in @user
42
- end
43
-
44
- it "should render index" do
45
- get :index
46
-
47
- assert_response :success
48
- end
49
-
50
- context "a new own sphere" do
51
- before do
52
- model_attributes[:actor_id] = @user.actor_id
53
- end
54
-
55
- it_should_behave_like "Allow Creating"
56
- end
57
-
58
- context "a new fake sphere" do
59
- before do
60
- model_attributes[:actor_id] = Factory(:user).actor_id
61
- end
62
-
63
- it "should not be created" do
64
- count = Sphere.count
65
- begin
66
- post :create, attributes
67
-
68
- assert false
69
- rescue CanCan::AccessDenied
70
- assigns(:sphere).should be_new_record
71
-
72
- Sphere.count.should eq(count)
73
- end
74
- end
75
- end
76
-
77
- context "a external sphere" do
78
- before do
79
- @current_model = Factory(:sphere)
80
- end
81
-
82
- it "should not be found on update" do
83
- begin
84
- put :update, updating_attributes
85
-
86
- assert false
87
- rescue ActiveRecord::RecordNotFound
88
- assigns(:sphere).should be_nil
89
- end
90
- end
91
-
92
- it "should not be found on destroy" do
93
- begin
94
- delete :destroy, :id => @current_model.to_param
95
-
96
- assert false
97
- rescue ActiveRecord::RecordNotFound
98
- assigns(:sphere).should be_nil
99
- end
100
- end
101
- end
102
-
103
-
104
- context "a existing own sphere" do
105
- before do
106
- @current_model = Factory(:sphere, :actor_id => @user.actor_id)
107
- end
108
-
109
- # This is not working, because of updating attributes. Do not know why
110
- # it_should_behave_like "Allow Updating"
111
- it_should_behave_like "Allow Destroying"
112
- end
113
-
114
- end
115
- end
116
-
@@ -1,5 +0,0 @@
1
- Factory.define :sphere do |s|
2
- s.sequence(:name) { |n| "Sphere #{ n }" }
3
- s.association :actor
4
- end
5
-
@@ -1,14 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe Relation::Custom do
4
- it "should assign parent" do
5
- parent = Factory(:relation_custom)
6
- sphere = parent.sphere
7
-
8
- r = Relation::Custom.create! :name => "test",
9
- :sphere_id => sphere.id
10
-
11
- r.parent.should eq(parent)
12
- end
13
- end
14
-