muck-invites 0.1.1
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 +30 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +6 -0
- data/Rakefile +66 -0
- data/VERSION +1 -0
- data/app/controllers/muck/invites_controller.rb +62 -0
- data/app/models/invite_mailer.rb +28 -0
- data/app/models/user_invite.rb +6 -0
- data/app/views/invite_mailer/invite_notification.text.html.erb +9 -0
- data/app/views/invite_mailer/invite_notification.text.plain.erb +9 -0
- data/app/views/invite_mailer/invited_joined_notification.text.html.erb +5 -0
- data/app/views/invite_mailer/invited_joined_notification.text.plain.erb +5 -0
- data/app/views/invites/_get_contacts.html.erb +27 -0
- data/app/views/invites/new.html.erb +50 -0
- data/config/muck_invites_routes.rb +3 -0
- data/db/migrate/20090928213532_create_invites.rb +20 -0
- data/install.rb +1 -0
- data/lib/active_record/acts/muck_invite.rb +57 -0
- data/lib/active_record/acts/muck_inviter.rb +68 -0
- data/lib/muck_invites.rb +3 -0
- data/lib/muck_invites/initialize_routes.rb +8 -0
- data/lib/muck_invites/tasks.rb +28 -0
- data/locales/ar.yml +19 -0
- data/locales/bg.yml +19 -0
- data/locales/ca.yml +19 -0
- data/locales/cs.yml +19 -0
- data/locales/da.yml +19 -0
- data/locales/de.yml +19 -0
- data/locales/el.yml +19 -0
- data/locales/en.yml +19 -0
- data/locales/es.yml +19 -0
- data/locales/et.yml +19 -0
- data/locales/fa.yml +19 -0
- data/locales/fi.yml +19 -0
- data/locales/fr.yml +19 -0
- data/locales/gl.yml +19 -0
- data/locales/hi.yml +19 -0
- data/locales/hr.yml +19 -0
- data/locales/hu.yml +19 -0
- data/locales/id.yml +19 -0
- data/locales/it.yml +19 -0
- data/locales/iw.yml +19 -0
- data/locales/ja.yml +19 -0
- data/locales/ko.yml +19 -0
- data/locales/lt.yml +19 -0
- data/locales/lv.yml +19 -0
- data/locales/mt.yml +19 -0
- data/locales/nl.yml +19 -0
- data/locales/no.yml +20 -0
- data/locales/pl.yml +19 -0
- data/locales/pt-PT.yml +19 -0
- data/locales/ro.yml +19 -0
- data/locales/ru.yml +19 -0
- data/locales/sk.yml +19 -0
- data/locales/sl.yml +19 -0
- data/locales/sq.yml +19 -0
- data/locales/sr.yml +19 -0
- data/locales/sv.yml +19 -0
- data/locales/th.yml +19 -0
- data/locales/tl.yml +19 -0
- data/locales/tr.yml +19 -0
- data/locales/uk.yml +19 -0
- data/locales/vi.yml +19 -0
- data/locales/zh-CN.yml +19 -0
- data/locales/zh-TW.yml +19 -0
- data/locales/zh.yml +19 -0
- data/muck-invites.gemspec +454 -0
- data/public/stylesheets/muck-invites.css +13 -0
- data/rails/init.rb +18 -0
- data/tasks/muck_invites_tasks.rake +1 -0
- data/test/rails_root/.gitignore +8 -0
- data/test/rails_root/.rake_tasks +103 -0
- data/test/rails_root/Capfile +3 -0
- data/test/rails_root/Rakefile +14 -0
- data/test/rails_root/app/controllers/application_controller.rb +23 -0
- data/test/rails_root/app/controllers/default_controller.rb +9 -0
- data/test/rails_root/app/helpers/application_helper.rb +3 -0
- data/test/rails_root/app/models/.keep +0 -0
- data/test/rails_root/app/models/activity.rb +26 -0
- data/test/rails_root/app/models/invite.rb +4 -0
- data/test/rails_root/app/models/user.rb +9 -0
- data/test/rails_root/app/models/user_session.rb +2 -0
- data/test/rails_root/app/views/default/index.html.erb +2 -0
- data/test/rails_root/app/views/layouts/default.html.erb +29 -0
- data/test/rails_root/config/boot.rb +109 -0
- data/test/rails_root/config/database.yml +23 -0
- data/test/rails_root/config/environment.rb +25 -0
- data/test/rails_root/config/environments/cucumber.rb +38 -0
- data/test/rails_root/config/environments/development.rb +19 -0
- data/test/rails_root/config/environments/production.rb +1 -0
- data/test/rails_root/config/environments/test.rb +42 -0
- data/test/rails_root/config/global_config.yml +81 -0
- data/test/rails_root/config/initializers/inflections.rb +10 -0
- data/test/rails_root/config/initializers/mime_types.rb +5 -0
- data/test/rails_root/config/initializers/requires.rb +13 -0
- data/test/rails_root/config/initializers/session_store.rb +8 -0
- data/test/rails_root/config/routes.rb +6 -0
- data/test/rails_root/db/.keep +0 -0
- data/test/rails_root/db/migrate/20090320174818_create_muck_permissions_and_roles.rb +16 -0
- data/test/rails_root/db/migrate/20090402033319_add_muck_activities.rb +36 -0
- data/test/rails_root/db/migrate/20090402234137_create_languages.rb +18 -0
- data/test/rails_root/db/migrate/20090426041056_create_countries.rb +15 -0
- data/test/rails_root/db/migrate/20090426041103_create_states.rb +18 -0
- data/test/rails_root/db/migrate/20090602041838_create_users.rb +39 -0
- data/test/rails_root/db/migrate/20090608073052_create_friends.rb +16 -0
- data/test/rails_root/db/migrate/20090703055724_add_contents.rb +49 -0
- data/test/rails_root/db/migrate/20090704220055_create_slugs.rb +18 -0
- data/test/rails_root/db/migrate/20090928213532_create_invites.rb +20 -0
- data/test/rails_root/features/comments.feature +21 -0
- data/test/rails_root/features/step_definitions/comment_steps.rb +11 -0
- data/test/rails_root/features/step_definitions/common_steps.rb +93 -0
- data/test/rails_root/features/step_definitions/webrat_steps.rb +128 -0
- data/test/rails_root/features/support/env.rb +49 -0
- data/test/rails_root/features/support/paths.rb +33 -0
- data/test/rails_root/lib/tasks/cucumber.rake +20 -0
- data/test/rails_root/public/.htaccess +40 -0
- data/test/rails_root/public/404.html +30 -0
- data/test/rails_root/public/422.html +30 -0
- data/test/rails_root/public/500.html +30 -0
- data/test/rails_root/public/dispatch.rb +10 -0
- data/test/rails_root/public/favicon.ico +0 -0
- data/test/rails_root/public/images/arrow_down.gif +0 -0
- data/test/rails_root/public/images/arrow_left.gif +0 -0
- data/test/rails_root/public/images/arrow_right.gif +0 -0
- data/test/rails_root/public/images/arrow_up.gif +0 -0
- data/test/rails_root/public/images/fancybox/fancy_closebox.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_left.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_progress.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_right.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_e.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_n.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_ne.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_nw.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_s.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_se.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_sw.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_shadow_w.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_left.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_main.png +0 -0
- data/test/rails_root/public/images/fancybox/fancy_title_right.png +0 -0
- data/test/rails_root/public/images/icons/accept.png +0 -0
- data/test/rails_root/public/images/icons/add.png +0 -0
- data/test/rails_root/public/images/icons/blue_guy.png +0 -0
- data/test/rails_root/public/images/icons/button_background.png +0 -0
- data/test/rails_root/public/images/icons/cancel.png +0 -0
- data/test/rails_root/public/images/icons/close.png +0 -0
- data/test/rails_root/public/images/icons/comment.png +0 -0
- data/test/rails_root/public/images/icons/delete.png +0 -0
- data/test/rails_root/public/images/icons/exclaim.png +0 -0
- data/test/rails_root/public/images/icons/grey_guy.png +0 -0
- data/test/rails_root/public/images/icons/hide.png +0 -0
- data/test/rails_root/public/images/icons/information.png +0 -0
- data/test/rails_root/public/images/icons/minus.png +0 -0
- data/test/rails_root/public/images/icons/question.png +0 -0
- data/test/rails_root/public/images/icons/search_box.png +0 -0
- data/test/rails_root/public/images/icons/star.png +0 -0
- data/test/rails_root/public/images/icons/stop.png +0 -0
- data/test/rails_root/public/images/icons/thumb_down.png +0 -0
- data/test/rails_root/public/images/icons/thumb_up.png +0 -0
- data/test/rails_root/public/images/icons/vote.png +0 -0
- data/test/rails_root/public/images/loading.gif +0 -0
- data/test/rails_root/public/images/nothing.png +0 -0
- data/test/rails_root/public/images/profile_default.jpg +0 -0
- data/test/rails_root/public/images/rails.png +0 -0
- data/test/rails_root/public/images/spinner.gif +0 -0
- data/test/rails_root/public/images/sprites.png +0 -0
- data/test/rails_root/public/javascripts/application.js +2 -0
- data/test/rails_root/public/javascripts/builder.js +136 -0
- data/test/rails_root/public/javascripts/controls.js +963 -0
- data/test/rails_root/public/javascripts/dragdrop.js +972 -0
- data/test/rails_root/public/javascripts/effects.js +1120 -0
- data/test/rails_root/public/javascripts/fancyzoom.min.js +1 -0
- data/test/rails_root/public/javascripts/jquery/jquery-ui.js +273 -0
- data/test/rails_root/public/javascripts/jquery/jquery.easing.js +1 -0
- data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +9 -0
- data/test/rails_root/public/javascripts/jquery/jquery.form.js +637 -0
- data/test/rails_root/public/javascripts/jquery/jquery.jgrowl.js +2 -0
- data/test/rails_root/public/javascripts/jquery/jquery.js +19 -0
- data/test/rails_root/public/javascripts/jquery/jquery.tips.js +69 -0
- data/test/rails_root/public/javascripts/jquery/jrails.js +1 -0
- data/test/rails_root/public/javascripts/muck.js +81 -0
- data/test/rails_root/public/javascripts/muck_activities.js +108 -0
- data/test/rails_root/public/javascripts/muck_time/en.js +53 -0
- data/test/rails_root/public/javascripts/prototype.js +4225 -0
- data/test/rails_root/public/javascripts/scriptaculous.js +58 -0
- data/test/rails_root/public/javascripts/slider.js +277 -0
- data/test/rails_root/public/javascripts/sound.js +60 -0
- data/test/rails_root/public/robots.txt +1 -0
- data/test/rails_root/public/stylesheets/.keep +0 -0
- data/test/rails_root/public/stylesheets/admin.css +12 -0
- data/test/rails_root/public/stylesheets/blueprint/ie.css +26 -0
- data/test/rails_root/public/stylesheets/blueprint/liquid_screen.css +203 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/key.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/readme.txt +32 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/screen.css +97 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/fancy-type/screen.css +71 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/readme.txt +18 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/screen.css +40 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/liquid/liquid.css +134 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/liquid/src/liquid.css +197 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/rtl/readme.txt +10 -0
- data/test/rails_root/public/stylesheets/blueprint/plugins/rtl/screen.css +109 -0
- data/test/rails_root/public/stylesheets/blueprint/print.css +30 -0
- data/test/rails_root/public/stylesheets/blueprint/screen.css +251 -0
- data/test/rails_root/public/stylesheets/blueprint/sprite.css +1 -0
- data/test/rails_root/public/stylesheets/blueprint/src/forms.css +49 -0
- data/test/rails_root/public/stylesheets/blueprint/src/grid.css +213 -0
- data/test/rails_root/public/stylesheets/blueprint/src/grid.png +0 -0
- data/test/rails_root/public/stylesheets/blueprint/src/ie.css +59 -0
- data/test/rails_root/public/stylesheets/blueprint/src/print.css +85 -0
- data/test/rails_root/public/stylesheets/blueprint/src/reset.css +38 -0
- data/test/rails_root/public/stylesheets/blueprint/src/typography.css +105 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_100_f0f0f0_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_50_99c2ff_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_80_e6e6e6_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_highlight-soft_100_e7eef3_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_222222_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_888888_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/cupertino/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/jquery/jquery.fancybox.css +44 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_217bc0_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_2e83ff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_469bdd_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_6da8d5_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_f9bd01_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/redmond/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/smoothness/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/test/rails_root/public/stylesheets/jquery/ui-lightness/jquery-ui-1.7.1.custom.css +404 -0
- data/test/rails_root/public/stylesheets/muck-invites.css +13 -0
- data/test/rails_root/public/stylesheets/reset.css +0 -0
- data/test/rails_root/public/stylesheets/styles.css +85 -0
- data/test/rails_root/public/stylesheets/themes/blue/styles.css +1 -0
- data/test/rails_root/public/stylesheets/themes/red/styles.css +1 -0
- data/test/rails_root/script/about +3 -0
- data/test/rails_root/script/breakpointer +3 -0
- data/test/rails_root/script/console +3 -0
- data/test/rails_root/script/create_project.rb +52 -0
- data/test/rails_root/script/cucumber +8 -0
- data/test/rails_root/script/dbconsole +3 -0
- data/test/rails_root/script/destroy +3 -0
- data/test/rails_root/script/generate +3 -0
- data/test/rails_root/script/performance/benchmarker +3 -0
- data/test/rails_root/script/performance/profiler +3 -0
- data/test/rails_root/script/performance/request +3 -0
- data/test/rails_root/script/plugin +3 -0
- data/test/rails_root/script/process/inspector +3 -0
- data/test/rails_root/script/process/reaper +3 -0
- data/test/rails_root/script/process/spawner +3 -0
- data/test/rails_root/script/runner +3 -0
- data/test/rails_root/script/server +3 -0
- data/test/rails_root/test/factories.rb +73 -0
- data/test/rails_root/test/functional/.keep +0 -0
- data/test/rails_root/test/functional/invites_controller_test.rb +67 -0
- data/test/rails_root/test/mocks/development/.keep +0 -0
- data/test/rails_root/test/mocks/test/.keep +0 -0
- data/test/rails_root/test/shoulda_macros/controller.rb +49 -0
- data/test/rails_root/test/shoulda_macros/forms.rb +32 -0
- data/test/rails_root/test/shoulda_macros/models.rb +50 -0
- data/test/rails_root/test/shoulda_macros/pagination.rb +53 -0
- data/test/rails_root/test/shoulda_macros/plugins.rb +34 -0
- data/test/rails_root/test/test_helper.rb +48 -0
- data/test/rails_root/test/unit/.keep +0 -0
- data/test/rails_root/test/unit/contacts_test.rb +37 -0
- data/test/rails_root/test/unit/invite_mailer_test.rb +41 -0
- data/test/rails_root/test/unit/invite_test.rb +140 -0
- data/test/rails_root/test/unit/user_test.rb +18 -0
- data/test/rails_root/vendor/plugins/jrails/CHANGELOG +43 -0
- data/test/rails_root/vendor/plugins/jrails/LICENSE +18 -0
- data/test/rails_root/vendor/plugins/jrails/README.rdoc +21 -0
- data/test/rails_root/vendor/plugins/jrails/Rakefile +18 -0
- data/test/rails_root/vendor/plugins/jrails/VERSION.yml +4 -0
- data/test/rails_root/vendor/plugins/jrails/bin/jrails +30 -0
- data/test/rails_root/vendor/plugins/jrails/init.rb +1 -0
- data/test/rails_root/vendor/plugins/jrails/install.rb +9 -0
- data/test/rails_root/vendor/plugins/jrails/javascripts/jquery-ui.js +188 -0
- data/test/rails_root/vendor/plugins/jrails/javascripts/jquery.js +19 -0
- data/test/rails_root/vendor/plugins/jrails/javascripts/jrails.js +1 -0
- data/test/rails_root/vendor/plugins/jrails/javascripts/sources/jrails.js +197 -0
- data/test/rails_root/vendor/plugins/jrails/jrails.gemspec +50 -0
- data/test/rails_root/vendor/plugins/jrails/lib/jrails.rb +421 -0
- data/test/rails_root/vendor/plugins/jrails/rails/init.rb +15 -0
- data/test/rails_root/vendor/plugins/jrails/tasks/jrails.rake +25 -0
- data/test/rails_root/vendor/plugins/ssl_requirement/README +43 -0
- data/test/rails_root/vendor/plugins/ssl_requirement/lib/ssl_requirement.rb +62 -0
- data/test/rails_root/vendor/plugins/ssl_requirement/test/ssl_requirement_test.rb +132 -0
- data/test/rails_root/vendor/plugins/validation_reflection/CHANGELOG +24 -0
- data/test/rails_root/vendor/plugins/validation_reflection/LICENSE +20 -0
- data/test/rails_root/vendor/plugins/validation_reflection/README +64 -0
- data/test/rails_root/vendor/plugins/validation_reflection/Rakefile +22 -0
- data/test/rails_root/vendor/plugins/validation_reflection/about.yml +7 -0
- data/test/rails_root/vendor/plugins/validation_reflection/init.rb +8 -0
- data/test/rails_root/vendor/plugins/validation_reflection/lib/boiler_plate/validation_reflection.rb +129 -0
- data/test/rails_root/vendor/plugins/validation_reflection/test/test_helper.rb +36 -0
- data/test/rails_root/vendor/plugins/validation_reflection/test/validation_reflection_test.rb +126 -0
- data/uninstall.rb +1 -0
- metadata +482 -0
data/.gitignore
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
**/*.pid
|
|
2
|
+
log/*.log
|
|
3
|
+
log/*.pid
|
|
4
|
+
tmp
|
|
5
|
+
.DS_Store
|
|
6
|
+
public/cache/**/*
|
|
7
|
+
public/system/**/*
|
|
8
|
+
doc/**/*
|
|
9
|
+
db/*.sqlite3
|
|
10
|
+
.project
|
|
11
|
+
.loadpath
|
|
12
|
+
nbproject/
|
|
13
|
+
.idea
|
|
14
|
+
testjour.log
|
|
15
|
+
*.so
|
|
16
|
+
*.o
|
|
17
|
+
Makefile
|
|
18
|
+
mkmf.log
|
|
19
|
+
*.bundle
|
|
20
|
+
conftest
|
|
21
|
+
content/
|
|
22
|
+
REVISION
|
|
23
|
+
deploy.rb
|
|
24
|
+
pkg/*
|
|
25
|
+
*.sw?
|
|
26
|
+
.DS_Store
|
|
27
|
+
coverage
|
|
28
|
+
rdoc
|
|
29
|
+
pkg
|
|
30
|
+
test/feed_archive
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2009 Justin Ball
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/testtask'
|
|
3
|
+
require 'rake/rdoctask'
|
|
4
|
+
|
|
5
|
+
desc 'Default: run unit tests.'
|
|
6
|
+
task :default => :test
|
|
7
|
+
|
|
8
|
+
desc 'Test muck-invites.'
|
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
|
10
|
+
t.libs << 'lib'
|
|
11
|
+
t.libs << 'test/rails_root/test'
|
|
12
|
+
t.pattern = 'test/rails_root/test/**/*_test.rb'
|
|
13
|
+
t.verbose = true
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
begin
|
|
17
|
+
require 'rcov/rcovtask'
|
|
18
|
+
Rcov::RcovTask.new do |t|
|
|
19
|
+
#t.libs << 'lib'
|
|
20
|
+
t.libs << 'test/rails_root/lib'
|
|
21
|
+
t.pattern = 'test/rails_root/test/**/*_test.rb'
|
|
22
|
+
t.verbose = true
|
|
23
|
+
t.output_dir = 'coverage'
|
|
24
|
+
t.rcov_opts << '--exclude "gems/*"'
|
|
25
|
+
end
|
|
26
|
+
rescue LoadError
|
|
27
|
+
task :rcov do
|
|
28
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
desc 'Generate documentation for the muck-invites gem.'
|
|
33
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
34
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
35
|
+
rdoc.title = 'MuckInvites'
|
|
36
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
|
37
|
+
rdoc.rdoc_files.include('README*')
|
|
38
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
desc 'Translate this gem'
|
|
42
|
+
task :translate do
|
|
43
|
+
file = File.join(File.dirname(__FILE__), 'locales', 'en.yml')
|
|
44
|
+
system("babelphish -o -y #{file}")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
begin
|
|
48
|
+
require 'jeweler'
|
|
49
|
+
Jeweler::Tasks.new do |gemspec|
|
|
50
|
+
gemspec.name = "muck-invites"
|
|
51
|
+
gemspec.summary = "The invite engine for the muck system"
|
|
52
|
+
gemspec.email = "justinball@gmail.com"
|
|
53
|
+
gemspec.homepage = "http://github.com/jbasdf/muck_invites"
|
|
54
|
+
gemspec.description = "The invite engine for the muck system."
|
|
55
|
+
gemspec.authors = ["Justin Ball, Joel Duffin"]
|
|
56
|
+
gemspec.rubyforge_project = 'muck-invites'
|
|
57
|
+
gemspec.add_dependency "contacts"
|
|
58
|
+
gemspec.add_dependency "muck-engine"
|
|
59
|
+
end
|
|
60
|
+
Jeweler::GemcutterTasks.new
|
|
61
|
+
Jeweler::RubyforgeTasks.new do |rubyforge|
|
|
62
|
+
rubyforge.doc_task = "rdoc"
|
|
63
|
+
end
|
|
64
|
+
rescue LoadError
|
|
65
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
|
66
|
+
end
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.1
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
class Muck::InvitesController < ApplicationController
|
|
2
|
+
|
|
3
|
+
unloadable
|
|
4
|
+
|
|
5
|
+
before_filter :login_required
|
|
6
|
+
|
|
7
|
+
def new
|
|
8
|
+
flash.discard
|
|
9
|
+
@page_title = t('muck.invites.new_invites', :app_name => GlobalConfig.application_name)
|
|
10
|
+
respond_to do |format|
|
|
11
|
+
format.html { render :template => 'invites/new' }
|
|
12
|
+
format.pjs { render :template => 'invites/new', :layout => false }
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_contacts
|
|
17
|
+
success = true
|
|
18
|
+
begin
|
|
19
|
+
@contacts = User.get_contacts(params[:get_contacts][:email], params[:get_contacts][:password])
|
|
20
|
+
if @contacts.blank?
|
|
21
|
+
message = t('muck.invites.no_contacts_found')
|
|
22
|
+
success = false
|
|
23
|
+
end
|
|
24
|
+
rescue Contacts::AuthenticationError => ex
|
|
25
|
+
success = false
|
|
26
|
+
message = ex.to_s
|
|
27
|
+
end
|
|
28
|
+
respond_to do |format|
|
|
29
|
+
format.html do
|
|
30
|
+
flash[:error] = message if message
|
|
31
|
+
render :template => 'invites/_get_contacts'
|
|
32
|
+
end
|
|
33
|
+
format.json do
|
|
34
|
+
render :json => { :success => success, :message => message, :html => get_contacts_html }
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def create
|
|
40
|
+
if params[:emails]
|
|
41
|
+
current_user.invite(params[:emails])
|
|
42
|
+
flash[:notice] = t('muck.invites.create_success', :emails => params[:emails].join(', '), :app_name => GlobalConfig.application_name)
|
|
43
|
+
end
|
|
44
|
+
redirect_to('/')
|
|
45
|
+
rescue ActiveRecord::RecordInvalid => ex
|
|
46
|
+
if @invite
|
|
47
|
+
errors = @invite.errors.full_messages.to_sentence
|
|
48
|
+
else
|
|
49
|
+
errors = ex
|
|
50
|
+
end
|
|
51
|
+
flash[:error] = t('muck.invites.create_error', :errors => errors)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
protected
|
|
55
|
+
|
|
56
|
+
def get_contacts_html
|
|
57
|
+
render_as_html do
|
|
58
|
+
render_to_string(:partial => 'invites/get_contacts')
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class InviteMailer < ActionMailer::Base
|
|
2
|
+
unloadable
|
|
3
|
+
|
|
4
|
+
layout 'email_default'
|
|
5
|
+
default_url_options[:host] = GlobalConfig.application_url
|
|
6
|
+
|
|
7
|
+
def invite_notification(user, email)
|
|
8
|
+
setup_email(email)
|
|
9
|
+
subject I18n.t('muck.invites.invite', :inviter => user.full_name, :app_name => GlobalConfig.application_name)
|
|
10
|
+
body :user => user
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def invited_joined_notification(user, inviter)
|
|
14
|
+
setup_email(inviter.email)
|
|
15
|
+
subject I18n.t('muck.invites.invited_joined', :user => inviter.full_name)
|
|
16
|
+
body :user => user, :inviter => inviter
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
protected
|
|
20
|
+
|
|
21
|
+
def setup_email(email)
|
|
22
|
+
recipients email
|
|
23
|
+
from "#{GlobalConfig.from_email_name} <#{GlobalConfig.from_email}>"
|
|
24
|
+
sent_on Time.now
|
|
25
|
+
content_type "text/html" # There is a bug in Rails that prevents multipart emails from working inside an engine. See: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2263-rails-232-breaks-implicit-multipart-actionmailer-tests#ticket-2263-22
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<p><%= h(@user.full_name) %> invites you to join Folksemantic.</p>
|
|
2
|
+
|
|
3
|
+
<p>Folksemantic is the leading OpenCourseWare search engine. It has over 110,000 resources in its index and provides tools for sharing and discussing resources and receiving personalized recommendations.</p>
|
|
4
|
+
|
|
5
|
+
<p>Visit Folksemantic at: <a href="<%= root_url %>"><%= root_url %></a></p>
|
|
6
|
+
|
|
7
|
+
<p>See what <%= h(@user.full_name) %> is doing at: <a href="<%= profile_path(@user) %>"><%= profile_path(@user) %></a></p>
|
|
8
|
+
|
|
9
|
+
<p>If the links do not work, try copying and pasting them into your web browser.</p>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%= h(@user.full_name) %> invites you to join Folksemantic.
|
|
2
|
+
|
|
3
|
+
Folksemantic is the leading OpenCourseWare search engine. It has over 110,000 resources in its index and provides tools for sharing and discussing resources and receiving personalized recommendations.
|
|
4
|
+
|
|
5
|
+
Visit Folksemantic at: <%= root_url %>
|
|
6
|
+
|
|
7
|
+
See what <%= h(@user.full_name) %> is doing at: <%= profile_path(@user) %>
|
|
8
|
+
|
|
9
|
+
If the links do not work, try copying and pasting them into your web browser.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<p><%= h(@user.full_name) %>, a contact you invited, joined Folksemantic.</p>
|
|
2
|
+
|
|
3
|
+
<p>Visit <%= h(@user.full_name) %>'s profile to see what they are doing and to begin following them: <a href="<%= profile_path(@inviter) %>"><%= profile_path(@inviter) %></a></p>
|
|
4
|
+
|
|
5
|
+
<p>If the links do not work, try copying and pasting them into your web browser.</p>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<%= h(@user.full_name) %>, a contact you invited, joined Folksemantic.
|
|
2
|
+
|
|
3
|
+
Visit <%= h(@user.full_name) %>'s profile to see what they are doing and to begin following them: <%= profile_path(@inviter) %>
|
|
4
|
+
|
|
5
|
+
If the links do not work, try copying and pasting them into your web browser.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<%= output_errors(t('muck.invites.problem_adding_invite'), {:class => 'help-box'}, @invite) %>
|
|
2
|
+
<% if !@contacts.blank? -%>
|
|
3
|
+
<% custom_form_for(:invite_contacts, :url => {:action => 'create'}, :html => {:id => "invite-contacts-form", :name => 'invite-contacts-form'} ) do |f| -%>
|
|
4
|
+
<div id="contact-chooser">
|
|
5
|
+
<div id="contact-chooser-list">
|
|
6
|
+
<fieldset>
|
|
7
|
+
<div id="select-all-contacts">
|
|
8
|
+
<input id="select-all" type="checkbox" onclick='jQuery("input[type=checkbox]").attr("checked",jQuery("#select-all:checked").val() != null);' />
|
|
9
|
+
<%= t('muck.invites.select_all') %>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="table-wrapper">
|
|
12
|
+
<table id="contacts-list">
|
|
13
|
+
<% @contacts.each do |contact| %>
|
|
14
|
+
<tr class="contact">
|
|
15
|
+
<td class="cb"><input type="checkbox" value="<%= h(contact[1]) %>" name="emails[]"></td>
|
|
16
|
+
<td class="name"><%= contact[0] %></td>
|
|
17
|
+
<td class="email"><%= contact[1] %></td>
|
|
18
|
+
</tr>
|
|
19
|
+
<% end %>
|
|
20
|
+
</table>
|
|
21
|
+
</div>
|
|
22
|
+
</fieldset>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<%= f.submit t('muck.invites.invite_button'), :class => "button invite-submit" %>
|
|
26
|
+
<% end -%>
|
|
27
|
+
<% end -%>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<div id="invite-contacts">
|
|
2
|
+
<h1><%= @page_title %></h1>
|
|
3
|
+
<div id="notice-error" class="error message" style="display:none"></div>
|
|
4
|
+
<div id="get-contacts-form">
|
|
5
|
+
<% custom_form_for(:get_contacts, :url => get_contacts_invites_path,
|
|
6
|
+
:html => {:id => "get-contacts-form", :name => 'get-contacts-form',
|
|
7
|
+
:class => 'get-contacts-form', :autocomplete => 'off'} ) do |f| -%>
|
|
8
|
+
<%= f.text_field :email, { :label => t('muck.invites.your_email'),
|
|
9
|
+
:tip => t('muck.invites.your_email_help')} -%>
|
|
10
|
+
<%= f.password_field :password, { :label => t('muck.invites.email_password'),
|
|
11
|
+
:tip => t('muck.invites.email_password_help')} -%>
|
|
12
|
+
<%= f.submit t('muck.invites.continue_button'), :class => "button invite-submit", :id => 'get-contacts-button' %>
|
|
13
|
+
<% end -%>
|
|
14
|
+
</div>
|
|
15
|
+
<div id="contacts-loading" style="display:none">
|
|
16
|
+
<img src="/images/spinner.gif" alt="loading..." />
|
|
17
|
+
<%= t('muck.invites.retrieving_contacts') %>
|
|
18
|
+
</div>
|
|
19
|
+
<div id="contacts-chooser-wrapper" style="display:none;"></div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<script type="text/javascript">
|
|
23
|
+
jQuery(document).ready(function() {
|
|
24
|
+
jQuery("#get-contacts-button").click(function() {
|
|
25
|
+
jQuery("#get-contacts-form").hide();
|
|
26
|
+
jQuery("#contacts-loading").show();
|
|
27
|
+
jQuery("#notice-error").hide();
|
|
28
|
+
var form = jQuery(this).parents('form');
|
|
29
|
+
jQuery.post(form.attr('action'), form.serialize() + '&format=json',
|
|
30
|
+
function(data){
|
|
31
|
+
var json = eval('(' + data + ')');
|
|
32
|
+
jQuery("#contacts-loading").hide();
|
|
33
|
+
if(!json.success){
|
|
34
|
+
<% if GlobalConfig.growl_enabled -%>
|
|
35
|
+
jQuery.jGrowl.info(json.message);
|
|
36
|
+
<% else -%>
|
|
37
|
+
jQuery("#notice-error").html(json.message);
|
|
38
|
+
jQuery("#notice-error").show();
|
|
39
|
+
jQuery("#get-contacts-form").show();
|
|
40
|
+
<% end -%>
|
|
41
|
+
} else {
|
|
42
|
+
jQuery("#contacts-chooser-wrapper").html(json.html);
|
|
43
|
+
jQuery("#contacts-chooser-wrapper").show();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return false;
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class CreateInvites < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :invites, :force => true do |t|
|
|
4
|
+
t.string "email", :null => false
|
|
5
|
+
end
|
|
6
|
+
add_index :invites, ["email"]
|
|
7
|
+
|
|
8
|
+
create_table :user_invites, :force => true do |t|
|
|
9
|
+
t.integer "user_id", :null => false
|
|
10
|
+
t.integer "invite_id", :null => false
|
|
11
|
+
t.timestamp "created_at", :null => false
|
|
12
|
+
end
|
|
13
|
+
add_index :user_invites, ["user_id"]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.down
|
|
17
|
+
drop_table :user_invites
|
|
18
|
+
drop_table :invites
|
|
19
|
+
end
|
|
20
|
+
end
|
data/install.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Install hook code here
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module ActiveRecord
|
|
2
|
+
module Acts #:nodoc:
|
|
3
|
+
module MuckInvite #:nodoc:
|
|
4
|
+
def self.included(base)
|
|
5
|
+
base.extend(ClassMethods)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module ClassMethods
|
|
9
|
+
|
|
10
|
+
def acts_as_muck_invite(options = {})
|
|
11
|
+
|
|
12
|
+
has_many :user_invites
|
|
13
|
+
has_many :users, :through => :user_invites
|
|
14
|
+
validates_presence_of :email
|
|
15
|
+
|
|
16
|
+
named_scope :by_newest, :order => "created_at DESC"
|
|
17
|
+
named_scope :by_oldest, :order => "created_at ASC"
|
|
18
|
+
named_scope :recent, lambda { { :conditions => ['created_at > ?', 1.week.ago] } }
|
|
19
|
+
|
|
20
|
+
email_name_regex = '[\w\.%\+\-]+'.freeze
|
|
21
|
+
domain_head_regex = '(?:[A-Z0-9\-]+\.)+'.freeze
|
|
22
|
+
domain_tld_regex = '(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|jobs|museum)'.freeze
|
|
23
|
+
email_regex = /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i
|
|
24
|
+
|
|
25
|
+
validates_format_of :email, :with => email_regex, :message => 'does not look like a valid email address.'
|
|
26
|
+
|
|
27
|
+
include ActiveRecord::Acts::MuckInvite::InstanceMethods
|
|
28
|
+
extend ActiveRecord::Acts::MuckInvite::SingletonMethods
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# class methods
|
|
34
|
+
module SingletonMethods
|
|
35
|
+
|
|
36
|
+
def who_invited?(email, id = nil)
|
|
37
|
+
users = []
|
|
38
|
+
|
|
39
|
+
if !id.nil?
|
|
40
|
+
invite = Invite.find(id)
|
|
41
|
+
users |= invite.users if !invite.nil?
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
invite = Invite.find_by_email(email)
|
|
45
|
+
users |= invite.users if !invite.nil?
|
|
46
|
+
|
|
47
|
+
users
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# All the methods available to a record that has had <tt>acts_as_muck_invite</tt> specified.
|
|
52
|
+
module InstanceMethods
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module ActiveRecord
|
|
2
|
+
module Acts #:nodoc:
|
|
3
|
+
module MuckInviter #:nodoc:
|
|
4
|
+
def self.included(base)
|
|
5
|
+
base.extend(ClassMethods)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module ClassMethods
|
|
9
|
+
|
|
10
|
+
def acts_as_muck_inviter(options = {})
|
|
11
|
+
|
|
12
|
+
has_many :user_invites
|
|
13
|
+
has_many :invites, :through => :user_invites
|
|
14
|
+
|
|
15
|
+
named_scope :by_newest, :order => "created_at DESC"
|
|
16
|
+
named_scope :by_oldest, :order => "created_at ASC"
|
|
17
|
+
named_scope :recent, lambda { { :conditions => ['created_at > ?', 1.week.ago] } }
|
|
18
|
+
|
|
19
|
+
include ActiveRecord::Acts::MuckInviter::InstanceMethods
|
|
20
|
+
extend ActiveRecord::Acts::MuckInviter::SingletonMethods
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# class methods
|
|
26
|
+
module SingletonMethods
|
|
27
|
+
def get_contacts(email, password)
|
|
28
|
+
return Contacts::Gmail.new(email, password).contacts if email.include?('@gmail.com')
|
|
29
|
+
return Contacts::Yahoo.new(email, password).contacts if email.include?('@yahoo.com')
|
|
30
|
+
return Contacts::Hotmail.new(email, password).contacts if email.include?('@hotmail.com')
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# All the methods available to a record that has had <tt>acts_as_muck_inviter</tt> specified.
|
|
35
|
+
module InstanceMethods
|
|
36
|
+
|
|
37
|
+
def notify_inviters(invite_id = nil)
|
|
38
|
+
inviters = Invite.who_invited?(self.email, invite_id)
|
|
39
|
+
if inviters.size > 0
|
|
40
|
+
content = I18n.t('muck.activities.joined_status', :name => self.full_name, :application_name => GlobalConfig.application_name)
|
|
41
|
+
inviters.each do |inviter|
|
|
42
|
+
add_activity(self, self, self, 'status_update', '', content) if GlobalConfig.create_activities_when_invited_joins
|
|
43
|
+
send_invited_joined_emails(inviters) if GlobalConfig.email_inviters_when_invited_joins
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def send_invited_joined_emails(inviters)
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def invite(emails)
|
|
53
|
+
emails = emails.split(/[, ]/) if !emails.is_a?(Array)
|
|
54
|
+
emails = emails.find_all { |email| !email.blank?}
|
|
55
|
+
raise I18n.t('muck.invites.no_email_error') if emails.blank?
|
|
56
|
+
emails.each do |email|
|
|
57
|
+
invite = Invite.find_by_email(email) || Invite.create(:email => email)
|
|
58
|
+
invites << invite if !invites.include?(invite)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def inviters
|
|
63
|
+
Invite.who_invited?(self.email)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|