fat_free_crm 0.13.2 → 0.13.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fat_free_crm might be problematic. Click here for more details.
- checksums.yaml +5 -13
- data/.travis.yml +3 -3
- data/Gemfile +5 -2
- data/Gemfile.lock +137 -119
- data/MIT-LICENSE +1 -1
- data/README.md +5 -3
- data/app/assets/javascripts/admin/fields.js.coffee +31 -8
- data/app/assets/javascripts/application.js.erb +6 -10
- data/app/assets/javascripts/crm.js.coffee +426 -0
- data/app/assets/javascripts/crm_chosen.js.coffee +19 -38
- data/app/assets/javascripts/crm_classes.js.coffee +215 -0
- data/app/assets/javascripts/crm_comments.js.coffee +20 -58
- data/app/assets/javascripts/crm_loginout.js.coffee +27 -0
- data/app/assets/javascripts/crm_select2.js.coffee +29 -0
- data/app/assets/javascripts/crm_sortable.js.coffee +32 -0
- data/app/assets/javascripts/crm_tags.js.coffee +22 -0
- data/app/assets/javascripts/crm_textarea_autocomplete.js.coffee +33 -0
- data/app/assets/javascripts/datepicker.js.coffee +2 -2
- data/app/assets/javascripts/format_buttons.js.coffee +23 -24
- data/app/assets/javascripts/lists.js.coffee +45 -76
- data/app/assets/javascripts/pagination.js.coffee +16 -0
- data/app/assets/javascripts/search.js.coffee +6 -22
- data/app/assets/javascripts/timeago.js.coffee +21 -0
- data/app/assets/stylesheets/application.css.erb +0 -1
- data/app/assets/stylesheets/common.scss +36 -29
- data/app/assets/stylesheets/lists.css.scss +17 -3
- data/app/controllers/admin/groups_controller.rb +2 -1
- data/app/controllers/application_controller.rb +5 -5
- data/app/controllers/entities/accounts_controller.rb +1 -1
- data/app/controllers/entities/campaigns_controller.rb +1 -1
- data/app/controllers/entities/contacts_controller.rb +1 -1
- data/app/controllers/entities/leads_controller.rb +1 -1
- data/app/controllers/entities/opportunities_controller.rb +1 -1
- data/app/controllers/home_controller.rb +10 -7
- data/app/controllers/tasks_controller.rb +15 -0
- data/app/controllers/users_controller.rb +6 -4
- data/app/helpers/accounts_helper.rb +8 -5
- data/app/helpers/application_helper.rb +53 -39
- data/app/helpers/campaigns_helper.rb +1 -0
- data/app/helpers/leads_helper.rb +3 -3
- data/app/helpers/opportunities_helper.rb +15 -0
- data/app/helpers/remote_link_pagination_helper.rb +8 -0
- data/app/helpers/tags_helper.rb +2 -2
- data/app/helpers/tasks_helper.rb +22 -15
- data/app/helpers/users_helper.rb +3 -2
- data/app/mailers/user_mailer.rb +9 -3
- data/app/models/entities/account_contact.rb +1 -1
- data/app/models/fields/custom_field.rb +1 -1
- data/app/models/list.rb +1 -0
- data/app/models/observers/entity_observer.rb +10 -1
- data/app/models/observers/lead_observer.rb +2 -0
- data/app/models/observers/opportunity_observer.rb +2 -0
- data/app/models/observers/task_observer.rb +2 -0
- data/app/models/polymorphic/avatar.rb +2 -0
- data/app/models/polymorphic/comment.rb +0 -1
- data/app/models/polymorphic/task.rb +41 -9
- data/app/models/users/ability.rb +1 -0
- data/app/models/users/group.rb +0 -5
- data/app/models/users/user.rb +0 -7
- data/app/views/accounts/_edit.html.haml +1 -0
- data/app/views/accounts/_index_brief.html.haml +2 -2
- data/app/views/accounts/_index_long.html.haml +2 -2
- data/app/views/accounts/_new.html.haml +1 -0
- data/app/views/accounts/_sidebar_index.html.haml +1 -1
- data/app/views/accounts/_sidebar_show.html.haml +1 -1
- data/app/views/accounts/_top_section.html.haml +1 -1
- data/app/views/accounts/create.js.haml +9 -9
- data/app/views/accounts/destroy.js.haml +2 -2
- data/app/views/accounts/edit.js.haml +5 -5
- data/app/views/accounts/index.js.haml +5 -5
- data/app/views/accounts/new.js.haml +1 -1
- data/app/views/accounts/show.html.haml +1 -1
- data/app/views/accounts/show.js.haml +1 -1
- data/app/views/accounts/update.js.haml +7 -5
- data/app/views/admin/field_groups/_field_group.html.haml +4 -5
- data/app/views/admin/field_groups/confirm.js.haml +2 -2
- data/app/views/admin/field_groups/create.js.haml +6 -12
- data/app/views/admin/field_groups/destroy.js.haml +3 -3
- data/app/views/admin/field_groups/edit.js.haml +1 -1
- data/app/views/admin/field_groups/new.js.haml +1 -1
- data/app/views/admin/field_groups/update.js.haml +2 -2
- data/app/views/admin/fields/_field.html.haml +1 -1
- data/app/views/admin/fields/_sort_by.html.haml +3 -3
- data/app/views/admin/fields/create.js.haml +9 -9
- data/app/views/admin/fields/destroy.js.haml +4 -4
- data/app/views/admin/fields/edit.js.haml +2 -2
- data/app/views/admin/fields/index.html.haml +1 -8
- data/app/views/admin/fields/show.html.haml +1 -1
- data/app/views/admin/fields/update.js.haml +8 -8
- data/app/views/admin/groups/_form.html.haml +1 -3
- data/app/views/admin/groups/create.js.haml +8 -8
- data/app/views/admin/groups/destroy.js.haml +3 -3
- data/app/views/admin/groups/edit.js.haml +3 -3
- data/app/views/admin/groups/index.js.haml +2 -2
- data/app/views/admin/groups/new.js.haml +2 -2
- data/app/views/admin/groups/update.js.haml +5 -5
- data/app/views/admin/tags/confirm.js.haml +2 -2
- data/app/views/admin/tags/create.js.haml +8 -8
- data/app/views/admin/tags/destroy.js.haml +3 -3
- data/app/views/admin/tags/edit.js.haml +4 -4
- data/app/views/admin/tags/new.js.haml +1 -1
- data/app/views/admin/tags/update.js.haml +5 -5
- data/app/views/admin/users/_profile.html.haml +3 -4
- data/app/views/admin/users/confirm.js.haml +2 -2
- data/app/views/admin/users/create.js.haml +8 -8
- data/app/views/admin/users/destroy.js.haml +3 -3
- data/app/views/admin/users/edit.js.haml +4 -4
- data/app/views/admin/users/index.js.haml +2 -2
- data/app/views/admin/users/new.js.haml +2 -2
- data/app/views/admin/users/reactivate.js.haml +2 -2
- data/app/views/admin/users/suspend.js.haml +2 -2
- data/app/views/admin/users/update.js.haml +5 -5
- data/app/views/campaigns/_edit.html.haml +1 -0
- data/app/views/campaigns/_index_brief.html.haml +1 -1
- data/app/views/campaigns/_index_long.html.haml +1 -1
- data/app/views/campaigns/_new.html.haml +1 -0
- data/app/views/campaigns/_sidebar_index.html.haml +1 -1
- data/app/views/campaigns/_sidebar_show.html.haml +1 -1
- data/app/views/campaigns/_status.html.haml +1 -1
- data/app/views/campaigns/_top_section.html.haml +1 -1
- data/app/views/campaigns/create.js.haml +10 -10
- data/app/views/campaigns/destroy.js.haml +2 -2
- data/app/views/campaigns/edit.js.haml +6 -6
- data/app/views/campaigns/index.js.haml +5 -5
- data/app/views/campaigns/new.js.haml +1 -1
- data/app/views/campaigns/show.html.haml +1 -1
- data/app/views/campaigns/show.js.haml +1 -1
- data/app/views/campaigns/update.js.haml +8 -6
- data/app/views/comments/_edit.html.haml +1 -1
- data/app/views/comments/_new.html.haml +1 -1
- data/app/views/comments/create.js.haml +9 -9
- data/app/views/comments/destroy.js.haml +2 -2
- data/app/views/comments/edit.js.haml +3 -3
- data/app/views/comments/update.js.haml +5 -5
- data/app/views/contacts/_contacts.html.haml +1 -1
- data/app/views/contacts/_edit.html.haml +1 -0
- data/app/views/contacts/_index_brief.html.haml +2 -2
- data/app/views/contacts/_index_full.html.haml +2 -2
- data/app/views/contacts/_index_long.html.haml +2 -2
- data/app/views/contacts/_new.html.haml +1 -0
- data/app/views/contacts/_section_general.html.haml +4 -3
- data/app/views/contacts/_sidebar_show.html.haml +1 -1
- data/app/views/contacts/_top_section.html.haml +1 -1
- data/app/views/contacts/create.js.haml +10 -10
- data/app/views/contacts/destroy.js.haml +3 -3
- data/app/views/contacts/edit.js.haml +5 -5
- data/app/views/contacts/index.js.haml +5 -5
- data/app/views/contacts/new.js.haml +1 -1
- data/app/views/contacts/show.html.haml +1 -1
- data/app/views/contacts/show.js.haml +1 -1
- data/app/views/contacts/update.js.haml +8 -6
- data/app/views/emails/destroy.js.haml +2 -2
- data/app/views/entities/_basic_search.html.haml +15 -12
- data/app/views/entities/_permissions.html.haml +6 -11
- data/app/views/entities/attach.js.haml +3 -3
- data/app/views/entities/contacts.js.haml +2 -2
- data/app/views/entities/discard.js.haml +1 -1
- data/app/views/entities/leads.js.haml +2 -2
- data/app/views/entities/opportunities.js.haml +2 -2
- data/app/views/entities/subscription_update.js.haml +1 -1
- data/app/views/entities/versions.js.haml +2 -2
- data/app/views/fields/group.js.erb +1 -1
- data/app/views/home/_account.html.haml +2 -2
- data/app/views/home/_assets_menu.html.haml +3 -3
- data/app/views/home/_duration_menu.html.haml +3 -3
- data/app/views/home/_events_menu.html.haml +3 -3
- data/app/views/home/_opportunity.html.haml +2 -2
- data/app/views/home/_options.html.haml +0 -1
- data/app/views/home/_users_menu.html.haml +3 -3
- data/app/views/home/index.js.haml +4 -4
- data/app/views/home/options.js.haml +1 -1
- data/app/views/layouts/_about.html.haml +3 -3
- data/app/views/layouts/_footer.html.haml +1 -1
- data/app/views/layouts/_header.html.haml +1 -1
- data/app/views/layouts/_jumpbox.html.haml +23 -21
- data/app/views/layouts/_sidebar.html.haml +1 -2
- data/app/views/layouts/admin/application.html.haml +1 -1
- data/app/views/layouts/application.html.haml +3 -3
- data/app/views/leads/_convert.html.haml +1 -11
- data/app/views/leads/_convert_permissions.html.haml +4 -9
- data/app/views/leads/_edit.html.haml +1 -0
- data/app/views/leads/_index_brief.html.haml +1 -1
- data/app/views/leads/_index_long.html.haml +1 -1
- data/app/views/leads/_leads.html.haml +1 -1
- data/app/views/leads/_new.html.haml +1 -0
- data/app/views/leads/_sidebar_index.html.haml +1 -1
- data/app/views/leads/_sidebar_show.html.haml +1 -1
- data/app/views/leads/_top_section.html.haml +1 -1
- data/app/views/leads/convert.js.haml +5 -5
- data/app/views/leads/create.js.haml +9 -9
- data/app/views/leads/destroy.js.haml +2 -2
- data/app/views/leads/edit.js.haml +5 -5
- data/app/views/leads/index.js.haml +5 -5
- data/app/views/leads/new.js.haml +1 -1
- data/app/views/leads/promote.js.haml +7 -7
- data/app/views/leads/reject.js.haml +2 -2
- data/app/views/leads/show.html.haml +1 -1
- data/app/views/leads/show.js.haml +1 -1
- data/app/views/leads/update.js.haml +9 -7
- data/app/views/lists/_lists.html.haml +6 -0
- data/app/views/lists/_sidebar.html.haml +18 -17
- data/app/views/lists/create.js.haml +6 -7
- data/app/views/lists/destroy.js.haml +1 -1
- data/app/views/opportunities/_edit.html.haml +2 -1
- data/app/views/opportunities/_index_brief.html.haml +1 -1
- data/app/views/opportunities/_index_long.html.haml +1 -1
- data/app/views/opportunities/_new.html.haml +2 -1
- data/app/views/opportunities/_opportunities.html.haml +1 -1
- data/app/views/opportunities/_sidebar_index.html.haml +1 -1
- data/app/views/opportunities/_sidebar_show.html.haml +1 -1
- data/app/views/opportunities/_top_section.html.haml +2 -2
- data/app/views/opportunities/contacts.js.haml +2 -2
- data/app/views/opportunities/create.js.haml +10 -10
- data/app/views/opportunities/destroy.js.haml +3 -3
- data/app/views/opportunities/edit.js.haml +5 -5
- data/app/views/opportunities/index.html.haml +1 -1
- data/app/views/opportunities/index.js.haml +5 -5
- data/app/views/opportunities/new.js.haml +1 -1
- data/app/views/opportunities/show.html.haml +1 -1
- data/app/views/opportunities/show.js.haml +1 -1
- data/app/views/opportunities/update.js.haml +8 -6
- data/app/views/shared/_address.html.haml +1 -1
- data/app/views/shared/_inline_styles.html.haml +1 -1
- data/app/views/shared/_naming.html.haml +3 -3
- data/app/views/shared/_paginate.haml +2 -1
- data/app/views/shared/_paginate_with_per_page.html.haml +10 -12
- data/app/views/shared/_search.html.haml +7 -3
- data/app/views/shared/_select_popup.html.haml +9 -11
- data/app/views/shared/_tags.html.haml +5 -4
- data/app/views/tasks/_completed.html.haml +3 -1
- data/app/views/tasks/_selector.html.haml +1 -1
- data/app/views/tasks/_top_section.html.haml +1 -1
- data/app/views/tasks/complete.js.haml +7 -7
- data/app/views/tasks/create.js.haml +17 -17
- data/app/views/tasks/destroy.js.haml +2 -2
- data/app/views/tasks/discard.js.haml +1 -1
- data/app/views/tasks/edit.js.haml +4 -4
- data/app/views/tasks/filter.js.haml +2 -2
- data/app/views/tasks/new.js.haml +1 -1
- data/app/views/tasks/uncomplete.js.haml +12 -0
- data/app/views/tasks/update.js.haml +4 -4
- data/app/views/users/_avatar.html.haml +1 -1
- data/app/views/users/_languages.html.haml +3 -3
- data/app/views/users/_profile.html.haml +1 -1
- data/app/views/users/avatar.js.haml +1 -1
- data/app/views/users/change_password.js.haml +5 -5
- data/app/views/users/edit.js.haml +1 -1
- data/app/views/users/password.js.haml +2 -2
- data/app/views/users/show.html.haml +1 -1
- data/app/views/users/update.js.haml +5 -5
- data/app/views/users/upload_avatar.js.haml +3 -3
- data/app/views/versions/_versions.html.haml +1 -1
- data/config/application.rb +3 -0
- data/config/environments/production.rb +1 -1
- data/config/environments/staging.rb +58 -13
- data/config/initializers/locale.rb +2 -0
- data/config/locales/cz_fat_free_crm.yml +1 -0
- data/config/locales/de_fat_free_crm.yml +1 -0
- data/config/locales/en-GB_fat_free_crm.yml +1 -0
- data/config/locales/en-US_fat_free_crm.yml +2 -0
- data/config/locales/es_fat_free_crm.yml +1 -0
- data/config/locales/fr-CA_fat_free_crm.yml +1 -0
- data/config/locales/fr_fat_free_crm.yml +1 -0
- data/config/locales/it_fat_free_crm.yml +1 -0
- data/config/locales/ja_fat_free_crm.yml +1 -0
- data/config/locales/pl_fat_free_crm.yml +1 -0
- data/config/locales/pt-BR_fat_free_crm.yml +1 -0
- data/config/locales/ru_fat_free_crm.yml +444 -61
- data/config/locales/sv-SE_fat_free_crm.yml +1 -0
- data/config/locales/th_fat_free_crm.yml +1 -0
- data/config/locales/zh-CN_fat_free_crm.yml +1 -0
- data/config/routes.rb +20 -19
- data/config/settings.default.yml +11 -10
- data/fat_free_crm.gemspec +5 -4
- data/lib/{plugins/country_select/lib/country_select.rb → country_select.rb} +0 -0
- data/lib/fat_free_crm.rb +3 -1
- data/lib/fat_free_crm/engine.rb +2 -4
- data/lib/fat_free_crm/gem_dependencies.rb +1 -1
- data/lib/fat_free_crm/gem_ext.rb +0 -2
- data/lib/fat_free_crm/permissions.rb +2 -3
- data/lib/fat_free_crm/version.rb +1 -1
- data/lib/{plugins/gravatar_image_tag/lib/gravatar_image_tag.rb → gravatar_image_tag.rb} +0 -0
- data/lib/tasks/ffcrm/settings.rake +4 -16
- data/public/favicon.ico +0 -0
- data/spec/controllers/entities/accounts_controller_spec.rb +5 -5
- data/spec/controllers/entities/campaigns_controller_spec.rb +5 -5
- data/spec/controllers/entities/contacts_controller_spec.rb +42 -5
- data/spec/controllers/entities/leads_controller_spec.rb +7 -7
- data/spec/controllers/entities/opportunities_controller_spec.rb +5 -5
- data/spec/controllers/home_controller_spec.rb +3 -3
- data/spec/controllers/tasks_controller_spec.rb +29 -0
- data/spec/factories/shared_factories.rb +1 -3
- data/spec/features/support/selector_helpers.rb +4 -4
- data/spec/helpers/tasks_helper_spec.rb +10 -5
- data/spec/lib/permissions_spec.rb +10 -22
- data/spec/mailers/user_mailer_spec.rb +5 -4
- data/spec/models/observers/entity_observer_spec.rb +13 -8
- data/spec/models/polymorphic/task_spec.rb +111 -32
- data/spec/routing/accounts_routing_spec.rb +1 -1
- data/spec/routing/campaigns_routing_spec.rb +1 -1
- data/spec/routing/contacts_routing_spec.rb +1 -1
- data/spec/routing/leads_routing_spec.rb +1 -1
- data/spec/routing/opportunities_routing_spec.rb +1 -1
- data/spec/shared/controllers.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/views/accounts/create.js.haml_spec.rb +3 -3
- data/spec/views/accounts/index.js.haml_spec.rb +4 -4
- data/spec/views/accounts/update.js.haml_spec.rb +5 -5
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +2 -2
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/create.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/destroy.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/edit.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/index.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/new.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/reactivate.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/suspend.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/update.js.haml_spec.rb +3 -3
- data/spec/views/campaigns/create.js.haml_spec.rb +4 -4
- data/spec/views/campaigns/destroy.js.haml_spec.rb +1 -1
- data/spec/views/campaigns/edit.js.haml_spec.rb +4 -4
- data/spec/views/campaigns/index.js.haml_spec.rb +2 -2
- data/spec/views/campaigns/new.js.haml_spec.rb +1 -1
- data/spec/views/campaigns/update.js.haml_spec.rb +7 -7
- data/spec/views/contacts/create.js.haml_spec.rb +4 -4
- data/spec/views/contacts/edit.js.haml_spec.rb +4 -4
- data/spec/views/contacts/index.js.html_spec.rb +2 -2
- data/spec/views/contacts/new.js.haml_spec.rb +2 -2
- data/spec/views/contacts/update.js.haml_spec.rb +11 -11
- data/spec/views/home/index.js.haml_spec.rb +1 -1
- data/spec/views/home/options.js.haml_spec.rb +3 -3
- data/spec/views/leads/convert.js.haml_spec.rb +3 -3
- data/spec/views/leads/create.js.haml_spec.rb +5 -5
- data/spec/views/leads/destroy.js.haml_spec.rb +1 -1
- data/spec/views/leads/edit.js.haml_spec.rb +4 -4
- data/spec/views/leads/index.js.haml_spec.rb +2 -2
- data/spec/views/leads/new.js.haml_spec.rb +1 -1
- data/spec/views/leads/promote.js.haml_spec.rb +13 -13
- data/spec/views/leads/reject.js.haml_spec.rb +6 -6
- data/spec/views/leads/update.js.haml_spec.rb +11 -11
- data/spec/views/opportunities/create.js.haml_spec.rb +4 -4
- data/spec/views/opportunities/destroy.js.haml_spec.rb +1 -1
- data/spec/views/opportunities/edit.js.haml_spec.rb +4 -4
- data/spec/views/opportunities/index.js.haml_spec.rb +2 -2
- data/spec/views/opportunities/update.js.haml_spec.rb +11 -11
- data/spec/views/tasks/complete.js.haml_spec.rb +5 -5
- data/spec/views/tasks/create.js.haml_spec.rb +13 -13
- data/spec/views/tasks/destroy.js.haml_spec.rb +3 -3
- data/spec/views/tasks/edit.js.haml_spec.rb +4 -4
- data/spec/views/tasks/new.js.haml_spec.rb +2 -2
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +44 -0
- data/spec/views/tasks/update.js.haml_spec.rb +17 -17
- data/spec/views/users/avatar.js.haml_spec.rb +1 -1
- data/spec/views/users/change_password.js.haml_spec.rb +4 -4
- data/spec/views/users/edit.js.haml_spec.rb +1 -1
- data/spec/views/users/password.js.haml_spec.rb +2 -2
- data/spec/views/users/update.js.haml_spec.rb +5 -5
- data/spec/views/users/upload_avatar.js.haml_spec.rb +2 -2
- data/vendor/assets/javascripts/ajax-chosen.jquery.coffee +166 -76
- data/vendor/assets/javascripts/chosen.jquery.coffee +2 -2
- data/vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-pt-BR.js +22 -0
- data/vendor/assets/javascripts/jquery_ui_datepicker/{jquery-ui-timepicker-sv.js → jquery-ui-timepicker-sv-SE.js} +0 -0
- data/vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-th.js +19 -0
- data/vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-fr-CA.js +21 -0
- data/vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-pt.js +21 -0
- data/vendor/assets/javascripts/rating.js +2 -2
- metadata +101 -122
- data/app/assets/images/facebook-close.gif +0 -0
- data/app/assets/javascripts/crm.js +0 -495
- data/app/assets/javascripts/crm_classes.js +0 -218
- data/app/assets/javascripts/crm_fields.js +0 -34
- data/app/assets/javascripts/crm_loginout.js +0 -29
- data/app/assets/javascripts/crm_textarea_autocomplete.js +0 -32
- data/app/assets/javascripts/groups.js.coffee +0 -8
- data/app/assets/javascripts/jquery-noconflict.js +0 -6
- data/app/assets/javascripts/timeago.js +0 -17
- data/app/views/lists/_personal_sidebar.html.haml +0 -28
- data/lib/fat_free_crm/gem_ext/active_model/serializers/xml/serializer/attribute.rb +0 -17
- data/lib/fat_free_crm/gem_ext/authlogic/session/cookies.rb +0 -16
- data/lib/fat_free_crm/plugin_dependencies.rb +0 -12
- data/lib/plugins/country_select/MIT-LICENSE +0 -20
- data/lib/plugins/country_select/README +0 -14
- data/lib/plugins/country_select/init.rb +0 -1
- data/lib/plugins/country_select/install.rb +0 -2
- data/lib/plugins/country_select/uninstall.rb +0 -2
- data/lib/plugins/gravatar_image_tag/Gemfile +0 -8
- data/lib/plugins/gravatar_image_tag/README.textile +0 -108
- data/lib/plugins/gravatar_image_tag/ROADMAP.textile +0 -33
- data/lib/plugins/gravatar_image_tag/Rakefile +0 -50
- data/lib/plugins/gravatar_image_tag/VERSION +0 -1
- data/lib/plugins/gravatar_image_tag/gravatar_image_tag.gemspec +0 -45
- data/lib/plugins/gravatar_image_tag/init.rb +0 -2
- data/lib/plugins/gravatar_image_tag/spec/gravatar_image_tag_spec.rb +0 -83
- data/lib/plugins/gravatar_image_tag/spec/test_helper.rb +0 -12
- data/lib/tasks/db/migrate.rake +0 -66
- data/lib/tasks/db/schema.rake +0 -20
- data/vendor/assets/javascripts/ajax-chosen-prototype.js +0 -2
- data/vendor/assets/javascripts/ajax-chosen.proto.coffee +0 -98
- data/vendor/assets/javascripts/chosen-prototype.js +0 -3
- data/vendor/assets/javascripts/chosen.proto.coffee +0 -580
- data/vendor/assets/javascripts/event.simulate.js +0 -64
- data/vendor/assets/javascripts/facebooklist.js +0 -548
- data/vendor/assets/javascripts/facebooklist.simulate.js +0 -28
- data/vendor/assets/javascripts/modalbox.js +0 -506
- data/vendor/assets/stylesheets/facebooklist.css +0 -47
@@ -1,64 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Event.simulate(@element, eventName[, options]) -> Element
|
3
|
-
*
|
4
|
-
* - @element: element to fire event on
|
5
|
-
* - eventName: name of event to fire (only MouseEvents and HTMLEvents interfaces are supported)
|
6
|
-
* - options: optional object to fine-tune event properties - pointerX, pointerY, ctrlKey, etc.
|
7
|
-
*
|
8
|
-
* $('foo').simulate('click'); // => fires "click" event on an element with id=foo
|
9
|
-
*
|
10
|
-
**/
|
11
|
-
(function(){
|
12
|
-
|
13
|
-
var eventMatchers = {
|
14
|
-
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
|
15
|
-
'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/
|
16
|
-
}
|
17
|
-
var defaultOptions = {
|
18
|
-
pointerX: 0,
|
19
|
-
pointerY: 0,
|
20
|
-
button: 0,
|
21
|
-
ctrlKey: false,
|
22
|
-
altKey: false,
|
23
|
-
shiftKey: false,
|
24
|
-
metaKey: false,
|
25
|
-
bubbles: true,
|
26
|
-
cancelable: true
|
27
|
-
}
|
28
|
-
|
29
|
-
Event.simulate = function(element, eventName) {
|
30
|
-
var options = Object.extend(defaultOptions, arguments[2] || { });
|
31
|
-
var oEvent, eventType = null;
|
32
|
-
|
33
|
-
element = $(element);
|
34
|
-
|
35
|
-
for (var name in eventMatchers) {
|
36
|
-
if (eventMatchers[name].test(eventName)) { eventType = name; break; }
|
37
|
-
}
|
38
|
-
|
39
|
-
if (!eventType)
|
40
|
-
throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
|
41
|
-
|
42
|
-
if (document.createEvent) {
|
43
|
-
oEvent = document.createEvent(eventType);
|
44
|
-
if (eventType == 'HTMLEvents') {
|
45
|
-
oEvent.initEvent(eventName, options.bubbles, options.cancelable);
|
46
|
-
}
|
47
|
-
else {
|
48
|
-
oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView,
|
49
|
-
options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
|
50
|
-
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
|
51
|
-
}
|
52
|
-
element.dispatchEvent(oEvent);
|
53
|
-
}
|
54
|
-
else {
|
55
|
-
options.clientX = options.pointerX;
|
56
|
-
options.clientY = options.pointerY;
|
57
|
-
oEvent = Object.extend(document.createEventObject(), options);
|
58
|
-
element.fireEvent('on' + eventName, oEvent);
|
59
|
-
}
|
60
|
-
return element;
|
61
|
-
}
|
62
|
-
|
63
|
-
Element.addMethods({ simulate: Event.simulate });
|
64
|
-
})()
|
@@ -1,548 +0,0 @@
|
|
1
|
-
|
2
|
-
/*
|
3
|
-
Proto!MultiSelect
|
4
|
-
Copyright: InteRiders <http://interiders.com/> - Distributed under MIT - Keep this message!
|
5
|
-
*/
|
6
|
-
|
7
|
-
// Added key contstant for COMMA watching happiness
|
8
|
-
Object.extend(Event, {
|
9
|
-
KEY_COMMA: {code: 188, value:","},
|
10
|
-
KEY_SPACE: {code: 32, value:" "}
|
11
|
-
});
|
12
|
-
|
13
|
-
var ResizableTextbox = Class.create({
|
14
|
-
initialize: function(element, options) {
|
15
|
-
var that = this;
|
16
|
-
this.options = $H({
|
17
|
-
min: 5,
|
18
|
-
max: 500,
|
19
|
-
step: 7
|
20
|
-
});
|
21
|
-
this.options.update(options);
|
22
|
-
this.el = $(element);
|
23
|
-
this.width = this.el.offsetWidth;
|
24
|
-
this.el.observe(
|
25
|
-
'keyup', function() {
|
26
|
-
var newsize = that.options.get('step') * $F(this).length;
|
27
|
-
if(newsize <= that.options.get('min')) newsize = that.width;
|
28
|
-
if(! ($F(this).length == this.retrieveData('rt-value') || newsize <= that.options.min || newsize >= that.options.max))
|
29
|
-
this.setStyle({'width': newsize});
|
30
|
-
}).observe('keydown', function() {
|
31
|
-
this.cacheData('rt-value', $F(this).length);
|
32
|
-
}
|
33
|
-
);
|
34
|
-
}
|
35
|
-
});
|
36
|
-
|
37
|
-
var TextboxList = Class.create({
|
38
|
-
initialize: function(element, options) {
|
39
|
-
this.options = $H({/*
|
40
|
-
onFocus: $empty,
|
41
|
-
onBlur: $empty,
|
42
|
-
onInputFocus: $empty,
|
43
|
-
onInputBlur: $empty,
|
44
|
-
onBoxFocus: $empty,
|
45
|
-
onBoxBlur: $empty,
|
46
|
-
onBoxDispose: $empty,*/
|
47
|
-
resizable: {},
|
48
|
-
className: 'bit',
|
49
|
-
separator: Event.KEY_COMMA,
|
50
|
-
tabindex: null,
|
51
|
-
extrainputs: true,
|
52
|
-
startinput: true,
|
53
|
-
hideempty: true,
|
54
|
-
newValues: false,
|
55
|
-
newValueDelimiters: ['[',']'],
|
56
|
-
spaceReplace: '',
|
57
|
-
fetchFile: undefined,
|
58
|
-
fetchMethod: 'get',
|
59
|
-
results: 10,
|
60
|
-
maxResults: 0, // 0 = set to default (which is 10 (see FacebookList class)),
|
61
|
-
wordMatch: false,
|
62
|
-
onEmptyInput: function(input){},
|
63
|
-
onAdd: function(tag){},
|
64
|
-
onDispose: function(tag){},
|
65
|
-
caseSensitive: false,
|
66
|
-
regexSearch: true
|
67
|
-
});
|
68
|
-
this.current_input = "";
|
69
|
-
this.options.update(options);
|
70
|
-
this.element = $(element).hide();
|
71
|
-
this.bits = new Hash();
|
72
|
-
this.events = new Hash();
|
73
|
-
this.count = 0;
|
74
|
-
this.current = false;
|
75
|
-
this.maininput = this.createInput({className: 'maininput'});
|
76
|
-
this.maininput.addClassName('maininput');
|
77
|
-
this.holder = new Element('ul', {
|
78
|
-
className: 'holder'
|
79
|
-
}).insert(this.maininput);
|
80
|
-
if(this.options.get('tabindex')) {
|
81
|
-
this.maininput.down('input').writeAttribute('tabindex', this.options.get('tabindex'));
|
82
|
-
}
|
83
|
-
this.element.insert({'before':this.holder});
|
84
|
-
this.holder.observe('click', function(event){
|
85
|
-
event.stop();
|
86
|
-
if(this.maininput != this.current) this.focus(this.maininput);
|
87
|
-
}.bind(this));
|
88
|
-
this.makeResizable(this.maininput);
|
89
|
-
this.setEvents();
|
90
|
-
},
|
91
|
-
|
92
|
-
setEvents: function() {
|
93
|
-
document.observe(Prototype.Browser.IE ? 'keydown' : 'keypress', function(e) {
|
94
|
-
if(! this.current) return;
|
95
|
-
if(this.current.retrieveData('type') == 'box' && e.keyCode == Event.KEY_BACKSPACE) e.stop();
|
96
|
-
}.bind(this));
|
97
|
-
|
98
|
-
document.observe(
|
99
|
-
'keyup', function(e) {
|
100
|
-
e.stop();
|
101
|
-
if(! this.current) return;
|
102
|
-
switch(e.keyCode){
|
103
|
-
case Event.KEY_LEFT: return this.move('left');
|
104
|
-
case Event.KEY_RIGHT: return this.move('right');
|
105
|
-
case Event.KEY_DELETE:
|
106
|
-
case Event.KEY_BACKSPACE: return this.moveDispose();
|
107
|
-
}
|
108
|
-
}.bind(this)).observe(
|
109
|
-
'click', function() { document.fire('blur'); }.bindAsEventListener(this)
|
110
|
-
);
|
111
|
-
},
|
112
|
-
|
113
|
-
update: function() {
|
114
|
-
this.element.value = this.bits.values().join(this.options.get('separator').value);
|
115
|
-
if (!this.current_input.blank()){
|
116
|
-
this.element.value += (this.element.value.blank() ? "" : this.options.get('separator').value) + this.current_input;
|
117
|
-
}
|
118
|
-
return this;
|
119
|
-
},
|
120
|
-
|
121
|
-
add: function(text, html) {
|
122
|
-
var id = this.id_base + '-' + this.count++;
|
123
|
-
var el = this.createBox($pick(html, text), {'id': id, 'class': this.options.get('className'), 'newValue' : text.newValue ? 'true' : 'false'});
|
124
|
-
(this.current || this.maininput).insert({'before':el});
|
125
|
-
el.observe('click', function(e) {
|
126
|
-
e.stop();
|
127
|
-
this.focus(el);
|
128
|
-
}.bind(this));
|
129
|
-
this.bits.set(id, text.value);
|
130
|
-
// Dynamic updating... why not?
|
131
|
-
this.update();
|
132
|
-
if(this.options.get('extrainputs') && (this.options.get('startinput') || el.previous())) this.addSmallInput(el,'before');
|
133
|
-
this.options.get('onAdd')(text.value, el);
|
134
|
-
return el;
|
135
|
-
},
|
136
|
-
|
137
|
-
addSmallInput: function(el, where) {
|
138
|
-
var input = this.createInput({'class': 'smallinput'});
|
139
|
-
el.insert({}[where] = input);
|
140
|
-
input.cacheData('small', true);
|
141
|
-
this.makeResizable(input);
|
142
|
-
if(this.options.get('hideempty')) input.hide();
|
143
|
-
return input;
|
144
|
-
},
|
145
|
-
|
146
|
-
dispose: function(el) {
|
147
|
-
this.options.get('onDispose')(this.bits.get(el.id));
|
148
|
-
this.bits.unset(el.id);
|
149
|
-
// Dynamic updating... why not?
|
150
|
-
this.update();
|
151
|
-
if(el.previous() && el.previous().retrieveData('small')) el.previous().remove();
|
152
|
-
if(this.current == el) this.focus(el.next());
|
153
|
-
if(el.retrieveData('type') == 'box') el.onBoxDispose(this);
|
154
|
-
el.remove();
|
155
|
-
return this;
|
156
|
-
},
|
157
|
-
|
158
|
-
focus: function(el, nofocus) {
|
159
|
-
if(! this.current) el.fire('focus');
|
160
|
-
else if(this.current == el) return this;
|
161
|
-
this.blur();
|
162
|
-
el.addClassName(this.options.get('className') + '-' + el.retrieveData('type') + '-focus');
|
163
|
-
if(el.retrieveData('small')) el.setStyle({'display': 'block'});
|
164
|
-
if(el.retrieveData('type') == 'input') {
|
165
|
-
el.onInputFocus(this);
|
166
|
-
if(! nofocus) this.callEvent(el.retrieveData('input'), 'focus');
|
167
|
-
}
|
168
|
-
else el.fire('onBoxFocus');
|
169
|
-
this.current = el;
|
170
|
-
return this;
|
171
|
-
},
|
172
|
-
|
173
|
-
blur: function(noblur) {
|
174
|
-
if(! this.current) return this;
|
175
|
-
if(this.current.retrieveData('type') == 'input') {
|
176
|
-
var input = this.current.retrieveData('input');
|
177
|
-
if(! noblur) this.callEvent(input, 'blur');
|
178
|
-
input.onInputBlur(this);
|
179
|
-
}
|
180
|
-
else this.current.fire('onBoxBlur');
|
181
|
-
if(this.current.retrieveData('small') && ! input.get('value') && this.options.get('hideempty'))
|
182
|
-
this.current.hide();
|
183
|
-
this.current.removeClassName(this.options.get('className') + '-' + this.current.retrieveData('type') + '-focus');
|
184
|
-
this.current = false;
|
185
|
-
return this;
|
186
|
-
},
|
187
|
-
|
188
|
-
createBox: function(text, options) {
|
189
|
-
var box = new Element('li', options).addClassName(this.options.get('className') + '-box').update(text.caption).cacheData('type', 'box');
|
190
|
-
return box;
|
191
|
-
},
|
192
|
-
|
193
|
-
createInput: function(options) {
|
194
|
-
var opts = Object.extend(options,{'type': 'text', 'autocomplete':'off'});
|
195
|
-
var li = new Element('li', {className: this.options.get('className') + '-input'});
|
196
|
-
var el = new Element('input', options);
|
197
|
-
el.observe('click', function(e) { e.stop(); }).observe('focus', function(e) { if(! this.isSelfEvent('focus')) this.focus(li, true); }.bind(this)).observe('blur', function() { if(! this.isSelfEvent('blur')) this.blur(true); }.bind(this)).observe('keydown', function(e) { this.cacheData('lastvalue', this.value).cacheData('lastcaret', this.getCaretPosition()); });
|
198
|
-
var tmp = li.cacheData('type', 'input').cacheData('input', el).insert(el);
|
199
|
-
return tmp;
|
200
|
-
},
|
201
|
-
|
202
|
-
callEvent: function(el, type) {
|
203
|
-
this.events.set(type, el);
|
204
|
-
el[type]();
|
205
|
-
},
|
206
|
-
|
207
|
-
isSelfEvent: function(type) {
|
208
|
-
return (this.events.get(type)) ? !! this.events.unset(type) : false;
|
209
|
-
},
|
210
|
-
|
211
|
-
makeResizable: function(li) {
|
212
|
-
var el = li.retrieveData('input');
|
213
|
-
el.cacheData('resizable', new ResizableTextbox(el, Object.extend(this.options.get('resizable'),{min: el.offsetWidth, max: (this.element.getWidth()?this.element.getWidth():50)})));
|
214
|
-
return this;
|
215
|
-
},
|
216
|
-
|
217
|
-
checkInput: function() {
|
218
|
-
var input = this.current.retrieveData('input');
|
219
|
-
return (! input.retrieveData('lastvalue') || (input.getCaretPosition() === 0 && input.retrieveData('lastcaret') === 0));
|
220
|
-
},
|
221
|
-
|
222
|
-
move: function(direction) {
|
223
|
-
var el = this.current[(direction == 'left' ? 'previous' : 'next')]();
|
224
|
-
if(el && (! this.current.retrieveData('input') || ((this.checkInput() || direction == 'right')))) this.focus(el);
|
225
|
-
return this;
|
226
|
-
},
|
227
|
-
|
228
|
-
moveDispose: function() {
|
229
|
-
if(this.current.retrieveData('type') == 'box') return this.dispose(this.current);
|
230
|
-
if(this.checkInput() && this.bits.keys().length && this.current.previous()) return this.focus(this.current.previous());
|
231
|
-
}
|
232
|
-
});
|
233
|
-
|
234
|
-
//helper functions
|
235
|
-
Element.addMethods({
|
236
|
-
getCaretPosition: function() {
|
237
|
-
if (this.createTextRange) {
|
238
|
-
var r = document.selection.createRange().duplicate();
|
239
|
-
r.moveEnd('character', this.value.length);
|
240
|
-
if (r.text === '') return this.value.length;
|
241
|
-
return this.value.lastIndexOf(r.text);
|
242
|
-
} else return this.selectionStart;
|
243
|
-
},
|
244
|
-
cacheData: function(element, key, value) {
|
245
|
-
if (Object.isUndefined(this[$(element).identify()]) || !Object.isHash(this[$(element).identify()]))
|
246
|
-
this[$(element).identify()] = $H();
|
247
|
-
this[$(element).identify()].set(key,value);
|
248
|
-
return element;
|
249
|
-
},
|
250
|
-
retrieveData: function(element,key) {
|
251
|
-
return this[$(element).identify()].get(key);
|
252
|
-
}
|
253
|
-
});
|
254
|
-
|
255
|
-
function $pick(){for(var B=0,A=arguments.length;B<A;B++){if(!Object.isUndefined(arguments[B])){return arguments[B];}}return null;}
|
256
|
-
|
257
|
-
var FacebookList = Class.create(TextboxList, {
|
258
|
-
initialize: function($super,element, autoholder, options, func) {
|
259
|
-
$super(element, options);
|
260
|
-
this.loptions = $H({
|
261
|
-
autocomplete: {
|
262
|
-
'opacity': 1,
|
263
|
-
'maxresults': 10,
|
264
|
-
'minchars': 1
|
265
|
-
}
|
266
|
-
});
|
267
|
-
|
268
|
-
this.id_base = $(element).identify() + "_" + this.options.get("className");
|
269
|
-
|
270
|
-
this.data = [];
|
271
|
-
this.data_searchable = [];
|
272
|
-
this.autoholder = $(autoholder).setOpacity(this.loptions.get('autocomplete').opacity);
|
273
|
-
this.autoholder.observe('mouseover',function() {this.curOn = true;}.bind(this)).observe('mouseout',function() {this.curOn = false;}.bind(this));
|
274
|
-
this.autoresults = this.autoholder.select('ul').first();
|
275
|
-
var children = this.autoresults.select('li');
|
276
|
-
children.each(function(el) { this.add({value:el.readAttribute('value'),caption:el.innerHTML}); }, this);
|
277
|
-
|
278
|
-
// Loading the options list only once at initialize.
|
279
|
-
// This would need to be further extended if the list was exceptionally long
|
280
|
-
if (!Object.isUndefined(this.options.get('fetchFile'))) {
|
281
|
-
new Ajax.Request(this.options.get('fetchFile'), {
|
282
|
-
method: this.options.get('fetchMethod'),
|
283
|
-
onSuccess: function(transport) {
|
284
|
-
transport.responseText.evalJSON(true).each(function(t) {
|
285
|
-
this.autoFeed(t) }.bind(this));
|
286
|
-
}.bind(this)
|
287
|
-
}
|
288
|
-
);
|
289
|
-
}
|
290
|
-
},
|
291
|
-
|
292
|
-
autoShow: function(search) {
|
293
|
-
this.autoholder.setStyle({'display': 'block'});
|
294
|
-
this.autoholder.descendants().each(function(e) { e.hide() });
|
295
|
-
if(! search || ! search.strip() || (! search.length || search.length < this.loptions.get('autocomplete').minchars)) {
|
296
|
-
this.autoholder.select('.default').first().setStyle({'display': 'block'});
|
297
|
-
this.resultsshown = false;
|
298
|
-
} else {
|
299
|
-
this.resultsshown = true;
|
300
|
-
this.autoresults.setStyle({'display': 'block'}).update('');
|
301
|
-
if (!this.options.get('regexSearch')) {
|
302
|
-
var matches = new Array();
|
303
|
-
if (search) {
|
304
|
-
if (!this.options.get('caseSensitive')) {
|
305
|
-
search = search.toLowerCase();
|
306
|
-
}
|
307
|
-
var matches_found = 0;
|
308
|
-
for (var i=0,len=this.data_searchable.length; i<len; i++) {
|
309
|
-
if (this.data_searchable[i].indexOf(search) >= 0) {
|
310
|
-
matches[matches_found++] = this.data[i];
|
311
|
-
}
|
312
|
-
}
|
313
|
-
}
|
314
|
-
} else {
|
315
|
-
if (this.options.get('wordMatch')) {
|
316
|
-
var regexp = new RegExp("(^|\\s)"+search,(!this.options.get('caseSensitive') ? 'i' : ''));
|
317
|
-
} else {
|
318
|
-
var regexp = new RegExp(search,(!this.options.get('caseSensitive') ? 'i' : ''));
|
319
|
-
var matches = this.data.filter(
|
320
|
-
function(str) {
|
321
|
-
return str ? regexp.test(str.evalJSON(true).caption) : false;
|
322
|
-
});
|
323
|
-
}
|
324
|
-
}
|
325
|
-
|
326
|
-
var count = 0;
|
327
|
-
matches = matches.compact();
|
328
|
-
matches = matches.sortBy(function(m) {
|
329
|
-
m = m.evalJSON(true);
|
330
|
-
return m.value.startsWith(search);
|
331
|
-
}).reverse();
|
332
|
-
matches.each(
|
333
|
-
function(result, ti) {
|
334
|
-
count++;
|
335
|
-
if(ti >= (this.options.get('maxResults') ? this.options.get('maxResults') : this.loptions.get('autocomplete').maxresults)) return;
|
336
|
-
var that = this;
|
337
|
-
var el = new Element('li');
|
338
|
-
el.observe('click',function(e) {
|
339
|
-
e.stop();
|
340
|
-
that.current_input = "";
|
341
|
-
that.autoAdd(this);
|
342
|
-
}
|
343
|
-
).observe('mouseover', function() { that.autoFocus(this); } ).update(
|
344
|
-
this.autoHighlight(result.evalJSON(true).caption, search)
|
345
|
-
);
|
346
|
-
this.autoresults.insert(el);
|
347
|
-
el.cacheData('result', result.evalJSON(true));
|
348
|
-
if(ti == 0) this.autoFocus(el);
|
349
|
-
},
|
350
|
-
this
|
351
|
-
);
|
352
|
-
}
|
353
|
-
if (count == 0) {
|
354
|
-
// if there are no results, hide everything so that KEY_ENTER has no effect
|
355
|
-
this.autoHide();
|
356
|
-
} else {
|
357
|
-
if (count > this.options.get('results'))
|
358
|
-
this.autoresults.setStyle({'height': (this.options.get('results')*24)+'px'});
|
359
|
-
else
|
360
|
-
this.autoresults.setStyle({'height': (count?(count*24):0)+'px'});
|
361
|
-
}
|
362
|
-
|
363
|
-
return this;
|
364
|
-
},
|
365
|
-
|
366
|
-
autoHighlight: function(html, highlight) {
|
367
|
-
return html.gsub(new RegExp(highlight,'i'), function(match) {
|
368
|
-
return '<em>' + match[0] + '</em>';
|
369
|
-
});
|
370
|
-
},
|
371
|
-
|
372
|
-
autoHide: function() {
|
373
|
-
this.resultsshown = false;
|
374
|
-
this.autoholder.hide();
|
375
|
-
return this;
|
376
|
-
},
|
377
|
-
|
378
|
-
autoFocus: function(el) {
|
379
|
-
if(! el) return;
|
380
|
-
if(this.autocurrent) this.autocurrent.removeClassName('auto-focus');
|
381
|
-
this.autocurrent = el.addClassName('auto-focus');
|
382
|
-
return this;
|
383
|
-
},
|
384
|
-
|
385
|
-
autoMove: function(direction) {
|
386
|
-
if(!this.resultsshown) return;
|
387
|
-
this.autoFocus(this.autocurrent[(direction == 'up' ? 'previous' : 'next')]());
|
388
|
-
this.autoresults.scrollTop = this.autocurrent.positionedOffset()[1]-this.autocurrent.getHeight();
|
389
|
-
return this;
|
390
|
-
},
|
391
|
-
|
392
|
-
autoFeed: function(text) {
|
393
|
-
var with_case = this.options.get('caseSensitive');
|
394
|
-
if (this.data.indexOf(Object.toJSON(text)) == -1) {
|
395
|
-
this.data.push(Object.toJSON(text));
|
396
|
-
this.data_searchable.push(with_case ? Object.toJSON(text).evalJSON(true).caption : Object.toJSON(text).evalJSON(true).caption.toLowerCase());
|
397
|
-
}
|
398
|
-
return this;
|
399
|
-
},
|
400
|
-
|
401
|
-
autoAdd: function(el) {
|
402
|
-
if(this.newvalue && this.options.get("newValues")) {
|
403
|
-
this.add({caption: el.value, value: el.value, newValue: true});
|
404
|
-
var input = el;
|
405
|
-
} else if(!el || ! el.retrieveData('result')) {
|
406
|
-
return;
|
407
|
-
} else {
|
408
|
-
this.add(el.retrieveData('result'));
|
409
|
-
delete this.data[this.data.indexOf(Object.toJSON(el.retrieveData('result')))];
|
410
|
-
var input = this.lastinput || this.current.retrieveData('input');
|
411
|
-
}
|
412
|
-
this.autoHide();
|
413
|
-
input.clear().focus();
|
414
|
-
return this;
|
415
|
-
},
|
416
|
-
|
417
|
-
createInput: function($super,options) {
|
418
|
-
var li = $super(options);
|
419
|
-
var input = li.retrieveData('input');
|
420
|
-
|
421
|
-
if(options['className'] == "maininput") {
|
422
|
-
// Give the input a hook for our cucumber tests to use.
|
423
|
-
input.setAttribute('name', 'fblist-maininput');
|
424
|
-
};
|
425
|
-
|
426
|
-
input.observe('keydown', function(e) {
|
427
|
-
this.dosearch = false;
|
428
|
-
this.newvalue = false;
|
429
|
-
|
430
|
-
switch(e.keyCode) {
|
431
|
-
case Event.KEY_UP: e.stop(); return this.autoMove('up');
|
432
|
-
case Event.KEY_DOWN: e.stop(); return this.autoMove('down');
|
433
|
-
|
434
|
-
case Event.KEY_RETURN:
|
435
|
-
// If the text input is blank and the user hits Enter call the
|
436
|
-
// onEmptyInput callback.
|
437
|
-
if (String('').valueOf() == String(this.current.retrieveData('input').getValue()).valueOf()) {
|
438
|
-
this.options.get("onEmptyInput")();
|
439
|
-
}
|
440
|
-
e.stop();
|
441
|
-
if(!this.autocurrent || !this.resultsshown) break;
|
442
|
-
this.current_input = "";
|
443
|
-
this.autoAdd(this.autocurrent);
|
444
|
-
this.autocurrent = false;
|
445
|
-
this.autoenter = true;
|
446
|
-
break;
|
447
|
-
case Event.KEY_ESC:
|
448
|
-
this.autoHide();
|
449
|
-
if(this.current && this.current.retrieveData('input'))
|
450
|
-
this.current.retrieveData('input').clear();
|
451
|
-
break;
|
452
|
-
default:
|
453
|
-
this.dosearch = true;
|
454
|
-
}
|
455
|
-
}.bind(this));
|
456
|
-
input.observe('keyup',function(e) {
|
457
|
-
var code = this.options.get('separator').code;
|
458
|
-
var splitOn = this.options.get('separator').value;
|
459
|
-
switch(e.keyCode) {
|
460
|
-
case code:
|
461
|
-
if(this.options.get('newValues')) {
|
462
|
-
new_value_el = this.current.retrieveData('input');
|
463
|
-
if (!new_value_el.value.endsWith('<')) {
|
464
|
-
keep_input = "";
|
465
|
-
if (new_value_el.value.indexOf(splitOn) < (new_value_el.value.length - splitOn.length)){
|
466
|
-
separator_pos = new_value_el.value.indexOf(splitOn);
|
467
|
-
keep_input = new_value_el.value.substr(separator_pos + 1);
|
468
|
-
new_value_el.value = new_value_el.value.substr(0,separator_pos).escapeHTML().strip();
|
469
|
-
} else {
|
470
|
-
new_value_el.value = new_value_el.value.gsub(splitOn,"").escapeHTML().strip();
|
471
|
-
}
|
472
|
-
if(!this.options.get("spaceReplace").blank()) new_value_el.value.gsub(" ", this.options.get("spaceReplace"));
|
473
|
-
if(!new_value_el.value.blank()) {
|
474
|
-
e.stop();
|
475
|
-
this.newvalue = true;
|
476
|
-
this.current_input = keep_input.escapeHTML().strip();
|
477
|
-
this.autoAdd(new_value_el);
|
478
|
-
input.value = keep_input;
|
479
|
-
this.update();
|
480
|
-
}
|
481
|
-
}
|
482
|
-
}
|
483
|
-
break;
|
484
|
-
case Event.KEY_UP:
|
485
|
-
case Event.KEY_DOWN:
|
486
|
-
case Event.KEY_RETURN:
|
487
|
-
case Event.KEY_ESC:
|
488
|
-
break;
|
489
|
-
default:
|
490
|
-
// If the user doesn't add comma after, the value is discarded upon submit
|
491
|
-
this.current_input = input.value.strip().escapeHTML();
|
492
|
-
this.update();
|
493
|
-
|
494
|
-
// Removed Ajax.Request from here and moved to initialize,
|
495
|
-
// now doesn't create server queries every search but only
|
496
|
-
// refreshes the list on initialize (page load)
|
497
|
-
if(this.searchTimeout) clearTimeout(this.searchTimeout);
|
498
|
-
this.searchTimeout = setTimeout(function(){
|
499
|
-
var sanitizer = new RegExp("[({[^$*+?\\\]})]","g");
|
500
|
-
if(this.dosearch) this.autoShow(input.value.replace(sanitizer,"\\$1"));
|
501
|
-
}.bind(this), 250);
|
502
|
-
}
|
503
|
-
}.bind(this));
|
504
|
-
input.observe(Prototype.Browser.IE ? 'keydown' : 'keypress', function(e) {
|
505
|
-
if ((e.keyCode == Event.KEY_RETURN) && this.autoenter) e.stop();
|
506
|
-
this.autoenter = false;
|
507
|
-
}.bind(this));
|
508
|
-
return li;
|
509
|
-
},
|
510
|
-
|
511
|
-
createBox: function($super,text, options) {
|
512
|
-
var li = $super(text, options);
|
513
|
-
li.observe('mouseover',function() {
|
514
|
-
this.addClassName('bit-hover');
|
515
|
-
}).observe('mouseout',function() {
|
516
|
-
this.removeClassName('bit-hover');
|
517
|
-
});
|
518
|
-
var a = new Element('a', {
|
519
|
-
'href': '#',
|
520
|
-
'class': 'closebutton'
|
521
|
-
});
|
522
|
-
a.observe('click',function(e) {
|
523
|
-
e.stop();
|
524
|
-
if(! this.current) this.focus(this.maininput);
|
525
|
-
this.dispose(li);
|
526
|
-
}.bind(this));
|
527
|
-
li.insert(a).cacheData('text', Object.toJSON(text));
|
528
|
-
return li;
|
529
|
-
}
|
530
|
-
});
|
531
|
-
|
532
|
-
Element.addMethods({
|
533
|
-
onBoxDispose: function(item,obj) {
|
534
|
-
// Set to not to "add back" values in the drop-down upon delete if they were new values
|
535
|
-
item = item.retrieveData('text').evalJSON(true);
|
536
|
-
if(!item.newValue)
|
537
|
-
obj.autoFeed(item);
|
538
|
-
},
|
539
|
-
onInputFocus: function(el,obj) { obj.autoShow(); },
|
540
|
-
onInputBlur: function(el,obj) {
|
541
|
-
obj.lastinput = el;
|
542
|
-
if(!obj.curOn) {
|
543
|
-
obj.blurhide = obj.autoHide.bind(obj).delay(0.1);
|
544
|
-
}
|
545
|
-
},
|
546
|
-
filter: function(D,E) { var C=[];for(var B=0,A=this.length;B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B]);}} return C; }
|
547
|
-
});
|
548
|
-
|