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,125 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
class << self
|
8
|
+
def boot!
|
9
|
+
unless booted?
|
10
|
+
preinitialize
|
11
|
+
pick_boot.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def booted?
|
16
|
+
defined? Rails::Initializer
|
17
|
+
end
|
18
|
+
|
19
|
+
def pick_boot
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def vendor_rails?
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
+
end
|
26
|
+
|
27
|
+
def preinitialize
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def preinitializer_path
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Boot
|
37
|
+
def run
|
38
|
+
load_initializer
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VendorBoot < Boot
|
44
|
+
def load_initializer
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
Rails::GemDependency.add_frozen_gem_path
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class GemBoot < Boot
|
52
|
+
def load_initializer
|
53
|
+
self.class.load_rubygems
|
54
|
+
load_rails_gem
|
55
|
+
require 'initializer'
|
56
|
+
end
|
57
|
+
|
58
|
+
def load_rails_gem
|
59
|
+
if version = self.class.gem_version
|
60
|
+
gem 'rails', version
|
61
|
+
else
|
62
|
+
gem 'rails'
|
63
|
+
end
|
64
|
+
rescue Gem::LoadError => load_error
|
65
|
+
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
66
|
+
exit 1
|
67
|
+
end
|
68
|
+
|
69
|
+
class << self
|
70
|
+
def rubygems_version
|
71
|
+
Gem::RubyGemsVersion rescue nil
|
72
|
+
end
|
73
|
+
|
74
|
+
def gem_version
|
75
|
+
if defined? RAILS_GEM_VERSION
|
76
|
+
RAILS_GEM_VERSION
|
77
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
78
|
+
ENV['RAILS_GEM_VERSION']
|
79
|
+
else
|
80
|
+
parse_gem_version(read_environment_rb)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def load_rubygems
|
85
|
+
min_version = '1.3.2'
|
86
|
+
require 'rubygems'
|
87
|
+
unless rubygems_version >= min_version
|
88
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
|
92
|
+
rescue LoadError
|
93
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
94
|
+
exit 1
|
95
|
+
end
|
96
|
+
|
97
|
+
def parse_gem_version(text)
|
98
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
def read_environment_rb
|
103
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Patch in the bundler
|
110
|
+
class Rails::Boot
|
111
|
+
def run
|
112
|
+
load_initializer
|
113
|
+
|
114
|
+
Rails::Initializer.class_eval do
|
115
|
+
def load_gems
|
116
|
+
@bundler_loaded ||= Bundler.require :default, Rails.env
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
Rails::Initializer.run(:set_load_path)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# All that for this:
|
125
|
+
Rails.boot!
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%
|
2
|
+
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
+
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
|
5
|
+
%>
|
6
|
+
default: <%= std_opts %> features
|
7
|
+
wip: --tags @wip:3 --wip features
|
8
|
+
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Sample database settings.
|
2
|
+
# origin: GM
|
3
|
+
|
4
|
+
development:
|
5
|
+
adapter: mysql
|
6
|
+
database: platforms_development
|
7
|
+
encoding: utf8
|
8
|
+
username: root
|
9
|
+
password: secret
|
10
|
+
|
11
|
+
test:
|
12
|
+
adapter: mysql
|
13
|
+
database: platforms_test
|
14
|
+
encoding: utf8
|
15
|
+
username: root
|
16
|
+
password: secret
|
17
|
+
|
18
|
+
cucumber:
|
19
|
+
adapter: mysql
|
20
|
+
database: platforms_cucumber
|
21
|
+
encoding: utf8
|
22
|
+
username: root
|
23
|
+
password: secret
|
24
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Capistrano recipe for the production server
|
2
|
+
# origin: RM
|
3
|
+
|
4
|
+
set :user, "deploy-platforms"
|
5
|
+
set :deploy_to, '/opt/www/platforms.makandra.com'
|
6
|
+
set :rails_env, 'production'
|
7
|
+
set :branch, 'master'
|
8
|
+
server "vogler.makandra.de", :app, :web, :cron, :db, :primary => true
|
9
|
+
server "moeller.makandra.de", :app, :web
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# Capistrano recipe for deployment.
|
2
|
+
# origin: GM
|
3
|
+
|
4
|
+
set :stages, %w[ production ]
|
5
|
+
require 'capistrano/ext/multistage'
|
6
|
+
require 'bundler/capistrano'
|
7
|
+
|
8
|
+
set :use_sudo, false
|
9
|
+
set :deploy_via, :export
|
10
|
+
set :repository, "git@dev.makandra.de:platforms2"
|
11
|
+
set :scm, :git
|
12
|
+
|
13
|
+
ssh_options[:forward_agent] = true
|
14
|
+
|
15
|
+
namespace :passenger do
|
16
|
+
desc "Restart Application"
|
17
|
+
task :restart do
|
18
|
+
run "touch #{current_path}/tmp/restart.txt"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
namespace :db do
|
23
|
+
desc "Create database yaml in shared path"
|
24
|
+
task :default do
|
25
|
+
run "mkdir -p #{shared_path}/config"
|
26
|
+
put File.read("config/database.yml"), "#{shared_path}/config/database.yml"
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Make symlink for database yaml"
|
30
|
+
task :symlink do
|
31
|
+
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Warn about pending migrations"
|
35
|
+
task :warn_if_pending_migrations, :roles => :db, :only => { :primary => true } do
|
36
|
+
rails_env = fetch(:rails_env, 'production')
|
37
|
+
run "cd #{release_path}; rake db:warn_if_pending_migrations RAILS_ENV=#{rails_env}"
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Do a dump of the DB on the remote machine using dumple"
|
41
|
+
task :dump, :roles => :db do
|
42
|
+
rails_env = fetch(:rails_env, 'production')
|
43
|
+
run "cd #{current_path}; dumple --fail-gently #{rails_env}"
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "Show usage of ~/dumps/ on remote host"
|
47
|
+
task :show_dump_usage do
|
48
|
+
run "dumple -i"
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
namespace :deploy do
|
54
|
+
|
55
|
+
desc "Create storage dir in shared path"
|
56
|
+
task :setup_storage do
|
57
|
+
run "mkdir -p #{shared_path}/storage"
|
58
|
+
end
|
59
|
+
|
60
|
+
task :symlink_storage do
|
61
|
+
run "ln -nfs #{shared_path}/storage #{release_path}/storage"
|
62
|
+
end
|
63
|
+
|
64
|
+
task :restart do
|
65
|
+
passenger.restart
|
66
|
+
end
|
67
|
+
|
68
|
+
task :start do
|
69
|
+
end
|
70
|
+
|
71
|
+
task :stop do
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
namespace :craken do
|
78
|
+
|
79
|
+
desc "Install raketab"
|
80
|
+
task :install do
|
81
|
+
rails_env = fetch(:rails_env, 'production')
|
82
|
+
run "cd #{release_path} && rake craken:install RAILS_ENV=#{rails_env}"
|
83
|
+
end
|
84
|
+
|
85
|
+
desc "Uninstall raketab"
|
86
|
+
task :uninstall do
|
87
|
+
run "cd #{release_path} && rake craken:uninstall"
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
before "deploy:update_code", "db:dump"
|
94
|
+
before "deploy:setup", :db
|
95
|
+
after "deploy:update_code", "db:symlink"
|
96
|
+
after "deploy:update_code", "deploy:symlink_storage"
|
97
|
+
before "deploy:setup", 'deploy:setup_storage'
|
98
|
+
after "deploy:symlink", "db:warn_if_pending_migrations"
|
99
|
+
after "deploy:symlink", "craken:install"
|
100
|
+
after "deploy:restart", "db:show_dump_usage"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Application-wide settings.
|
2
|
+
# Be sure to restart your server when you modify this file
|
3
|
+
# origin: RM
|
4
|
+
|
5
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
6
|
+
RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION
|
7
|
+
|
8
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
9
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
10
|
+
|
11
|
+
PAGE_SIZE = 50
|
12
|
+
|
13
|
+
APPLICATION_TITLE = 'Conferences and Participants'
|
14
|
+
NO_REPLY_EMAIL = "no-reply@makandra.com"
|
15
|
+
APPLICATION_EMAIL = NO_REPLY_EMAIL
|
16
|
+
APPLICATION_HOST = "localhost"
|
17
|
+
|
18
|
+
Rails::Initializer.run do |config|
|
19
|
+
|
20
|
+
config.action_mailer.default_url_options = { :host => APPLICATION_HOST }
|
21
|
+
|
22
|
+
config.autoload_paths << "#{RAILS_ROOT}/app/controllers/shared"
|
23
|
+
config.autoload_paths << "#{RAILS_ROOT}/app/models/shared"
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
I18n.default_locale = "en"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Application settings for Cucumber tests.
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb.
|
3
|
+
# origin: GM
|
4
|
+
|
5
|
+
|
6
|
+
# Edit at your own peril - it's recommended to regenerate this file
|
7
|
+
# in the future when you upgrade to a newer version of Cucumber.
|
8
|
+
|
9
|
+
# IMPORTANT: Setting config.cache_classes to false is known to
|
10
|
+
# break Cucumber's use_transactional_fixtures method.
|
11
|
+
# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
|
12
|
+
config.cache_classes = true
|
13
|
+
|
14
|
+
# Log error messages when you accidentally call methods on nil.
|
15
|
+
config.whiny_nils = true
|
16
|
+
|
17
|
+
# Show full error reports and disable caching
|
18
|
+
config.action_controller.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
|
21
|
+
# Disable request forgery protection in test environment
|
22
|
+
config.action_controller.allow_forgery_protection = false
|
23
|
+
|
24
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
25
|
+
# The :test delivery method accumulates sent emails in the
|
26
|
+
# ActionMailer::Base.deliveries array.
|
27
|
+
config.action_mailer.delivery_method = :test
|
28
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Application settings for the development environment.
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb.
|
3
|
+
# origin: GM
|
4
|
+
|
5
|
+
|
6
|
+
# In the development environment your application's code is reloaded on
|
7
|
+
# every request. This slows down response time but is perfect for development
|
8
|
+
# since you don't have to restart the webserver when you make code changes.
|
9
|
+
config.cache_classes = false
|
10
|
+
|
11
|
+
# Log error messages when you accidentally call methods on nil.
|
12
|
+
config.whiny_nils = true
|
13
|
+
|
14
|
+
# Show full error reports and disable caching
|
15
|
+
config.action_controller.consider_all_requests_local = true
|
16
|
+
config.action_view.debug_rjs = true
|
17
|
+
config.action_controller.perform_caching = false
|
18
|
+
|
19
|
+
# Don't care if the mailer can't send
|
20
|
+
config.action_mailer.raise_delivery_errors = false
|
21
|
+
config.action_mailer.delivery_method = :test
|
22
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Application settings for the production environment.
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb.
|
3
|
+
# origin: GM
|
4
|
+
|
5
|
+
APPLICATION_HOST = "platforms.makandra.com"
|
6
|
+
|
7
|
+
# The production environment is meant for finished, "live" apps.
|
8
|
+
# Code is not reloaded between requests
|
9
|
+
config.cache_classes = true
|
10
|
+
|
11
|
+
# Full error reports are disabled and caching is turned on
|
12
|
+
config.action_controller.consider_all_requests_local = false
|
13
|
+
config.action_controller.perform_caching = true
|
14
|
+
config.action_view.cache_template_loading = true
|
15
|
+
|
16
|
+
# See everything in the log (default is :info)
|
17
|
+
# config.log_level = :debug
|
18
|
+
|
19
|
+
# Use a different logger for distributed setups
|
20
|
+
# config.logger = SyslogLogger.new
|
21
|
+
|
22
|
+
# Use a different cache store in production
|
23
|
+
# config.cache_store = :mem_cache_store
|
24
|
+
|
25
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
26
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
27
|
+
|
28
|
+
# Disable delivery errors, bad email addresses will be ignored
|
29
|
+
# config.action_mailer.raise_delivery_errors = false
|
30
|
+
|
31
|
+
# Enable threaded mode
|
32
|
+
# config.threadsafe!
|
33
|
+
|
34
|
+
config.action_mailer.default_url_options = { :host => APPLICATION_HOST }
|
35
|
+
config.action_mailer.delivery_method = :sendmail
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Application settings for RSpec test runs.
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb.
|
3
|
+
# origin: GM
|
4
|
+
|
5
|
+
# The test environment is used exclusively to run your application's
|
6
|
+
# test suite. You never need to work with it otherwise. Remember that
|
7
|
+
# your test database is "scratch space" for the test suite and is wiped
|
8
|
+
# and recreated between test runs. Don't rely on the data there!
|
9
|
+
config.cache_classes = true
|
10
|
+
|
11
|
+
# Log error messages when you accidentally call methods on nil.
|
12
|
+
config.whiny_nils = true
|
13
|
+
|
14
|
+
# Show full error reports and disable caching
|
15
|
+
config.action_controller.consider_all_requests_local = true
|
16
|
+
config.action_controller.perform_caching = false
|
17
|
+
config.action_view.cache_template_loading = true
|
18
|
+
|
19
|
+
# Disable request forgery protection in test environment
|
20
|
+
config.action_controller.allow_forgery_protection = false
|
21
|
+
|
22
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
23
|
+
# The :test delivery method accumulates sent emails in the
|
24
|
+
# ActionMailer::Base.deliveries array.
|
25
|
+
config.action_mailer.delivery_method = :test
|
26
|
+
|
27
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
28
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
29
|
+
# like if you have constraints or database-specific column types
|
30
|
+
# config.active_record.schema_format = :sql
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Utility methods to create hashes from collections.
|
2
|
+
# origin: RM
|
3
|
+
module Enumerable
|
4
|
+
|
5
|
+
def collect_hash(&pairer)
|
6
|
+
collect_into_hash({}, &pairer)
|
7
|
+
end
|
8
|
+
|
9
|
+
def collect_ordered_hash(&pairer)
|
10
|
+
collect_into_hash(ActiveSupport::OrderedHash.new, &pairer)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def collect_into_hash(hash, &pairer)
|
16
|
+
inject(hash) do |hash, key|
|
17
|
+
pair = pairer.call(key)
|
18
|
+
hash[pair[0]] = pair[1] unless pair.nil?
|
19
|
+
hash
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Patch for resource_controller to use collection_path with additional params.
|
2
|
+
# origin: RM
|
3
|
+
ResourceController::Helpers::Urls.module_eval do
|
4
|
+
|
5
|
+
protected
|
6
|
+
|
7
|
+
def collection_path_with_params(params = nil)
|
8
|
+
collection_path_without_params.tap do |path|
|
9
|
+
if params.present?
|
10
|
+
path << (path.include?('?') ? '&' : '?')
|
11
|
+
path << params.collect{ |key, value| "#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}" }.join('&')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
alias_method_chain :collection_path, :params
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Secret for encrypted/signed cookies.
|
2
|
+
# origin: GM
|
3
|
+
|
4
|
+
# Be sure to restart your server when you modify this file.
|
5
|
+
|
6
|
+
# Your secret key for verifying the integrity of signed cookies.
|
7
|
+
# If you change this key, all old signed cookies will become invalid!
|
8
|
+
# Make sure the secret is at least 30 characters and all random,
|
9
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
10
|
+
ActionController::Base.cookie_verifier_secret = 'o_6H-uxNj]9ybb.-&vu(w`S9*z*HPa2y+@w~[a@\S?6Tc`5-1;qx2dnAIvrbT}D,NE.>y`zjw21\6RjAvl25+]TXopE,/_&lj|fUC/O9aRgpk8f^8Y&e@[Ay=^=nh2fXV'
|
@@ -0,0 +1,166 @@
|
|
1
|
+
# Controls and helpers for forms.
|
2
|
+
# origin: RM
|
3
|
+
ActionView::Helpers::FormBuilder.class_eval do
|
4
|
+
|
5
|
+
def partial(name, locals = {})
|
6
|
+
@template.render name, locals.merge(:form => self)
|
7
|
+
end
|
8
|
+
|
9
|
+
def check_box_list(field, choices, options = {})
|
10
|
+
html = ""
|
11
|
+
name = nil
|
12
|
+
choices.each do |choice, label|
|
13
|
+
html << '<div class="check_box_with_label">'
|
14
|
+
name = "#{object_name}[#{field}][]"
|
15
|
+
id = "#{name}_#{choice}".gsub(/[^a-z0-9]/i, '_')
|
16
|
+
checked = object.send(field).include?(choice)
|
17
|
+
html << @template.check_box_tag(name, choice, checked, :id => id)
|
18
|
+
html << @template.label_tag(id, ERB::Util.html_escape(label || choice))
|
19
|
+
html << '</div>'
|
20
|
+
end
|
21
|
+
html << @template.hidden_field_tag(name, '') unless options[:allow_empty] # cannot serialize an empty list
|
22
|
+
html.html_safe
|
23
|
+
end
|
24
|
+
|
25
|
+
def error_message_on(attr)
|
26
|
+
message = Error.message(object, attr)
|
27
|
+
@template.content_tag(:div, message, :class => 'error_message') if message.present?
|
28
|
+
end
|
29
|
+
|
30
|
+
def spec_label(field, text = nil, options = {})
|
31
|
+
label_html = label(field)
|
32
|
+
id = extract_element_attribute(label_html, 'for')
|
33
|
+
text ||= extract_element_text(label_html)
|
34
|
+
@template.spec_label_tag(id, text, options)
|
35
|
+
end
|
36
|
+
|
37
|
+
def image_picker(field, options = {})
|
38
|
+
image = object.send(field)
|
39
|
+
image_url = image.url(*[options[:style]].compact)
|
40
|
+
html = ''
|
41
|
+
if image.exists?
|
42
|
+
destroy_field = "destroy_#{field}"
|
43
|
+
html = [@template.image_tag(image_url), check_box(destroy_field), label(destroy_field, "Bild löschen")].join(" ")
|
44
|
+
|
45
|
+
else
|
46
|
+
html = file_field field
|
47
|
+
end
|
48
|
+
@template.content_tag :span, html.html_safe, :class => 'image_picker'
|
49
|
+
end
|
50
|
+
|
51
|
+
def user_picker(field, choices, options = {})
|
52
|
+
collection_select(field, choices, :id, :email, { :include_blank => true }, :class => 'user_picker')
|
53
|
+
end
|
54
|
+
|
55
|
+
def date_picker(field, options = {})
|
56
|
+
append_class_option(options, "date_picker")
|
57
|
+
value = object.send(field)
|
58
|
+
if value.is_a?(Date)
|
59
|
+
value = I18n.l(value, :format => :default)
|
60
|
+
end
|
61
|
+
options[:value] = value
|
62
|
+
text_field(field, options)
|
63
|
+
end
|
64
|
+
|
65
|
+
def datetime_picker(field, options = {})
|
66
|
+
append_class_option(options, "datetime_picker")
|
67
|
+
value = object.send(field)
|
68
|
+
if value.is_a?(Time)
|
69
|
+
value = I18n.l(value, :format => :default)
|
70
|
+
end
|
71
|
+
options[:value] = value
|
72
|
+
text_field(field, options)
|
73
|
+
end
|
74
|
+
|
75
|
+
def money_field(field, options = {})
|
76
|
+
append_class_option(options, "money_field")
|
77
|
+
number_field(field, options.reverse_merge(:unit => "€", :money => true))
|
78
|
+
end
|
79
|
+
|
80
|
+
def number_field(field, options = {})
|
81
|
+
append_class_option(options, "number_field")
|
82
|
+
observe_with = options.delete(:observe_with)
|
83
|
+
unit = options.delete(:unit)
|
84
|
+
value = object.send(field)
|
85
|
+
unless value.blank? || value.is_a?(String)
|
86
|
+
value = value.with_comma(options[:money] ? 2 : nil)
|
87
|
+
end
|
88
|
+
options[:value] = value
|
89
|
+
text_field_html = text_field(field, options) + (unit.present? ? " #{unit}" : "")
|
90
|
+
text_field_id = extract_element_id(text_field_html)
|
91
|
+
html = ''
|
92
|
+
html << text_field_html
|
93
|
+
html << @template.observe_field(text_field_id, :frequency => 0.2, :function => observe_with) if observe_with
|
94
|
+
html.html_safe
|
95
|
+
end
|
96
|
+
|
97
|
+
def combo_box(field, choices, options = {})
|
98
|
+
if RAILS_ENV == 'test' || RAILS_ENV == 'cucumber'
|
99
|
+
text_field(field, options)
|
100
|
+
else
|
101
|
+
current_choice = object.send(field)
|
102
|
+
choices << current_choice unless current_choice.blank? || choices.include?(current_choice)
|
103
|
+
more_choice = "Neu..."
|
104
|
+
choices << more_choice
|
105
|
+
collection_select field, choices, :to_s, :to_s, { :include_blank => true }, options.merge(:class => "combo_box", 'data-combo_box_new_choice' => more_choice)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def tag_picker(field, options = {})
|
110
|
+
tag_classes = %w(xs s m l xl)
|
111
|
+
text_field_html = text_field(field, :autocomplete => 'off')
|
112
|
+
text_field_id = extract_element_id(text_field_html)
|
113
|
+
scope = options[:scope] || object.class #.scoped(:conditions => ["updated_at > ?", Time.now - 18.months])
|
114
|
+
cloud = ''
|
115
|
+
@template.tag_cloud(scope.tag_counts_on(options[:context] || :tags), tag_classes) do |tag, klass|
|
116
|
+
event = "$('##{@template.escape_javascript text_field_id}').tagPicker('add', '#{@template.escape_javascript tag.name}')"
|
117
|
+
cloud << @template.link_to_function(ERB::Util.html_escape(tag.name), event, :class => "tag #{klass}")
|
118
|
+
cloud << " "
|
119
|
+
end
|
120
|
+
html = ''
|
121
|
+
html << '<div class="tag_picker">'
|
122
|
+
html << text_field_html
|
123
|
+
html << '<div class="tag_cloud">'
|
124
|
+
html << cloud
|
125
|
+
html << '</div>'
|
126
|
+
html << '</div>'
|
127
|
+
#debugger
|
128
|
+
#html << scope.tag_counts.inspect
|
129
|
+
#html << ActsAsTaggableOn::Tag.all.inspect
|
130
|
+
#html << ActsAsTaggableOn::Tagging.all.inspect
|
131
|
+
html.html_safe
|
132
|
+
end
|
133
|
+
|
134
|
+
private
|
135
|
+
|
136
|
+
def extract_element_id(html)
|
137
|
+
extract_element_attribute(html, 'id')
|
138
|
+
end
|
139
|
+
|
140
|
+
def extract_element_attribute(html, attr)
|
141
|
+
/#{attr}=[\"\'](.*?)[\"\']/.match(html)[1]
|
142
|
+
end
|
143
|
+
|
144
|
+
def extract_element_text(html)
|
145
|
+
/^<(\w+).*?>(.*?)<\/\1.*?>$/.match(html)[2]
|
146
|
+
end
|
147
|
+
|
148
|
+
def append_class_option(options, klass)
|
149
|
+
options[:class] ||= ''
|
150
|
+
options[:class] << " #{klass}"
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
ActionView::Helpers::FormTagHelper.class_eval do
|
156
|
+
|
157
|
+
def spec_label_tag(id, text = nil, options = {})
|
158
|
+
@@spec_label_counts ||= Hash.new(0)
|
159
|
+
count_key = "#{object_id}/#{text}"
|
160
|
+
count = @@spec_label_counts[count_key]
|
161
|
+
html = label_tag(id, count == 0 ? text : "#{text} (#{count + 1})", options.merge(:class => "hidden"))
|
162
|
+
@@spec_label_counts[count_key] += 1
|
163
|
+
html
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|