social_stream 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/Gemfile +5 -1
- data/README.rdoc +2 -2
- data/app/controllers/api_controller.rb +2 -1
- data/app/controllers/contacts_controller.rb +25 -2
- data/app/controllers/groups_controller.rb +12 -2
- data/app/controllers/notifications_controller.rb +72 -0
- data/app/controllers/permissions_controller.rb +10 -0
- data/app/controllers/relation/customs_controller.rb +8 -0
- data/app/controllers/spheres_controller.rb +12 -0
- data/app/helpers/contacts_helper.rb +24 -0
- data/app/helpers/location_helper.rb +26 -12
- data/app/helpers/notifications_helper.rb +23 -0
- data/app/helpers/permissions_helper.rb +16 -0
- data/app/helpers/profiles_helper.rb +31 -0
- data/app/helpers/subjects_helper.rb +0 -83
- data/app/helpers/toolbar_helper.rb +83 -0
- data/app/models/activity.rb +43 -36
- data/app/models/actor.rb +71 -14
- data/app/models/contact.rb +121 -0
- data/app/models/group.rb +3 -3
- data/app/models/permission.rb +33 -2
- data/app/models/relation.rb +1 -1
- data/app/models/relation/custom.rb +12 -1
- data/app/models/relation/public.rb +1 -1
- data/app/models/sphere.rb +3 -1
- data/app/models/tie.rb +35 -18
- data/app/views/activities/_walls.html.erb +2 -2
- data/app/views/api/activity_atom_feed.atom.builder +38 -38
- data/app/views/avatars/index.html.erb +12 -40
- data/app/views/comments/_new.html.erb +9 -8
- data/app/views/contacts/_contact.html.erb +20 -0
- data/app/views/contacts/_edit.html.erb +76 -0
- data/app/views/contacts/_form.html.erb +72 -0
- data/app/views/contacts/_index.html.erb +1 -1
- data/app/views/{ties → contacts}/_pendings.html.erb +3 -3
- data/app/views/{ties → contacts}/_suggestions.html.erb +5 -5
- data/app/views/contacts/_suggestions_and_pendings.html.erb +6 -0
- data/app/views/contacts/edit.html.erb +5 -0
- data/app/views/contacts/index.html.erb +1 -1
- data/app/views/contacts/new.html.erb +5 -0
- data/app/views/conversations/_conversation.html.erb +1 -1
- data/app/views/conversations/_index.html.erb +0 -5
- data/app/views/conversations/_show.html.erb +1 -2
- data/app/views/conversations/index.html.erb +4 -0
- data/app/views/conversations/index.js.erb +1 -0
- data/app/views/frontpage/index.html.erb +2 -3
- data/app/views/groups/_index.html.erb +5 -1
- data/app/views/groups/_new.html.erb +4 -3
- data/app/views/groups/_sidebar_index.html.erb +3 -10
- data/app/views/groups/_sidebar_show.html.erb +1 -9
- data/app/views/groups/index.html.erb +6 -8
- data/app/views/groups/show.html.erb +11 -4
- data/app/views/home/_sidebar.html.erb +1 -15
- data/app/views/home/index.html.erb +3 -2
- data/app/views/layouts/_account.html.erb +1 -1
- data/app/views/layouts/_flash.html.erb +5 -0
- data/app/views/layouts/_footer.html.erb +5 -4
- data/app/views/layouts/_representation.html.erb +5 -12
- data/app/views/layouts/application.html.erb +23 -20
- data/app/views/layouts/frontpage.html.erb +22 -10
- data/app/views/location/_location.html.erb +1 -1
- data/app/views/messages/_new.html.erb +0 -2
- data/app/views/notification_mailer/new_notification_email.html.erb +21 -0
- data/app/views/notification_mailer/new_notification_email.text.erb +11 -0
- data/app/views/notifications/_index.html.erb +21 -0
- data/app/views/notifications/_notification.html.erb +47 -0
- data/app/views/notifications/_show.html.erb +3 -0
- data/app/views/notifications/activities/_follow_body.html.erb +2 -0
- data/app/views/notifications/activities/_follow_subject.html.erb +2 -0
- data/app/views/notifications/activities/_like_body.html.erb +5 -0
- data/app/views/notifications/activities/_like_object_body.html.erb +2 -0
- data/app/views/notifications/activities/_like_object_subject.html.erb +2 -0
- data/app/views/notifications/activities/_like_subject.html.erb +5 -0
- data/app/views/notifications/activities/_like_subject_body.html.erb +1 -0
- data/app/views/notifications/activities/_like_subject_subject.html.erb +2 -0
- data/app/views/notifications/activities/_make-friend_body.html.erb +3 -0
- data/app/views/notifications/activities/_make-friend_subject.html.erb +2 -0
- data/app/views/notifications/activities/_post_body.html.erb +2 -0
- data/app/views/notifications/activities/_post_subject.html.erb +1 -0
- data/app/views/notifications/activities/_update_body.html.erb +1 -0
- data/app/views/notifications/activities/_update_subject.html.erb +1 -0
- data/app/views/notifications/index.html.erb +19 -0
- data/app/views/notifications/index.js.erb +8 -0
- data/app/views/notifications/show.html.erb +5 -0
- data/app/views/permissions/_index.html.erb +39 -0
- data/app/views/permissions/index.js.erb +10 -0
- data/app/views/profiles/_contact.html.erb +81 -0
- data/app/views/profiles/_experience.html.erb +22 -0
- data/app/views/profiles/_personal.html.erb +74 -0
- data/app/views/profiles/_profile.html.erb +12 -181
- data/app/views/profiles/_tags.html.erb +22 -0
- data/app/views/profiles/edit.html.erb +0 -14
- data/app/views/profiles/show.html.erb +14 -0
- data/app/views/profiles/update.js.erb +2 -28
- data/app/views/relation/customs/_form.html.erb +29 -0
- data/app/views/relation/customs/_index.html.erb +30 -0
- data/app/views/relation/customs/_list.html.erb +36 -0
- data/app/views/relation/customs/create.js.erb +20 -0
- data/app/views/relation/customs/index.js.erb +2 -0
- data/app/views/relation/customs/update.js.erb +6 -0
- data/app/views/spheres/_form.html.erb +28 -0
- data/app/views/spheres/_jquery.erb +130 -0
- data/app/views/spheres/_list.html.erb +19 -0
- data/app/views/spheres/create.js.erb +20 -0
- data/app/views/spheres/index.html.erb +74 -0
- data/app/views/ties/_edit.html.erb +1 -33
- data/app/views/toolbar/_home.html.erb +9 -0
- data/app/views/{subjects/_toolbar_home_menu.html.erb → toolbar/_home_menu.html.erb} +1 -1
- data/app/views/{subjects/_toolbar_home_menu_options.html.erb → toolbar/_home_menu_options.html.erb} +7 -3
- data/app/views/{subjects/_toolbar_home_menu_options_subjects.html.erb → toolbar/_home_menu_options_subjects.html.erb} +0 -0
- data/app/views/{subjects/_toolbar_logo.html.erb → toolbar/_logo.html.erb} +1 -1
- data/app/views/{subjects/_toolbar_message_menu.html.erb → toolbar/_message_menu.html.erb} +0 -0
- data/app/views/toolbar/_notifications_menu.html.erb +3 -0
- data/app/views/{subjects/_toolbar_profile.html.erb → toolbar/_profile.html.erb} +2 -2
- data/app/views/toolbar/_profile_menu.html.erb +15 -0
- data/app/views/toolbar/_profile_menu_basic_options.html.erb +5 -0
- data/app/views/toolbar/_profile_menu_tie_options.html.erb +35 -0
- data/app/views/users/_index.html.erb +1 -1
- data/app/views/users/_sidebar_index.html.erb +1 -6
- data/app/views/users/index.html.erb +3 -3
- data/app/views/users/show.html.erb +12 -2
- data/config/locales/en.yml +106 -79
- data/config/routes.rb +19 -5
- data/lib/generators/social_stream/templates/initializer.rb +2 -2
- data/lib/generators/social_stream/templates/migration.rb +3 -1
- data/lib/generators/social_stream/templates/public/images/HTML5.png +0 -0
- data/lib/generators/social_stream/templates/public/images/HTML5_Semantics.png +0 -0
- data/lib/generators/social_stream/templates/public/images/HTML5_Styling.png +0 -0
- data/lib/generators/social_stream/templates/public/images/Jcrop.gif +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/btn_notification.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/btn_notification_delete.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/error.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/info.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/success.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/warning.png +0 -0
- data/lib/generators/social_stream/templates/public/images/cancel.png +0 -0
- data/lib/generators/social_stream/templates/public/images/html5-badge-h-css3-semantics.png +0 -0
- data/lib/generators/social_stream/templates/public/images/icon_checkbox.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/actor/remote_subject.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/actor/remote_user.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/representation/group.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/representation/user.png +0 -0
- data/lib/generators/social_stream/templates/public/images/pbar-ani.gif +0 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.fileupload-ui.js +259 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.fileupload.js +475 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.form.js +815 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.mouse.js +156 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.slider.js +684 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.widget.js +236 -0
- data/lib/generators/social_stream/templates/public/javascripts/ui.checkbox.js +309 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/base.css +13 -12
- data/lib/generators/social_stream/templates/public/stylesheets/default/contacts.css +88 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/footer.css +1 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/header.css +5 -3
- data/lib/generators/social_stream/templates/public/stylesheets/default/home.css +1 -1
- data/lib/generators/social_stream/templates/public/stylesheets/default/images/loading.gif +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.fileupload-ui.css +73 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.ui.slider.css +24 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.ui.slidertheme.css +32 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/messages.css +4 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/spheres.css +226 -0
- data/lib/generators/social_stream/templates/relations.yml +12 -12
- data/lib/social_stream.rb +2 -1
- data/lib/social_stream/ability.rb +5 -4
- data/lib/social_stream/controllers/helpers.rb +19 -0
- data/lib/social_stream/models/object.rb +3 -1
- data/lib/social_stream/models/subject.rb +19 -6
- data/lib/social_stream/rails.rb +23 -1
- data/lib/social_stream/test_helpers/controllers.rb +1 -1
- data/lib/social_stream/version.rb +1 -1
- data/lib/tasks/db/populate.rake +6 -9
- data/social_stream.gemspec +7 -4
- data/spec/controllers/comments_controller_spec.rb +1 -1
- data/spec/controllers/contacts_controller_spec.rb +23 -0
- data/spec/controllers/groups_controller_spec.rb +12 -1
- data/spec/controllers/permissions_controller_spec.rb +48 -0
- data/spec/controllers/posts_controller_spec.rb +4 -4
- data/spec/controllers/relation_customs_controller_spec.rb +130 -0
- data/spec/controllers/representations_spec.rb +74 -0
- data/spec/controllers/spheres_controller_spec.rb +108 -0
- data/spec/dummy/config/initializers/mailboxer.rb +8 -0
- data/spec/dummy/config/initializers/social_stream.rb +2 -2
- data/spec/dummy/config/relations.yml +12 -12
- data/spec/factories/relation_custom.rb +4 -0
- data/spec/factories/sphere.rb +5 -0
- data/spec/factories/tie.rb +4 -4
- data/spec/models/activity_spec.rb +58 -38
- data/spec/models/actor_spec.rb +1 -1
- data/spec/models/group_spec.rb +12 -0
- data/spec/models/like_spec.rb +68 -0
- data/spec/models/profile_spec.rb +2 -1
- data/spec/models/relation_custom_spec.rb +14 -0
- data/spec/models/tie_spec.rb +26 -2
- metadata +195 -94
- data/app/controllers/avatars_controller.rb +0 -51
- data/app/controllers/representations_controller.rb +0 -19
- data/app/controllers/ties_controller.rb +0 -22
- data/app/helpers/ties_helper.rb +0 -37
- data/app/models/avatar.rb +0 -91
- data/app/models/representation.rb +0 -35
- data/app/views/avatars/_form.html.erb +0 -12
- data/app/views/avatars/_precrop.html.erb +0 -66
- data/app/views/avatars/edit.html.erb +0 -6
- data/app/views/avatars/new.html.erb +0 -32
- data/app/views/avatars/show.html.erb +0 -5
- data/app/views/groups/_location.html.erb +0 -3
- data/app/views/groups/_logo.html.erb +0 -5
- data/app/views/home/_location.html.erb +0 -3
- data/app/views/subjects/_toolbar_home.html.erb +0 -9
- data/app/views/subjects/_toolbar_profile_menu.html.erb +0 -12
- data/app/views/subjects/_toolbar_profile_menu_basic_options.html.erb +0 -13
- data/app/views/subjects/_toolbar_profile_menu_tie_options.html.erb +0 -41
- data/app/views/ties/_new.html.erb +0 -64
- data/app/views/ties/_tie.html.erb +0 -23
- data/app/views/ties/new.html.erb +0 -1
- data/app/views/users/_location.html.erb +0 -3
- 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/addContact.js +0 -100
- data/lib/generators/social_stream/templates/public/stylesheets/default/addContact.css +0 -29
- data/spec/controllers/representations_controller_spec.rb +0 -51
- data/spec/controllers/ties_controller_spec.rb +0 -19
- data/spec/models/representation_spec.rb +0 -16
data/.gitignore
CHANGED
data/Gemfile
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
source "http://rubygems.org"
|
|
2
2
|
|
|
3
|
+
gem 'rake', '0.8.7'
|
|
4
|
+
|
|
3
5
|
gemspec
|
|
4
6
|
#Uncomment the following two lines if you are planing to
|
|
5
|
-
#use a local code of mailboxer
|
|
7
|
+
#use a local code of mailboxer, avatar_for_rails or socialstream-files gems
|
|
6
8
|
#@dependencies.delete_if {|d| d.name == 'mailboxer' }
|
|
7
9
|
#gem 'mailboxer', :path => '../mailboxer'
|
|
10
|
+
#gem 'avatars_for_rails', :path => '../avatars_for_rails'
|
|
11
|
+
#gem 'social_stream-files', :path => '../social_stream-files'
|
|
8
12
|
|
|
9
13
|
|
|
10
14
|
|
data/README.rdoc
CHANGED
|
@@ -8,8 +8,8 @@ among the most popular websites, while many content oriented applications are su
|
|
|
8
8
|
networking features in order to improve engagement, enhance user awareness and stimulate communities
|
|
9
9
|
around the website.
|
|
10
10
|
|
|
11
|
-
{Social Stream}[http://github.com/ging/social_stream] is based
|
|
12
|
-
{
|
|
11
|
+
{Social Stream}[http://github.com/ging/social_stream] is based on
|
|
12
|
+
{social network analysis (SNA)}[http://en.wikipedia.org/wiki/Social_network] concepts and methods,
|
|
13
13
|
including social entities (actors), ties and relations. Social Stream is so flexible that you can
|
|
14
14
|
define custom actors (groups, organizations, institutions, social events) and relationships
|
|
15
15
|
(friends, collegues, members, administrators, contributors, attendants, speakers).
|
|
@@ -26,7 +26,8 @@ class ApiController < ApplicationController
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
@page = params[:page]
|
|
29
|
-
@activities = @user.wall(:
|
|
29
|
+
@activities = @user.wall(:home).paginate(:page => params[:page], :per_page => 10)
|
|
30
|
+
|
|
30
31
|
respond_to do |format|
|
|
31
32
|
format.atom
|
|
32
33
|
end
|
|
@@ -8,13 +8,36 @@ class ContactsController < ApplicationController
|
|
|
8
8
|
q.alphabetic.
|
|
9
9
|
letter(params[:letter]).
|
|
10
10
|
search(params[:search]).
|
|
11
|
-
merge(Tie.related_by(current_subject.
|
|
11
|
+
merge(Tie.related_by(current_subject.relation_customs.find_by_id(params[:relation])))
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
respond_to do |format|
|
|
15
15
|
format.html { @contacts = @contacts.paginate(:page => params[:page], :per_page => 10) }
|
|
16
16
|
format.js { @contacts = @contacts.paginate(:page => params[:page], :per_page => 10) }
|
|
17
|
-
format.json { render :text => @contacts.map{ |c| { 'key' => c.name, 'value' => c.
|
|
17
|
+
format.json { render :text => @contacts.map{ |c| { 'key' => c.name, 'value' => c.slug } }.to_json }
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
|
+
|
|
21
|
+
def new
|
|
22
|
+
@contact = Contact.new(current_actor, params[:id].to_i)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def edit
|
|
26
|
+
@contact = Contact.new(current_actor, params[:id].to_i)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def update
|
|
30
|
+
@contact = Contact.new(current_actor, params[:id].to_i)
|
|
31
|
+
|
|
32
|
+
if @contact.update_attributes(params[:contact])
|
|
33
|
+
redirect_to @contact.receiver_subject
|
|
34
|
+
else
|
|
35
|
+
render :action => 'edit'
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def suggestion
|
|
40
|
+
@tie = current_subject.suggestion
|
|
41
|
+
render :layout => false
|
|
42
|
+
end
|
|
20
43
|
end
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
class GroupsController < InheritedResources::Base
|
|
2
2
|
load_and_authorize_resource
|
|
3
3
|
|
|
4
|
-
respond_to :html, :
|
|
4
|
+
respond_to :html, :js
|
|
5
5
|
|
|
6
6
|
def index
|
|
7
|
-
@groups = Group.
|
|
7
|
+
@groups = Group.most(params[:most]).
|
|
8
|
+
alphabetic.
|
|
8
9
|
letter(params[:letter]).
|
|
9
10
|
search(params[:search]).
|
|
10
11
|
tagged_with(params[:tag]).
|
|
@@ -15,6 +16,15 @@ class GroupsController < InheritedResources::Base
|
|
|
15
16
|
end
|
|
16
17
|
end
|
|
17
18
|
|
|
19
|
+
def create
|
|
20
|
+
create! do |success, failure|
|
|
21
|
+
success.html {
|
|
22
|
+
self.current_subject = @group
|
|
23
|
+
redirect_to :home
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
18
28
|
protected
|
|
19
29
|
|
|
20
30
|
# Overwrite resource method to support slug
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
class NotificationsController < ApplicationController
|
|
2
|
+
|
|
3
|
+
before_filter :authenticate_user!
|
|
4
|
+
before_filter :get_mailbox, :get_actor
|
|
5
|
+
before_filter :check_current_subject_is_owner, :only => [:show, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
def index
|
|
8
|
+
@notifications = @mailbox.notifications.paginate(:per_page => 10, :page => params[:page])
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def show
|
|
12
|
+
render :action => :show
|
|
13
|
+
@actor.read @notification
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def new
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def edit
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def create
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def update
|
|
30
|
+
if params[:read].present?
|
|
31
|
+
if params[:read].eql?("Read")
|
|
32
|
+
@actor.read @notification
|
|
33
|
+
elsif params[:read].eql?("Unread")
|
|
34
|
+
@actor.unread @notification
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
redirect_to notifications_path(:page => params[:page])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def update_all
|
|
41
|
+
@notifications= @mailbox.notifications.all
|
|
42
|
+
@actor.read @notifications
|
|
43
|
+
redirect_to notifications_path(:page => params[:page])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def destroy
|
|
47
|
+
@notification.destroy
|
|
48
|
+
redirect_to notifications_path
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
def get_mailbox
|
|
54
|
+
@mailbox = current_subject.mailbox
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def get_actor
|
|
58
|
+
@actor = Actor.normalize(current_subject)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def check_current_subject_is_owner
|
|
63
|
+
|
|
64
|
+
@notification = Notification.find_by_id(params[:id])
|
|
65
|
+
|
|
66
|
+
if @notification.nil? #TODO or !@notification.is_receiver?(@actor)
|
|
67
|
+
redirect_to notifications_path
|
|
68
|
+
return
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
@@ -1,2 +1,26 @@
|
|
|
1
1
|
module ContactsHelper
|
|
2
|
+
def contact_brief(contact)
|
|
3
|
+
"N contacts in common"
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
# Show current ties from current user to actor, if they exist, or provide a link
|
|
7
|
+
# to create new ties to actor
|
|
8
|
+
def contact_to(a)
|
|
9
|
+
if user_signed_in?
|
|
10
|
+
if current_subject.ties_to(a).present?
|
|
11
|
+
current_subject.ties_to(a).map(&:relation_name).join(", ")
|
|
12
|
+
else
|
|
13
|
+
new_contact_link(Contact.new(current_subject, a))
|
|
14
|
+
end
|
|
15
|
+
else
|
|
16
|
+
link_to t("contact.new.link"), new_user_session_path
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def new_contact_link(contact)
|
|
21
|
+
link_to t("contact.new.link"),
|
|
22
|
+
new_contact_path(:id => contact.to_param),
|
|
23
|
+
:title => t("contact.new.title",
|
|
24
|
+
:name => contact.receiver.name)
|
|
25
|
+
end
|
|
2
26
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module LocationHelper
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
# Renders the location stack for your view. You can add as many stack levels as you wish.
|
|
4
4
|
#
|
|
5
5
|
# Usage:
|
|
@@ -20,15 +20,29 @@ module LocationHelper
|
|
|
20
20
|
#
|
|
21
21
|
# <%= location(link_to(leve1.name, level1.url),link_to(leve2.name, level2.url)) %>
|
|
22
22
|
#
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
def location(*stack)
|
|
24
|
+
location_body = t('location.base')
|
|
25
|
+
stack.collect {|level|
|
|
26
|
+
location_body << t('location.separator') + level
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
location_div = capture do
|
|
30
|
+
render :partial => "location/location", :locals=>{:location_body => location_body}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
case request.format
|
|
34
|
+
when Mime::JS
|
|
35
|
+
response = <<-EOJ
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
$('#map_location').html("#{ escape_javascript(location_div) }");
|
|
38
|
+
EOJ
|
|
39
|
+
|
|
40
|
+
response.html_safe
|
|
41
|
+
else
|
|
42
|
+
content_for(:location) do
|
|
43
|
+
location_div
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module NotificationsHelper
|
|
2
|
+
def decode_notification notification_text, activity
|
|
3
|
+
if activity.tie.present?
|
|
4
|
+
notification_text = notification_text.gsub(/\%\{sender\}/,link_to(activity.tie.sender.name,activity.tie.sender.subject))
|
|
5
|
+
notification_text = notification_text.gsub(/\%\{sender.name\}/,activity.tie.sender.name)
|
|
6
|
+
elsif activity._tie.present?
|
|
7
|
+
notification_text = notification_text.gsub(/\%\{sender\}/,link_to(activity._tie.sender.name,activity._tie.sender.subject))
|
|
8
|
+
notification_text = notification_text.gsub(/\%\{sender.name\}/,activity._tie.sender.name)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
if activity.direct_object.present?
|
|
12
|
+
object = activity.direct_object
|
|
13
|
+
object = object.subject if object.is_a? Actor
|
|
14
|
+
notification_text=notification_text.gsub(/\%\{object\}/,link_to(object.class.to_s.downcase,object))
|
|
15
|
+
notification_text=notification_text.gsub(/\%\{object.name\}/,object.class.to_s.downcase)
|
|
16
|
+
else
|
|
17
|
+
notification_text=notification_text.gsub(/\%\{object\}/,"nilclass")
|
|
18
|
+
notification_text=notification_text.gsub(/\%\{object.name\}/,"nilclass")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
notification_text
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module PermissionsHelper
|
|
2
|
+
DEFAULT_PERMISSIONS =
|
|
3
|
+
[
|
|
4
|
+
[ "read", "activity", "weak_star_ties" ],
|
|
5
|
+
[ "create", "activity", nil ],
|
|
6
|
+
[ "follow", nil, nil],
|
|
7
|
+
[ "represent", nil, nil]
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
def default_permissions
|
|
11
|
+
@default_permissions ||=
|
|
12
|
+
DEFAULT_PERMISSIONS.map{ |p|
|
|
13
|
+
Permission.find_or_create_by_action_and_object_and_function *p
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module ProfilesHelper
|
|
2
|
+
|
|
3
|
+
#Tells if the current subject accessing the profile is its owner or not
|
|
4
|
+
def is_owner?
|
|
5
|
+
if (current_subject.present?) and (@profile.present?) and (@profile.actor == current_subject.actor)
|
|
6
|
+
return true
|
|
7
|
+
else
|
|
8
|
+
return false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
#Returns true if the "Personal Information" section is empty
|
|
13
|
+
def is_personal_empty?
|
|
14
|
+
if (@profile.organization?) or (@profile.birthday?) or (@profile.city?) or (@profile.description?)
|
|
15
|
+
return false
|
|
16
|
+
else
|
|
17
|
+
return true
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
#Returns true if the "Personal Information" section is empty
|
|
22
|
+
def is_contact_empty?
|
|
23
|
+
if (@profile.phone?) or (@profile.mobile?) or (@profile.fax?) or (@profile.address?)or
|
|
24
|
+
(@profile.website?) or (@profile.subject.email?)
|
|
25
|
+
return false
|
|
26
|
+
else
|
|
27
|
+
return true
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -3,87 +3,4 @@ module SubjectsHelper
|
|
|
3
3
|
def link_name(subject, options = {})
|
|
4
4
|
link_to subject.name, subject, options
|
|
5
5
|
end
|
|
6
|
-
|
|
7
|
-
# Define the toolbar content for your view. There are two typical cases, depending on the value of
|
|
8
|
-
# options[:profile]
|
|
9
|
-
# * If present, render the profile menu for the {SocialStream::Models::Subject subject}
|
|
10
|
-
# * If blank, render the home menu
|
|
11
|
-
#
|
|
12
|
-
# The menu option allows overwriting a menu slot with the content of the given block
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
# Autoexpanding a menu section on your view:
|
|
16
|
-
#
|
|
17
|
-
# Toolbar allows you to autoexpand certain menu section that may be of interest for your view.
|
|
18
|
-
# For example, the messages menu when you are looking your inbox. This is done through :option element.
|
|
19
|
-
#
|
|
20
|
-
# To get it working, you should use the proper :option to be expanded, ":option => :messages" in the
|
|
21
|
-
# mentioned example. This will try, automatically, to expand the section of the menu where its root
|
|
22
|
-
# list link, the one expanding the section, has an id equal to "#messages_menu". If you use
|
|
23
|
-
# ":options => :contacts" it will try to expand "#contacts_menu".
|
|
24
|
-
#
|
|
25
|
-
# For now its working with :option => :messages, :contacts or :groups
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# Examples:
|
|
29
|
-
#
|
|
30
|
-
# Render the home toolbar:
|
|
31
|
-
#
|
|
32
|
-
# <% toolbar %>
|
|
33
|
-
#
|
|
34
|
-
# Render the profile toolbar for a user:
|
|
35
|
-
#
|
|
36
|
-
# <% toolbar :profile => @user %>
|
|
37
|
-
#
|
|
38
|
-
# Render the home toolbar changing the messages menu option:
|
|
39
|
-
#
|
|
40
|
-
# <% toolbar :option => :messages %>
|
|
41
|
-
#
|
|
42
|
-
# Render the profile toolbar for group changing the contacts menu option:
|
|
43
|
-
#
|
|
44
|
-
# <% toolbar :profile => @group, :option => :contacts %>
|
|
45
|
-
#
|
|
46
|
-
|
|
47
|
-
def toolbar(options = {}, &block)
|
|
48
|
-
if options[:option] && block_given?
|
|
49
|
-
menu_options[options[:option]] = capture(&block)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
content = capture do
|
|
53
|
-
if options[:profile]
|
|
54
|
-
render :partial => 'subjects/toolbar_profile', :locals => { :subject => options[:profile] }
|
|
55
|
-
else
|
|
56
|
-
render :partial => 'subjects/toolbar_home'
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
case request.format
|
|
61
|
-
when Mime::JS
|
|
62
|
-
response = <<-EOJ
|
|
63
|
-
|
|
64
|
-
$('#toolbar').html("#{ escape_javascript(content) }");
|
|
65
|
-
initMenu();
|
|
66
|
-
expandSubMenu('#{ options[:option] }');
|
|
67
|
-
EOJ
|
|
68
|
-
|
|
69
|
-
response.html_safe
|
|
70
|
-
else
|
|
71
|
-
content_for(:toolbar) do
|
|
72
|
-
content
|
|
73
|
-
end
|
|
74
|
-
content_for(:javascript) do
|
|
75
|
-
<<-EOJ
|
|
76
|
-
expandSubMenu('#{ options[:option] }');
|
|
77
|
-
EOJ
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# Cache menu options for toolbar
|
|
84
|
-
#
|
|
85
|
-
# @api private
|
|
86
|
-
def menu_options #:nodoc:
|
|
87
|
-
@menu_options ||= {}
|
|
88
|
-
end
|
|
89
6
|
end
|