serum-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +6 -0
- data/.rspec +3 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +42 -0
- data/LICENSE +22 -0
- data/README.md +40 -0
- data/bin/serum-rails +13 -0
- data/lib/serum/rails/app.rb +50 -0
- data/lib/serum/rails/code_scanner.rb +49 -0
- data/lib/serum/rails/metrics.rb +118 -0
- data/lib/serum/rails/type_selection.rb +31 -0
- data/lib/serum/rails/version.rb +7 -0
- data/lib/serum-rails.rb +5 -0
- data/serum-rails.gemspec +23 -0
- data/spec/serum/rails/metrics_spec.rb +87 -0
- data/spec/spec_helper.rb +80 -0
- data/spec/test_app/Capfile +4 -0
- data/spec/test_app/Gemfile +54 -0
- data/spec/test_app/Gemfile.lock +163 -0
- data/spec/test_app/Rakefile +11 -0
- data/spec/test_app/app/controllers/admin/categories_controller.rb +17 -0
- data/spec/test_app/app/controllers/admin/users_controller.rb +30 -0
- data/spec/test_app/app/controllers/application_controller/i18n_trait.rb +24 -0
- data/spec/test_app/app/controllers/application_controller/navigation_trait.rb +19 -0
- data/spec/test_app/app/controllers/application_controller/security_trait/disabled_clearance_accounts_trait.rb +41 -0
- data/spec/test_app/app/controllers/application_controller/security_trait.rb +65 -0
- data/spec/test_app/app/controllers/application_controller.rb +13 -0
- data/spec/test_app/app/controllers/conferences_controller.rb +67 -0
- data/spec/test_app/app/controllers/friendship_requests_controller.rb +31 -0
- data/spec/test_app/app/controllers/invitations_controller.rb +39 -0
- data/spec/test_app/app/controllers/members_controller.rb +21 -0
- data/spec/test_app/app/controllers/passwords_controller.rb +33 -0
- data/spec/test_app/app/controllers/sessions_controller.rb +17 -0
- data/spec/test_app/app/controllers/shared/boring_controller_trait/deletable_trait.rb +23 -0
- data/spec/test_app/app/controllers/shared/boring_controller_trait/flash_trait.rb +23 -0
- data/spec/test_app/app/controllers/shared/boring_controller_trait/helpers_trait.rb +35 -0
- data/spec/test_app/app/controllers/shared/boring_controller_trait/index_trait.rb +39 -0
- data/spec/test_app/app/controllers/shared/boring_controller_trait/log_changes_trait.rb +18 -0
- data/spec/test_app/app/controllers/shared/boring_controller_trait.rb +16 -0
- data/spec/test_app/app/controllers/users_controller.rb +49 -0
- data/spec/test_app/app/controllers/ws/api_controller/formatters_trait.rb +91 -0
- data/spec/test_app/app/controllers/ws/api_controller/parsers_trait.rb +59 -0
- data/spec/test_app/app/controllers/ws/api_controller.rb +70 -0
- data/spec/test_app/app/controllers/ws/attendees_controller.rb +43 -0
- data/spec/test_app/app/controllers/ws/categories_controller.rb +30 -0
- data/spec/test_app/app/controllers/ws/conferences_controller.rb +62 -0
- data/spec/test_app/app/controllers/ws/contacts_controller.rb +41 -0
- data/spec/test_app/app/controllers/ws/factory_controller.rb +45 -0
- data/spec/test_app/app/controllers/ws/members_controller.rb +34 -0
- data/spec/test_app/app/controllers/ws/series_controller.rb +19 -0
- data/spec/test_app/app/controllers/ws/tests_controller.rb +23 -0
- data/spec/test_app/app/helpers/application_helper.rb +180 -0
- data/spec/test_app/app/helpers/mail_helper.rb +9 -0
- data/spec/test_app/app/helpers/tags_helper.rb +16 -0
- data/spec/test_app/app/helpers/user_helper.rb +23 -0
- data/spec/test_app/app/models/attendance.rb +11 -0
- data/spec/test_app/app/models/category/ancestry_trait.rb +23 -0
- data/spec/test_app/app/models/category.rb +25 -0
- data/spec/test_app/app/models/conference/attendance_trait.rb +23 -0
- data/spec/test_app/app/models/conference/categories_trait.rb +26 -0
- data/spec/test_app/app/models/conference/icalendar_trait.rb +36 -0
- data/spec/test_app/app/models/conference/search_trait.rb +44 -0
- data/spec/test_app/app/models/conference.rb +24 -0
- data/spec/test_app/app/models/conference_category.rb +6 -0
- data/spec/test_app/app/models/conference_search.rb +51 -0
- data/spec/test_app/app/models/error.rb +25 -0
- data/spec/test_app/app/models/friendship.rb +14 -0
- data/spec/test_app/app/models/friendship_request.rb +19 -0
- data/spec/test_app/app/models/invitation.rb +38 -0
- data/spec/test_app/app/models/member_search.rb +18 -0
- data/spec/test_app/app/models/navigation.rb +38 -0
- data/spec/test_app/app/models/patterns.rb +14 -0
- data/spec/test_app/app/models/permissions.rb +106 -0
- data/spec/test_app/app/models/shared/afterlife_trait.rb +18 -0
- data/spec/test_app/app/models/shared/choice_trait.rb +37 -0
- data/spec/test_app/app/models/shared/deletable_trait.rb +8 -0
- data/spec/test_app/app/models/shared/flag_trait.rb +30 -0
- data/spec/test_app/app/models/shared/indestructible_trait.rb +19 -0
- data/spec/test_app/app/models/shared/list_field_trait.rb +70 -0
- data/spec/test_app/app/models/shared/person_name_trait.rb +25 -0
- data/spec/test_app/app/models/shared/searchable_trait.rb +71 -0
- data/spec/test_app/app/models/shared/sortable_trait.rb +24 -0
- data/spec/test_app/app/models/user/authentication_trait.rb +33 -0
- data/spec/test_app/app/models/user/authorization_trait.rb +17 -0
- data/spec/test_app/app/models/user/friends_trait.rb +42 -0
- data/spec/test_app/app/models/user/search_trait.rb +43 -0
- data/spec/test_app/app/models/user.rb +61 -0
- data/spec/test_app/app/models/util.rb +19 -0
- data/spec/test_app/app/views/admin/categories/_form.html.haml +18 -0
- data/spec/test_app/app/views/admin/categories/_list.html.haml +17 -0
- data/spec/test_app/app/views/admin/categories/edit.html.haml +6 -0
- data/spec/test_app/app/views/admin/categories/index.html.haml +6 -0
- data/spec/test_app/app/views/admin/categories/new.html.haml +6 -0
- data/spec/test_app/app/views/admin/categories/show.html.haml +27 -0
- data/spec/test_app/app/views/admin/users/_form.html.haml +49 -0
- data/spec/test_app/app/views/admin/users/_head.html.haml +5 -0
- data/spec/test_app/app/views/admin/users/_list.html.haml +20 -0
- data/spec/test_app/app/views/admin/users/_search.html.haml +9 -0
- data/spec/test_app/app/views/admin/users/deleted.html.haml +5 -0
- data/spec/test_app/app/views/admin/users/edit.html.haml +5 -0
- data/spec/test_app/app/views/admin/users/index.html.haml +7 -0
- data/spec/test_app/app/views/admin/users/new.html.haml +6 -0
- data/spec/test_app/app/views/clearance_mailer/change_password.erb +9 -0
- data/spec/test_app/app/views/conferences/_categories_list.html.haml +8 -0
- data/spec/test_app/app/views/conferences/_form.html.haml +32 -0
- data/spec/test_app/app/views/conferences/_head.html.haml +4 -0
- data/spec/test_app/app/views/conferences/_list.html.haml +22 -0
- data/spec/test_app/app/views/conferences/_search.html.haml +24 -0
- data/spec/test_app/app/views/conferences/edit.html.haml +8 -0
- data/spec/test_app/app/views/conferences/index.html.haml +22 -0
- data/spec/test_app/app/views/conferences/new.html.haml +9 -0
- data/spec/test_app/app/views/conferences/search.html.haml +7 -0
- data/spec/test_app/app/views/conferences/show.html.haml +78 -0
- data/spec/test_app/app/views/invitations/index.html.haml +26 -0
- data/spec/test_app/app/views/invitations/new.html.haml +22 -0
- data/spec/test_app/app/views/layouts/_flashes.html.haml +13 -0
- data/spec/test_app/app/views/layouts/_javascript_requirement.html.haml +8 -0
- data/spec/test_app/app/views/layouts/_javascripts.html.haml +4 -0
- data/spec/test_app/app/views/layouts/_notifications.html.haml +11 -0
- data/spec/test_app/app/views/layouts/_session_navigation.html.haml +12 -0
- data/spec/test_app/app/views/layouts/_stylesheets.html.haml +6 -0
- data/spec/test_app/app/views/layouts/screen.html.haml +30 -0
- data/spec/test_app/app/views/members/index.html.haml +40 -0
- data/spec/test_app/app/views/passwords/edit.html.haml +21 -0
- data/spec/test_app/app/views/passwords/new.html.haml +14 -0
- data/spec/test_app/app/views/sessions/new.html.haml +19 -0
- data/spec/test_app/app/views/users/_form.html.haml +45 -0
- data/spec/test_app/app/views/users/_head.html.haml +3 -0
- data/spec/test_app/app/views/users/edit.html.haml +5 -0
- data/spec/test_app/app/views/users/new.html.haml +6 -0
- data/spec/test_app/app/views/users/show.html.haml +49 -0
- data/spec/test_app/assets/data.json +981 -0
- data/spec/test_app/config/boot.rb +125 -0
- data/spec/test_app/config/cucumber.yml +8 -0
- data/spec/test_app/config/database.sample.yml +24 -0
- data/spec/test_app/config/deploy/production.rb +9 -0
- data/spec/test_app/config/deploy.rb +100 -0
- data/spec/test_app/config/environment.rb +27 -0
- data/spec/test_app/config/environments/cucumber.rb +28 -0
- data/spec/test_app/config/environments/development.rb +22 -0
- data/spec/test_app/config/environments/production.rb +35 -0
- data/spec/test_app/config/environments/test.rb +30 -0
- data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/test_app/config/initializers/clearance.rb +5 -0
- data/spec/test_app/config/initializers/collect_hash.rb +23 -0
- data/spec/test_app/config/initializers/collection_path_with_params.rb +18 -0
- data/spec/test_app/config/initializers/cookie_verification_secret.rb +10 -0
- data/spec/test_app/config/initializers/form_builder.rb +166 -0
- data/spec/test_app/config/initializers/inflections.rb +10 -0
- data/spec/test_app/config/initializers/invert_ordered_hash.rb +12 -0
- data/spec/test_app/config/initializers/localize_textfield_input_for_numbers.rb +30 -0
- data/spec/test_app/config/initializers/mime_types.rb +7 -0
- data/spec/test_app/config/initializers/new_rails_defaults.rb +21 -0
- data/spec/test_app/config/initializers/preload_associations.rb +7 -0
- data/spec/test_app/config/initializers/query_diet.rb +6 -0
- data/spec/test_app/config/initializers/saner_field_with_errors.rb +5 -0
- data/spec/test_app/config/initializers/session_store.rb +18 -0
- data/spec/test_app/config/locales/en.yml +231 -0
- data/spec/test_app/config/preinitializer.rb +22 -0
- data/spec/test_app/config/routes.rb +47 -0
- data/spec/test_app/db/migrate/20110114164517_initial_tables.rb +52 -0
- data/spec/test_app/db/migrate/20110118090858_add_profile_fields_to_user.rb +15 -0
- data/spec/test_app/db/migrate/20110118092741_create_conference.rb +20 -0
- data/spec/test_app/db/migrate/20110118093503_create_category.rb +17 -0
- data/spec/test_app/db/migrate/20110118104438_create_conference_category.rb +16 -0
- data/spec/test_app/db/migrate/20110118105959_create_attendance.rb +17 -0
- data/spec/test_app/db/migrate/20110118122324_create_friendship_requests.rb +15 -0
- data/spec/test_app/db/migrate/20110118162436_create_invitation.rb +16 -0
- data/spec/test_app/db/migrate/20110118170347_create_friendships.rb +15 -0
- data/spec/test_app/db/migrate/20110118193528_add_timestamps_to_conference.rb +12 -0
- data/spec/test_app/db/migrate/20110119075012_set_unique_index_on_username_for_user.rb +11 -0
- data/spec/test_app/db/migrate/20110119093458_remove_first_and_last_name_from_user.rb +12 -0
- data/spec/test_app/db/migrate/20110119110857_add_missing_indexes.rb +23 -0
- data/spec/test_app/db/migrate/20110119115751_add_uniqueness_of_name_to_category.rb +9 -0
- data/spec/test_app/db/seeds.rb +5 -0
- data/spec/test_app/lib/scripts/create_many_users_sql.rb +14 -0
- data/spec/test_app/lib/tasks/cucumber.rake +53 -0
- data/spec/test_app/lib/tasks/pending_migrations.rake +24 -0
- data/spec/test_app/lib/tasks/rcov.rake +42 -0
- data/spec/test_app/lib/tasks/rspec.rake +144 -0
- data/spec/test_app/public/404.html +30 -0
- data/spec/test_app/public/422.html +30 -0
- data/spec/test_app/public/500.html +30 -0
- data/spec/test_app/public/favicon.ico +0 -0
- data/spec/test_app/public/images/ajax-loader.gif +0 -0
- data/spec/test_app/public/images/icons/balloon-quotation.png +0 -0
- data/spec/test_app/public/images/icons/balloon-sound.png +0 -0
- data/spec/test_app/public/images/icons/balloon.png +0 -0
- data/spec/test_app/public/images/icons/bell.png +0 -0
- data/spec/test_app/public/images/icons/bin.png +0 -0
- data/spec/test_app/public/images/icons/bookmark.png +0 -0
- data/spec/test_app/public/images/icons/cake.png +0 -0
- data/spec/test_app/public/images/icons/calendar-blue.png +0 -0
- data/spec/test_app/public/images/icons/calendar-month.png +0 -0
- data/spec/test_app/public/images/icons/calendar-month_light.png +0 -0
- data/spec/test_app/public/images/icons/calendar-select.png +0 -0
- data/spec/test_app/public/images/icons/card-address.png +0 -0
- data/spec/test_app/public/images/icons/cards-address.png +0 -0
- data/spec/test_app/public/images/icons/cross-script.png +0 -0
- data/spec/test_app/public/images/icons/cross-small.png +0 -0
- data/spec/test_app/public/images/icons/cross.png +0 -0
- data/spec/test_app/public/images/icons/crown-silver.png +0 -0
- data/spec/test_app/public/images/icons/crown.png +0 -0
- data/spec/test_app/public/images/icons/dashboard.png +0 -0
- data/spec/test_app/public/images/icons/document-list.png +0 -0
- data/spec/test_app/public/images/icons/document-node.png +0 -0
- data/spec/test_app/public/images/icons/document-number.png +0 -0
- data/spec/test_app/public/images/icons/document-stamp.png +0 -0
- data/spec/test_app/public/images/icons/document-task.png +0 -0
- data/spec/test_app/public/images/icons/document-text.png +0 -0
- data/spec/test_app/public/images/icons/fire.png +0 -0
- data/spec/test_app/public/images/icons/folder-medium.png +0 -0
- data/spec/test_app/public/images/icons/folder.png +0 -0
- data/spec/test_app/public/images/icons/gear.png +0 -0
- data/spec/test_app/public/images/icons/globe-green.png +0 -0
- data/spec/test_app/public/images/icons/globe-green_light.png +0 -0
- data/spec/test_app/public/images/icons/globe-medium-green.png +0 -0
- data/spec/test_app/public/images/icons/heart-break.png +0 -0
- data/spec/test_app/public/images/icons/heart.png +0 -0
- data/spec/test_app/public/images/icons/images-flickr.png +0 -0
- data/spec/test_app/public/images/icons/information-balloon.png +0 -0
- data/spec/test_app/public/images/icons/key.png +0 -0
- data/spec/test_app/public/images/icons/light-bulb.png +0 -0
- data/spec/test_app/public/images/icons/lock--exclamation.png +0 -0
- data/spec/test_app/public/images/icons/lock.png +0 -0
- data/spec/test_app/public/images/icons/magnifier-medium.png +0 -0
- data/spec/test_app/public/images/icons/magnifier.png +0 -0
- data/spec/test_app/public/images/icons/mail.png +0 -0
- data/spec/test_app/public/images/icons/paper-clip-small.png +0 -0
- data/spec/test_app/public/images/icons/paper-clip.png +0 -0
- data/spec/test_app/public/images/icons/pencil.png +0 -0
- data/spec/test_app/public/images/icons/plus-circle.png +0 -0
- data/spec/test_app/public/images/icons/plus-small.png +0 -0
- data/spec/test_app/public/images/icons/plus.png +0 -0
- data/spec/test_app/public/images/icons/printer.png +0 -0
- data/spec/test_app/public/images/icons/question-balloon.png +0 -0
- data/spec/test_app/public/images/icons/question-white.png +0 -0
- data/spec/test_app/public/images/icons/question.png +0 -0
- data/spec/test_app/public/images/icons/quill.png +0 -0
- data/spec/test_app/public/images/icons/robot.png +0 -0
- data/spec/test_app/public/images/icons/ruby_16.png +0 -0
- data/spec/test_app/public/images/icons/ruby_2_16.png +0 -0
- data/spec/test_app/public/images/icons/ruby_32.png +0 -0
- data/spec/test_app/public/images/icons/show.png +0 -0
- data/spec/test_app/public/images/icons/star.png +0 -0
- data/spec/test_app/public/images/icons/sticky-note-text.png +0 -0
- data/spec/test_app/public/images/icons/telephone-fax.png +0 -0
- data/spec/test_app/public/images/icons/telephone-fax_light.png +0 -0
- data/spec/test_app/public/images/icons/telephone.png +0 -0
- data/spec/test_app/public/images/icons/telephone_light.png +0 -0
- data/spec/test_app/public/images/icons/thumb-up.png +0 -0
- data/spec/test_app/public/images/icons/thumb.png +0 -0
- data/spec/test_app/public/images/icons/tick.png +0 -0
- data/spec/test_app/public/images/icons/trophy-silver.png +0 -0
- data/spec/test_app/public/images/icons/trophy.png +0 -0
- data/spec/test_app/public/images/icons/user-gray.png +0 -0
- data/spec/test_app/public/images/icons/user-gray_gray.png +0 -0
- data/spec/test_app/public/images/icons/user-medium.png +0 -0
- data/spec/test_app/public/images/icons/user-red.png +0 -0
- data/spec/test_app/public/images/icons/users.png +0 -0
- data/spec/test_app/public/images/icons/users_gray.png +0 -0
- data/spec/test_app/public/images/icons/xfn.png +0 -0
- data/spec/test_app/public/images/legend_bg.png +0 -0
- data/spec/test_app/public/images/poshytip/tip-deepgray.png +0 -0
- data/spec/test_app/public/images/poshytip/tip-deepgray_arrows.png +0 -0
- data/spec/test_app/public/images/stripes_bottom_dark.png +0 -0
- data/spec/test_app/public/images/stripes_top_dark.png +0 -0
- data/spec/test_app/public/images/ui/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/spec/test_app/public/images/ui/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/spec/test_app/public/images/ui/ui-bg_flat_10_000000_40x100.png +0 -0
- data/spec/test_app/public/images/ui/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/spec/test_app/public/images/ui/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/spec/test_app/public/images/ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/test_app/public/images/ui/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/spec/test_app/public/images/ui/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/spec/test_app/public/images/ui/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/spec/test_app/public/images/ui/ui-icons_222222_256x240.png +0 -0
- data/spec/test_app/public/images/ui/ui-icons_228ef1_256x240.png +0 -0
- data/spec/test_app/public/images/ui/ui-icons_ef8c08_256x240.png +0 -0
- data/spec/test_app/public/images/ui/ui-icons_ffd27a_256x240.png +0 -0
- data/spec/test_app/public/images/ui/ui-icons_ffffff_256x240.png +0 -0
- data/spec/test_app/public/javascripts/application.js +175 -0
- data/spec/test_app/public/javascripts/lib/jquery-1.4.2.min.js +154 -0
- data/spec/test_app/public/javascripts/lib/jquery-ui-1.8.5.custom.min.js +249 -0
- data/spec/test_app/public/javascripts/lib/jquery-ui-1.8.5.custom.min.txt +9 -0
- data/spec/test_app/public/javascripts/lib/jquery-ui-timepicker-addon.js +682 -0
- data/spec/test_app/public/javascripts/lib/jquery-ui-timepicker-addon.min.js +22 -0
- data/spec/test_app/public/javascripts/lib/jquery.elastic.js +6 -0
- data/spec/test_app/public/javascripts/lib/jquery.elastic.performance.js +128 -0
- data/spec/test_app/public/javascripts/lib/jquery.elastic.source.js +117 -0
- data/spec/test_app/public/javascripts/lib/jquery.poshytip.js +414 -0
- data/spec/test_app/public/javascripts/lib/jquery.poshytip.min.js +7 -0
- data/spec/test_app/public/javascripts/lib/jquery.ui.datepicker-de.js +23 -0
- data/spec/test_app/public/javascripts/lib/jrails.js +1 -0
- data/spec/test_app/public/javascripts/lib/multiple-autocomplete.js +39 -0
- data/spec/test_app/public/javascripts/lib/underscore-min.js +17 -0
- data/spec/test_app/public/javascripts/lib/underscore.js +704 -0
- data/spec/test_app/public/robots.txt +5 -0
- data/spec/test_app/public/stylesheets/lib/PIE.htc +77 -0
- data/spec/test_app/public/stylesheets/lib/PIE_uncompressed.htc +3064 -0
- data/spec/test_app/public/stylesheets/lib/jquery-ui-timepicker-addon.css +11 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-darkgray/tip-darkgray.css +62 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-darkgray/tip-darkgray.png +0 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-darkgray/tip-darkgray_arrows.png +0 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-deepgray/tip-deepgray.css +64 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-green/tip-green.css +57 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-green/tip-green_arrows.gif +0 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-skyblue/tip-skyblue.css +58 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-skyblue/tip-skyblue.png +0 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-skyblue/tip-skyblue_arrows.png +0 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-twitter/tip-twitter.css +59 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-twitter/tip-twitter_arrows.gif +0 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-violet/tip-violet.css +60 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-violet/tip-violet.png +0 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-violet/tip-violet_arrows.png +0 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-yellow/tip-yellow.css +60 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-yellow/tip-yellow.png +0 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-yellow/tip-yellow_arrows.png +0 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-yellowsimple/tip-yellowsimple.css +60 -0
- data/spec/test_app/public/stylesheets/lib/poshytip/tip-yellowsimple/tip-yellowsimple_arrows.gif +0 -0
- data/spec/test_app/public/stylesheets/lib/ui-lightness/jquery-ui-1.8.5.custom.css +459 -0
- data/spec/test_app/public/stylesheets/sass/_mixins.sass +79 -0
- data/spec/test_app/public/stylesheets/sass/_reset.sass +40 -0
- data/spec/test_app/public/stylesheets/sass/print.sass +22 -0
- data/spec/test_app/public/stylesheets/sass/screen.sass +866 -0
- data/spec/test_app/script/about +4 -0
- data/spec/test_app/script/autospec +6 -0
- data/spec/test_app/script/console +3 -0
- data/spec/test_app/script/cucumber +10 -0
- data/spec/test_app/script/dbconsole +3 -0
- data/spec/test_app/script/destroy +3 -0
- data/spec/test_app/script/generate +3 -0
- data/spec/test_app/script/performance/benchmarker +3 -0
- data/spec/test_app/script/performance/profiler +3 -0
- data/spec/test_app/script/plugin +3 -0
- data/spec/test_app/script/runner +3 -0
- data/spec/test_app/script/server +3 -0
- data/spec/test_app/script/spec +10 -0
- metadata +748 -0
@@ -0,0 +1,163 @@
|
|
1
|
+
PATH
|
2
|
+
remote: vendor/gems/cucumber-rails-0.4.1
|
3
|
+
specs:
|
4
|
+
cucumber-rails (0.4.1)
|
5
|
+
cucumber (>= 0.10.1)
|
6
|
+
nokogiri (>= 1.4.4)
|
7
|
+
rack-test (>= 0.5.7)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
abstract (1.0.0)
|
13
|
+
actionmailer (2.3.11)
|
14
|
+
actionpack (= 2.3.11)
|
15
|
+
actionpack (2.3.11)
|
16
|
+
activesupport (= 2.3.11)
|
17
|
+
rack (~> 1.1.0)
|
18
|
+
activerecord (2.3.11)
|
19
|
+
activesupport (= 2.3.11)
|
20
|
+
activeresource (2.3.11)
|
21
|
+
activesupport (= 2.3.11)
|
22
|
+
activesupport (2.3.11)
|
23
|
+
acts-as-taggable-on (2.0.6)
|
24
|
+
aegis (2.5.3)
|
25
|
+
ancestry (1.2.4)
|
26
|
+
activerecord (>= 2.2.2)
|
27
|
+
andand (1.3.1)
|
28
|
+
builder (3.0.0)
|
29
|
+
capybara (0.4.1.2)
|
30
|
+
celerity (>= 0.7.9)
|
31
|
+
culerity (>= 0.2.4)
|
32
|
+
mime-types (>= 1.16)
|
33
|
+
nokogiri (>= 1.3.3)
|
34
|
+
rack (>= 1.0.0)
|
35
|
+
rack-test (>= 0.5.4)
|
36
|
+
selenium-webdriver (>= 0.0.27)
|
37
|
+
xpath (~> 0.1.3)
|
38
|
+
celerity (0.8.9)
|
39
|
+
childprocess (0.1.8)
|
40
|
+
ffi (~> 1.0.6)
|
41
|
+
clearance (0.8.8)
|
42
|
+
columnize (0.3.2)
|
43
|
+
configuration (1.2.0)
|
44
|
+
cucumber (0.10.2)
|
45
|
+
builder (>= 2.1.2)
|
46
|
+
diff-lcs (>= 1.1.2)
|
47
|
+
gherkin (>= 2.3.5)
|
48
|
+
json (>= 1.4.6)
|
49
|
+
term-ansicolor (>= 1.0.5)
|
50
|
+
cucumber_factory (1.7.4)
|
51
|
+
cucumber_spinner (0.2.1)
|
52
|
+
rtui (>= 0.2.2)
|
53
|
+
culerity (0.2.15)
|
54
|
+
database_cleaner (0.6.7)
|
55
|
+
diff-lcs (1.1.2)
|
56
|
+
erubis (2.6.6)
|
57
|
+
abstract (>= 1.0.0)
|
58
|
+
faker (0.3.1)
|
59
|
+
ffi (1.0.7)
|
60
|
+
rake (>= 0.8.7)
|
61
|
+
gherkin (2.3.7)
|
62
|
+
json (>= 1.4.6)
|
63
|
+
haml (3.1.1)
|
64
|
+
inaction_mailer (0.6)
|
65
|
+
jrails (0.6.0)
|
66
|
+
json (1.5.1)
|
67
|
+
json_pure (1.5.1)
|
68
|
+
launchy (0.4.0)
|
69
|
+
configuration (>= 0.0.5)
|
70
|
+
rake (>= 0.8.1)
|
71
|
+
linecache (0.43)
|
72
|
+
machinist (1.0.6)
|
73
|
+
machinist_callbacks (0.1.3)
|
74
|
+
machinist (< 2.0.0)
|
75
|
+
mime-types (1.16)
|
76
|
+
modularity (0.6.0)
|
77
|
+
mysql (2.8.1)
|
78
|
+
nokogiri (1.4.4)
|
79
|
+
paperclip (2.3.4)
|
80
|
+
activerecord
|
81
|
+
activesupport
|
82
|
+
query_diet (0.2.0)
|
83
|
+
rack (1.1.2)
|
84
|
+
rack-test (0.6.0)
|
85
|
+
rack (>= 1.0)
|
86
|
+
rails (2.3.11)
|
87
|
+
actionmailer (= 2.3.11)
|
88
|
+
actionpack (= 2.3.11)
|
89
|
+
activerecord (= 2.3.11)
|
90
|
+
activeresource (= 2.3.11)
|
91
|
+
activesupport (= 2.3.11)
|
92
|
+
rake (>= 0.8.3)
|
93
|
+
rake (0.8.7)
|
94
|
+
resource_controller (0.6.6)
|
95
|
+
rspec (1.3.2)
|
96
|
+
rspec-rails (1.3.4)
|
97
|
+
rack (>= 1.0.0)
|
98
|
+
rspec (~> 1.3.1)
|
99
|
+
rspec_spinner (1.1.3)
|
100
|
+
rtui
|
101
|
+
rtui (0.2.2)
|
102
|
+
ruby-debug (0.10.4)
|
103
|
+
columnize (>= 0.1)
|
104
|
+
ruby-debug-base (~> 0.10.4.0)
|
105
|
+
ruby-debug-base (0.10.4)
|
106
|
+
linecache (>= 0.3)
|
107
|
+
ruby-ole (1.2.11.1)
|
108
|
+
rubyzip (0.9.4)
|
109
|
+
sass (3.1.1)
|
110
|
+
selenium-webdriver (0.2.0)
|
111
|
+
childprocess (>= 0.1.7)
|
112
|
+
ffi (>= 1.0.7)
|
113
|
+
json_pure
|
114
|
+
rubyzip
|
115
|
+
shoulda (2.11.1)
|
116
|
+
spreadsheet (0.6.5.2)
|
117
|
+
ruby-ole (>= 1.0)
|
118
|
+
term-ansicolor (1.0.5)
|
119
|
+
timecop (0.3.5)
|
120
|
+
vpim (0.695)
|
121
|
+
will_paginate (2.3.15)
|
122
|
+
xpath (0.1.4)
|
123
|
+
nokogiri (~> 1.3)
|
124
|
+
|
125
|
+
PLATFORMS
|
126
|
+
ruby
|
127
|
+
|
128
|
+
DEPENDENCIES
|
129
|
+
acts-as-taggable-on (= 2.0.6)
|
130
|
+
aegis
|
131
|
+
ancestry
|
132
|
+
andand (= 1.3.1)
|
133
|
+
capybara
|
134
|
+
clearance (= 0.8.8)
|
135
|
+
cucumber
|
136
|
+
cucumber-rails!
|
137
|
+
cucumber_factory
|
138
|
+
cucumber_spinner
|
139
|
+
database_cleaner
|
140
|
+
erubis (= 2.6.6)
|
141
|
+
faker (= 0.3.1)
|
142
|
+
haml
|
143
|
+
inaction_mailer
|
144
|
+
jrails (= 0.6.0)
|
145
|
+
launchy
|
146
|
+
machinist (= 1.0.6)
|
147
|
+
machinist_callbacks (= 0.1.3)
|
148
|
+
modularity (= 0.6.0)
|
149
|
+
mysql
|
150
|
+
paperclip (= 2.3.4)
|
151
|
+
query_diet (= 0.2.0)
|
152
|
+
rails (= 2.3.11)
|
153
|
+
resource_controller (= 0.6.6)
|
154
|
+
rspec (= 1.3.2)
|
155
|
+
rspec-rails
|
156
|
+
rspec_spinner (= 1.1.3)
|
157
|
+
ruby-debug
|
158
|
+
sass
|
159
|
+
shoulda (= 2.11.1)
|
160
|
+
spreadsheet (= 0.6.5.2)
|
161
|
+
timecop (= 0.3.5)
|
162
|
+
vpim
|
163
|
+
will_paginate (= 2.3.15)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
require 'tasks/rails'
|
11
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Controller to manage category as an admin.
|
2
|
+
# origin: M
|
3
|
+
class Admin::CategoriesController < ApplicationController
|
4
|
+
|
5
|
+
does 'boring_controller',
|
6
|
+
:order => 'categories.name'
|
7
|
+
|
8
|
+
in_sections :admin_categories
|
9
|
+
permissions :admin_categories
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def collection_scope
|
14
|
+
Category.roots.by_name
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Controller to manage users as an admin.
|
2
|
+
# origin: RM
|
3
|
+
class Admin::UsersController < ApplicationController
|
4
|
+
|
5
|
+
does 'boring_controller',
|
6
|
+
:order => 'users.username',
|
7
|
+
:show_is_edit => true
|
8
|
+
|
9
|
+
before_filter :set_sections, :except => :deleted
|
10
|
+
|
11
|
+
in_sections :admin_users
|
12
|
+
permissions :admin_users
|
13
|
+
|
14
|
+
def deleted
|
15
|
+
in_sections :deleted_users
|
16
|
+
@users = User.find(:all, :conditions => { :deleted => true }).paginate(:page => params[:page], :per_page => PAGE_SIZE)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def set_sections
|
22
|
+
in_sections object.andand.deleted? ? :deleted_users : :active_users
|
23
|
+
end
|
24
|
+
|
25
|
+
# What we call User.search with
|
26
|
+
def search_args
|
27
|
+
[params[:query], current_user]
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Configures I18n in controllers.
|
2
|
+
# origin: RM
|
3
|
+
module ApplicationController::I18nTrait
|
4
|
+
|
5
|
+
as_trait do
|
6
|
+
|
7
|
+
prepend_before_filter :set_locale
|
8
|
+
helper_method :translate_model_name
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def translate_model_name(model)
|
13
|
+
klass = model
|
14
|
+
klass = klass.class if klass.is_a?(ActiveRecord::Base)
|
15
|
+
klass.human_name
|
16
|
+
end
|
17
|
+
|
18
|
+
def set_locale
|
19
|
+
I18n.locale = 'en'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Allows controllers to associate actions with tabs in the site navigation.
|
2
|
+
# origin: RM
|
3
|
+
module ApplicationController::NavigationTrait
|
4
|
+
as_trait do
|
5
|
+
|
6
|
+
before_filter :set_default_section
|
7
|
+
|
8
|
+
DEFAULT_SECTIONS = { 'edit' => 'edit', 'update' => 'edit', 'show' => 'show', 'index' => 'index' }
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def set_default_section
|
13
|
+
DEFAULT_SECTIONS[action_name].andand.tap do |section|
|
14
|
+
in_sections section
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Clearance
|
2
|
+
class DisabledAccount < StandardError
|
3
|
+
end
|
4
|
+
end
|
5
|
+
|
6
|
+
# Trait to ensure disabled (locked, deleted) users cannot sign in.
|
7
|
+
# origin: RM
|
8
|
+
module ApplicationController::SecurityTrait::DisabledClearanceAccountsTrait
|
9
|
+
as_trait do
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def user_from_cookie_with_disabled_accounts
|
14
|
+
user = user_from_cookie_without_disabled_accounts
|
15
|
+
if user && user.account_disabled?
|
16
|
+
cookies.delete(:remember_token)
|
17
|
+
raise Clearance::DisabledAccount, "Signed out user ##{user.id} because her account has been disabled"
|
18
|
+
end
|
19
|
+
user
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method_chain :user_from_cookie, :disabled_accounts
|
23
|
+
|
24
|
+
def sign_in_with_disabled_accounts(user)
|
25
|
+
if user.account_disabled?
|
26
|
+
raise Clearance::DisabledAccount, "Cannot sign in user ##{user.id} because her account has been disabled"
|
27
|
+
else
|
28
|
+
sign_in_without_disabled_accounts(user)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
alias_method_chain :sign_in, :disabled_accounts
|
33
|
+
|
34
|
+
rescue_from Clearance::DisabledAccount, :with => :deny_access_to_disabled_account
|
35
|
+
|
36
|
+
def deny_access_to_disabled_account
|
37
|
+
deny_access translate('disabled_account', :default => "Your account has been disabled")
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Provides authorization, authentication and CSRF protections for controllers.
|
2
|
+
# origin: RM
|
3
|
+
module ApplicationController::SecurityTrait
|
4
|
+
|
5
|
+
as_trait do
|
6
|
+
|
7
|
+
include Aegis::Controller
|
8
|
+
include Clearance::Authentication
|
9
|
+
protect_from_forgery
|
10
|
+
filter_parameter_logging :password
|
11
|
+
|
12
|
+
# Require a signed in user by default
|
13
|
+
before_filter :authenticate
|
14
|
+
around_filter :rescue_access_denied
|
15
|
+
|
16
|
+
require_permissions
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# Override Clearance method so people not signed in are still users
|
21
|
+
def current_user
|
22
|
+
super || User.guest
|
23
|
+
end
|
24
|
+
|
25
|
+
# Override Clearance method for our notion of being signed in
|
26
|
+
def signed_in?
|
27
|
+
super && current_user != User.guest
|
28
|
+
end
|
29
|
+
|
30
|
+
# Override Clearance method for our notion of being signed in
|
31
|
+
def signed_out?
|
32
|
+
!signed_in?
|
33
|
+
end
|
34
|
+
|
35
|
+
# Override Clearance method so sessions time out after 1 hour
|
36
|
+
def sign_in(user)
|
37
|
+
if user
|
38
|
+
cookies[:remember_token] = {
|
39
|
+
:value => user.remember_token,
|
40
|
+
:expires => 1.hour.from_now.utc
|
41
|
+
}
|
42
|
+
self.current_user = user
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def rescue_access_denied
|
47
|
+
yield
|
48
|
+
rescue Aegis::AccessDenied => e
|
49
|
+
flash[:error] = 'Access denied'
|
50
|
+
redirect_to root_path
|
51
|
+
end
|
52
|
+
|
53
|
+
# Mark a controller that doesn''t require a signed in user
|
54
|
+
def self.public_controller(options = {})
|
55
|
+
skip_permissions
|
56
|
+
skip_before_filter :authenticate, options
|
57
|
+
end
|
58
|
+
|
59
|
+
def sign_in_url
|
60
|
+
new_session_path
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Base class for all controllers.
|
2
|
+
# origin: RM
|
3
|
+
class ApplicationController < ActionController::Base
|
4
|
+
include Modularity::Does
|
5
|
+
does 'application_controller/security'
|
6
|
+
does 'application_controller/i18n'
|
7
|
+
does 'application_controller/navigation'
|
8
|
+
does 'application_controller/security_trait/disabled_clearance_accounts'
|
9
|
+
|
10
|
+
helper :all
|
11
|
+
layout 'screen'
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Manages conferences as a conference creator. Also allows to sign up as an attendee and cancel the attendance again.
|
2
|
+
# origin: M
|
3
|
+
class ConferencesController < ApplicationController
|
4
|
+
|
5
|
+
public_controller :only => [:index, :show, :search]
|
6
|
+
|
7
|
+
in_sections :conferences
|
8
|
+
|
9
|
+
does 'boring_controller', :destroy_is_permanent => true, :order => :name
|
10
|
+
|
11
|
+
before_filter :set_category, :only => :index
|
12
|
+
|
13
|
+
permissions :conferences
|
14
|
+
|
15
|
+
create.before do
|
16
|
+
object.user = current_user
|
17
|
+
end
|
18
|
+
|
19
|
+
index.before do
|
20
|
+
in_sections :browse
|
21
|
+
@running_conferences = end_of_association_chain.running
|
22
|
+
@conference_search = ConferenceSearch.new
|
23
|
+
@categories = if @category
|
24
|
+
@category.children
|
25
|
+
else
|
26
|
+
Category.roots
|
27
|
+
end.by_name
|
28
|
+
end
|
29
|
+
|
30
|
+
def search
|
31
|
+
in_sections :search
|
32
|
+
@conference_search = ConferenceSearch.new(params[:conference_search] || {})
|
33
|
+
@conferences = paginate(@conference_search.find.by_name)
|
34
|
+
end
|
35
|
+
|
36
|
+
show.wants.ics do
|
37
|
+
send_data object.to_icalendar(current_user).encode, :type => 'text/calendar'
|
38
|
+
end
|
39
|
+
|
40
|
+
def attend
|
41
|
+
object.attend!(current_user)
|
42
|
+
flash[:success] = "You have signed up for #{object.name}"
|
43
|
+
redirect_to object_path
|
44
|
+
end
|
45
|
+
|
46
|
+
def cancel_attendance
|
47
|
+
object.cancel_attendance!(current_user)
|
48
|
+
flash[:success] = "You are no longer signed up for #{object.name}"
|
49
|
+
redirect_to object_path
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def set_category
|
55
|
+
if params[:category_id]
|
56
|
+
@category = Category.find(params[:category_id])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def end_of_association_chain
|
61
|
+
if @category
|
62
|
+
@category.conferences
|
63
|
+
else
|
64
|
+
Conference
|
65
|
+
end.by_name
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Accepts or rejects a friendship request.
|
2
|
+
# origin: M
|
3
|
+
class FriendshipRequestsController < ApplicationController
|
4
|
+
|
5
|
+
permissions :friends
|
6
|
+
|
7
|
+
def accept
|
8
|
+
if object.accept
|
9
|
+
flash[:notice] = 'Contact request accepted'
|
10
|
+
else
|
11
|
+
flash[:error] = 'Error accepting contact request'
|
12
|
+
end
|
13
|
+
redirect_to current_user
|
14
|
+
end
|
15
|
+
|
16
|
+
def deny
|
17
|
+
if object.deny
|
18
|
+
flash[:notice] = 'Contact request denied'
|
19
|
+
else
|
20
|
+
flash[:error] = 'Error denying contact request'
|
21
|
+
end
|
22
|
+
redirect_to current_user
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def object
|
28
|
+
@friendship_request ||= current_user.friendship_requests.find(params[:id])
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Sends, accept and dismisses conference invitations.
|
2
|
+
# origin: M
|
3
|
+
class InvitationsController < ApplicationController
|
4
|
+
|
5
|
+
resource_controller
|
6
|
+
|
7
|
+
permissions :invitations
|
8
|
+
|
9
|
+
in_sections :conferences, :invitations
|
10
|
+
|
11
|
+
def create
|
12
|
+
invitation = current_user.sent_invitations.create!(object_params)
|
13
|
+
flash[:notice] = "You have invited #{current_user.name_for(invitation.recipient)} to #{invitation.conference.name}"
|
14
|
+
redirect_to new_invitation_path(:invitation => { :conference_id => invitation.conference.id})
|
15
|
+
end
|
16
|
+
|
17
|
+
def accept
|
18
|
+
object.accept!
|
19
|
+
flash[:success] = "You have signed up for #{object.conference.name}"
|
20
|
+
redirect_to object.conference
|
21
|
+
end
|
22
|
+
|
23
|
+
def dismiss
|
24
|
+
object.dismiss!
|
25
|
+
flash[:notice] = "Invitation dismissed"
|
26
|
+
redirect_to conferences_path
|
27
|
+
end
|
28
|
+
|
29
|
+
def end_of_association_chain
|
30
|
+
current_user.received_invitations
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def object_params
|
36
|
+
(super || {}).slice(:conference_id, :recipient_id)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Shows the user list, searches users and sends friendship requests to multiple users at once.
|
2
|
+
# origin: M
|
3
|
+
class MembersController < ApplicationController
|
4
|
+
|
5
|
+
permissions :members
|
6
|
+
in_sections :members, :member_search
|
7
|
+
|
8
|
+
def index
|
9
|
+
@member_search ||= MemberSearch.new current_user, params[:member_search]
|
10
|
+
@matching_users = @member_search.users.by_username.paginate(:page => params[:page], :per_page => PAGE_SIZE)
|
11
|
+
end
|
12
|
+
|
13
|
+
def request_friendships
|
14
|
+
for user in User.active.scoped(:conditions => { :id => params[:friendship_request].andand[:user_id] })
|
15
|
+
user.friendship_requests.create! :requesting_user => current_user
|
16
|
+
end
|
17
|
+
flash[:notice] = 'Contact requests sent'
|
18
|
+
redirect_to members_path
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Lets users reset their password when they forgot or when their account was created by an admin.
|
2
|
+
# origin: RM
|
3
|
+
class PasswordsController < Clearance::PasswordsController
|
4
|
+
|
5
|
+
public_controller
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
# Be more gentle than the default Clearance implementation and redirect
|
10
|
+
# users to the password recovery from if the token is incorrect (or already used)
|
11
|
+
def forbid_non_existent_user
|
12
|
+
super
|
13
|
+
rescue ActionController::Forbidden => e
|
14
|
+
if User.exists?(params[:user_id])
|
15
|
+
redirect_to new_password_path(:user_id => params[:user_id])
|
16
|
+
else
|
17
|
+
raise e
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def url_after_create
|
22
|
+
new_session_path
|
23
|
+
end
|
24
|
+
|
25
|
+
def url_after_update
|
26
|
+
root_path
|
27
|
+
end
|
28
|
+
|
29
|
+
def flash_success_after_update
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Controller support for indestructible records that set deleted flags instead of destroying themselves.
|
2
|
+
# origin: RM
|
3
|
+
module BoringControllerTrait::DeletableTrait
|
4
|
+
as_trait do
|
5
|
+
|
6
|
+
def destroy
|
7
|
+
load_object
|
8
|
+
object.deleted = !object.deleted?
|
9
|
+
if object.save
|
10
|
+
if object.deleted?
|
11
|
+
set_flash :destroy
|
12
|
+
else
|
13
|
+
flash[:notice] = "#{translate_model_name(object)} restored"
|
14
|
+
end
|
15
|
+
redirect_to collection_url
|
16
|
+
else
|
17
|
+
set_flash :destroy_fails
|
18
|
+
redirect_to edit_object_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Provides good default flash messages for controller actions.
|
2
|
+
# origin: RM
|
3
|
+
module BoringControllerTrait::FlashTrait
|
4
|
+
as_trait do
|
5
|
+
|
6
|
+
create.success.flash lambda { "#{translate_model_name(object)} created" }
|
7
|
+
create.failure.flash lambda { error_flash("Could not save") }
|
8
|
+
|
9
|
+
update.success.flash lambda { "#{translate_model_name(object)} updated" }
|
10
|
+
update.failure.flash lambda { error_flash("Could not save") }
|
11
|
+
|
12
|
+
destroy.success.flash lambda { "#{translate_model_name(object)} deleted" }
|
13
|
+
destroy.failure.flash lambda { error_flash("Could not delete") }
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
# This is a hack because resource_controller uses flash[:notice] for everything
|
18
|
+
def error_flash(msg)
|
19
|
+
"<span class='error'>#{ERB::Util.html_escape msg}</span>".html_safe
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Provides macros to quickly configure a resource_controller.
|
2
|
+
# origin: RM
|
3
|
+
module BoringControllerTrait::HelpersTrait
|
4
|
+
as_trait do |options|
|
5
|
+
|
6
|
+
if options[:show_is_edit]
|
7
|
+
for action in [:show, :update, :create] do
|
8
|
+
send(action).wants.html do
|
9
|
+
redirect_to edit_object_path
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
if options[:for_forms]
|
15
|
+
before_filter :only => [:new, :create, :edit, :update] do |c|
|
16
|
+
c.send(options[:for_forms])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
if options[:model_name]
|
23
|
+
|
24
|
+
define_method :model_name do
|
25
|
+
options[:model_name]
|
26
|
+
end
|
27
|
+
|
28
|
+
define_method :object_name do
|
29
|
+
options[:model_name]
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|