socializer 0.1.13
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.
- checksums.yaml +7 -0
- data/.editorconfig +11 -0
- data/.gitignore +29 -0
- data/.rubocop.yml +42 -0
- data/.travis.yml +13 -0
- data/CONTRIBUTING.md +46 -0
- data/Gemfile +31 -0
- data/README.md +91 -0
- data/Rakefile +38 -0
- data/app/assets/images/socializer/.gitkeep +0 -0
- data/app/assets/images/socializer/auth_buttons/facebook_128.png +0 -0
- data/app/assets/images/socializer/auth_buttons/facebook_256.png +0 -0
- data/app/assets/images/socializer/auth_buttons/facebook_32.png +0 -0
- data/app/assets/images/socializer/auth_buttons/facebook_64.png +0 -0
- data/app/assets/images/socializer/auth_buttons/google_128.png +0 -0
- data/app/assets/images/socializer/auth_buttons/google_256.png +0 -0
- data/app/assets/images/socializer/auth_buttons/google_32.png +0 -0
- data/app/assets/images/socializer/auth_buttons/google_64.png +0 -0
- data/app/assets/images/socializer/auth_buttons/linkedin_128.png +0 -0
- data/app/assets/images/socializer/auth_buttons/linkedin_256.png +0 -0
- data/app/assets/images/socializer/auth_buttons/linkedin_32.png +0 -0
- data/app/assets/images/socializer/auth_buttons/linkedin_64.png +0 -0
- data/app/assets/images/socializer/auth_buttons/twitter_128.png +0 -0
- data/app/assets/images/socializer/auth_buttons/twitter_256.png +0 -0
- data/app/assets/images/socializer/auth_buttons/twitter_32.png +0 -0
- data/app/assets/images/socializer/auth_buttons/twitter_64.png +0 -0
- data/app/assets/images/socializer/auth_buttons/yahoo_128.png +0 -0
- data/app/assets/images/socializer/auth_buttons/yahoo_256.png +0 -0
- data/app/assets/images/socializer/auth_buttons/yahoo_32.png +0 -0
- data/app/assets/images/socializer/auth_buttons/yahoo_64.png +0 -0
- data/app/assets/images/socializer/close.png +0 -0
- data/app/assets/images/socializer/icons/Bell.png +0 -0
- data/app/assets/images/socializer/icons/Edit.png +0 -0
- data/app/assets/images/socializer/icons/Home.png +0 -0
- data/app/assets/images/socializer/icons/Power.png +0 -0
- data/app/assets/images/socializer/icons/Safe.png +0 -0
- data/app/assets/images/socializer/icons/User.png +0 -0
- data/app/assets/images/socializer/icons/Users.png +0 -0
- data/app/assets/images/socializer/icons/Web.png +0 -0
- data/app/assets/images/socializer/loading.gif +0 -0
- data/app/assets/images/socializer/next.png +0 -0
- data/app/assets/images/socializer/pause.png +0 -0
- data/app/assets/images/socializer/play.png +0 -0
- data/app/assets/images/socializer/previous.png +0 -0
- data/app/assets/javascripts/socializer/activities.js.coffee +47 -0
- data/app/assets/javascripts/socializer/application.js +24 -0
- data/app/assets/javascripts/socializer/circles.js.coffee +33 -0
- data/app/assets/javascripts/socializer/jquery.qtip.min.js +7 -0
- data/app/assets/javascripts/socializer/jquery.tokeninput.js +862 -0
- data/app/assets/javascripts/socializer/notes.js.coffee +38 -0
- data/app/assets/javascripts/socializer/people.js.coffee +7 -0
- data/app/assets/javascripts/socializer/shares.js.coffee +8 -0
- data/app/assets/stylesheets/socializer/activities.css +84 -0
- data/app/assets/stylesheets/socializer/application.css +409 -0
- data/app/assets/stylesheets/socializer/authentications.css +4 -0
- data/app/assets/stylesheets/socializer/circles.css +74 -0
- data/app/assets/stylesheets/socializer/comments.css +4 -0
- data/app/assets/stylesheets/socializer/groups.css +61 -0
- data/app/assets/stylesheets/socializer/jquery.qtip.min.css +2 -0
- data/app/assets/stylesheets/socializer/likes.css +4 -0
- data/app/assets/stylesheets/socializer/memberships.css +4 -0
- data/app/assets/stylesheets/socializer/notes.css +21 -0
- data/app/assets/stylesheets/socializer/notifications.css +46 -0
- data/app/assets/stylesheets/socializer/pages.css +4 -0
- data/app/assets/stylesheets/socializer/persons.css +25 -0
- data/app/assets/stylesheets/socializer/sessions.css +4 -0
- data/app/assets/stylesheets/socializer/shares.css.scss +3 -0
- data/app/assets/stylesheets/socializer/ties.css +4 -0
- data/app/assets/stylesheets/socializer/token-input.css +183 -0
- data/app/controllers/socializer/activities_controller.rb +84 -0
- data/app/controllers/socializer/application_controller.rb +37 -0
- data/app/controllers/socializer/audiences_controller.rb +30 -0
- data/app/controllers/socializer/authentications_controller.rb +13 -0
- data/app/controllers/socializer/circles_controller.rb +54 -0
- data/app/controllers/socializer/comments_controller.rb +37 -0
- data/app/controllers/socializer/groups_controller.rb +70 -0
- data/app/controllers/socializer/likes_controller.rb +50 -0
- data/app/controllers/socializer/memberships_controller.rb +46 -0
- data/app/controllers/socializer/notes_controller.rb +43 -0
- data/app/controllers/socializer/notifications_controller.rb +29 -0
- data/app/controllers/socializer/pages_controller.rb +7 -0
- data/app/controllers/socializer/people_controller.rb +37 -0
- data/app/controllers/socializer/person_addresses_controller.rb +27 -0
- data/app/controllers/socializer/person_contributions_controller.rb +27 -0
- data/app/controllers/socializer/person_educations_controller.rb +27 -0
- data/app/controllers/socializer/person_employments_controller.rb +27 -0
- data/app/controllers/socializer/person_links_controller.rb +27 -0
- data/app/controllers/socializer/person_phones_controller.rb +27 -0
- data/app/controllers/socializer/person_places_controller.rb +27 -0
- data/app/controllers/socializer/person_profiles_controller.rb +27 -0
- data/app/controllers/socializer/sessions_controller.rb +37 -0
- data/app/controllers/socializer/shares_controller.rb +54 -0
- data/app/controllers/socializer/ties_controller.rb +16 -0
- data/app/helpers/socializer/application_helper.rb +22 -0
- data/app/models/concerns/socializer/object_type_base.rb +58 -0
- data/app/models/socializer/activity.rb +162 -0
- data/app/models/socializer/activity_field.rb +10 -0
- data/app/models/socializer/activity_object.rb +118 -0
- data/app/models/socializer/audience.rb +19 -0
- data/app/models/socializer/authentication.rb +20 -0
- data/app/models/socializer/circle.rb +32 -0
- data/app/models/socializer/comment.rb +13 -0
- data/app/models/socializer/group.rb +100 -0
- data/app/models/socializer/group_category.rb +11 -0
- data/app/models/socializer/group_link.rb +12 -0
- data/app/models/socializer/identity.rb +9 -0
- data/app/models/socializer/membership.rb +24 -0
- data/app/models/socializer/note.rb +13 -0
- data/app/models/socializer/notification.rb +16 -0
- data/app/models/socializer/person.rb +129 -0
- data/app/models/socializer/person_address.rb +12 -0
- data/app/models/socializer/person_contribution.rb +12 -0
- data/app/models/socializer/person_education.rb +8 -0
- data/app/models/socializer/person_employment.rb +8 -0
- data/app/models/socializer/person_link.rb +12 -0
- data/app/models/socializer/person_phone.rb +16 -0
- data/app/models/socializer/person_place.rb +11 -0
- data/app/models/socializer/person_profile.rb +12 -0
- data/app/models/socializer/tie.rb +12 -0
- data/app/models/socializer/verb.rb +9 -0
- data/app/views/layouts/socializer/_header.html.erb +11 -0
- data/app/views/layouts/socializer/application.html.erb +60 -0
- data/app/views/socializer/activities/_activity.html.erb +23 -0
- data/app/views/socializer/activities/_activity_bottom.html.erb +55 -0
- data/app/views/socializer/activities/_activity_content.html.erb +19 -0
- data/app/views/socializer/activities/_activity_top.html.erb +22 -0
- data/app/views/socializer/activities/_stream_card.html.erb +6 -0
- data/app/views/socializer/activities/_stream_list.html.erb +16 -0
- data/app/views/socializer/activities/audience.html.erb +19 -0
- data/app/views/socializer/activities/destroy.js.erb +3 -0
- data/app/views/socializer/activities/edit.html.erb +0 -0
- data/app/views/socializer/activities/index.html.erb +15 -0
- data/app/views/socializer/authentications/_form.html.erb +0 -0
- data/app/views/socializer/authentications/_menu.html.erb +5 -0
- data/app/views/socializer/authentications/index.html.erb +8 -0
- data/app/views/socializer/authentications/new.html.erb +8 -0
- data/app/views/socializer/circles/_card.html.erb +7 -0
- data/app/views/socializer/circles/_circles.html.erb +6 -0
- data/app/views/socializer/circles/_form.html.erb +6 -0
- data/app/views/socializer/circles/_menu.html.erb +7 -0
- data/app/views/socializer/circles/contact_of.html.erb +7 -0
- data/app/views/socializer/circles/contacts.html.erb +7 -0
- data/app/views/socializer/circles/edit.html.erb +1 -0
- data/app/views/socializer/circles/find_people.html.erb +7 -0
- data/app/views/socializer/circles/index.html.erb +6 -0
- data/app/views/socializer/circles/new.html.erb +1 -0
- data/app/views/socializer/circles/show.html.erb +10 -0
- data/app/views/socializer/comments/_form.html.erb +8 -0
- data/app/views/socializer/comments/edit.html.erb +1 -0
- data/app/views/socializer/comments/new.html.erb +1 -0
- data/app/views/socializer/groups/_card.html.erb +6 -0
- data/app/views/socializer/groups/_form.html.erb +6 -0
- data/app/views/socializer/groups/_menu.html.erb +10 -0
- data/app/views/socializer/groups/edit.html.erb +1 -0
- data/app/views/socializer/groups/index.html.erb +0 -0
- data/app/views/socializer/groups/joinable.html.erb +16 -0
- data/app/views/socializer/groups/memberships.html.erb +19 -0
- data/app/views/socializer/groups/new.html.erb +1 -0
- data/app/views/socializer/groups/ownerships.html.erb +20 -0
- data/app/views/socializer/groups/pending_invites.html.erb +20 -0
- data/app/views/socializer/groups/public.html.erb +16 -0
- data/app/views/socializer/groups/restricted.html.erb +16 -0
- data/app/views/socializer/groups/show.html.erb +29 -0
- data/app/views/socializer/likes/create.js.erb +2 -0
- data/app/views/socializer/likes/destroy.js.erb +2 -0
- data/app/views/socializer/likes/index.html.erb +5 -0
- data/app/views/socializer/notes/_form.html.erb +7 -0
- data/app/views/socializer/notes/create.js.erb +10 -0
- data/app/views/socializer/notes/destroy.js.erb +3 -0
- data/app/views/socializer/notes/edit.html.erb +1 -0
- data/app/views/socializer/notes/new.html.erb +2 -0
- data/app/views/socializer/notifications/index.html.erb +35 -0
- data/app/views/socializer/pages/index.html.erb +2 -0
- data/app/views/socializer/people/_card.html.erb +15 -0
- data/app/views/socializer/people/_form.html.erb +30 -0
- data/app/views/socializer/people/_login.html.erb +14 -0
- data/app/views/socializer/people/_menu.html.erb +9 -0
- data/app/views/socializer/people/edit.html.erb +2 -0
- data/app/views/socializer/people/index.html.erb +5 -0
- data/app/views/socializer/people/likes.html.erb +6 -0
- data/app/views/socializer/people/message.html.erb +5 -0
- data/app/views/socializer/people/show.html.erb +122 -0
- data/app/views/socializer/person_addresses/_form.html.erb +12 -0
- data/app/views/socializer/person_contributions/_form.html.erb +7 -0
- data/app/views/socializer/person_educations/_form.html.erb +10 -0
- data/app/views/socializer/person_employments/_form.html.erb +10 -0
- data/app/views/socializer/person_links/_form.html.erb +6 -0
- data/app/views/socializer/person_phones/_form.html.erb +6 -0
- data/app/views/socializer/person_places/_form.html.erb +6 -0
- data/app/views/socializer/person_profiles/_form.html.erb +6 -0
- data/app/views/socializer/shares/_form.html.erb +19 -0
- data/app/views/socializer/shares/new.html.erb +1 -0
- data/config.ru +4 -0
- data/config/cucumber.yml +8 -0
- data/config/initializers/inflections.rb +3 -0
- data/config/locales/en.yml +108 -0
- data/config/locales/fr.yml +329 -0
- data/config/rails_best_practices.yml +41 -0
- data/config/routes.rb +71 -0
- data/db/migrate/20110804175740_create_socializer_activity_objects.rb +14 -0
- data/db/migrate/20110804180557_create_socializer_people.rb +31 -0
- data/db/migrate/20110804184415_create_socializer_notes.rb +12 -0
- data/db/migrate/20110804192211_create_socializer_authentications.rb +12 -0
- data/db/migrate/20110805085417_create_socializer_circles.rb +14 -0
- data/db/migrate/20110805090617_create_socializer_activities.rb +17 -0
- data/db/migrate/20110805092635_create_socializer_audiences.rb +14 -0
- data/db/migrate/20110805094846_create_socializer_comments.rb +12 -0
- data/db/migrate/20110805121454_create_socializer_groups.rb +19 -0
- data/db/migrate/20110805121543_create_socializer_memberships.rb +14 -0
- data/db/migrate/20110805125606_create_socializer_ties.rb +13 -0
- data/db/migrate/20111207234435_create_socializer_identities.rb +12 -0
- data/db/migrate/20130524000429_create_socializer_verbs.rb +10 -0
- data/db/migrate/20130528143831_create_socializer_activity_fields.rb +10 -0
- data/db/migrate/20140128235250_create_socializer_notifications.rb +11 -0
- data/db/migrate/20140131065531_create_socializer_person_employments.rb +15 -0
- data/db/migrate/20140131065733_create_socializer_person_educations.rb +15 -0
- data/db/migrate/20140131065836_create_socializer_person_places.rb +11 -0
- data/db/migrate/20140131070051_create_socializer_person_contributions.rb +12 -0
- data/db/migrate/20140131070232_create_socializer_person_links.rb +11 -0
- data/db/migrate/20140131070259_create_socializer_person_profiles.rb +11 -0
- data/db/migrate/20140131070417_create_socializer_person_phones.rb +12 -0
- data/db/migrate/20140131070611_create_socializer_person_addresses.rb +17 -0
- data/db/migrate/20140131070839_create_socializer_group_links.rb +11 -0
- data/db/migrate/20140131070951_create_socializer_group_categories.rb +10 -0
- data/features/support/capybara.rb +14 -0
- data/features/support/env.rb +57 -0
- data/features/support/factory_girl.rb +1 -0
- data/lib/socializer.rb +4 -0
- data/lib/socializer/engine.rb +27 -0
- data/lib/socializer/version.rb +3 -0
- data/lib/tasks/cucumber.rake +65 -0
- data/lib/tasks/socializer_tasks.rake +4 -0
- data/script/cucumber +10 -0
- data/socializer.gemspec +49 -0
- data/spec/controllers/socializer/likes_controller_spec.rb +29 -0
- data/spec/controllers/socializer/shares_controller_spec.rb +22 -0
- data/spec/factories/socializer_activities.rb +11 -0
- data/spec/factories/socializer_activity_fields.rb +8 -0
- data/spec/factories/socializer_activity_objects.rb +7 -0
- data/spec/factories/socializer_audiences.rb +9 -0
- data/spec/factories/socializer_authentications.rb +6 -0
- data/spec/factories/socializer_circles.rb +9 -0
- data/spec/factories/socializer_comments.rb +6 -0
- data/spec/factories/socializer_group_categories.rb +8 -0
- data/spec/factories/socializer_group_links.rb +9 -0
- data/spec/factories/socializer_groups.rb +9 -0
- data/spec/factories/socializer_identities.rb +10 -0
- data/spec/factories/socializer_memberships.rb +6 -0
- data/spec/factories/socializer_notes.rb +7 -0
- data/spec/factories/socializer_notifications.rb +10 -0
- data/spec/factories/socializer_people.rb +7 -0
- data/spec/factories/socializer_person_addresses.rb +8 -0
- data/spec/factories/socializer_person_contributions.rb +9 -0
- data/spec/factories/socializer_person_educations.rb +7 -0
- data/spec/factories/socializer_person_employments.rb +7 -0
- data/spec/factories/socializer_person_links.rb +9 -0
- data/spec/factories/socializer_person_phones.rb +9 -0
- data/spec/factories/socializer_person_places.rb +8 -0
- data/spec/factories/socializer_person_profiles.rb +9 -0
- data/spec/factories/socializer_ties.rb +6 -0
- data/spec/factories/socializer_verbs.rb +7 -0
- data/spec/inflector_spec.rb +19 -0
- data/spec/models/socializer/activity_field_spec.rb +25 -0
- data/spec/models/socializer/activity_object_spec.rb +118 -0
- data/spec/models/socializer/activity_spec.rb +16 -0
- data/spec/models/socializer/audience_spec.rb +32 -0
- data/spec/models/socializer/authentication_spec.rb +29 -0
- data/spec/models/socializer/circle_spec.rb +53 -0
- data/spec/models/socializer/comment_spec.rb +19 -0
- data/spec/models/socializer/group_category_spec.rb +23 -0
- data/spec/models/socializer/group_link_spec.rb +25 -0
- data/spec/models/socializer/group_spec.rb +218 -0
- data/spec/models/socializer/identity_spec.rb +32 -0
- data/spec/models/socializer/membership_spec.rb +68 -0
- data/spec/models/socializer/note_spec.rb +19 -0
- data/spec/models/socializer/notification_spec.rb +28 -0
- data/spec/models/socializer/person_address_spec.rb +27 -0
- data/spec/models/socializer/person_contribution_spec.rb +27 -0
- data/spec/models/socializer/person_education_spec.rb +25 -0
- data/spec/models/socializer/person_employment_spec.rb +25 -0
- data/spec/models/socializer/person_link_spec.rb +26 -0
- data/spec/models/socializer/person_phone_spec.rb +28 -0
- data/spec/models/socializer/person_place_spec.rb +25 -0
- data/spec/models/socializer/person_profile_spec.rb +26 -0
- data/spec/models/socializer/person_spec.rb +105 -0
- data/spec/models/socializer/tie_spec.rb +24 -0
- data/spec/models/socializer/verb_spec.rb +24 -0
- data/spec/spec_helper.rb +84 -0
- data/vendor/assets/javascripts/moment/langs.js +5841 -0
- data/vendor/assets/javascripts/moment/moment.js +2400 -0
- metadata +754 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class NotificationsController < ApplicationController
|
|
3
|
+
after_filter :reset_unread_notifications, only: [:index]
|
|
4
|
+
|
|
5
|
+
def index
|
|
6
|
+
@notifications = current_user.received_notifications
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def show
|
|
10
|
+
n = Notification.find(params[:id])
|
|
11
|
+
read_notification(n) unless n.read?
|
|
12
|
+
redirect_to stream_path(provider: :activities, id: n.activity.id)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def read_notification(notification)
|
|
18
|
+
notification.read = true
|
|
19
|
+
notification.save!
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def reset_unread_notifications
|
|
23
|
+
if current_user.activity_object.unread_notifications_count > 0
|
|
24
|
+
current_user.activity_object.unread_notifications_count = 0
|
|
25
|
+
current_user.activity_object.save!
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class PeopleController < ApplicationController
|
|
3
|
+
before_filter :set_person, only: [:show, :likes, :message]
|
|
4
|
+
|
|
5
|
+
def index
|
|
6
|
+
@people = Person.all
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def show
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def edit
|
|
13
|
+
@person = current_user
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def update
|
|
17
|
+
current_user.update!(params[:person])
|
|
18
|
+
redirect_to current_user
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# TODO: Should be handled by the likes controller.
|
|
22
|
+
# Used to display the likes in the user profile
|
|
23
|
+
def likes
|
|
24
|
+
@likes = @person.likes
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def message
|
|
28
|
+
@current_id = @person.guid
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def set_person
|
|
34
|
+
@person = Person.find(params[:id])
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class PersonAddressesController < ApplicationController
|
|
3
|
+
before_filter :set_person_address, only: [:update, :destroy]
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
@person_address = current_user.adresses.build(params[:person_address])
|
|
7
|
+
@person_address.save!
|
|
8
|
+
redirect_to current_user
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def update
|
|
12
|
+
@person_address.update!(params[:person_address])
|
|
13
|
+
redirect_to current_user
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def destroy
|
|
17
|
+
@person_address.destroy
|
|
18
|
+
redirect_to current_user
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def set_person_address
|
|
24
|
+
@person_address = current_user.addresses.find(params[:id])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class PersonContributionsController < ApplicationController
|
|
3
|
+
before_filter :set_person_contribution, only: [:update, :destroy]
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
@person_contribution = current_user.adresses.build(params[:person_contribution])
|
|
7
|
+
@person_contribution.save!
|
|
8
|
+
redirect_to current_user
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def update
|
|
12
|
+
@person_contribution.update!(params[:person_contribution])
|
|
13
|
+
redirect_to current_user
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def destroy
|
|
17
|
+
@person_contribution.destroy
|
|
18
|
+
redirect_to current_user
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def set_person_contribution
|
|
24
|
+
@person_contribution = current_user.contributions.find(params[:id])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class PersonEducationsController < ApplicationController
|
|
3
|
+
before_filter :set_person_education, only: [:update, :destroy]
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
@person_education = current_user.adresses.build(params[:person_education])
|
|
7
|
+
@person_education.save!
|
|
8
|
+
redirect_to current_user
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def update
|
|
12
|
+
@person_education.update!(params[:person_education])
|
|
13
|
+
redirect_to current_user
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def destroy
|
|
17
|
+
@person_education.destroy
|
|
18
|
+
redirect_to current_user
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def set_person_education
|
|
24
|
+
@person_education = current_user.educations.find(params[:id])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class PersonEmploymentsController < ApplicationController
|
|
3
|
+
before_filter :set_person_employment, only: [:update, :destroy]
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
@person_employment = current_user.adresses.build(params[:person_employment])
|
|
7
|
+
@person_employment.save!
|
|
8
|
+
redirect_to current_user
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def update
|
|
12
|
+
@person_employment.update!(params[:person_employment])
|
|
13
|
+
redirect_to current_user
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def destroy
|
|
17
|
+
@person_employment.destroy
|
|
18
|
+
redirect_to current_user
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def set_person_employment
|
|
24
|
+
@person_employment = current_user.employments.find(params[:id])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class PersonLinksController < ApplicationController
|
|
3
|
+
before_filter :set_person_link, only: [:update, :destroy]
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
@person_link = current_user.adresses.build(params[:person_link])
|
|
7
|
+
@person_link.save!
|
|
8
|
+
redirect_to current_user
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def update
|
|
12
|
+
@person_link.update!(params[:person_link])
|
|
13
|
+
redirect_to current_user
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def destroy
|
|
17
|
+
@person_link.destroy
|
|
18
|
+
redirect_to current_user
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def set_person_link
|
|
24
|
+
@person_link = current_user.links.find(params[:id])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class PersonPhonesController < ApplicationController
|
|
3
|
+
before_filter :set_person_phone, only: [:update, :destroy]
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
@person_phone = current_user.adresses.build(params[:person_phone])
|
|
7
|
+
@person_phone.save!
|
|
8
|
+
redirect_to current_user
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def update
|
|
12
|
+
@person_phone.update!(params[:person_phone])
|
|
13
|
+
redirect_to current_user
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def destroy
|
|
17
|
+
@person_phone.destroy
|
|
18
|
+
redirect_to current_user
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def set_person_phone
|
|
24
|
+
@person_phone = current_user.phones.find(params[:id])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class PersonPlacesController < ApplicationController
|
|
3
|
+
before_filter :set_person_place, only: [:update, :destroy]
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
@person_place = current_user.adresses.build(params[:person_place])
|
|
7
|
+
@person_place.save!
|
|
8
|
+
redirect_to current_user
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def update
|
|
12
|
+
@person_place.update!(params[:person_place])
|
|
13
|
+
redirect_to current_user
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def destroy
|
|
17
|
+
@person_place.destroy
|
|
18
|
+
redirect_to current_user
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def set_person_place
|
|
24
|
+
@person_place = current_user.places.find(params[:id])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class PersonProfilesController < ApplicationController
|
|
3
|
+
before_filter :set_person_profile, only: [:update, :destroy]
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
@person_profile = current_user.adresses.build(params[:person_profile])
|
|
7
|
+
@person_profile.save!
|
|
8
|
+
redirect_to current_user
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def update
|
|
12
|
+
@person_profile.update!(params[:person_profile])
|
|
13
|
+
redirect_to current_user
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def destroy
|
|
17
|
+
@person_profile.destroy
|
|
18
|
+
redirect_to current_user
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def set_person_profile
|
|
24
|
+
@person_profile = current_user.profiles.find(params[:id])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class SessionsController < ApplicationController
|
|
3
|
+
def create
|
|
4
|
+
auth = request.env['omniauth.auth']
|
|
5
|
+
user_auth = Authentication.where(provider: auth.provider, uid: auth.uid).first
|
|
6
|
+
|
|
7
|
+
if user_auth.nil?
|
|
8
|
+
if signed_in?
|
|
9
|
+
current_user.authentications.create!(provider: auth.provider, uid: auth.uid)
|
|
10
|
+
redirect_to authentications_path
|
|
11
|
+
else
|
|
12
|
+
user = Person.create_with_omniauth(auth)
|
|
13
|
+
user.activity_object.circles.create!(name: 'Friends', content: 'Your real friends, the ones you feel comfortable sharing private details with.')
|
|
14
|
+
user.activity_object.circles.create!(name: 'Family', content: 'Your close and extended family, with as many or as few in-laws as you want.')
|
|
15
|
+
user.activity_object.circles.create!(name: 'Acquaintances', content: "A good place to stick people you've met but aren't particularly close to.")
|
|
16
|
+
user.activity_object.circles.create!(name: 'Following', content: "People you don't know personally, but whose posts you find interesting.")
|
|
17
|
+
end
|
|
18
|
+
else
|
|
19
|
+
user = user_auth.person if user_auth.present?
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
if user
|
|
23
|
+
cookies[:user_id] = { domain: :all, value: "#{user.id}" }
|
|
24
|
+
redirect_to root_url
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def destroy
|
|
29
|
+
cookies.delete :user_id, domain: :all
|
|
30
|
+
redirect_to root_url
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def failure
|
|
34
|
+
redirect_to root_url
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class SharesController < ApplicationController
|
|
3
|
+
# before_action :set_share, only: [:show, :edit, :update, :destroy]
|
|
4
|
+
|
|
5
|
+
def new
|
|
6
|
+
@activity_object = ActivityObject.find(params[:id])
|
|
7
|
+
@share = @activity_object.activitable
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def create
|
|
11
|
+
# scope = params[:share][:scope]
|
|
12
|
+
object_ids = params[:share][:object_ids]
|
|
13
|
+
|
|
14
|
+
activity = Activity.new do |a|
|
|
15
|
+
a.actor_id = current_user.guid
|
|
16
|
+
a.activity_object_id = params[:share][:activity_id]
|
|
17
|
+
a.verb = Verb.find_or_create_by(name: 'share')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
activity.build_activity_field(content: params[:share][:content]) if params[:share][:content]
|
|
21
|
+
|
|
22
|
+
public = Socializer::Audience.privacy_level.find_value(:public).value.to_s
|
|
23
|
+
circles = Socializer::Audience.privacy_level.find_value(:circles).value.to_s
|
|
24
|
+
|
|
25
|
+
object_ids.split(',').each do |object_id|
|
|
26
|
+
# REFACTOR: remove duplication
|
|
27
|
+
if object_id == public || object_id == circles
|
|
28
|
+
activity.audiences.build(privacy_level: object_id)
|
|
29
|
+
else
|
|
30
|
+
activity.audiences.build do |a|
|
|
31
|
+
a.privacy_level = :limited
|
|
32
|
+
a.activity_object_id = object_id
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
activity.save!
|
|
38
|
+
|
|
39
|
+
redirect_to stream_path
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
# # Use callbacks to share common setup or constraints between actions.
|
|
45
|
+
# def set_share
|
|
46
|
+
# @share = Share.find(params[:id])
|
|
47
|
+
# end
|
|
48
|
+
|
|
49
|
+
# # Never trust parameters from the scary internet, only allow the white list through.
|
|
50
|
+
# def share_params
|
|
51
|
+
# params.require(:share).permit(:content, :actor_id)
|
|
52
|
+
# end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
class TiesController < ApplicationController
|
|
3
|
+
def create
|
|
4
|
+
@circle = Circle.find(params[:tie][:circle_id])
|
|
5
|
+
@circle.add_contact(params[:tie][:contact_id])
|
|
6
|
+
redirect_to @circle
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def destroy
|
|
10
|
+
@tie = Tie.find(params[:id])
|
|
11
|
+
@circle = @tie.circle
|
|
12
|
+
@tie.destroy
|
|
13
|
+
redirect_to @circle
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
module ApplicationHelper
|
|
3
|
+
def signin_path(provider)
|
|
4
|
+
"/auth/#{provider.to_s}"
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def current_user?(user)
|
|
8
|
+
user == current_user
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def time_ago(time, options = {})
|
|
12
|
+
time = time.to_time.utc
|
|
13
|
+
|
|
14
|
+
options.reverse_merge! title: l(time, format: :short)
|
|
15
|
+
|
|
16
|
+
options[:data] ||= {}
|
|
17
|
+
options[:data].merge! time_ago: 'moment.js'
|
|
18
|
+
|
|
19
|
+
time_tag time, time.strftime('%B %e, %Y %l:%M%P'), options
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module Socializer
|
|
2
|
+
module ObjectTypeBase
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
attr_accessor :activity_verb, :scope, :object_ids, :activity_target_id
|
|
7
|
+
attr_accessible :activity_verb, :scope, :object_ids, :author_id, :activity_target_id
|
|
8
|
+
|
|
9
|
+
has_one :activity_object, as: :activitable, dependent: :destroy
|
|
10
|
+
|
|
11
|
+
before_create :create_activity_object
|
|
12
|
+
after_create :append_to_activity_stream
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def guid
|
|
17
|
+
activity_object.id
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
protected
|
|
21
|
+
|
|
22
|
+
def create_activity_object
|
|
23
|
+
build_activity_object
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def append_to_activity_stream
|
|
27
|
+
# REFACTOR: the activity_verb.blank? and object_ids.blank? checks shouldn't be needed
|
|
28
|
+
# since the record should be invalid without them.
|
|
29
|
+
return if activity_verb.blank?
|
|
30
|
+
|
|
31
|
+
activity = Activity.new do |a|
|
|
32
|
+
a.target_id = activity_target_id if activity_target_id.present?
|
|
33
|
+
a.actor_id = author_id
|
|
34
|
+
a.activity_object_id = guid
|
|
35
|
+
a.verb = Verb.find_or_create_by(name: activity_verb)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
return if object_ids.blank?
|
|
39
|
+
|
|
40
|
+
public = Socializer::Audience.privacy_level.find_value(:public).value.to_s
|
|
41
|
+
circles = Socializer::Audience.privacy_level.find_value(:circles).value.to_s
|
|
42
|
+
|
|
43
|
+
# REFACTOR: remove duplication
|
|
44
|
+
object_ids.each do |object_id|
|
|
45
|
+
if object_id == public || object_id == circles
|
|
46
|
+
activity.audiences.build(privacy_level: object_id)
|
|
47
|
+
else
|
|
48
|
+
activity.audiences.build do |a|
|
|
49
|
+
a.privacy_level = :limited
|
|
50
|
+
a.activity_object_id = object_id
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
activity.save!
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|