socializer 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- 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,24 @@
|
|
1
|
+
module Socializer
|
2
|
+
class Membership < ActiveRecord::Base
|
3
|
+
attr_accessible :group_id
|
4
|
+
|
5
|
+
belongs_to :group
|
6
|
+
belongs_to :activity_member, class_name: 'ActivityObject', foreign_key: 'member_id'
|
7
|
+
|
8
|
+
def member
|
9
|
+
@member ||= activity_member.activitable
|
10
|
+
end
|
11
|
+
|
12
|
+
def approve!
|
13
|
+
update_attribute(:active, true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def confirm!
|
17
|
+
update_attribute(:active, true)
|
18
|
+
end
|
19
|
+
|
20
|
+
def decline!
|
21
|
+
destroy
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Socializer
|
2
|
+
class Note < ActiveRecord::Base
|
3
|
+
include Socializer::ObjectTypeBase
|
4
|
+
|
5
|
+
attr_accessible :content
|
6
|
+
|
7
|
+
belongs_to :activity_author, class_name: 'ActivityObject', foreign_key: 'author_id'
|
8
|
+
|
9
|
+
def author
|
10
|
+
@author ||= activity_author.activitable
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Socializer
|
2
|
+
class Notification < ActiveRecord::Base
|
3
|
+
# Increment the number of unread notifications
|
4
|
+
after_save { activity_object.increment_unread_notifications_count }
|
5
|
+
|
6
|
+
attr_accessible :read
|
7
|
+
|
8
|
+
# Relationships
|
9
|
+
belongs_to :activity
|
10
|
+
belongs_to :activity_object # Person, Group, ...
|
11
|
+
|
12
|
+
# Validations
|
13
|
+
validates :activity_id, presence: true
|
14
|
+
validates :activity_object_id, presence: true
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
class Person < ActiveRecord::Base
|
5
|
+
extend Enumerize
|
6
|
+
include Socializer::ObjectTypeBase
|
7
|
+
|
8
|
+
# enumerize :avatar_provider, in: { twitter: 1, facebook: 2, linkedin: 3, gravatar: 4 }, default: :gravatar, predicates: true, scope: true
|
9
|
+
|
10
|
+
attr_accessible :display_name, :email, :language, :avatar_provider, :tagline, :introduction, :bragging_rights,
|
11
|
+
:occupation, :skills, :gender, :looking_for_friends, :looking_for_dating, :looking_for_relationship,
|
12
|
+
:looking_for_networking, :birthdate, :relationship, :other_names
|
13
|
+
|
14
|
+
enumerize :gender, in: { unknown: 0, female: 1, male: 2 }, default: :unknown, predicates: true, scope: true
|
15
|
+
enumerize :relationship, in: { unknown: 0, single: 1, relationship: 2, engaged: 3, married: 4, complicated: 5, open: 6, widowed: 7, domestic: 8, civil: 9 }, default: :unknown, predicates: true, scope: true
|
16
|
+
|
17
|
+
has_many :authentications
|
18
|
+
|
19
|
+
has_many :addresses, class_name: 'PersonAddress', foreign_key: 'person_id', dependent: :destroy
|
20
|
+
has_many :contributions, class_name: 'PersonContribution', foreign_key: 'person_id', dependent: :destroy
|
21
|
+
has_many :educations, class_name: 'PersonEducation', foreign_key: 'person_id', dependent: :destroy
|
22
|
+
has_many :employments, class_name: 'PersonEmployment', foreign_key: 'person_id', dependent: :destroy
|
23
|
+
has_many :links, class_name: 'PersonLink', foreign_key: 'person_id', dependent: :destroy
|
24
|
+
has_many :phones, class_name: 'PersonPhone', foreign_key: 'person_id', dependent: :destroy
|
25
|
+
has_many :places, class_name: 'PersonPlace', foreign_key: 'person_id', dependent: :destroy
|
26
|
+
has_many :profiles, class_name: 'PersonProfile', foreign_key: 'person_id', dependent: :destroy
|
27
|
+
|
28
|
+
validates :avatar_provider, inclusion: %w( TWITTER FACEBOOK LINKEDIN GRAVATAR )
|
29
|
+
|
30
|
+
def services
|
31
|
+
@services ||= authentications.where { provider.not_eq('Identity') }
|
32
|
+
end
|
33
|
+
|
34
|
+
def circles
|
35
|
+
@circles ||= activity_object.circles
|
36
|
+
end
|
37
|
+
|
38
|
+
def comments
|
39
|
+
@comments ||= activity_object.comments
|
40
|
+
end
|
41
|
+
|
42
|
+
def notes
|
43
|
+
@notes ||= activity_object.notes
|
44
|
+
end
|
45
|
+
|
46
|
+
def groups
|
47
|
+
@groups ||= activity_object.groups
|
48
|
+
end
|
49
|
+
|
50
|
+
def memberships
|
51
|
+
@memberships ||= activity_object.memberships
|
52
|
+
end
|
53
|
+
|
54
|
+
def received_notifications
|
55
|
+
@notifications ||= activity_object.notifications
|
56
|
+
end
|
57
|
+
|
58
|
+
def contacts
|
59
|
+
@contacts ||= circles.map { |c| c.contacts }.flatten.uniq
|
60
|
+
end
|
61
|
+
|
62
|
+
def contact_of
|
63
|
+
@contact_of ||= Circle.joins { ties }.where { ties.contact_id.eq my { guid } }.map { |circle| circle.author }.uniq
|
64
|
+
end
|
65
|
+
|
66
|
+
def likes
|
67
|
+
activity_obj_id = activity_object.id
|
68
|
+
verbs_of_interest = %w(like unlike)
|
69
|
+
verbs_of_interest = Verb.where { name.in(verbs_of_interest) }
|
70
|
+
|
71
|
+
query = Activity.group { activity_object_id }.where { verb_id.in(verbs_of_interest) & actor_id.eq(activity_obj_id) & target_id.eq(nil) }.having('COUNT(1) % 2 == 1')
|
72
|
+
@likes ||= query
|
73
|
+
end
|
74
|
+
|
75
|
+
def likes?(object)
|
76
|
+
activity_obj_id = activity_object.id
|
77
|
+
verbs_of_interest = %w(like unlike)
|
78
|
+
verbs_of_interest = Verb.where { name.in(verbs_of_interest) }
|
79
|
+
|
80
|
+
query = Activity.where { verb_id.in(verbs_of_interest) & activity_object_id.eq(object.id) & actor_id.eq(activity_obj_id) }
|
81
|
+
query.size.odd?
|
82
|
+
end
|
83
|
+
|
84
|
+
def pending_memberships_invites
|
85
|
+
privacy_private = Group.privacy_level.find_value(:private).value
|
86
|
+
@pending_memberships_invites ||= Membership.joins { group }.where { member_id.eq(my { guid }) & active.eq(false) & group.privacy_level.eq(privacy_private) }
|
87
|
+
end
|
88
|
+
|
89
|
+
# TODO: avatar_url - clean this up
|
90
|
+
def avatar_url
|
91
|
+
avatar_provider_array = %w( FACEBOOK LINKEDIN TWITTER )
|
92
|
+
|
93
|
+
if avatar_provider_array.include?(avatar_provider)
|
94
|
+
provider = avatar_provider.downcase
|
95
|
+
authentications.where(provider: provider).first.try(:image_url)
|
96
|
+
else
|
97
|
+
return if email.blank?
|
98
|
+
"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}"
|
99
|
+
end
|
100
|
+
|
101
|
+
# if avatar_provider == 'FACEBOOK'
|
102
|
+
# authentications.where(provider: 'facebook')[0].image_url if authentications.where(provider: 'facebook')[0].present?
|
103
|
+
# elsif avatar_provider == 'TWITTER'
|
104
|
+
# authentications.where(provider: 'twitter')[0].image_url if authentications.where(provider: 'twitter')[0].present?
|
105
|
+
# elsif avatar_provider == 'LINKEDIN'
|
106
|
+
# authentications.where(provider: 'linkedin')[0].image_url if authentications.where(provider: 'linkedin')[0].present?
|
107
|
+
# else
|
108
|
+
# "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}" if email.present?
|
109
|
+
# end
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.create_with_omniauth(auth)
|
113
|
+
create! do |user|
|
114
|
+
user.display_name = auth.info.name
|
115
|
+
user.email = auth.info.email
|
116
|
+
image_url = auth.info.image
|
117
|
+
|
118
|
+
if image_url.nil?
|
119
|
+
image_url = ''
|
120
|
+
user.avatar_provider = 'GRAVATAR'
|
121
|
+
else
|
122
|
+
user.avatar_provider = auth.provider.upcase
|
123
|
+
end
|
124
|
+
|
125
|
+
user.authentications.build(provider: auth.provider, uid: auth.uid, image_url: image_url)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Socializer
|
2
|
+
class PersonAddress < ActiveRecord::Base
|
3
|
+
extend Enumerize
|
4
|
+
|
5
|
+
enumerize :category, in: { home: 1, work: 2 }, default: :home, predicates: true, scope: true
|
6
|
+
|
7
|
+
attr_accessible :line1, :line2, :city, :postal_code_or_zip, :province_or_state, :country
|
8
|
+
|
9
|
+
# Relationships
|
10
|
+
belongs_to :person
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Socializer
|
2
|
+
class PersonPhone < ActiveRecord::Base
|
3
|
+
extend Enumerize
|
4
|
+
|
5
|
+
enumerize :category, in: { home: 1, work: 2 }, default: :home, predicates: true, scope: true
|
6
|
+
|
7
|
+
attr_accessible :label, :number
|
8
|
+
|
9
|
+
# Relationships
|
10
|
+
belongs_to :person
|
11
|
+
|
12
|
+
# Validations
|
13
|
+
validates :label, presence: true
|
14
|
+
validates :number, presence: true
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Socializer
|
2
|
+
class Tie < ActiveRecord::Base
|
3
|
+
attr_accessible :contact_id
|
4
|
+
|
5
|
+
belongs_to :circle
|
6
|
+
belongs_to :activity_contact, class_name: 'ActivityObject', foreign_key: 'contact_id'
|
7
|
+
|
8
|
+
def contact
|
9
|
+
@contact ||= activity_contact.activitable
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div id="page-header">
|
2
|
+
<div id="inner-header">
|
3
|
+
<%= link_to image_tag("socializer/icons/Home.png", width: 60, title: "#{t('.home')}"), root_path %>
|
4
|
+
<%= link_to image_tag("socializer/icons/User.png", width: 60, title: "#{t('.profile')}"), stream_path(provider: :people, id: current_user.id) %>
|
5
|
+
<%= link_to image_tag("socializer/icons/Web.png", width: 60, title: "#{t('.circles')}"), circles_contacts_path %>
|
6
|
+
<%= link_to image_tag("socializer/icons/Safe.png", width: 60, title: "#{t('.authentications')}"), authentications_path %>
|
7
|
+
<%= link_to image_tag("socializer/icons/Users.png", width: 60, title: "#{t('.groups')}"), groups_memberships_path %>
|
8
|
+
<%= link_to image_tag("socializer/icons/Bell.png", width: 60, title: "#{t('.notifications')}"), notifications_path %>
|
9
|
+
<%= link_to image_tag("socializer/icons/Power.png", width: 60, title: "#{t('.signout')}"), signout_path, method: :delete, style: "float: right;" %>
|
10
|
+
</div>
|
11
|
+
</div>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Socializer</title>
|
5
|
+
<%= stylesheet_link_tag "socializer/application" %>
|
6
|
+
<%= stylesheet_link_tag "//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.css"%>
|
7
|
+
<%= javascript_include_tag "socializer/application" %>
|
8
|
+
|
9
|
+
<%= javascript_include_tag "//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" %>
|
10
|
+
<%= csrf_meta_tags %>
|
11
|
+
</head>
|
12
|
+
<body data-controller="<%= controller_name %>" data-action="<%= action_name %>", data-locale="<%= I18n.locale %>" >
|
13
|
+
|
14
|
+
<% if signed_in? %>
|
15
|
+
<%= render 'layouts/socializer/header' %>
|
16
|
+
<div id="outer-page">
|
17
|
+
|
18
|
+
<div id="stream-column">
|
19
|
+
<% if params[:provider] == 'people' || params[:controller] == 'socializer/people' %>
|
20
|
+
<%= render 'socializer/people/card', person: @person %>
|
21
|
+
<% else %>
|
22
|
+
<%= render 'socializer/activities/stream_list' %>
|
23
|
+
<% end %>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<% if params[:controller] == 'socializer/activities' && (params[:provider] == 'groups' || params[:provider] =='circles' || params[:provider].nil?) %>
|
27
|
+
|
28
|
+
<div id="page-content" style="width: 558px;">
|
29
|
+
<%= yield %>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div id="contextual-column">
|
33
|
+
|
34
|
+
<% if params[:provider] == 'circles' %>
|
35
|
+
<%= render 'socializer/circles/card', circle: @circle, title: @title %>
|
36
|
+
<% elsif params[:provider] == 'groups' %>
|
37
|
+
<%= render 'socializer/groups/card', group: @group, title: @title %>
|
38
|
+
<% elsif params[:provider].nil? %>
|
39
|
+
<%= render 'socializer/activities/stream_card' %>
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<% else %>
|
45
|
+
|
46
|
+
<div id="page-content" style="width: 758px;">
|
47
|
+
<%= yield %>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<% end %>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
<% else %>
|
54
|
+
<div id="outer-page">
|
55
|
+
<%= render 'socializer/people/login' %>
|
56
|
+
</div>
|
57
|
+
<% end %>
|
58
|
+
|
59
|
+
</body>
|
60
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<li data-activityid="<%= activity.guid %>">
|
2
|
+
|
3
|
+
<%# Activity top (for notes and activities) %>
|
4
|
+
<% if activity.activitable_object.note? || activity.activitable_object.activity? %>
|
5
|
+
|
6
|
+
<%= render 'socializer/activities/activity_top', activity: activity %>
|
7
|
+
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<%= render 'socializer/activities/activity_content', activity: activity %>
|
11
|
+
|
12
|
+
<%= render 'socializer/activities/activity_bottom', activity: activity %>
|
13
|
+
|
14
|
+
<%# Render comments %>
|
15
|
+
<ul>
|
16
|
+
<% activity.comments.each do |subactivity| %>
|
17
|
+
|
18
|
+
<li><%= render subactivity %></li>
|
19
|
+
|
20
|
+
<% end %>
|
21
|
+
</ul>
|
22
|
+
|
23
|
+
</li>
|