social_stream 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +6 -0
- data/app/controllers/api_controller.rb +39 -0
- data/app/controllers/frontpage_controller.rb +2 -0
- data/app/controllers/groups_controller.rb +8 -2
- data/app/controllers/likes_controller.rb +9 -29
- data/app/controllers/logos_controller.rb +21 -0
- data/app/controllers/mailbox/conversation_controller.rb +110 -0
- data/app/controllers/mailbox_controller.rb +35 -0
- data/app/controllers/posts_controller.rb +2 -0
- data/app/controllers/profiles_controller.rb +3 -0
- data/app/controllers/ties_controller.rb +10 -0
- data/app/controllers/users_controller.rb +5 -5
- data/app/helpers/groups_helper.rb +0 -2
- data/app/helpers/subjects_helper.rb +11 -0
- data/app/helpers/ties_helper.rb +1 -1
- data/app/models/activity.rb +24 -1
- data/app/models/activity_object.rb +10 -0
- data/app/models/activity_object_activity.rb +10 -0
- data/app/models/actor.rb +87 -60
- data/app/models/group.rb +10 -4
- data/app/models/like.rb +34 -0
- data/app/models/logo.rb +51 -0
- data/app/models/permission.rb +7 -5
- data/app/models/profile.rb +24 -8
- data/app/models/tie.rb +15 -2
- data/app/models/user.rb +2 -2
- data/app/views/activities/_activities.html.erb +1 -1
- data/app/views/activities/_new.html.erb +12 -7
- data/app/views/api/activity_atom_feed.atom.builder +40 -0
- data/app/views/comments/_new.html.erb +1 -1
- data/app/views/devise/passwords/edit.html.erb +21 -0
- data/app/views/devise/passwords/new.html.erb +16 -0
- data/app/views/devise/registrations/new.html.erb +35 -19
- data/app/views/devise/sessions/new.html.erb +30 -0
- data/app/views/frontpage/_header.html.erb +18 -20
- data/app/views/frontpage/_search.html.erb +13 -0
- data/app/views/frontpage/_sponsor.html.erb +12 -13
- data/app/views/frontpage/index.html.erb +88 -80
- data/app/views/groups/_group.html.erb +2 -6
- data/app/views/groups/_index.html.erb +22 -25
- data/app/views/groups/_logo.html.erb +1 -1
- data/app/views/groups/_new.html.erb +56 -39
- data/app/views/groups/_profile.html.erb +142 -0
- data/app/views/groups/_sidebar_index.html.erb +73 -0
- data/app/views/groups/{_middle_show.html.erb → _sidebar_show.html.erb} +2 -2
- data/app/views/groups/_tabs.html.erb +37 -31
- data/app/views/groups/_toolbar_show.html.erb +12 -0
- data/app/views/groups/edit.html.erb +136 -0
- data/app/views/groups/index.html.erb +47 -46
- data/app/views/groups/new.html.erb +2 -0
- data/app/views/groups/show.html.erb +9 -4
- data/app/views/groups/update.js.erb +39 -0
- data/app/views/home/_groups.html.erb +4 -5
- data/app/views/{users/_middle_index.html.erb → home/_sidebar.html.erb} +0 -2
- data/app/views/home/index.html.erb +3 -5
- data/app/views/layouts/_footer.html.erb +4 -0
- data/app/views/layouts/_header.erb +29 -37
- data/app/views/layouts/_representation.html.erb +2 -2
- data/app/views/layouts/application.html.erb +47 -74
- data/app/views/layouts/frontpage.html.erb +27 -48
- data/app/views/layouts/test.html +44 -0
- data/app/views/likes/create.js.erb +1 -1
- data/app/views/likes/destroy.js.erb +1 -1
- data/app/views/logos/_form.html.erb +33 -0
- data/app/views/logos/_precrop.html.erb +48 -0
- data/app/views/logos/edit.html.erb +6 -0
- data/app/views/logos/index.html.erb +27 -0
- data/app/views/logos/new.html.erb +20 -0
- data/app/views/logos/show.html.erb +5 -0
- data/app/views/mailbox/_conversation.html.erb +23 -0
- data/app/views/mailbox/_conversations.html.erb +9 -0
- data/app/views/mailbox/_index.html.erb +16 -0
- data/app/views/{messages → mailbox}/_location.html.erb +0 -0
- data/app/views/mailbox/_menu_options.html.erb +19 -0
- data/app/views/mailbox/_show.html.erb +15 -0
- data/app/views/mailbox/conversation/_conversation.html.erb +40 -0
- data/app/views/mailbox/conversation/_form.html.erb +54 -0
- data/app/views/mailbox/conversation/_location.html.erb +3 -0
- data/app/views/mailbox/conversation/_new.html.erb +19 -0
- data/app/views/mailbox/conversation/_show.html.erb +27 -0
- data/app/views/mailbox/conversation/edit.html.erb +6 -0
- data/app/views/mailbox/conversation/new.html.erb +10 -0
- data/app/views/mailbox/conversation/new.js.erb +1 -0
- data/app/views/mailbox/conversation/show.html.erb +1 -0
- data/app/views/{messages → mailbox}/edit.html.erb +0 -0
- data/app/views/mailbox/index.html.erb +10 -0
- data/app/views/{messages → mailbox}/index.js.erb +0 -0
- data/app/views/mailbox/new.html.erb +14 -0
- data/app/views/mailbox/show.html.erb +11 -0
- data/app/views/mailbox/show.js.erb +1 -0
- data/app/views/menu/_group.html.erb +15 -0
- data/{lib/generators/social_stream/templates/public/stylesheets/users.css → app/views/menu/_home_user.html.erb} +0 -0
- data/app/views/menu/_options.html.erb +11 -0
- data/app/views/menu/_services.html.erb +11 -0
- data/app/views/menu/_tiesGroup.html.erb +14 -0
- data/app/views/menu/_tiesUser.html.erb +11 -0
- data/app/views/menu/_user.html.erb +15 -0
- data/app/views/profiles/show.html.erb +1 -0
- data/app/views/subjects/_contacts.html.erb +8 -9
- data/app/views/subjects/_menu_options.html.erb +14 -0
- data/app/views/subjects/_toolbar.html.erb +15 -0
- data/app/views/ties/_new.html.erb +3 -2
- data/app/views/ties/_pendings.html.erb +7 -12
- data/app/views/ties/_suggestions.html.erb +12 -12
- data/app/views/ties/_tie.html.erb +9 -7
- data/app/views/ties/new.js.erb +1 -2
- data/app/views/users/_groups.html.erb +4 -3
- data/app/views/users/_index.html.erb +24 -22
- data/app/views/users/_logo.html.erb +1 -1
- data/app/views/users/_profile.html.erb +167 -164
- data/app/views/users/_sidebar_index.html.erb +6 -0
- data/app/views/users/{_middle_show.html.erb → _sidebar_show.html.erb} +0 -0
- data/app/views/users/_toolbar_show.html.erb +17 -0
- data/app/views/users/edit.html.erb +193 -165
- data/app/views/users/index.html.erb +34 -47
- data/{spec/dummy/public/stylesheets/.gitkeep → app/views/users/info.html.erb} +0 -0
- data/app/views/users/show.html.erb +4 -4
- data/app/views/users/show.xml.builder +28 -0
- data/app/views/users/update.js.erb +3 -1
- data/config/locales/en.yml +88 -9
- data/config/routes.rb +30 -14
- data/lib/generators/social_stream/install_generator.rb +8 -2
- data/lib/generators/social_stream/templates/migration.rb +75 -81
- data/lib/generators/social_stream/templates/public/images/{frontpage/facebook.png → btn/1-facebook.png} +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/edit.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/facebook.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/linkedin.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/twitter-follow-icon.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/twitter.png +0 -0
- data/lib/generators/social_stream/templates/public/images/frontpage/collaborate.png +0 -0
- data/lib/generators/social_stream/templates/public/images/frontpage/meet.png +0 -0
- data/lib/generators/social_stream/templates/public/images/frontpage/share.png +0 -0
- data/lib/generators/social_stream/templates/public/images/icons/favicon.ico +0 -0
- data/lib/generators/social_stream/templates/public/images/logo.png +0 -0
- data/lib/generators/social_stream/templates/public/images/w3c_css.png +0 -0
- data/lib/generators/social_stream/templates/public/images/w3c_xhtml.png +0 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery-ui-1.8.4.custom.min.js +3 -3
- data/lib/generators/social_stream/templates/public/javascripts/jquery-ui-personalized-1.5.2.packed.js +1 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery-ui.min.js +3 -3
- data/lib/generators/social_stream/templates/public/javascripts/jquery.Jcrop.min.js +163 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.fcbkcomplete.min.js +76 -76
- data/lib/generators/social_stream/templates/public/javascripts/jquery.min.js +156 -5
- data/lib/generators/social_stream/templates/public/javascripts/main.js +9 -0
- data/lib/generators/social_stream/templates/public/javascripts/menu-collapsed.js +42 -0
- data/lib/generators/social_stream/templates/public/javascripts/menu.js +1 -1
- data/lib/generators/social_stream/templates/public/javascripts/rails.js +30 -29
- data/lib/generators/social_stream/templates/public/javascripts/superfish.js +121 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/activities.css +72 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/base.css +150 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/carousel.css +23 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{fcbkComplete.css → default/fcbkComplete.css} +2 -2
- data/lib/generators/social_stream/templates/public/stylesheets/default/footer.css +25 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/frontpage.css +54 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/header.css +44 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/home.css +44 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-icons_222222_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-icons_454545_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-icons_888888_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{images → default/images}/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jqcloud.css +15 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{jquery-ui.css → default/jquery-ui.css} +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.Jcrop.css +35 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/menu.css +33 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-icons_222222_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-icons_454545_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-icons_888888_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/jquery-ui-1.7.3.custom.css +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/{smoothness → default/smoothness}/jquery-ui-1.8.4.custom.css +0 -0
- data/lib/social_stream.rb +11 -2
- data/lib/social_stream/ability.rb +21 -3
- data/lib/social_stream/models/object.rb +5 -3
- data/lib/social_stream/models/subject.rb +50 -31
- data/lib/social_stream/rails.rb +5 -0
- data/lib/social_stream/test_helpers.rb +11 -0
- data/lib/social_stream/test_helpers/controllers.rb +64 -0
- data/lib/social_stream/version.rb +1 -1
- data/lib/tasks/db/populate.rake +110 -25
- data/social_stream.gemspec +7 -1
- data/spec/controllers/contacts_controller_spec.rb +1 -1
- data/spec/controllers/groups_controller_spec.rb +8 -0
- data/spec/controllers/home_controller_spec.rb +15 -0
- data/spec/controllers/likes_controller_spec.rb +29 -0
- data/spec/controllers/posts_controller_spec.rb +41 -0
- data/spec/controllers/profiles_controller_spec.rb +46 -0
- data/spec/controllers/users_controller_spec.rb +2 -2
- data/spec/dummy/.gitignore +4 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environments/test_pg.rb +35 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/factories/group.rb +1 -1
- data/spec/integration/navigation_spec.rb +1 -1
- data/spec/models/actor_spec.rb +4 -4
- data/spec/models/user_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/support/db.rb +7 -0
- metadata +198 -116
- data/app/controllers/messages_controller.rb +0 -3
- data/app/models/message.rb +0 -2
- data/app/views/groups/_middle_index.html.erb +0 -74
- data/app/views/groups/_right_index.html.erb +0 -19
- data/app/views/groups/_right_show.html.erb +0 -8
- data/app/views/home/_middle.html.erb +0 -4
- data/app/views/home/_options.html.erb +0 -8
- data/app/views/home/_right.html.erb +0 -17
- data/app/views/messages/_form.html.erb +0 -24
- data/app/views/messages/_index.html.erb +0 -24
- data/app/views/messages/_message.html.erb +0 -17
- data/app/views/messages/_messages.html.erb +0 -2
- data/app/views/messages/index.html.erb +0 -1
- data/app/views/messages/new.html.erb +0 -14
- data/app/views/messages/show.html.erb +0 -21
- data/app/views/users/_menu.html.erb +0 -7
- data/app/views/users/_options.html.erb +0 -5
- data/app/views/users/_right_index.html.erb +0 -19
- data/app/views/users/_right_show.html.erb +0 -14
- data/lib/generators/social_stream/templates/public/images/btn/btn_share.png +0 -0
- data/lib/generators/social_stream/templates/public/images/favicon.ico +0 -0
- data/lib/generators/social_stream/templates/public/images/frontpage/collaborate.gif +0 -0
- data/lib/generators/social_stream/templates/public/images/frontpage/meet.gif +0 -0
- data/lib/generators/social_stream/templates/public/images/frontpage/share.gif +0 -0
- data/lib/generators/social_stream/templates/public/javascripts/hoverIntent.js +0 -84
- data/lib/generators/social_stream/templates/public/stylesheets/activities.css +0 -235
- data/lib/generators/social_stream/templates/public/stylesheets/base.css +0 -68
- data/lib/generators/social_stream/templates/public/stylesheets/boxy.css +0 -49
- data/lib/generators/social_stream/templates/public/stylesheets/browse.css +0 -162
- data/lib/generators/social_stream/templates/public/stylesheets/carousel.css +0 -57
- data/lib/generators/social_stream/templates/public/stylesheets/edit_user.css +0 -104
- data/lib/generators/social_stream/templates/public/stylesheets/frontpage.css +0 -708
- data/lib/generators/social_stream/templates/public/stylesheets/header.css +0 -116
- data/lib/generators/social_stream/templates/public/stylesheets/home.css +0 -121
- data/lib/generators/social_stream/templates/public/stylesheets/index.css +0 -625
- data/lib/generators/social_stream/templates/public/stylesheets/jqcloud.css +0 -62
- data/lib/generators/social_stream/templates/public/stylesheets/menu.css +0 -83
- data/lib/generators/social_stream/templates/public/stylesheets/message.css +0 -46
- data/lib/generators/social_stream/templates/public/stylesheets/middle.css +0 -113
- data/lib/generators/social_stream/templates/public/stylesheets/right.css +0 -58
- data/lib/generators/social_stream/templates/public/stylesheets/social_stream.css +0 -78
- data/lib/generators/social_stream/templates/public/stylesheets/ui.dropdownchecklist.css +0 -21
- data/spec/dummy/db/.gitignore +0 -2
- data/spec/dummy/log/.gitignore +0 -1
- data/spec/dummy/public/javascripts/application.js +0 -2
- data/spec/dummy/public/javascripts/controls.js +0 -965
- data/spec/dummy/public/javascripts/dragdrop.js +0 -974
- data/spec/dummy/public/javascripts/effects.js +0 -1123
- data/spec/dummy/public/javascripts/prototype.js +0 -6001
- data/spec/dummy/public/javascripts/rails.js +0 -175
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
class ApiController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :authenticate_user!, :only => [:create_key, :users, :activity_atom_feed]
|
4
|
+
|
5
|
+
def create_key
|
6
|
+
current_user.reset_authentication_token!
|
7
|
+
redirect_to :controller => :users, :action => :show, :id => current_user.to_param, :auth_token => params[:auth_token]
|
8
|
+
end
|
9
|
+
|
10
|
+
def users
|
11
|
+
if !params[:id]
|
12
|
+
params[:id]=current_user.to_param
|
13
|
+
end
|
14
|
+
|
15
|
+
if !params[:format]
|
16
|
+
params[:format]='xml'
|
17
|
+
end
|
18
|
+
|
19
|
+
redirect_to :controller => :users, :action => :show, :format => params[:format], :id => params[:id], :auth_token => params[:auth_token]
|
20
|
+
end
|
21
|
+
|
22
|
+
def activity_atom_feed
|
23
|
+
if !params[:page]
|
24
|
+
params[:page] = 1
|
25
|
+
end
|
26
|
+
|
27
|
+
@user = current_user
|
28
|
+
if params[:id] != nil
|
29
|
+
@user = User.find_by_slug!(params[:id])
|
30
|
+
end
|
31
|
+
|
32
|
+
@page = params[:page]
|
33
|
+
@activities = current_user.home_wall.paginate(:page => params[:page], :per_page => 10)
|
34
|
+
respond_to do |format|
|
35
|
+
format.atom
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -1,4 +1,7 @@
|
|
1
1
|
class GroupsController < InheritedResources::Base
|
2
|
+
|
3
|
+
respond_to :html, :xml, :js
|
4
|
+
|
2
5
|
def index
|
3
6
|
if params[:search]
|
4
7
|
@groups = Group.search("%"+params[:search]+"%").paginate(:per_page => 10, :page => params[:page])
|
@@ -10,11 +13,14 @@ class GroupsController < InheritedResources::Base
|
|
10
13
|
end
|
11
14
|
end
|
12
15
|
end
|
16
|
+
|
17
|
+
|
18
|
+
|
13
19
|
protected
|
14
20
|
|
15
|
-
# Overwrite resource method to support
|
21
|
+
# Overwrite resource method to support slug
|
16
22
|
# See InheritedResources::BaseHelpers#resource
|
17
23
|
def resource
|
18
|
-
@group ||= end_of_association_chain.
|
24
|
+
@group ||= end_of_association_chain.find_by_slug!(params[:id])
|
19
25
|
end
|
20
26
|
end
|
@@ -1,12 +1,8 @@
|
|
1
1
|
class LikesController < ApplicationController
|
2
|
-
# Ensure the suitable tie exists
|
3
|
-
before_filter :tie!, :only => :create
|
4
|
-
|
5
2
|
# POST /activities/1/like.js
|
6
3
|
def create
|
7
|
-
@like =
|
8
|
-
|
9
|
-
|
4
|
+
@like = Like.new(current_subject, params[:activity_id])
|
5
|
+
|
10
6
|
respond_to do |format|
|
11
7
|
if @like.save
|
12
8
|
format.js
|
@@ -16,32 +12,16 @@ class LikesController < ApplicationController
|
|
16
12
|
end
|
17
13
|
end
|
18
14
|
|
15
|
+
# DELETE /activities/1/like.js
|
19
16
|
def destroy
|
20
|
-
|
21
|
-
@like.destroy
|
22
|
-
end
|
17
|
+
@like = Like.find!(current_subject, params[:activity_id])
|
23
18
|
|
24
19
|
respond_to do |format|
|
25
|
-
|
20
|
+
if @like.destroy
|
21
|
+
format.js
|
22
|
+
else
|
23
|
+
format.js
|
24
|
+
end
|
26
25
|
end
|
27
26
|
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def activity
|
32
|
-
@activity ||= Activity.find(params[:activity_id])
|
33
|
-
end
|
34
|
-
|
35
|
-
def activity!
|
36
|
-
activity || raise(ActiveRecord::RecordNotFound)
|
37
|
-
end
|
38
|
-
|
39
|
-
def tie
|
40
|
-
@tie ||= current_subject.sent_ties(:receiver => activity!.receiver,
|
41
|
-
:relation => activity!.relation).first
|
42
|
-
end
|
43
|
-
|
44
|
-
def tie!
|
45
|
-
tie || raise(ActiveRecord::RecordNotFound)
|
46
|
-
end
|
47
27
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class LogosController < InheritedResources::Base
|
2
|
+
=begin
|
3
|
+
def new
|
4
|
+
# if params[:logo_logo].present?
|
5
|
+
# render :template => "logos/_precrop", :layout => false
|
6
|
+
# end
|
7
|
+
debugger
|
8
|
+
if params[:logo_logo]
|
9
|
+
|
10
|
+
end
|
11
|
+
respond_to do |format|
|
12
|
+
format.html #new.html.erb
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
=end
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
class Mailbox::ConversationController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :get_mailbox
|
4
|
+
|
5
|
+
|
6
|
+
def show
|
7
|
+
@actor = Actor.normalize(current_subject)
|
8
|
+
@conversation = MailboxerConversation.find_by_id(params[:id])
|
9
|
+
if @conversation.nil? or !@conversation.is_participant?(@actor)
|
10
|
+
redirect_to mailbox_index_path
|
11
|
+
return
|
12
|
+
end
|
13
|
+
@mails = @conversation.mails(@actor)
|
14
|
+
# messages = Array.new
|
15
|
+
# @mails.each do |mail|
|
16
|
+
# messages << mail.message
|
17
|
+
# end
|
18
|
+
# @messages = messages.uniq
|
19
|
+
end
|
20
|
+
|
21
|
+
def new
|
22
|
+
end
|
23
|
+
|
24
|
+
def edit
|
25
|
+
end
|
26
|
+
|
27
|
+
def create
|
28
|
+
@conversation = MailboxerConversation.new
|
29
|
+
if params[:subject].blank?
|
30
|
+
@conversation.errors.add("subject", "can't be empty")
|
31
|
+
end
|
32
|
+
if params[:body].blank?
|
33
|
+
@conversation.errors.add("body", "can't be empty")
|
34
|
+
end
|
35
|
+
if params[:_recipients].nil? or params[:_recipients]==[]
|
36
|
+
@conversation.errors.add("recipients", "can't be empty")
|
37
|
+
end
|
38
|
+
if @conversation.errors.any?
|
39
|
+
render :action => :new
|
40
|
+
return
|
41
|
+
end
|
42
|
+
@actor = current_subject
|
43
|
+
@recipients = Array.new
|
44
|
+
params[:_recipients].each do |recp_id|
|
45
|
+
recp = Actor.find_by_id(recp_id)
|
46
|
+
next if recp.nil?
|
47
|
+
@recipients << recp
|
48
|
+
end
|
49
|
+
|
50
|
+
if (mail = @actor.send_message(@recipients, params[:body], params[:subject]))
|
51
|
+
@conversation = mail.conversation
|
52
|
+
redirect_to mailbox_conversation_path(@conversation)
|
53
|
+
else
|
54
|
+
render :action => :new
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
def update
|
60
|
+
@actor = Actor.normalize(current_subject)
|
61
|
+
@conversation = MailboxerConversation.find_by_id(params[:id])
|
62
|
+
if @conversation.nil? or !@conversation.is_participant?(@actor)
|
63
|
+
redirect_to mailbox_index_path
|
64
|
+
return
|
65
|
+
end
|
66
|
+
|
67
|
+
if params[:untrash].present?
|
68
|
+
@conversation.untrash(@actor)
|
69
|
+
end
|
70
|
+
|
71
|
+
if params[:reply_all].present?
|
72
|
+
if params[:body].present?
|
73
|
+
last_mail = @conversation.mails(@actor).last
|
74
|
+
@actor.reply_to_all(last_mail, params[:body])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
@mails = @conversation.mails(@actor)
|
79
|
+
render :action => :show
|
80
|
+
end
|
81
|
+
|
82
|
+
def destroy
|
83
|
+
@actor = Actor.normalize(current_subject)
|
84
|
+
@conversation = MailboxerConversation.find_by_id(params[:id])
|
85
|
+
if @conversation.nil? or !@conversation.is_participant?(@actor)
|
86
|
+
redirect_to mailbox_index_path
|
87
|
+
return
|
88
|
+
end
|
89
|
+
|
90
|
+
@conversation.move_to_trash(@actor)
|
91
|
+
|
92
|
+
if params[:location].present?
|
93
|
+
case params[:location]
|
94
|
+
when 'conversation'
|
95
|
+
redirect_to mailbox_path(:id => :trash)
|
96
|
+
else
|
97
|
+
redirect_to mailbox_path(:id => params[:location])
|
98
|
+
end
|
99
|
+
|
100
|
+
return
|
101
|
+
end
|
102
|
+
redirect_to mailbox_index_path
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
|
107
|
+
def get_mailbox
|
108
|
+
@mailbox = current_subject.mailbox
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class MailboxController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :get_mailbox
|
4
|
+
|
5
|
+
def index
|
6
|
+
end
|
7
|
+
|
8
|
+
def new
|
9
|
+
end
|
10
|
+
|
11
|
+
def create
|
12
|
+
end
|
13
|
+
|
14
|
+
def show
|
15
|
+
if params[:id].blank? or !["inbox","sentbox","trash"].include?params[:id]
|
16
|
+
redirect_to :action => :index
|
17
|
+
return
|
18
|
+
end
|
19
|
+
|
20
|
+
if params[:id].eql?"inbox"
|
21
|
+
@conversations = @mailbox.inbox.paginate(:per_page => 8, :page => params[:page])
|
22
|
+
elsif params[:id].eql?"sentbox"
|
23
|
+
@conversations = @mailbox.sentbox.paginate(:per_page => 8, :page => params[:page])
|
24
|
+
else
|
25
|
+
@conversations = @mailbox.trash.paginate(:per_page => 8, :page => params[:page])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def get_mailbox
|
32
|
+
@mailbox = current_subject.mailbox
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -12,16 +12,16 @@ class UsersController < ApplicationController
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def show
|
15
|
-
@user = User.
|
16
|
-
|
15
|
+
@user = User.find_by_slug!(params[:id])
|
16
|
+
|
17
17
|
respond_to do |format|
|
18
18
|
format.html # show.html.erb
|
19
|
-
format.xml { render :xml => @user }
|
19
|
+
format.xml # { render :xml => @user }
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
def edit
|
24
|
-
@user = User.
|
24
|
+
@user = User.find_by_slug!(params[:id])
|
25
25
|
|
26
26
|
respond_to do |format|
|
27
27
|
format.html # edit.html.erb
|
@@ -31,7 +31,7 @@ class UsersController < ApplicationController
|
|
31
31
|
|
32
32
|
def update
|
33
33
|
|
34
|
-
@user = User.
|
34
|
+
@user = User.find_by_slug!(params[:id])
|
35
35
|
|
36
36
|
respond_to do |format|
|
37
37
|
if @user.update_attributes(params[:user])
|
data/app/helpers/ties_helper.rb
CHANGED
data/app/models/activity.rb
CHANGED
@@ -26,6 +26,8 @@ class Activity < ActiveRecord::Base
|
|
26
26
|
has_many :activity_objects,
|
27
27
|
:through => :activity_object_activities
|
28
28
|
|
29
|
+
after_create :like_direct_object
|
30
|
+
|
29
31
|
scope :home_wall, lambda { |ties|
|
30
32
|
select("DISTINCT activities.*").
|
31
33
|
roots.
|
@@ -104,9 +106,21 @@ class Activity < ActiveRecord::Base
|
|
104
106
|
liked_by(user).present?
|
105
107
|
end
|
106
108
|
|
109
|
+
# Build a new children activity where subject like this
|
110
|
+
def new_like(subject)
|
111
|
+
children.new :verb => "like",
|
112
|
+
:_tie => subject.sent_ties(:receiver => receiver,
|
113
|
+
:relation => relation).first
|
114
|
+
end
|
115
|
+
|
116
|
+
# The first activity object of this activity
|
117
|
+
def direct_activity_object
|
118
|
+
activity_objects.first
|
119
|
+
end
|
120
|
+
|
107
121
|
# The first object of this activity
|
108
122
|
def direct_object
|
109
|
-
|
123
|
+
direct_activity_object.try(:object)
|
110
124
|
end
|
111
125
|
|
112
126
|
private
|
@@ -124,4 +138,13 @@ class Activity < ActiveRecord::Base
|
|
124
138
|
end
|
125
139
|
end
|
126
140
|
end
|
141
|
+
|
142
|
+
# Link like activities with parent direct object
|
143
|
+
def like_direct_object
|
144
|
+
return unless verb == "like"
|
145
|
+
|
146
|
+
return if parent.direct_object.blank?
|
147
|
+
|
148
|
+
activity_objects << parent.direct_activity_object
|
149
|
+
end
|
127
150
|
end
|