social_stream 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. data/.gitignore +1 -0
  2. data/README.rdoc +2 -3
  3. data/app/controllers/likes_controller.rb +2 -2
  4. data/app/controllers/messages_controller.rb +3 -0
  5. data/app/controllers/representations_controller.rb +8 -0
  6. data/app/controllers/ties_controller.rb +1 -1
  7. data/app/helpers/activities_helper.rb +2 -2
  8. data/app/helpers/ties_helper.rb +19 -16
  9. data/app/models/activity.rb +42 -7
  10. data/app/models/activity_object.rb +1 -0
  11. data/app/models/activity_verb.rb +5 -1
  12. data/app/models/actor.rb +113 -68
  13. data/app/models/group.rb +15 -1
  14. data/app/models/message.rb +2 -0
  15. data/app/models/permission.rb +20 -41
  16. data/app/models/profile.rb +1 -1
  17. data/app/models/relation.rb +34 -26
  18. data/app/models/representation.rb +35 -0
  19. data/app/models/tie.rb +47 -100
  20. data/app/models/user.rb +12 -17
  21. data/app/views/activities/_activities.html.erb +2 -2
  22. data/app/views/activities/_new.html.erb +6 -3
  23. data/app/views/activities/_options.html.erb +1 -1
  24. data/app/views/comments/_new.html.erb +2 -2
  25. data/app/views/frontpage/index.html.erb +0 -2
  26. data/app/views/groups/_group.html.erb +3 -3
  27. data/app/views/groups/_index.html.erb +3 -4
  28. data/app/views/groups/_middle_show.html.erb +7 -4
  29. data/app/views/groups/_new.html.erb +25 -0
  30. data/app/views/groups/_right_show.html.erb +4 -2
  31. data/app/views/groups/new.html.erb +1 -0
  32. data/app/views/groups/show.html.erb +1 -1
  33. data/app/views/home/_groups.html.erb +7 -5
  34. data/app/views/home/_location.html.erb +1 -1
  35. data/app/views/home/_options.html.erb +2 -2
  36. data/app/views/home/_right.html.erb +2 -2
  37. data/app/views/home/index.html.erb +6 -2
  38. data/app/views/layouts/_footer.html.erb +1 -1
  39. data/app/views/layouts/_header.erb +4 -1
  40. data/app/views/layouts/_representation.html.erb +20 -0
  41. data/app/views/{private_messages → messages}/_form.html.erb +4 -4
  42. data/app/views/{private_messages → messages}/_index.html.erb +1 -1
  43. data/app/views/{private_messages → messages}/_location.html.erb +1 -1
  44. data/app/views/messages/_message.html.erb +17 -0
  45. data/app/views/messages/_messages.html.erb +2 -0
  46. data/app/views/messages/edit.html.erb +6 -0
  47. data/app/views/{private_messages → messages}/index.html.erb +0 -0
  48. data/app/views/{private_messages → messages}/index.js.erb +0 -0
  49. data/app/views/{private_messages → messages}/new.html.erb +2 -2
  50. data/app/views/messages/show.html.erb +21 -0
  51. data/app/views/subjects/_contacts.html.erb +20 -0
  52. data/app/views/ties/_new.html.erb +6 -6
  53. data/app/views/ties/_pendings.html.erb +3 -3
  54. data/app/views/ties/_suggestions.html.erb +3 -3
  55. data/app/views/ties/_tie.html.erb +1 -1
  56. data/app/views/ties/create.js.erb +4 -5
  57. data/app/views/ties/new.js.erb +1 -1
  58. data/app/views/users/_groups.html.erb +5 -5
  59. data/app/views/users/_index.html.erb +3 -1
  60. data/app/views/users/_options.html.erb +1 -1
  61. data/app/views/users/_right_show.html.erb +3 -3
  62. data/app/views/users/show.html.erb +5 -3
  63. data/config/locales/en.yml +13 -19
  64. data/config/routes.rb +11 -4
  65. data/lib/generators/social_stream/install_generator.rb +2 -10
  66. data/lib/generators/social_stream/templates/initializer.rb +1 -1
  67. data/lib/generators/social_stream/templates/migration.rb +19 -24
  68. data/lib/generators/social_stream/templates/public/javascripts/jquery.js +6883 -0
  69. data/lib/generators/social_stream/templates/public/javascripts/rails.js +146 -0
  70. data/lib/generators/social_stream/templates/public/javascripts/ui.dropdownchecklist.js +3 -13
  71. data/lib/generators/social_stream/templates/public/stylesheets/header.css +5 -1
  72. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  73. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_flat_75_ffffff_40x100.png +0 -0
  74. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  75. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_glass_65_ffffff_1x400.png +0 -0
  76. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_glass_75_dadada_1x400.png +0 -0
  77. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  78. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  79. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  80. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-icons_222222_256x240.png +0 -0
  81. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-icons_2e83ff_256x240.png +0 -0
  82. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-icons_454545_256x240.png +0 -0
  83. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-icons_888888_256x240.png +0 -0
  84. data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-icons_cd0a0a_256x240.png +0 -0
  85. data/lib/generators/social_stream/templates/relations.yml +42 -0
  86. data/lib/social_stream/ability.rb +7 -6
  87. data/lib/social_stream/controllers/helpers.rb +35 -0
  88. data/lib/social_stream/models/{activity_object.rb → object.rb} +1 -1
  89. data/lib/social_stream/models/{actor.rb → subject.rb} +10 -30
  90. data/lib/social_stream/models/supertype.rb +5 -2
  91. data/lib/social_stream/rails.rb +25 -6
  92. data/lib/social_stream/relations.rb +46 -0
  93. data/lib/social_stream/version.rb +1 -1
  94. data/lib/social_stream.rb +13 -13
  95. data/lib/tasks/db/populate.rake +23 -29
  96. data/spec/controllers/groups_controller_spec.rb +2 -6
  97. data/spec/controllers/ties_controller_spec.rb +19 -0
  98. data/spec/controllers/users_controller_spec.rb +0 -2
  99. data/spec/dummy/config/application.rb +0 -1
  100. data/spec/dummy/config/initializers/social_stream.rb +14 -2
  101. data/spec/dummy/config/relations.yml +42 -0
  102. data/spec/dummy/db/schema.rb +9 -0
  103. data/spec/dummy/db/seeds.rb +0 -1
  104. data/spec/factories/activity.rb +2 -2
  105. data/spec/factories/actor.rb +2 -1
  106. data/spec/factories/group.rb +1 -0
  107. data/spec/factories/post.rb +1 -1
  108. data/spec/factories/tie.rb +16 -22
  109. data/spec/models/activity_spec.rb +27 -24
  110. data/spec/models/actor_spec.rb +3 -0
  111. data/spec/models/representation_spec.rb +16 -0
  112. data/spec/models/tie_spec.rb +49 -57
  113. data/spec/models/user_spec.rb +22 -0
  114. data/spec/support/db.rb +1 -1
  115. metadata +47 -45
  116. data/Gemfile.lock +0 -171
  117. data/app/controllers/private_messages_controller.rb +0 -3
  118. data/app/models/private_message.rb +0 -6
  119. data/app/views/groups/_follow.html.erb +0 -9
  120. data/app/views/groups/_followers.html.erb +0 -16
  121. data/app/views/home/_contacts.html.erb +0 -17
  122. data/app/views/private_messages/_messages.html.erb +0 -2
  123. data/app/views/private_messages/_private_message.html.erb +0 -17
  124. data/app/views/private_messages/edit.html.erb +0 -6
  125. data/app/views/private_messages/show.html.erb +0 -21
  126. data/app/views/ties/_pending.html.erb +0 -21
  127. data/app/views/users/_contacts.html.erb +0 -19
  128. data/init.rb +0 -3
  129. data/lib/generators/social_stream/templates/seeds.yml +0 -64
  130. data/lib/social_stream/rails/common.rb +0 -36
  131. data/lib/social_stream/rails/engine.rb +0 -9
  132. data/lib/social_stream/rails/railtie.rb +0 -9
  133. data/lib/social_stream/seed.rb +0 -49
  134. data/spec/dummy/db/seeds/social_stream.yml +0 -64
  135. data/spec/models/user_space.rb +0 -10
@@ -1,9 +0,0 @@
1
- require 'social_stream/rails/common'
2
-
3
- module SocialStream
4
- module Rails
5
- class Engine < ::Rails::Engine #:nodoc:
6
- include Common
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- require 'social_stream/rails/common'
2
-
3
- module SocialStream
4
- module Rails
5
- class Railtie < ::Rails::Railtie #:nodoc:
6
- include Common
7
- end
8
- end
9
- end
@@ -1,49 +0,0 @@
1
- module SocialStream
2
- # Seed you database with initial data for SocialStream
3
- #
4
- class Seed
5
- def initialize(config)
6
- s = YAML.load_file(config)
7
-
8
- seed_activity_verbs
9
- seed_relations(s['relations'])
10
- end
11
-
12
- def seed_activity_verbs
13
- ActivityVerb::Available.each do |value|
14
- ActivityVerb.find_or_create_by_name value
15
- end
16
- end
17
-
18
- def seed_relations(rs)
19
- relations = {}
20
-
21
- rs.each_pair do |name, r|
22
- relations[name] =
23
- Relation.
24
- find_or_create_by_sender_type_and_receiver_type_and_name(r['sender_type'],
25
- r['receiver_type'],
26
- r['name'])
27
- relations[name].update_attribute(:reflexive, r['reflexive'])
28
-
29
- # FIXME: optimize
30
- relations[name].relation_permissions.destroy_all
31
-
32
- if (ps = r['permissions']).present?
33
- ps.each do |p|
34
- relations[name].permissions <<
35
- Permission.find_or_create_by_action_and_object_and_parameter(*p)
36
- end
37
- end
38
- end
39
-
40
- # Parent, inverse and granted relations must be set after creation
41
- rs.each_pair do |name, r|
42
- %w( parent inverse granted ).each do |s|
43
- relations[name].__send__("#{ s }=", relations[r[s]]) # relations[name].parent = relations[r['parent']]
44
- end
45
- relations[name].save!
46
- end
47
- end
48
- end
49
- end
@@ -1,64 +0,0 @@
1
- # Seed configuration for Social Stream
2
- #
3
- # Define the relations and permissions supported by your application
4
- #
5
- relations:
6
- user-friend:
7
- sender_type: User
8
- receiver_type: User
9
- name: friend
10
- inverse: user-friend
11
- reflexive: true
12
- permissions:
13
- - [ create, activity, inverse_weak_set ]
14
- - [ read, activity, inverse_group_set ]
15
- - [ update, activity, inverse_weak_set ]
16
- - [ destroy, activity, inverse_weak_set ]
17
- user-public:
18
- sender_type: User
19
- receiver_type: User
20
- name: public
21
- parent: user-friend
22
- inverse: user-public
23
- permissions:
24
- - [ read, activity, inverse_group_set ]
25
- user-friend-request:
26
- sender_type: User
27
- receiver_type: User
28
- name: friend_request
29
- granted: user-friend
30
-
31
- user-group-member:
32
- sender_type: User
33
- receiver_type: Group
34
- name: member
35
- inverse: group-user-member
36
- user-group-follower:
37
- sender_type: User
38
- receiver_type: Group
39
- name: follower
40
- user-group-public:
41
- sender_type: User
42
- receiver_type: Group
43
- name: public
44
- parent: user-group-member
45
- inverse: group-user-public
46
-
47
- group-user-member:
48
- sender_type: Group
49
- receiver_type: User
50
- name: member
51
- inverse: user-group-member
52
- permissions:
53
- - [ create, activity, inverse_weak_set ]
54
- - [ read, activity, inverse_group_set ]
55
- - [ update, activity, inverse_weak_group_set ]
56
- - [ destroy, activity, inverse_weak_group_set ]
57
- group-user-public:
58
- sender_type: Group
59
- receiver_type: User
60
- name: public
61
- parent: group-user-member
62
- inverse: user-group-public
63
- permissions:
64
- - [ read, activity, inverse_group_set ]
@@ -1,10 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe User do
4
- it "should find by permalink" do
5
- user = Factory(:user)
6
-
7
- assert user.should == User.find_by_permalink(user.permalink)
8
- end
9
- end
10
-