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.
- data/.gitignore +1 -0
- data/README.rdoc +2 -3
- data/app/controllers/likes_controller.rb +2 -2
- data/app/controllers/messages_controller.rb +3 -0
- data/app/controllers/representations_controller.rb +8 -0
- data/app/controllers/ties_controller.rb +1 -1
- data/app/helpers/activities_helper.rb +2 -2
- data/app/helpers/ties_helper.rb +19 -16
- data/app/models/activity.rb +42 -7
- data/app/models/activity_object.rb +1 -0
- data/app/models/activity_verb.rb +5 -1
- data/app/models/actor.rb +113 -68
- data/app/models/group.rb +15 -1
- data/app/models/message.rb +2 -0
- data/app/models/permission.rb +20 -41
- data/app/models/profile.rb +1 -1
- data/app/models/relation.rb +34 -26
- data/app/models/representation.rb +35 -0
- data/app/models/tie.rb +47 -100
- data/app/models/user.rb +12 -17
- data/app/views/activities/_activities.html.erb +2 -2
- data/app/views/activities/_new.html.erb +6 -3
- data/app/views/activities/_options.html.erb +1 -1
- data/app/views/comments/_new.html.erb +2 -2
- data/app/views/frontpage/index.html.erb +0 -2
- data/app/views/groups/_group.html.erb +3 -3
- data/app/views/groups/_index.html.erb +3 -4
- data/app/views/groups/_middle_show.html.erb +7 -4
- data/app/views/groups/_new.html.erb +25 -0
- data/app/views/groups/_right_show.html.erb +4 -2
- data/app/views/groups/new.html.erb +1 -0
- data/app/views/groups/show.html.erb +1 -1
- data/app/views/home/_groups.html.erb +7 -5
- data/app/views/home/_location.html.erb +1 -1
- data/app/views/home/_options.html.erb +2 -2
- data/app/views/home/_right.html.erb +2 -2
- data/app/views/home/index.html.erb +6 -2
- data/app/views/layouts/_footer.html.erb +1 -1
- data/app/views/layouts/_header.erb +4 -1
- data/app/views/layouts/_representation.html.erb +20 -0
- data/app/views/{private_messages → messages}/_form.html.erb +4 -4
- data/app/views/{private_messages → messages}/_index.html.erb +1 -1
- data/app/views/{private_messages → messages}/_location.html.erb +1 -1
- data/app/views/messages/_message.html.erb +17 -0
- data/app/views/messages/_messages.html.erb +2 -0
- data/app/views/messages/edit.html.erb +6 -0
- data/app/views/{private_messages → messages}/index.html.erb +0 -0
- data/app/views/{private_messages → messages}/index.js.erb +0 -0
- data/app/views/{private_messages → messages}/new.html.erb +2 -2
- data/app/views/messages/show.html.erb +21 -0
- data/app/views/subjects/_contacts.html.erb +20 -0
- data/app/views/ties/_new.html.erb +6 -6
- data/app/views/ties/_pendings.html.erb +3 -3
- data/app/views/ties/_suggestions.html.erb +3 -3
- data/app/views/ties/_tie.html.erb +1 -1
- data/app/views/ties/create.js.erb +4 -5
- data/app/views/ties/new.js.erb +1 -1
- data/app/views/users/_groups.html.erb +5 -5
- data/app/views/users/_index.html.erb +3 -1
- data/app/views/users/_options.html.erb +1 -1
- data/app/views/users/_right_show.html.erb +3 -3
- data/app/views/users/show.html.erb +5 -3
- data/config/locales/en.yml +13 -19
- data/config/routes.rb +11 -4
- data/lib/generators/social_stream/install_generator.rb +2 -10
- data/lib/generators/social_stream/templates/initializer.rb +1 -1
- data/lib/generators/social_stream/templates/migration.rb +19 -24
- data/lib/generators/social_stream/templates/public/javascripts/jquery.js +6883 -0
- data/lib/generators/social_stream/templates/public/javascripts/rails.js +146 -0
- data/lib/generators/social_stream/templates/public/javascripts/ui.dropdownchecklist.js +3 -13
- data/lib/generators/social_stream/templates/public/stylesheets/header.css +5 -1
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-icons_222222_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-icons_454545_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-icons_888888_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/{images → stylesheets/images}/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/generators/social_stream/templates/relations.yml +42 -0
- data/lib/social_stream/ability.rb +7 -6
- data/lib/social_stream/controllers/helpers.rb +35 -0
- data/lib/social_stream/models/{activity_object.rb → object.rb} +1 -1
- data/lib/social_stream/models/{actor.rb → subject.rb} +10 -30
- data/lib/social_stream/models/supertype.rb +5 -2
- data/lib/social_stream/rails.rb +25 -6
- data/lib/social_stream/relations.rb +46 -0
- data/lib/social_stream/version.rb +1 -1
- data/lib/social_stream.rb +13 -13
- data/lib/tasks/db/populate.rake +23 -29
- data/spec/controllers/groups_controller_spec.rb +2 -6
- data/spec/controllers/ties_controller_spec.rb +19 -0
- data/spec/controllers/users_controller_spec.rb +0 -2
- data/spec/dummy/config/application.rb +0 -1
- data/spec/dummy/config/initializers/social_stream.rb +14 -2
- data/spec/dummy/config/relations.yml +42 -0
- data/spec/dummy/db/schema.rb +9 -0
- data/spec/dummy/db/seeds.rb +0 -1
- data/spec/factories/activity.rb +2 -2
- data/spec/factories/actor.rb +2 -1
- data/spec/factories/group.rb +1 -0
- data/spec/factories/post.rb +1 -1
- data/spec/factories/tie.rb +16 -22
- data/spec/models/activity_spec.rb +27 -24
- data/spec/models/actor_spec.rb +3 -0
- data/spec/models/representation_spec.rb +16 -0
- data/spec/models/tie_spec.rb +49 -57
- data/spec/models/user_spec.rb +22 -0
- data/spec/support/db.rb +1 -1
- metadata +47 -45
- data/Gemfile.lock +0 -171
- data/app/controllers/private_messages_controller.rb +0 -3
- data/app/models/private_message.rb +0 -6
- data/app/views/groups/_follow.html.erb +0 -9
- data/app/views/groups/_followers.html.erb +0 -16
- data/app/views/home/_contacts.html.erb +0 -17
- data/app/views/private_messages/_messages.html.erb +0 -2
- data/app/views/private_messages/_private_message.html.erb +0 -17
- data/app/views/private_messages/edit.html.erb +0 -6
- data/app/views/private_messages/show.html.erb +0 -21
- data/app/views/ties/_pending.html.erb +0 -21
- data/app/views/users/_contacts.html.erb +0 -19
- data/init.rb +0 -3
- data/lib/generators/social_stream/templates/seeds.yml +0 -64
- data/lib/social_stream/rails/common.rb +0 -36
- data/lib/social_stream/rails/engine.rb +0 -9
- data/lib/social_stream/rails/railtie.rb +0 -9
- data/lib/social_stream/seed.rb +0 -49
- data/spec/dummy/db/seeds/social_stream.yml +0 -64
- data/spec/models/user_space.rb +0 -10
data/lib/social_stream/seed.rb
DELETED
@@ -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 ]
|
data/spec/models/user_space.rb
DELETED