xrono 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/.rspec +1 -0
- data/.travis.yml +20 -0
- data/Gemfile +30 -0
- data/Gemfile.lock +336 -0
- data/LICENSE +21 -0
- data/README.md +64 -0
- data/RELEASE_NOTES.md +83 -0
- data/Rakefile +15 -0
- data/XRONO.md +64 -0
- data/app/assets/images/chosen-sprite.png +0 -0
- data/app/assets/images/grid.png +0 -0
- data/app/assets/images/isotope_logo.png +0 -0
- data/app/assets/images/logo.png +0 -0
- data/app/assets/images/logo_122x40.png +0 -0
- data/app/assets/images/logo_97x40.png +0 -0
- data/app/assets/images/main_bg.jpg +0 -0
- data/app/assets/images/nav_bg.jpg +0 -0
- data/app/assets/images/rails.png +0 -0
- data/app/assets/images/top_bg.jpg +0 -0
- data/app/assets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/ui-bg_flat_0_fbf9ee_40x100.png +0 -0
- data/app/assets/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/app/assets/images/ui-bg_flat_65_ffffff_40x100.png +0 -0
- data/app/assets/images/ui-bg_flat_75_cccccc_40x100.png +0 -0
- data/app/assets/images/ui-bg_flat_75_dadada_40x100.png +0 -0
- data/app/assets/images/ui-bg_flat_75_e6e6e6_40x100.png +0 -0
- data/app/assets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/ui-bg_flat_95_fef1ec_40x100.png +0 -0
- data/app/assets/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/app/assets/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/app/assets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/app/assets/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/app/assets/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/app/assets/images/ui-icons_217bc0_256x240.png +0 -0
- data/app/assets/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/ui-icons_469bdd_256x240.png +0 -0
- data/app/assets/images/ui-icons_6da8d5_256x240.png +0 -0
- data/app/assets/images/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/app/assets/images/ui-icons_f9bd01_256x240.png +0 -0
- data/app/assets/javascripts/add_taxonomy.js.erb +307 -0
- data/app/assets/javascripts/admin_invoices.js +15 -0
- data/app/assets/javascripts/api/v1/clients.js.coffee +3 -0
- data/app/assets/javascripts/api/v1/tokens.js.coffee +3 -0
- data/app/assets/javascripts/application.js.erb +25 -0
- data/app/assets/javascripts/bootstrap-dropdown.js +92 -0
- data/app/assets/javascripts/bootstrap-tabs.js +80 -0
- data/app/assets/javascripts/bootstrap.js.coffee +4 -0
- data/app/assets/javascripts/calendar.js +25 -0
- data/app/assets/javascripts/chosen.jquery.js +898 -0
- data/app/assets/javascripts/client_login/clients.js.coffee +3 -0
- data/app/assets/javascripts/client_login/reports.js.coffee +3 -0
- data/app/assets/javascripts/comments.js +16 -0
- data/app/assets/javascripts/css_browser_selector.js +8 -0
- data/app/assets/javascripts/dashboard.js +3 -0
- data/app/assets/javascripts/data_vaults.js.coffee +3 -0
- data/app/assets/javascripts/file_attachments.js +9 -0
- data/app/assets/javascripts/jquery-tagselector.js +50 -0
- data/app/assets/javascripts/jquery-ui-1.8.16.custom.min.js +791 -0
- data/app/assets/javascripts/jquery.jeditable.js +543 -0
- data/app/assets/javascripts/jquery_ujs.js +336 -0
- data/app/assets/javascripts/schedule_modal.js +25 -0
- data/app/assets/javascripts/specify_project.js +21 -0
- data/app/assets/javascripts/ticket_board.js +104 -0
- data/app/assets/stylesheets/_jquery-ui-1.8.16.custom.css +568 -0
- data/app/assets/stylesheets/application.css +7 -0
- data/app/assets/stylesheets/bootstrap_and_overrides.css.scss +41 -0
- data/app/assets/stylesheets/chosen.css +367 -0
- data/app/assets/stylesheets/client_login/clients.css.scss +3 -0
- data/app/assets/stylesheets/client_login/reports.css.scss +3 -0
- data/app/assets/stylesheets/data_vaults.css.scss +3 -0
- data/app/assets/stylesheets/jquery-tagselector.css +49 -0
- data/app/assets/stylesheets/responsive.scss +650 -0
- data/app/assets/stylesheets/screen.scss +303 -0
- data/app/controllers/admin/base_controller.rb +18 -0
- data/app/controllers/admin/invoices_controller.rb +42 -0
- data/app/controllers/admin/payroll_controller.rb +29 -0
- data/app/controllers/admin/site_settings_controller.rb +19 -0
- data/app/controllers/admin/unentered_time_report_controller.rb +26 -0
- data/app/controllers/admin/users_controller.rb +86 -0
- data/app/controllers/admin/weekly_time_report_controller.rb +11 -0
- data/app/controllers/api/base_controller.rb +14 -0
- data/app/controllers/api/v1/base_controller.rb +2 -0
- data/app/controllers/api/v1/clients_controller.rb +10 -0
- data/app/controllers/api/v1/credentials_controller.rb +10 -0
- data/app/controllers/api/v1/projects_controller.rb +27 -0
- data/app/controllers/api/v1/tickets_controller.rb +46 -0
- data/app/controllers/api/v1/tokens_controller.rb +30 -0
- data/app/controllers/api/v1/work_units_controller.rb +23 -0
- data/app/controllers/client_login/base_controller.rb +3 -0
- data/app/controllers/client_login/clients_controller.rb +35 -0
- data/app/controllers/client_login/contacts_controller.rb +53 -0
- data/app/controllers/client_login/projects_controller.rb +24 -0
- data/app/controllers/client_login/reports_controller.rb +23 -0
- data/app/controllers/client_login/tickets_controller.rb +41 -0
- data/app/controllers/client_login/work_units_controller.rb +11 -0
- data/app/controllers/clients_controller.rb +103 -0
- data/app/controllers/comments_controller.rb +75 -0
- data/app/controllers/contacts_controller.rb +54 -0
- data/app/controllers/dashboard/base_controller.rb +79 -0
- data/app/controllers/data_vaults_controller.rb +12 -0
- data/app/controllers/doorkeeper/application_controller.rb +33 -0
- data/app/controllers/file_attachments_controller.rb +60 -0
- data/app/controllers/projects_controller.rb +62 -0
- data/app/controllers/tickets_controller.rb +48 -0
- data/app/controllers/users_controller.rb +57 -0
- data/app/controllers/work_units_controller.rb +114 -0
- data/app/controllers/xrono/application_controller.rb +65 -0
- data/app/helpers/admin/unentered_time_report_helper.rb +9 -0
- data/app/helpers/admin_base_helper.rb +14 -0
- data/app/helpers/clients_helper.rb +5 -0
- data/app/helpers/dashboard_helper.rb +9 -0
- data/app/helpers/gravatar_helper.rb +5 -0
- data/app/helpers/refurl_helper.rb +9 -0
- data/app/helpers/xrono/application_helper.rb +54 -0
- data/app/mailers/notifier.rb +18 -0
- data/app/models/chart_data.rb +20 -0
- data/app/models/client.rb +98 -0
- data/app/models/comment.rb +8 -0
- data/app/models/contact.rb +10 -0
- data/app/models/data_vault.rb +6 -0
- data/app/models/file_attachment.rb +8 -0
- data/app/models/project.rb +76 -0
- data/app/models/role.rb +3 -0
- data/app/models/roles_user.rb +4 -0
- data/app/models/site_settings.rb +4 -0
- data/app/models/ticket.rb +85 -0
- data/app/models/user.rb +147 -0
- data/app/models/weekly_time_report.rb +26 -0
- data/app/models/work_unit.rb +99 -0
- data/app/models/work_unit/finders.rb +67 -0
- data/app/views/admin/_nav.html.haml +1 -0
- data/app/views/admin/base/index.html.haml +3 -0
- data/app/views/admin/base/reports.html.haml +3 -0
- data/app/views/admin/invoices/index.html.haml +19 -0
- data/app/views/admin/invoices/show.html.haml +57 -0
- data/app/views/admin/payroll/index.html.haml +18 -0
- data/app/views/admin/payroll/show.html.haml +56 -0
- data/app/views/admin/site_settings/edit.html.haml +32 -0
- data/app/views/admin/unentered_time_report/_week_navigation.html.haml +6 -0
- data/app/views/admin/unentered_time_report/show.html.haml +16 -0
- data/app/views/admin/users/_form.html.haml +48 -0
- data/app/views/admin/users/_locked_users.html.haml +31 -0
- data/app/views/admin/users/_users_table.html.haml +25 -0
- data/app/views/admin/users/edit.html.haml +1 -0
- data/app/views/admin/users/index.html.haml +14 -0
- data/app/views/admin/users/locked_clients.html.haml +13 -0
- data/app/views/admin/users/locked_users.html.haml +13 -0
- data/app/views/admin/users/new.html.haml +1 -0
- data/app/views/admin/users/projects.html.haml +25 -0
- data/app/views/admin/users/unlocked_clients.html.haml +13 -0
- data/app/views/admin/weekly_time_report/_week_pagination.html.haml +11 -0
- data/app/views/admin/weekly_time_report/show.html.haml +41 -0
- data/app/views/client_login/_work_unit_index.haml +16 -0
- data/app/views/client_login/base/index.html.haml +18 -0
- data/app/views/client_login/clients/show.html.haml +32 -0
- data/app/views/client_login/contacts/_form.html.haml +34 -0
- data/app/views/client_login/contacts/edit.html.haml +4 -0
- data/app/views/client_login/contacts/index.html.haml +30 -0
- data/app/views/client_login/contacts/new.html.haml +5 -0
- data/app/views/client_login/contacts/show.html.haml +26 -0
- data/app/views/client_login/projects/_tickets.html.haml +31 -0
- data/app/views/client_login/projects/show.html.haml +8 -0
- data/app/views/client_login/reports/index.html.haml +4 -0
- data/app/views/client_login/reports/work_units.html.haml +96 -0
- data/app/views/client_login/tickets/_form.html.haml +33 -0
- data/app/views/client_login/tickets/new.html.haml +1 -0
- data/app/views/client_login/tickets/show.html.haml +23 -0
- data/app/views/client_login/work_units/show.html.haml +18 -0
- data/app/views/clients/_breadcrumbs.html.haml +2 -0
- data/app/views/clients/_clients_table.html.haml +24 -0
- data/app/views/clients/_form.html.haml +34 -0
- data/app/views/clients/_projects.html.haml +31 -0
- data/app/views/clients/edit.html.haml +1 -0
- data/app/views/clients/inactive_clients.html.haml +9 -0
- data/app/views/clients/index.html.haml +8 -0
- data/app/views/clients/new.html.haml +1 -0
- data/app/views/clients/show.html.haml +34 -0
- data/app/views/clients/suspended_clients.html.haml +8 -0
- data/app/views/comments/_comment.html.haml +46 -0
- data/app/views/comments/_comment_form.haml +29 -0
- data/app/views/comments/_comments.html.haml +3 -0
- data/app/views/contacts/_form.html.haml +34 -0
- data/app/views/contacts/edit.html.haml +1 -0
- data/app/views/contacts/index.html.haml +23 -0
- data/app/views/contacts/new.html.haml +1 -0
- data/app/views/contacts/show.html.haml +26 -0
- data/app/views/dashboard/base/_two_week_time_report.html.haml +13 -0
- data/app/views/dashboard/base/_week_pagination.html.haml +10 -0
- data/app/views/dashboard/base/calendar.html.haml +1 -0
- data/app/views/dashboard/base/calendar.js.erb +3 -0
- data/app/views/dashboard/base/index.html.haml +18 -0
- data/app/views/devise/confirmations/new.html.haml +9 -0
- data/app/views/devise/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/devise/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/devise/mailer/unlock_instructions.html.haml +5 -0
- data/app/views/devise/passwords/edit.html.haml +17 -0
- data/app/views/devise/passwords/new.html.haml +12 -0
- data/app/views/devise/registrations/edit.html.haml +36 -0
- data/app/views/devise/registrations/new.html.haml +32 -0
- data/app/views/devise/sessions/new.html.haml +22 -0
- data/app/views/devise/shared/_links.haml +15 -0
- data/app/views/devise/unlocks/new.html.haml +9 -0
- data/app/views/file_attachments/_file_attachment.html.haml +10 -0
- data/app/views/file_attachments/_file_attachment_combined.html.haml +30 -0
- data/app/views/file_attachments/_file_attachments.html.haml +5 -0
- data/app/views/file_attachments/new.html.haml +17 -0
- data/app/views/layouts/application.html.haml +32 -0
- data/app/views/layouts/doorkeeper.html.haml +31 -0
- data/app/views/notifier/daily.text.erb +8 -0
- data/app/views/notifier/work_unit_notification.text.erb +17 -0
- data/app/views/projects/_breadcrumbs.html.haml +5 -0
- data/app/views/projects/_form.html.haml +94 -0
- data/app/views/projects/_pie_chart_metrics.html.haml +4 -0
- data/app/views/projects/_specify.html.haml +11 -0
- data/app/views/projects/_ticket_table.html.haml +36 -0
- data/app/views/projects/edit.html.haml +2 -0
- data/app/views/projects/new.html.haml +2 -0
- data/app/views/projects/show.html.haml +57 -0
- data/app/views/shared/_calendar.html.haml +86 -0
- data/app/views/shared/_data_vault.html.haml +16 -0
- data/app/views/shared/_files_and_comments.html.haml +21 -0
- data/app/views/shared/_flashes.html.haml +10 -0
- data/app/views/shared/_javascripts.html.haml +8 -0
- data/app/views/shared/_menu.html.haml +14 -0
- data/app/views/shared/_user_roles.html.haml +7 -0
- data/app/views/shared/_work_unit_index.html.haml +24 -0
- data/app/views/tickets/_add_ticket.html.haml +27 -0
- data/app/views/tickets/_breadcrumbs.html.haml +8 -0
- data/app/views/tickets/_form.html.haml +40 -0
- data/app/views/tickets/_ticket_detail.html.haml +18 -0
- data/app/views/tickets/edit.html.haml +2 -0
- data/app/views/tickets/modal_new.html.haml +28 -0
- data/app/views/tickets/new.html.haml +1 -0
- data/app/views/tickets/show.html.haml +28 -0
- data/app/views/tickets/ticket_detail.html.haml +18 -0
- data/app/views/users/_change_password_form.haml +13 -0
- data/app/views/users/_user_head.html.haml +7 -0
- data/app/views/users/edit.haml +34 -0
- data/app/views/users/historical_time.html.haml +5 -0
- data/app/views/users/index.html.haml +18 -0
- data/app/views/users/show.html.haml +13 -0
- data/app/views/work_units/_add_work_unit.html.haml +81 -0
- data/app/views/work_units/_breadcrumbs.html.haml +11 -0
- data/app/views/work_units/_dashboard_line.html.haml +6 -0
- data/app/views/work_units/_edit_work_unit.haml +44 -0
- data/app/views/work_units/_shared_form.haml +40 -0
- data/app/views/work_units/edit.html.haml +2 -0
- data/app/views/work_units/index.html.haml +7 -0
- data/app/views/work_units/new.html.haml +6 -0
- data/app/views/work_units/show.html.haml +25 -0
- data/app/workers/daily_notifier_worker.rb +7 -0
- data/app/workers/work_unit_notifier_worker.rb +7 -0
- data/config.ru +7 -0
- data/config/admin_navigation.rb +71 -0
- data/config/admin_reports_navigation.rb +6 -0
- data/config/boot.rb +6 -0
- data/config/client_navigation.rb +64 -0
- data/config/cucumber.yml +8 -0
- data/config/initializers/00_requirements.rb +2 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/devise.rb +144 -0
- data/config/initializers/doorkeeper.rb +32 -0
- data/config/initializers/doorkeeper_monkeypatch.rb +66 -0
- data/config/initializers/github_concern.rb +4 -0
- data/config/initializers/haml.rb +13 -0
- data/config/initializers/inflections.rb +10 -0
- data/config/initializers/load_controller_mixins.rb +1 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/paper_clip.rb +1 -0
- data/config/initializers/simple_navigation.rb +1 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/devise.en.yml +39 -0
- data/config/locales/doorkeeper.en.yml +23 -0
- data/config/locales/en.yml +201 -0
- data/config/locales/faker.en.yml +48 -0
- data/config/navigation.rb +78 -0
- data/config/rackspace_cloudfiles.yml +14 -0
- data/config/routes.rb +113 -0
- data/config/secondary_navigation.rb +65 -0
- data/config/trinidad.yml +4 -0
- data/config/warble.rb +144 -0
- data/db/migrate/20100825165612_create_clients.rb +14 -0
- data/db/migrate/20100825185313_create_projects.rb +14 -0
- data/db/migrate/20100825223943_create_tickets.rb +16 -0
- data/db/migrate/20100902174920_create_work_units.rb +14 -0
- data/db/migrate/20100902190129_add_missing_fields_to_work_units.rb +13 -0
- data/db/migrate/20100904173839_add_guid_to_clients_projects_tickets_and_work_orders.rb +13 -0
- data/db/migrate/20100922181642_create_comments.rb +19 -0
- data/db/migrate/20100927180254_devise_create_users.rb +32 -0
- data/db/migrate/20100927184505_add_details_to_users.rb +13 -0
- data/db/migrate/20100927191329_add_user_to_work_units.rb +9 -0
- data/db/migrate/20100928163356_create_roles.rb +22 -0
- data/db/migrate/20100928203745_create_addresses.rb +19 -0
- data/db/migrate/20100928204544_create_contacts.rb +17 -0
- data/db/migrate/20101007175626_add_lockable_to_users.rb +11 -0
- data/db/migrate/20101020162216_add_paid_at_to_work_units_table.rb +9 -0
- data/db/migrate/20101020162516_add_check_number_to_work_units_table.rb +9 -0
- data/db/migrate/20101020215135_add_paid_field_to_work_units_table.rb +9 -0
- data/db/migrate/20101020215226_add_invoiced_field_to_work_units_table.rb +9 -0
- data/db/migrate/20101020215457_remove_paid_at_from_work_units_table.rb +9 -0
- data/db/migrate/20101020215624_remove_check_number_from_work_units_table.rb +9 -0
- data/db/migrate/20101025161443_add_invoiced_at_to_work_units_table.rb +9 -0
- data/db/migrate/20101026151900_add_initials_to_clients.rb +9 -0
- data/db/migrate/20101029145059_create_file_attachments.rb +18 -0
- data/db/migrate/20101030142615_add_guid_to_users.rb +9 -0
- data/db/migrate/20101102145137_add_paid_at_to_work_units.rb +9 -0
- data/db/migrate/20101112151337_add_active_to_comments.rb +9 -0
- data/db/migrate/20101119172727_add_recieves_email_to_contact.rb +10 -0
- data/db/migrate/20101122225423_projects_users.rb +11 -0
- data/db/migrate/20101129214537_remove_projects_users_table.rb +11 -0
- data/db/migrate/20101130225328_contact_receives_email.rb +9 -0
- data/db/migrate/20101202203051_add_address_to_contacts.rb +19 -0
- data/db/migrate/20101202214746_remove_address_table.rb +17 -0
- data/db/migrate/20101216214304_add_hours_type_to_work_unit.rb +9 -0
- data/db/migrate/20101217152455_add_effective_hours_to_work_units.rb +9 -0
- data/db/migrate/20101228154820_add_overtime_multiplier_to_clients_table.rb +9 -0
- data/db/migrate/20101228154951_add_overtime_multiplier_to_projects_table.rb +9 -0
- data/db/migrate/20101228155122_create_site_settings_table.rb +11 -0
- data/db/migrate/20110107190927_add_site_logo_columns_to_site_settings.rb +15 -0
- data/db/migrate/20110111155513_add_total_yearly_pto_per_user_to_site_settings.rb +9 -0
- data/db/migrate/20110111220015_add_not_valid_to_file_attachment.rb +9 -0
- data/db/migrate/20110125153818_add_fullwidth_to_users.rb +9 -0
- data/db/migrate/20110222162404_add_daily_target_hours_to_users.rb +9 -0
- data/db/migrate/20110310021732_add_client_to_site_settings.rb +9 -0
- data/db/migrate/20110630194044_add_expanded_calendar_to_user.rb +9 -0
- data/db/migrate/20110922175742_add_state_to_tickets.rb +9 -0
- data/db/migrate/20111212193345_add_estimated_hours_to_tickets.rb +5 -0
- data/db/migrate/20111216152557_add_client_boolean_to_user.rb +5 -0
- data/db/migrate/20111220193307_add_repo_and_branch_to_projects_and_ticket.rb +6 -0
- data/db/migrate/20111220193619_create_git_pushes.rb +9 -0
- data/db/migrate/20111220193620_create_git_commits.rb +10 -0
- data/db/migrate/20111220193621_add_user_id_to_git_push.rb +5 -0
- data/db/migrate/20111220193622_create_github_concernable_git_pushes.rb +11 -0
- data/db/migrate/20111227140859_add_token_to_user.rb +7 -0
- data/db/migrate/20120102185406_add_completed_boolean_to_ticket.rb +5 -0
- data/db/migrate/20120104132121_add_completed_to_project.rb +5 -0
- data/db/migrate/20120124184915_modify_project_for_new_git_integration.rb +11 -0
- data/db/migrate/20120125145833_add_rates_to_project.rb +6 -0
- data/db/migrate/20120126151009_create_data_vaults.rb +11 -0
- data/db/migrate/20120126151341_create_versions.rb +18 -0
- data/db/migrate/20120126154403_rename_column_data_to_encrypted_data.rb +8 -0
- data/db/migrate/20120221193022_add_index_to_user_id_on_work_units.rb +5 -0
- data/db/migrate/20120221195345_acts_as_taggable_on_migration.rb +30 -0
- data/db/migrate/20120320212313_remove_timestamps_from_roles_users_table.rb +11 -0
- data/db/migrate/20120710034831_create_doorkeeper_tables.rb +42 -0
- data/db/migrate/20121021122002_add_missing_indices.rb +21 -0
- data/doc/website/favicon.ico +0 -0
- data/doc/website/images/clock_box.png +0 -0
- data/doc/website/images/demo.png +0 -0
- data/doc/website/images/download.png +0 -0
- data/doc/website/images/fork_me.png +0 -0
- data/doc/website/images/lightbox-blank.gif +0 -0
- data/doc/website/images/lightbox-btn-close.gif +0 -0
- data/doc/website/images/lightbox-btn-next.gif +0 -0
- data/doc/website/images/lightbox-btn-prev.gif +0 -0
- data/doc/website/images/lightbox-ico-loading.gif +0 -0
- data/doc/website/images/main_bg.png +0 -0
- data/doc/website/images/nav_bg.png +0 -0
- data/doc/website/images/screen_1.png +0 -0
- data/doc/website/images/screen_2.png +0 -0
- data/doc/website/images/screen_3.png +0 -0
- data/doc/website/images/screen_4.png +0 -0
- data/doc/website/images/screen_5.png +0 -0
- data/doc/website/images/screen_6.png +0 -0
- data/doc/website/images/support.png +0 -0
- data/doc/website/images/thumb_1.png +0 -0
- data/doc/website/images/thumb_2.png +0 -0
- data/doc/website/images/thumb_3.png +0 -0
- data/doc/website/images/thumb_4.png +0 -0
- data/doc/website/images/thumb_5.png +0 -0
- data/doc/website/images/thumb_6.png +0 -0
- data/doc/website/images/xrono_logo.png +0 -0
- data/doc/website/index.html +274 -0
- data/doc/website/javascripts/application.js +18 -0
- data/doc/website/javascripts/greyscalebasic_regular.typeface.js +1 -0
- data/doc/website/javascripts/jquery.lightbox-0.5.min.js +42 -0
- data/doc/website/javascripts/jquery.min.js +32 -0
- data/doc/website/javascripts/jquery.tweet.js +181 -0
- data/doc/website/javascripts/typeface.js +873 -0
- data/doc/website/javascripts/verdana_regular.typeface.js +1 -0
- data/doc/website/stylesheets/jquery.lightbox.css +104 -0
- data/doc/website/stylesheets/jquery.tweet.css +38 -0
- data/doc/website/stylesheets/reset-fonts-grids.css +32 -0
- data/doc/website/stylesheets/screen.css +228 -0
- data/doc/xrono_dash.png +0 -0
- data/doc/xrono_ticket.png +0 -0
- data/features/admin/invoices.feature +37 -0
- data/features/admin/manage_users.feature +17 -0
- data/features/admin/payroll.feature +64 -0
- data/features/admin/roles.feature +9 -0
- data/features/admin/site_settings.feature +19 -0
- data/features/admin/unentered_time_report.feature +38 -0
- data/features/admin/weekly_time_report.feature +14 -0
- data/features/api/v1/clients_controller.feature +58 -0
- data/features/authorization-admin.feature +34 -0
- data/features/authorization-non-admin.feature +38 -0
- data/features/client_login.feature +15 -0
- data/features/collaborative_work_units.feature +112 -0
- data/features/daily_emails.feature +11 -0
- data/features/dashboard.feature +74 -0
- data/features/manage_clients.feature +116 -0
- data/features/manage_comments.feature +30 -0
- data/features/manage_contacts.feature +56 -0
- data/features/manage_file_attachments.feature +51 -0
- data/features/manage_projects.feature +92 -0
- data/features/manage_self.feature +48 -0
- data/features/manage_tickets.feature +74 -0
- data/features/manage_users.feature +76 -0
- data/features/manage_work_units.feature +115 -0
- data/features/mockups/images/asset-tracker-client-show.png +0 -0
- data/features/mockups/images/asset-tracker.png +0 -0
- data/features/mockups/images/ixi - asset tracker v3 homepage - no time entered modal.png +0 -0
- data/features/mockups/images/ixi - asset tracker v3 homepage - schedule on modal.png +0 -0
- data/features/mockups/images/ixi - asset tracker v3 homepage.png +0 -0
- data/features/mockups/ixi - asset tracker v3 homepage - no time entered modal.bmml +194 -0
- data/features/mockups/ixi - asset tracker v3 homepage - schedule on modal.bmml +208 -0
- data/features/mockups/ixi - asset tracker v3 homepage.bmml +172 -0
- data/features/project_assignment.feature +69 -0
- data/features/search_work_units.feature +38 -0
- data/features/step_definitions/calendar_expansion_steps.rb +7 -0
- data/features/step_definitions/client_login_steps.rb +8 -0
- data/features/step_definitions/client_steps.rb +29 -0
- data/features/step_definitions/comment_steps.rb +4 -0
- data/features/step_definitions/contact_steps.rb +22 -0
- data/features/step_definitions/debug_steps.rb +5 -0
- data/features/step_definitions/devise_steps.rb +26 -0
- data/features/step_definitions/email_steps.rb +74 -0
- data/features/step_definitions/file_attachment_steps.rb +8 -0
- data/features/step_definitions/modified_web_steps.rb +25 -0
- data/features/step_definitions/pickle_steps.rb +101 -0
- data/features/step_definitions/project_steps.rb +32 -0
- data/features/step_definitions/search_steps.rb +3 -0
- data/features/step_definitions/ticket_board_steps.rb +39 -0
- data/features/step_definitions/ticket_detail_steps.rb +9 -0
- data/features/step_definitions/ticket_steps.rb +12 -0
- data/features/step_definitions/unentered_time_report_steps.rb +3 -0
- data/features/step_definitions/user_steps.rb +43 -0
- data/features/step_definitions/web_steps.rb +274 -0
- data/features/step_definitions/weekly_time_report_steps.rb +7 -0
- data/features/step_definitions/work_unit_index_steps.rb +8 -0
- data/features/step_definitions/work_unit_steps.rb +39 -0
- data/features/support/email.rb +21 -0
- data/features/support/env.rb +80 -0
- data/features/support/paths.rb +96 -0
- data/features/support/pickle.rb +26 -0
- data/features/support/selectors.rb +51 -0
- data/features/support/xrono.rb +19 -0
- data/features/work_unit_notifier.feature +11 -0
- data/lib/controller_mixins.rb +5 -0
- data/lib/controller_mixins/authorization.rb +15 -0
- data/lib/controller_mixins/contacts.rb +37 -0
- data/lib/controller_mixins/generic.rb +15 -0
- data/lib/controller_mixins/tickets.rb +35 -0
- data/lib/controller_mixins/work_units.rb +13 -0
- data/lib/date_ext.rb +16 -0
- data/lib/guid_referenced.rb +19 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/acts_as_commentable_tasks.rake +4 -0
- data/lib/tasks/cucumber.rake +65 -0
- data/lib/tasks/git_repo_tasks.rake +47 -0
- data/lib/tasks/notifications.rake +8 -0
- data/lib/tasks/paperclip_tasks.rake +79 -0
- data/lib/xrono.rb +1 -0
- data/lib/xrono/engine.rb +45 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/favicon.ico +0 -0
- data/public/favicon.psd +0 -0
- data/public/robots.txt +5 -0
- data/public/stylesheets/.gitkeep +0 -0
- data/public/stylesheets/ie.css +53 -0
- data/public/stylesheets/print.css +57 -0
- data/public/stylesheets/screen.css +182 -0
- data/script/cucumber +10 -0
- data/script/rails +6 -0
- data/spec/blueprints.rb +86 -0
- data/spec/controllers/api/v1/clients_controller_spec.rb +41 -0
- data/spec/controllers/api/v1/projects_controller_spec.rb +54 -0
- data/spec/controllers/api/v1/tickets_controller_spec.rb +122 -0
- data/spec/controllers/api/v1/tokens_controller_spec.rb +52 -0
- data/spec/controllers/client_login/clients_controller_spec.rb +5 -0
- data/spec/controllers/client_login/reports_controller_spec.rb +5 -0
- data/spec/controllers/data_vaults_controller_spec.rb +5 -0
- data/spec/internal/app/controllers/application_controller.rb +5 -0
- data/spec/internal/config/admin_navigation.rb +71 -0
- data/spec/internal/config/database.yml +14 -0
- data/spec/internal/config/database.yml.example +20 -0
- data/spec/internal/config/database.yml.mysql +20 -0
- data/spec/internal/config/database.yml.mysql.jruby +20 -0
- data/spec/internal/config/database.yml.postgres +20 -0
- data/spec/internal/config/database.yml.postgres.jruby +20 -0
- data/spec/internal/config/navigation.rb +80 -0
- data/spec/internal/config/routes.rb +3 -0
- data/spec/internal/config/secondary_navigation.rb +65 -0
- data/spec/internal/db/schema.rb +296 -0
- data/spec/internal/log/.gitignore +1 -0
- data/spec/internal/public/favicon.ico +0 -0
- data/spec/internal/public/system/attachment_files/2/original/tmp.txt +1 -0
- data/spec/internal/public/system/attachment_files/3/original/tmp.txt +1 -0
- data/spec/lib/date_ext_spec.rb +40 -0
- data/spec/mailers/notifier_spec.rb +9 -0
- data/spec/models/client_spec.rb +167 -0
- data/spec/models/contact_spec.rb +29 -0
- data/spec/models/data_vault_spec.rb +5 -0
- data/spec/models/project_spec.rb +115 -0
- data/spec/models/ticket_spec.rb +223 -0
- data/spec/models/user_spec.rb +258 -0
- data/spec/models/work_unit_spec.rb +467 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/support/xrono/macros.rb +15 -0
- data/vendor/plugins/.gitkeep +0 -0
- data/xrono.gemspec +50 -0
- metadata +1209 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
$(".datepicker").datepicker();
|
2
|
+
|
3
|
+
$("#global_invoiced").keyup(function() {
|
4
|
+
value = $("#global_invoiced").val();
|
5
|
+
$(".global").each(function() {
|
6
|
+
this.value = value;
|
7
|
+
});
|
8
|
+
});
|
9
|
+
|
10
|
+
$(".ticket_invoiced").keyup(function() {
|
11
|
+
value = this.value
|
12
|
+
$("." + this.id).each(function() {
|
13
|
+
this.value = value;
|
14
|
+
});
|
15
|
+
});
|
@@ -0,0 +1,25 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery_ujs
|
3
|
+
//= require jquery-ui-1.8.16.custom.min.js
|
4
|
+
//= require admin_invoices
|
5
|
+
//= require calendar
|
6
|
+
//= require comments
|
7
|
+
//= require css_browser_selector
|
8
|
+
//= require dashboard
|
9
|
+
//= require file_attachments
|
10
|
+
//= require schedule_modal
|
11
|
+
//= require chosen.jquery.js
|
12
|
+
//= require jquery.jeditable.js
|
13
|
+
//= require bootstrap-tooltip
|
14
|
+
//= require bootstrap-dropdown
|
15
|
+
|
16
|
+
|
17
|
+
// Place your application-specific JavaScript functions and classes here
|
18
|
+
// This file is automatically included by javascript_include_tag :defaults
|
19
|
+
|
20
|
+
$(function() {
|
21
|
+
<% unless Rails.env.test? || Rails.env.cucumber? %>
|
22
|
+
<% # only use chosen in dev r prod - it breaks cukes %>
|
23
|
+
$(".chzn-select").chosen();
|
24
|
+
<% end %>
|
25
|
+
});
|
@@ -0,0 +1,92 @@
|
|
1
|
+
/* ============================================================
|
2
|
+
* bootstrap-dropdown.js v2.0.2
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
|
4
|
+
* ============================================================
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* ============================================================ */
|
19
|
+
|
20
|
+
|
21
|
+
!function( $ ){
|
22
|
+
|
23
|
+
"use strict"
|
24
|
+
|
25
|
+
/* DROPDOWN CLASS DEFINITION
|
26
|
+
* ========================= */
|
27
|
+
|
28
|
+
var toggle = '[data-toggle="dropdown"]'
|
29
|
+
, Dropdown = function ( element ) {
|
30
|
+
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
31
|
+
$('html').on('click.dropdown.data-api', function () {
|
32
|
+
$el.parent().removeClass('open')
|
33
|
+
})
|
34
|
+
}
|
35
|
+
|
36
|
+
Dropdown.prototype = {
|
37
|
+
|
38
|
+
constructor: Dropdown
|
39
|
+
|
40
|
+
, toggle: function ( e ) {
|
41
|
+
var $this = $(this)
|
42
|
+
, selector = $this.attr('data-target')
|
43
|
+
, $parent
|
44
|
+
, isActive
|
45
|
+
|
46
|
+
if (!selector) {
|
47
|
+
selector = $this.attr('href')
|
48
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
49
|
+
}
|
50
|
+
|
51
|
+
$parent = $(selector)
|
52
|
+
$parent.length || ($parent = $this.parent())
|
53
|
+
|
54
|
+
isActive = $parent.hasClass('open')
|
55
|
+
|
56
|
+
clearMenus()
|
57
|
+
!isActive && $parent.toggleClass('open')
|
58
|
+
|
59
|
+
return false
|
60
|
+
}
|
61
|
+
|
62
|
+
}
|
63
|
+
|
64
|
+
function clearMenus() {
|
65
|
+
$(toggle).parent().removeClass('open')
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
/* DROPDOWN PLUGIN DEFINITION
|
70
|
+
* ========================== */
|
71
|
+
|
72
|
+
$.fn.dropdown = function ( option ) {
|
73
|
+
return this.each(function () {
|
74
|
+
var $this = $(this)
|
75
|
+
, data = $this.data('dropdown')
|
76
|
+
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
|
77
|
+
if (typeof option == 'string') data[option].call($this)
|
78
|
+
})
|
79
|
+
}
|
80
|
+
|
81
|
+
$.fn.dropdown.Constructor = Dropdown
|
82
|
+
|
83
|
+
|
84
|
+
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
85
|
+
* =================================== */
|
86
|
+
|
87
|
+
$(function () {
|
88
|
+
$('html').on('click.dropdown.data-api', clearMenus)
|
89
|
+
$('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
90
|
+
})
|
91
|
+
|
92
|
+
}( window.jQuery );
|
@@ -0,0 +1,80 @@
|
|
1
|
+
/* ========================================================
|
2
|
+
* bootstrap-tabs.js v1.4.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#tabs
|
4
|
+
* ========================================================
|
5
|
+
* Copyright 2011 Twitter, Inc.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* ======================================================== */
|
19
|
+
|
20
|
+
|
21
|
+
!function( $ ){
|
22
|
+
|
23
|
+
"use strict"
|
24
|
+
|
25
|
+
function activate ( element, container ) {
|
26
|
+
container
|
27
|
+
.find('> .active')
|
28
|
+
.removeClass('active')
|
29
|
+
.find('> .dropdown-menu > .active')
|
30
|
+
.removeClass('active')
|
31
|
+
|
32
|
+
element.addClass('active')
|
33
|
+
|
34
|
+
if ( element.parent('.dropdown-menu') ) {
|
35
|
+
element.closest('li.dropdown').addClass('active')
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
function tab( e ) {
|
40
|
+
var $this = $(this)
|
41
|
+
, $ul = $this.closest('ul:not(.dropdown-menu)')
|
42
|
+
, href = $this.attr('href')
|
43
|
+
, previous
|
44
|
+
, $href
|
45
|
+
|
46
|
+
if ( /^#\w+/.test(href) ) {
|
47
|
+
e.preventDefault()
|
48
|
+
|
49
|
+
if ( $this.parent('li').hasClass('active') ) {
|
50
|
+
return
|
51
|
+
}
|
52
|
+
|
53
|
+
previous = $ul.find('.active a').last()[0]
|
54
|
+
$href = $(href)
|
55
|
+
|
56
|
+
activate($this.parent('li'), $ul)
|
57
|
+
activate($href, $href.parent())
|
58
|
+
|
59
|
+
$this.trigger({
|
60
|
+
type: 'change'
|
61
|
+
, relatedTarget: previous
|
62
|
+
})
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
/* TABS/PILLS PLUGIN DEFINITION
|
68
|
+
* ============================ */
|
69
|
+
|
70
|
+
$.fn.tabs = $.fn.pills = function ( selector ) {
|
71
|
+
return this.each(function () {
|
72
|
+
$(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab)
|
73
|
+
})
|
74
|
+
}
|
75
|
+
|
76
|
+
$(document).ready(function () {
|
77
|
+
$('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
|
78
|
+
})
|
79
|
+
|
80
|
+
}( window.jQuery || window.ender );
|
@@ -0,0 +1,25 @@
|
|
1
|
+
//hide/show work unit description
|
2
|
+
$('tr.calendar_top .expand').live('click', function() {
|
3
|
+
$(this).parents('.calendar').find('a').siblings('.description').each(function() {
|
4
|
+
$(this).toggle('fast');
|
5
|
+
$(this).toggleClass("expand");
|
6
|
+
});
|
7
|
+
return false;
|
8
|
+
});
|
9
|
+
|
10
|
+
function show_by_default(status)
|
11
|
+
{
|
12
|
+
if (status == true)
|
13
|
+
{
|
14
|
+
$('.calendar').find('a').siblings('.description').each(function() {
|
15
|
+
$(this).show();
|
16
|
+
$(this).addClass("expand");
|
17
|
+
});
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
if (typeof calendar_expansion_default === 'undefined') {
|
22
|
+
calendar_expansion_default = false;
|
23
|
+
}
|
24
|
+
|
25
|
+
show_by_default(calendar_expansion_default);
|
@@ -0,0 +1,898 @@
|
|
1
|
+
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
2
|
+
// by Patrick Filler for Harvest, http://getharvest.com
|
3
|
+
//
|
4
|
+
// Version 0.9.5
|
5
|
+
// Full source at https://github.com/harvesthq/chosen
|
6
|
+
// Copyright (c) 2011 Harvest http://getharvest.com
|
7
|
+
|
8
|
+
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
9
|
+
// This file is generated by `cake build`, do not edit it by hand.
|
10
|
+
(function() {
|
11
|
+
var SelectParser;
|
12
|
+
SelectParser = (function() {
|
13
|
+
function SelectParser() {
|
14
|
+
this.options_index = 0;
|
15
|
+
this.parsed = [];
|
16
|
+
}
|
17
|
+
SelectParser.prototype.add_node = function(child) {
|
18
|
+
if (child.nodeName === "OPTGROUP") {
|
19
|
+
return this.add_group(child);
|
20
|
+
} else {
|
21
|
+
return this.add_option(child);
|
22
|
+
}
|
23
|
+
};
|
24
|
+
SelectParser.prototype.add_group = function(group) {
|
25
|
+
var group_position, option, _i, _len, _ref, _results;
|
26
|
+
group_position = this.parsed.length;
|
27
|
+
this.parsed.push({
|
28
|
+
array_index: group_position,
|
29
|
+
group: true,
|
30
|
+
label: group.label,
|
31
|
+
children: 0,
|
32
|
+
disabled: group.disabled
|
33
|
+
});
|
34
|
+
_ref = group.childNodes;
|
35
|
+
_results = [];
|
36
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
37
|
+
option = _ref[_i];
|
38
|
+
_results.push(this.add_option(option, group_position, group.disabled));
|
39
|
+
}
|
40
|
+
return _results;
|
41
|
+
};
|
42
|
+
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
43
|
+
if (option.nodeName === "OPTION") {
|
44
|
+
if (option.text !== "") {
|
45
|
+
if (group_position != null) {
|
46
|
+
this.parsed[group_position].children += 1;
|
47
|
+
}
|
48
|
+
this.parsed.push({
|
49
|
+
array_index: this.parsed.length,
|
50
|
+
options_index: this.options_index,
|
51
|
+
value: option.value,
|
52
|
+
text: option.text,
|
53
|
+
html: option.innerHTML,
|
54
|
+
selected: option.selected,
|
55
|
+
disabled: group_disabled === true ? group_disabled : option.disabled,
|
56
|
+
group_array_index: group_position,
|
57
|
+
classes: option.className,
|
58
|
+
style: option.style.cssText
|
59
|
+
});
|
60
|
+
} else {
|
61
|
+
this.parsed.push({
|
62
|
+
array_index: this.parsed.length,
|
63
|
+
options_index: this.options_index,
|
64
|
+
empty: true
|
65
|
+
});
|
66
|
+
}
|
67
|
+
return this.options_index += 1;
|
68
|
+
}
|
69
|
+
};
|
70
|
+
return SelectParser;
|
71
|
+
})();
|
72
|
+
SelectParser.select_to_array = function(select) {
|
73
|
+
var child, parser, _i, _len, _ref;
|
74
|
+
parser = new SelectParser();
|
75
|
+
_ref = select.childNodes;
|
76
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
77
|
+
child = _ref[_i];
|
78
|
+
parser.add_node(child);
|
79
|
+
}
|
80
|
+
return parser.parsed;
|
81
|
+
};
|
82
|
+
this.SelectParser = SelectParser;
|
83
|
+
}).call(this);
|
84
|
+
(function() {
|
85
|
+
/*
|
86
|
+
Chosen source: generate output using 'cake build'
|
87
|
+
Copyright (c) 2011 by Harvest
|
88
|
+
*/
|
89
|
+
var AbstractChosen, root;
|
90
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
91
|
+
root = this;
|
92
|
+
AbstractChosen = (function() {
|
93
|
+
function AbstractChosen(form_field, options) {
|
94
|
+
this.form_field = form_field;
|
95
|
+
this.options = options != null ? options : {};
|
96
|
+
this.set_default_values();
|
97
|
+
this.is_multiple = this.form_field.multiple;
|
98
|
+
this.default_text_default = this.is_multiple ? "Select Some Options" : "Select an Option";
|
99
|
+
this.setup();
|
100
|
+
this.set_up_html();
|
101
|
+
this.register_observers();
|
102
|
+
this.finish_setup();
|
103
|
+
}
|
104
|
+
AbstractChosen.prototype.set_default_values = function() {
|
105
|
+
this.click_test_action = __bind(function(evt) {
|
106
|
+
return this.test_active_click(evt);
|
107
|
+
}, this);
|
108
|
+
this.activate_action = __bind(function(evt) {
|
109
|
+
return this.activate_field(evt);
|
110
|
+
}, this);
|
111
|
+
this.active_field = false;
|
112
|
+
this.mouse_on_container = false;
|
113
|
+
this.results_showing = false;
|
114
|
+
this.result_highlighted = null;
|
115
|
+
this.result_single_selected = null;
|
116
|
+
this.allow_single_deselect = (this.options.allow_single_deselect != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
117
|
+
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
118
|
+
this.choices = 0;
|
119
|
+
return this.results_none_found = this.options.no_results_text || "No results match";
|
120
|
+
};
|
121
|
+
AbstractChosen.prototype.mouse_enter = function() {
|
122
|
+
return this.mouse_on_container = true;
|
123
|
+
};
|
124
|
+
AbstractChosen.prototype.mouse_leave = function() {
|
125
|
+
return this.mouse_on_container = false;
|
126
|
+
};
|
127
|
+
AbstractChosen.prototype.input_focus = function(evt) {
|
128
|
+
if (!this.active_field) {
|
129
|
+
return setTimeout((__bind(function() {
|
130
|
+
return this.container_mousedown();
|
131
|
+
}, this)), 50);
|
132
|
+
}
|
133
|
+
};
|
134
|
+
AbstractChosen.prototype.input_blur = function(evt) {
|
135
|
+
if (!this.mouse_on_container) {
|
136
|
+
this.active_field = false;
|
137
|
+
return setTimeout((__bind(function() {
|
138
|
+
return this.blur_test();
|
139
|
+
}, this)), 100);
|
140
|
+
}
|
141
|
+
};
|
142
|
+
AbstractChosen.prototype.result_add_option = function(option) {
|
143
|
+
var classes, style;
|
144
|
+
if (!option.disabled) {
|
145
|
+
option.dom_id = this.container_id + "_o_" + option.array_index;
|
146
|
+
classes = option.selected && this.is_multiple ? [] : ["active-result"];
|
147
|
+
if (option.selected) {
|
148
|
+
classes.push("result-selected");
|
149
|
+
}
|
150
|
+
if (option.group_array_index != null) {
|
151
|
+
classes.push("group-option");
|
152
|
+
}
|
153
|
+
if (option.classes !== "") {
|
154
|
+
classes.push(option.classes);
|
155
|
+
}
|
156
|
+
style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
|
157
|
+
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
|
158
|
+
} else {
|
159
|
+
return "";
|
160
|
+
}
|
161
|
+
};
|
162
|
+
AbstractChosen.prototype.results_update_field = function() {
|
163
|
+
this.result_clear_highlight();
|
164
|
+
this.result_single_selected = null;
|
165
|
+
return this.results_build();
|
166
|
+
};
|
167
|
+
AbstractChosen.prototype.results_toggle = function() {
|
168
|
+
if (this.results_showing) {
|
169
|
+
return this.results_hide();
|
170
|
+
} else {
|
171
|
+
return this.results_show();
|
172
|
+
}
|
173
|
+
};
|
174
|
+
AbstractChosen.prototype.results_search = function(evt) {
|
175
|
+
if (this.results_showing) {
|
176
|
+
return this.winnow_results();
|
177
|
+
} else {
|
178
|
+
return this.results_show();
|
179
|
+
}
|
180
|
+
};
|
181
|
+
AbstractChosen.prototype.keyup_checker = function(evt) {
|
182
|
+
var stroke, _ref;
|
183
|
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
184
|
+
this.search_field_scale();
|
185
|
+
switch (stroke) {
|
186
|
+
case 8:
|
187
|
+
if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
|
188
|
+
return this.keydown_backstroke();
|
189
|
+
} else if (!this.pending_backstroke) {
|
190
|
+
this.result_clear_highlight();
|
191
|
+
return this.results_search();
|
192
|
+
}
|
193
|
+
break;
|
194
|
+
case 13:
|
195
|
+
evt.preventDefault();
|
196
|
+
if (this.results_showing) {
|
197
|
+
return this.result_select(evt);
|
198
|
+
}
|
199
|
+
break;
|
200
|
+
case 27:
|
201
|
+
if (this.results_showing) {
|
202
|
+
return this.results_hide();
|
203
|
+
}
|
204
|
+
break;
|
205
|
+
case 9:
|
206
|
+
case 38:
|
207
|
+
case 40:
|
208
|
+
case 16:
|
209
|
+
case 91:
|
210
|
+
case 17:
|
211
|
+
break;
|
212
|
+
default:
|
213
|
+
return this.results_search();
|
214
|
+
}
|
215
|
+
};
|
216
|
+
AbstractChosen.prototype.generate_field_id = function() {
|
217
|
+
var new_id;
|
218
|
+
new_id = this.generate_random_id();
|
219
|
+
this.form_field.id = new_id;
|
220
|
+
return new_id;
|
221
|
+
};
|
222
|
+
AbstractChosen.prototype.generate_random_char = function() {
|
223
|
+
var chars, newchar, rand;
|
224
|
+
chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
|
225
|
+
rand = Math.floor(Math.random() * chars.length);
|
226
|
+
return newchar = chars.substring(rand, rand + 1);
|
227
|
+
};
|
228
|
+
return AbstractChosen;
|
229
|
+
})();
|
230
|
+
root.AbstractChosen = AbstractChosen;
|
231
|
+
}).call(this);
|
232
|
+
(function() {
|
233
|
+
/*
|
234
|
+
Chosen source: generate output using 'cake build'
|
235
|
+
Copyright (c) 2011 by Harvest
|
236
|
+
*/
|
237
|
+
var $, Chosen, get_side_border_padding, root;
|
238
|
+
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
|
239
|
+
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
|
240
|
+
function ctor() { this.constructor = child; }
|
241
|
+
ctor.prototype = parent.prototype;
|
242
|
+
child.prototype = new ctor;
|
243
|
+
child.__super__ = parent.prototype;
|
244
|
+
return child;
|
245
|
+
}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
246
|
+
root = this;
|
247
|
+
$ = jQuery;
|
248
|
+
$.fn.extend({
|
249
|
+
chosen: function(options) {
|
250
|
+
if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
|
251
|
+
return this;
|
252
|
+
}
|
253
|
+
return $(this).each(function(input_field) {
|
254
|
+
if (!($(this)).hasClass("chzn-done")) {
|
255
|
+
return new Chosen(this, options);
|
256
|
+
}
|
257
|
+
});
|
258
|
+
}
|
259
|
+
});
|
260
|
+
Chosen = (function() {
|
261
|
+
__extends(Chosen, AbstractChosen);
|
262
|
+
function Chosen() {
|
263
|
+
Chosen.__super__.constructor.apply(this, arguments);
|
264
|
+
}
|
265
|
+
Chosen.prototype.setup = function() {
|
266
|
+
this.form_field_jq = $(this.form_field);
|
267
|
+
return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
|
268
|
+
};
|
269
|
+
Chosen.prototype.finish_setup = function() {
|
270
|
+
return this.form_field_jq.addClass("chzn-done");
|
271
|
+
};
|
272
|
+
Chosen.prototype.set_up_html = function() {
|
273
|
+
var container_div, dd_top, dd_width, sf_width;
|
274
|
+
this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
|
275
|
+
this.container_id += "_chzn";
|
276
|
+
this.f_width = this.form_field_jq.outerWidth();
|
277
|
+
this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
|
278
|
+
container_div = $("<div />", {
|
279
|
+
id: this.container_id,
|
280
|
+
"class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
|
281
|
+
style: 'width: ' + this.f_width + 'px;'
|
282
|
+
});
|
283
|
+
if (this.is_multiple) {
|
284
|
+
container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
|
285
|
+
} else {
|
286
|
+
container_div.html('<a href="javascript:void(0)" class="chzn-single"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
|
287
|
+
}
|
288
|
+
this.form_field_jq.hide().after(container_div);
|
289
|
+
this.container = $('#' + this.container_id);
|
290
|
+
this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
|
291
|
+
this.dropdown = this.container.find('div.chzn-drop').first();
|
292
|
+
dd_top = this.container.height();
|
293
|
+
dd_width = this.f_width - get_side_border_padding(this.dropdown);
|
294
|
+
this.dropdown.css({
|
295
|
+
"width": dd_width + "px",
|
296
|
+
"top": dd_top + "px"
|
297
|
+
});
|
298
|
+
this.search_field = this.container.find('input').first();
|
299
|
+
this.search_results = this.container.find('ul.chzn-results').first();
|
300
|
+
this.search_field_scale();
|
301
|
+
this.search_no_results = this.container.find('li.no-results').first();
|
302
|
+
if (this.is_multiple) {
|
303
|
+
this.search_choices = this.container.find('ul.chzn-choices').first();
|
304
|
+
this.search_container = this.container.find('li.search-field').first();
|
305
|
+
} else {
|
306
|
+
this.search_container = this.container.find('div.chzn-search').first();
|
307
|
+
this.selected_item = this.container.find('.chzn-single').first();
|
308
|
+
sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
|
309
|
+
this.search_field.css({
|
310
|
+
"width": sf_width + "px"
|
311
|
+
});
|
312
|
+
}
|
313
|
+
this.results_build();
|
314
|
+
this.set_tab_index();
|
315
|
+
return this.form_field_jq.trigger("liszt:ready", {
|
316
|
+
chosen: this
|
317
|
+
});
|
318
|
+
};
|
319
|
+
Chosen.prototype.register_observers = function() {
|
320
|
+
this.container.mousedown(__bind(function(evt) {
|
321
|
+
return this.container_mousedown(evt);
|
322
|
+
}, this));
|
323
|
+
this.container.mouseup(__bind(function(evt) {
|
324
|
+
return this.container_mouseup(evt);
|
325
|
+
}, this));
|
326
|
+
this.container.mouseenter(__bind(function(evt) {
|
327
|
+
return this.mouse_enter(evt);
|
328
|
+
}, this));
|
329
|
+
this.container.mouseleave(__bind(function(evt) {
|
330
|
+
return this.mouse_leave(evt);
|
331
|
+
}, this));
|
332
|
+
this.search_results.mouseup(__bind(function(evt) {
|
333
|
+
return this.search_results_mouseup(evt);
|
334
|
+
}, this));
|
335
|
+
this.search_results.mouseover(__bind(function(evt) {
|
336
|
+
return this.search_results_mouseover(evt);
|
337
|
+
}, this));
|
338
|
+
this.search_results.mouseout(__bind(function(evt) {
|
339
|
+
return this.search_results_mouseout(evt);
|
340
|
+
}, this));
|
341
|
+
this.form_field_jq.bind("liszt:updated", __bind(function(evt) {
|
342
|
+
return this.results_update_field(evt);
|
343
|
+
}, this));
|
344
|
+
this.search_field.blur(__bind(function(evt) {
|
345
|
+
return this.input_blur(evt);
|
346
|
+
}, this));
|
347
|
+
this.search_field.keyup(__bind(function(evt) {
|
348
|
+
return this.keyup_checker(evt);
|
349
|
+
}, this));
|
350
|
+
this.search_field.keydown(__bind(function(evt) {
|
351
|
+
return this.keydown_checker(evt);
|
352
|
+
}, this));
|
353
|
+
if (this.is_multiple) {
|
354
|
+
this.search_choices.click(__bind(function(evt) {
|
355
|
+
return this.choices_click(evt);
|
356
|
+
}, this));
|
357
|
+
return this.search_field.focus(__bind(function(evt) {
|
358
|
+
return this.input_focus(evt);
|
359
|
+
}, this));
|
360
|
+
}
|
361
|
+
};
|
362
|
+
Chosen.prototype.search_field_disabled = function() {
|
363
|
+
this.is_disabled = this.form_field_jq[0].disabled;
|
364
|
+
if (this.is_disabled) {
|
365
|
+
this.container.addClass('chzn-disabled');
|
366
|
+
this.search_field[0].disabled = true;
|
367
|
+
if (!this.is_multiple) {
|
368
|
+
this.selected_item.unbind("focus", this.activate_action);
|
369
|
+
}
|
370
|
+
return this.close_field();
|
371
|
+
} else {
|
372
|
+
this.container.removeClass('chzn-disabled');
|
373
|
+
this.search_field[0].disabled = false;
|
374
|
+
if (!this.is_multiple) {
|
375
|
+
return this.selected_item.bind("focus", this.activate_action);
|
376
|
+
}
|
377
|
+
}
|
378
|
+
};
|
379
|
+
Chosen.prototype.container_mousedown = function(evt) {
|
380
|
+
var target_closelink;
|
381
|
+
if (!this.is_disabled) {
|
382
|
+
target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
|
383
|
+
if (evt && evt.type === "mousedown") {
|
384
|
+
evt.stopPropagation();
|
385
|
+
}
|
386
|
+
if (!this.pending_destroy_click && !target_closelink) {
|
387
|
+
if (!this.active_field) {
|
388
|
+
if (this.is_multiple) {
|
389
|
+
this.search_field.val("");
|
390
|
+
}
|
391
|
+
$(document).click(this.click_test_action);
|
392
|
+
this.results_show();
|
393
|
+
} else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) {
|
394
|
+
evt.preventDefault();
|
395
|
+
this.results_toggle();
|
396
|
+
}
|
397
|
+
return this.activate_field();
|
398
|
+
} else {
|
399
|
+
return this.pending_destroy_click = false;
|
400
|
+
}
|
401
|
+
}
|
402
|
+
};
|
403
|
+
Chosen.prototype.container_mouseup = function(evt) {
|
404
|
+
if (evt.target.nodeName === "ABBR") {
|
405
|
+
return this.results_reset(evt);
|
406
|
+
}
|
407
|
+
};
|
408
|
+
Chosen.prototype.blur_test = function(evt) {
|
409
|
+
if (!this.active_field && this.container.hasClass("chzn-container-active")) {
|
410
|
+
return this.close_field();
|
411
|
+
}
|
412
|
+
};
|
413
|
+
Chosen.prototype.close_field = function() {
|
414
|
+
$(document).unbind("click", this.click_test_action);
|
415
|
+
if (!this.is_multiple) {
|
416
|
+
this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
|
417
|
+
this.search_field.attr("tabindex", -1);
|
418
|
+
}
|
419
|
+
this.active_field = false;
|
420
|
+
this.results_hide();
|
421
|
+
this.container.removeClass("chzn-container-active");
|
422
|
+
this.winnow_results_clear();
|
423
|
+
this.clear_backstroke();
|
424
|
+
this.show_search_field_default();
|
425
|
+
return this.search_field_scale();
|
426
|
+
};
|
427
|
+
Chosen.prototype.activate_field = function() {
|
428
|
+
if (!this.is_multiple && !this.active_field) {
|
429
|
+
this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
|
430
|
+
this.selected_item.attr("tabindex", -1);
|
431
|
+
}
|
432
|
+
this.container.addClass("chzn-container-active");
|
433
|
+
this.active_field = true;
|
434
|
+
this.search_field.val(this.search_field.val());
|
435
|
+
return this.search_field.focus();
|
436
|
+
};
|
437
|
+
Chosen.prototype.test_active_click = function(evt) {
|
438
|
+
if ($(evt.target).parents('#' + this.container_id).length) {
|
439
|
+
return this.active_field = true;
|
440
|
+
} else {
|
441
|
+
return this.close_field();
|
442
|
+
}
|
443
|
+
};
|
444
|
+
Chosen.prototype.results_build = function() {
|
445
|
+
var content, data, _i, _len, _ref;
|
446
|
+
this.parsing = true;
|
447
|
+
this.results_data = root.SelectParser.select_to_array(this.form_field);
|
448
|
+
if (this.is_multiple && this.choices > 0) {
|
449
|
+
this.search_choices.find("li.search-choice").remove();
|
450
|
+
this.choices = 0;
|
451
|
+
} else if (!this.is_multiple) {
|
452
|
+
this.selected_item.find("span").text(this.default_text);
|
453
|
+
if (this.form_field.options.length <= this.disable_search_threshold) {
|
454
|
+
this.container.addClass("chzn-container-single-nosearch");
|
455
|
+
} else {
|
456
|
+
this.container.removeClass("chzn-container-single-nosearch");
|
457
|
+
}
|
458
|
+
}
|
459
|
+
content = '';
|
460
|
+
_ref = this.results_data;
|
461
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
462
|
+
data = _ref[_i];
|
463
|
+
if (data.group) {
|
464
|
+
content += this.result_add_group(data);
|
465
|
+
} else if (!data.empty) {
|
466
|
+
content += this.result_add_option(data);
|
467
|
+
if (data.selected && this.is_multiple) {
|
468
|
+
this.choice_build(data);
|
469
|
+
} else if (data.selected && !this.is_multiple) {
|
470
|
+
this.selected_item.find("span").text(data.text);
|
471
|
+
if (this.allow_single_deselect) {
|
472
|
+
this.single_deselect_control_build();
|
473
|
+
}
|
474
|
+
}
|
475
|
+
}
|
476
|
+
}
|
477
|
+
this.search_field_disabled();
|
478
|
+
this.show_search_field_default();
|
479
|
+
this.search_field_scale();
|
480
|
+
this.search_results.html(content);
|
481
|
+
return this.parsing = false;
|
482
|
+
};
|
483
|
+
Chosen.prototype.result_add_group = function(group) {
|
484
|
+
if (!group.disabled) {
|
485
|
+
group.dom_id = this.container_id + "_g_" + group.array_index;
|
486
|
+
return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
|
487
|
+
} else {
|
488
|
+
return "";
|
489
|
+
}
|
490
|
+
};
|
491
|
+
Chosen.prototype.result_do_highlight = function(el) {
|
492
|
+
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
493
|
+
if (el.length) {
|
494
|
+
this.result_clear_highlight();
|
495
|
+
this.result_highlight = el;
|
496
|
+
this.result_highlight.addClass("highlighted");
|
497
|
+
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
498
|
+
visible_top = this.search_results.scrollTop();
|
499
|
+
visible_bottom = maxHeight + visible_top;
|
500
|
+
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
501
|
+
high_bottom = high_top + this.result_highlight.outerHeight();
|
502
|
+
if (high_bottom >= visible_bottom) {
|
503
|
+
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
504
|
+
} else if (high_top < visible_top) {
|
505
|
+
return this.search_results.scrollTop(high_top);
|
506
|
+
}
|
507
|
+
}
|
508
|
+
};
|
509
|
+
Chosen.prototype.result_clear_highlight = function() {
|
510
|
+
if (this.result_highlight) {
|
511
|
+
this.result_highlight.removeClass("highlighted");
|
512
|
+
}
|
513
|
+
return this.result_highlight = null;
|
514
|
+
};
|
515
|
+
Chosen.prototype.results_show = function() {
|
516
|
+
var dd_top;
|
517
|
+
if (!this.is_multiple) {
|
518
|
+
this.selected_item.addClass("chzn-single-with-drop");
|
519
|
+
if (this.result_single_selected) {
|
520
|
+
this.result_do_highlight(this.result_single_selected);
|
521
|
+
}
|
522
|
+
}
|
523
|
+
dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
|
524
|
+
this.dropdown.css({
|
525
|
+
"top": dd_top + "px",
|
526
|
+
"left": 0
|
527
|
+
});
|
528
|
+
this.results_showing = true;
|
529
|
+
this.search_field.focus();
|
530
|
+
this.search_field.val(this.search_field.val());
|
531
|
+
return this.winnow_results();
|
532
|
+
};
|
533
|
+
Chosen.prototype.results_hide = function() {
|
534
|
+
if (!this.is_multiple) {
|
535
|
+
this.selected_item.removeClass("chzn-single-with-drop");
|
536
|
+
}
|
537
|
+
this.result_clear_highlight();
|
538
|
+
this.dropdown.css({
|
539
|
+
"left": "-9000px"
|
540
|
+
});
|
541
|
+
return this.results_showing = false;
|
542
|
+
};
|
543
|
+
Chosen.prototype.set_tab_index = function(el) {
|
544
|
+
var ti;
|
545
|
+
if (this.form_field_jq.attr("tabindex")) {
|
546
|
+
ti = this.form_field_jq.attr("tabindex");
|
547
|
+
this.form_field_jq.attr("tabindex", -1);
|
548
|
+
if (this.is_multiple) {
|
549
|
+
return this.search_field.attr("tabindex", ti);
|
550
|
+
} else {
|
551
|
+
this.selected_item.attr("tabindex", ti);
|
552
|
+
return this.search_field.attr("tabindex", -1);
|
553
|
+
}
|
554
|
+
}
|
555
|
+
};
|
556
|
+
Chosen.prototype.show_search_field_default = function() {
|
557
|
+
if (this.is_multiple && this.choices < 1 && !this.active_field) {
|
558
|
+
this.search_field.val(this.default_text);
|
559
|
+
return this.search_field.addClass("default");
|
560
|
+
} else {
|
561
|
+
this.search_field.val("");
|
562
|
+
return this.search_field.removeClass("default");
|
563
|
+
}
|
564
|
+
};
|
565
|
+
Chosen.prototype.search_results_mouseup = function(evt) {
|
566
|
+
var target;
|
567
|
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
568
|
+
if (target.length) {
|
569
|
+
this.result_highlight = target;
|
570
|
+
return this.result_select(evt);
|
571
|
+
}
|
572
|
+
};
|
573
|
+
Chosen.prototype.search_results_mouseover = function(evt) {
|
574
|
+
var target;
|
575
|
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
576
|
+
if (target) {
|
577
|
+
return this.result_do_highlight(target);
|
578
|
+
}
|
579
|
+
};
|
580
|
+
Chosen.prototype.search_results_mouseout = function(evt) {
|
581
|
+
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
582
|
+
return this.result_clear_highlight();
|
583
|
+
}
|
584
|
+
};
|
585
|
+
Chosen.prototype.choices_click = function(evt) {
|
586
|
+
evt.preventDefault();
|
587
|
+
if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
|
588
|
+
return this.results_show();
|
589
|
+
}
|
590
|
+
};
|
591
|
+
Chosen.prototype.choice_build = function(item) {
|
592
|
+
var choice_id, link;
|
593
|
+
choice_id = this.container_id + "_c_" + item.array_index;
|
594
|
+
this.choices += 1;
|
595
|
+
this.search_container.before('<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>');
|
596
|
+
link = $('#' + choice_id).find("a").first();
|
597
|
+
return link.click(__bind(function(evt) {
|
598
|
+
return this.choice_destroy_link_click(evt);
|
599
|
+
}, this));
|
600
|
+
};
|
601
|
+
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
602
|
+
evt.preventDefault();
|
603
|
+
if (!this.is_disabled) {
|
604
|
+
this.pending_destroy_click = true;
|
605
|
+
return this.choice_destroy($(evt.target));
|
606
|
+
} else {
|
607
|
+
return evt.stopPropagation;
|
608
|
+
}
|
609
|
+
};
|
610
|
+
Chosen.prototype.choice_destroy = function(link) {
|
611
|
+
this.choices -= 1;
|
612
|
+
this.show_search_field_default();
|
613
|
+
if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
|
614
|
+
this.results_hide();
|
615
|
+
}
|
616
|
+
this.result_deselect(link.attr("rel"));
|
617
|
+
return link.parents('li').first().remove();
|
618
|
+
};
|
619
|
+
Chosen.prototype.results_reset = function(evt) {
|
620
|
+
this.form_field.options[0].selected = true;
|
621
|
+
this.selected_item.find("span").text(this.default_text);
|
622
|
+
this.show_search_field_default();
|
623
|
+
$(evt.target).remove();
|
624
|
+
this.form_field_jq.trigger("change");
|
625
|
+
if (this.active_field) {
|
626
|
+
return this.results_hide();
|
627
|
+
}
|
628
|
+
};
|
629
|
+
Chosen.prototype.result_select = function(evt) {
|
630
|
+
var high, high_id, item, position;
|
631
|
+
if (this.result_highlight) {
|
632
|
+
high = this.result_highlight;
|
633
|
+
high_id = high.attr("id");
|
634
|
+
this.result_clear_highlight();
|
635
|
+
if (this.is_multiple) {
|
636
|
+
this.result_deactivate(high);
|
637
|
+
} else {
|
638
|
+
this.search_results.find(".result-selected").removeClass("result-selected");
|
639
|
+
this.result_single_selected = high;
|
640
|
+
}
|
641
|
+
high.addClass("result-selected");
|
642
|
+
position = high_id.substr(high_id.lastIndexOf("_") + 1);
|
643
|
+
item = this.results_data[position];
|
644
|
+
item.selected = true;
|
645
|
+
this.form_field.options[item.options_index].selected = true;
|
646
|
+
if (this.is_multiple) {
|
647
|
+
this.choice_build(item);
|
648
|
+
} else {
|
649
|
+
this.selected_item.find("span").first().text(item.text);
|
650
|
+
if (this.allow_single_deselect) {
|
651
|
+
this.single_deselect_control_build();
|
652
|
+
}
|
653
|
+
}
|
654
|
+
if (!(evt.metaKey && this.is_multiple)) {
|
655
|
+
this.results_hide();
|
656
|
+
}
|
657
|
+
this.search_field.val("");
|
658
|
+
this.form_field_jq.trigger("change");
|
659
|
+
return this.search_field_scale();
|
660
|
+
}
|
661
|
+
};
|
662
|
+
Chosen.prototype.result_activate = function(el) {
|
663
|
+
return el.addClass("active-result");
|
664
|
+
};
|
665
|
+
Chosen.prototype.result_deactivate = function(el) {
|
666
|
+
return el.removeClass("active-result");
|
667
|
+
};
|
668
|
+
Chosen.prototype.result_deselect = function(pos) {
|
669
|
+
var result, result_data;
|
670
|
+
result_data = this.results_data[pos];
|
671
|
+
result_data.selected = false;
|
672
|
+
this.form_field.options[result_data.options_index].selected = false;
|
673
|
+
result = $("#" + this.container_id + "_o_" + pos);
|
674
|
+
result.removeClass("result-selected").addClass("active-result").show();
|
675
|
+
this.result_clear_highlight();
|
676
|
+
this.winnow_results();
|
677
|
+
this.form_field_jq.trigger("change");
|
678
|
+
return this.search_field_scale();
|
679
|
+
};
|
680
|
+
Chosen.prototype.single_deselect_control_build = function() {
|
681
|
+
if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) {
|
682
|
+
return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
683
|
+
}
|
684
|
+
};
|
685
|
+
Chosen.prototype.winnow_results = function() {
|
686
|
+
var found, option, part, parts, regex, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
|
687
|
+
this.no_results_clear();
|
688
|
+
results = 0;
|
689
|
+
searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
|
690
|
+
regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
691
|
+
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
692
|
+
_ref = this.results_data;
|
693
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
694
|
+
option = _ref[_i];
|
695
|
+
if (!option.disabled && !option.empty) {
|
696
|
+
if (option.group) {
|
697
|
+
$('#' + option.dom_id).css('display', 'none');
|
698
|
+
} else if (!(this.is_multiple && option.selected)) {
|
699
|
+
found = false;
|
700
|
+
result_id = option.dom_id;
|
701
|
+
result = $("#" + result_id);
|
702
|
+
if (regex.test(option.html)) {
|
703
|
+
found = true;
|
704
|
+
results += 1;
|
705
|
+
} else if (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0) {
|
706
|
+
parts = option.html.replace(/\[|\]/g, "").split(" ");
|
707
|
+
if (parts.length) {
|
708
|
+
for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
|
709
|
+
part = parts[_j];
|
710
|
+
if (regex.test(part)) {
|
711
|
+
found = true;
|
712
|
+
results += 1;
|
713
|
+
}
|
714
|
+
}
|
715
|
+
}
|
716
|
+
}
|
717
|
+
if (found) {
|
718
|
+
if (searchText.length) {
|
719
|
+
startpos = option.html.search(zregex);
|
720
|
+
text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
|
721
|
+
text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
722
|
+
} else {
|
723
|
+
text = option.html;
|
724
|
+
}
|
725
|
+
result.html(text);
|
726
|
+
this.result_activate(result);
|
727
|
+
if (option.group_array_index != null) {
|
728
|
+
$("#" + this.results_data[option.group_array_index].dom_id).css('display', 'auto');
|
729
|
+
}
|
730
|
+
} else {
|
731
|
+
if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
|
732
|
+
this.result_clear_highlight();
|
733
|
+
}
|
734
|
+
this.result_deactivate(result);
|
735
|
+
}
|
736
|
+
}
|
737
|
+
}
|
738
|
+
}
|
739
|
+
if (results < 1 && searchText.length) {
|
740
|
+
return this.no_results(searchText);
|
741
|
+
} else {
|
742
|
+
return this.winnow_results_set_highlight();
|
743
|
+
}
|
744
|
+
};
|
745
|
+
Chosen.prototype.winnow_results_clear = function() {
|
746
|
+
var li, lis, _i, _len, _results;
|
747
|
+
this.search_field.val("");
|
748
|
+
lis = this.search_results.find("li");
|
749
|
+
_results = [];
|
750
|
+
for (_i = 0, _len = lis.length; _i < _len; _i++) {
|
751
|
+
li = lis[_i];
|
752
|
+
li = $(li);
|
753
|
+
_results.push(li.hasClass("group-result") ? li.css('display', 'auto') : !this.is_multiple || !li.hasClass("result-selected") ? this.result_activate(li) : void 0);
|
754
|
+
}
|
755
|
+
return _results;
|
756
|
+
};
|
757
|
+
Chosen.prototype.winnow_results_set_highlight = function() {
|
758
|
+
var do_high, selected_results;
|
759
|
+
if (!this.result_highlight) {
|
760
|
+
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
761
|
+
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
762
|
+
if (do_high != null) {
|
763
|
+
return this.result_do_highlight(do_high);
|
764
|
+
}
|
765
|
+
}
|
766
|
+
};
|
767
|
+
Chosen.prototype.no_results = function(terms) {
|
768
|
+
var no_results_html;
|
769
|
+
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
770
|
+
no_results_html.find("span").first().html(terms);
|
771
|
+
return this.search_results.append(no_results_html);
|
772
|
+
};
|
773
|
+
Chosen.prototype.no_results_clear = function() {
|
774
|
+
return this.search_results.find(".no-results").remove();
|
775
|
+
};
|
776
|
+
Chosen.prototype.keydown_arrow = function() {
|
777
|
+
var first_active, next_sib;
|
778
|
+
if (!this.result_highlight) {
|
779
|
+
first_active = this.search_results.find("li.active-result").first();
|
780
|
+
if (first_active) {
|
781
|
+
this.result_do_highlight($(first_active));
|
782
|
+
}
|
783
|
+
} else if (this.results_showing) {
|
784
|
+
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
785
|
+
if (next_sib) {
|
786
|
+
this.result_do_highlight(next_sib);
|
787
|
+
}
|
788
|
+
}
|
789
|
+
if (!this.results_showing) {
|
790
|
+
return this.results_show();
|
791
|
+
}
|
792
|
+
};
|
793
|
+
Chosen.prototype.keyup_arrow = function() {
|
794
|
+
var prev_sibs;
|
795
|
+
if (!this.results_showing && !this.is_multiple) {
|
796
|
+
return this.results_show();
|
797
|
+
} else if (this.result_highlight) {
|
798
|
+
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
799
|
+
if (prev_sibs.length) {
|
800
|
+
return this.result_do_highlight(prev_sibs.first());
|
801
|
+
} else {
|
802
|
+
if (this.choices > 0) {
|
803
|
+
this.results_hide();
|
804
|
+
}
|
805
|
+
return this.result_clear_highlight();
|
806
|
+
}
|
807
|
+
}
|
808
|
+
};
|
809
|
+
Chosen.prototype.keydown_backstroke = function() {
|
810
|
+
if (this.pending_backstroke) {
|
811
|
+
this.choice_destroy(this.pending_backstroke.find("a").first());
|
812
|
+
return this.clear_backstroke();
|
813
|
+
} else {
|
814
|
+
this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
|
815
|
+
return this.pending_backstroke.addClass("search-choice-focus");
|
816
|
+
}
|
817
|
+
};
|
818
|
+
Chosen.prototype.clear_backstroke = function() {
|
819
|
+
if (this.pending_backstroke) {
|
820
|
+
this.pending_backstroke.removeClass("search-choice-focus");
|
821
|
+
}
|
822
|
+
return this.pending_backstroke = null;
|
823
|
+
};
|
824
|
+
Chosen.prototype.keydown_checker = function(evt) {
|
825
|
+
var stroke, _ref;
|
826
|
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
827
|
+
this.search_field_scale();
|
828
|
+
if (stroke !== 8 && this.pending_backstroke) {
|
829
|
+
this.clear_backstroke();
|
830
|
+
}
|
831
|
+
switch (stroke) {
|
832
|
+
case 8:
|
833
|
+
this.backstroke_length = this.search_field.val().length;
|
834
|
+
break;
|
835
|
+
case 9:
|
836
|
+
if (this.results_showing && !this.is_multiple) {
|
837
|
+
this.result_select(evt);
|
838
|
+
}
|
839
|
+
this.mouse_on_container = false;
|
840
|
+
break;
|
841
|
+
case 13:
|
842
|
+
evt.preventDefault();
|
843
|
+
break;
|
844
|
+
case 38:
|
845
|
+
evt.preventDefault();
|
846
|
+
this.keyup_arrow();
|
847
|
+
break;
|
848
|
+
case 40:
|
849
|
+
this.keydown_arrow();
|
850
|
+
break;
|
851
|
+
}
|
852
|
+
};
|
853
|
+
Chosen.prototype.search_field_scale = function() {
|
854
|
+
var dd_top, div, h, style, style_block, styles, w, _i, _len;
|
855
|
+
if (this.is_multiple) {
|
856
|
+
h = 0;
|
857
|
+
w = 0;
|
858
|
+
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
859
|
+
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
860
|
+
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
861
|
+
style = styles[_i];
|
862
|
+
style_block += style + ":" + this.search_field.css(style) + ";";
|
863
|
+
}
|
864
|
+
div = $('<div />', {
|
865
|
+
'style': style_block
|
866
|
+
});
|
867
|
+
div.text(this.search_field.val());
|
868
|
+
$('body').append(div);
|
869
|
+
w = div.width() + 25;
|
870
|
+
div.remove();
|
871
|
+
if (w > this.f_width - 10) {
|
872
|
+
w = this.f_width - 10;
|
873
|
+
}
|
874
|
+
this.search_field.css({
|
875
|
+
'width': w + 'px'
|
876
|
+
});
|
877
|
+
dd_top = this.container.height();
|
878
|
+
return this.dropdown.css({
|
879
|
+
"top": dd_top + "px"
|
880
|
+
});
|
881
|
+
}
|
882
|
+
};
|
883
|
+
Chosen.prototype.generate_random_id = function() {
|
884
|
+
var string;
|
885
|
+
string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
|
886
|
+
while ($("#" + string).length > 0) {
|
887
|
+
string += this.generate_random_char();
|
888
|
+
}
|
889
|
+
return string;
|
890
|
+
};
|
891
|
+
return Chosen;
|
892
|
+
})();
|
893
|
+
get_side_border_padding = function(elmt) {
|
894
|
+
var side_border_padding;
|
895
|
+
return side_border_padding = elmt.outerWidth() - elmt.width();
|
896
|
+
};
|
897
|
+
root.get_side_border_padding = get_side_border_padding;
|
898
|
+
}).call(this);
|