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
data/lib/tasks/db/schema.rake
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
2
|
-
#
|
3
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
4
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
5
|
-
#------------------------------------------------------------------------------
|
6
|
-
namespace :db do
|
7
|
-
namespace :schema do
|
8
|
-
|
9
|
-
desc "Upgrade your database schema from ids to timestamps"
|
10
|
-
task :upgrade => :environment do
|
11
|
-
timestamps = Dir.glob("db/migrate/*.rb").map{|f| File.basename(f)[/(\d+)/,1] }.sort
|
12
|
-
timestamps[0..30].each_with_index do |timestamp, i|
|
13
|
-
puts "== #{i+1} => #{timestamp}"
|
14
|
-
ActiveRecord::Base.connection.
|
15
|
-
execute("update schema_migrations set version=#{timestamp} where version='#{i+1}';")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
root = this
|
2
|
-
|
3
|
-
class ajaxChosen extends Chosen
|
4
|
-
activate_field: ->
|
5
|
-
if @options.show_on_activate and not @active_field
|
6
|
-
this.results_show()
|
7
|
-
super
|
8
|
-
|
9
|
-
constructor: (select, @options, callback) ->
|
10
|
-
# Load chosen. To make things clear, I have taken the liberty
|
11
|
-
# of using the .chzn-autoselect class to specify input elements
|
12
|
-
# we want to use with ajax autocomplete.
|
13
|
-
super select, options
|
14
|
-
|
15
|
-
# Save a reference to the chosen object
|
16
|
-
chosen = $(this)
|
17
|
-
|
18
|
-
# Now that chosen is loaded normally, we can bootstrap it with
|
19
|
-
# our ajax autocomplete code.
|
20
|
-
select.next('.chzn-container')
|
21
|
-
.down('.chzn-search > input')
|
22
|
-
.observe 'keyup', ->
|
23
|
-
# This code will be executed every time the user types a letter
|
24
|
-
# into the input form that chosen has created
|
25
|
-
|
26
|
-
# Retrieve the current value of the input form
|
27
|
-
val = $(this).value.strip()
|
28
|
-
# Don't perform the AJAX search until user stops typing for a
|
29
|
-
# minimum delay
|
30
|
-
|
31
|
-
if window.ajaxChosenDelayTimer
|
32
|
-
clearTimeout window.ajaxChosenDelayTimer
|
33
|
-
window.ajaxChosenDelayTimer = null
|
34
|
-
|
35
|
-
# This reference is frozen in the following closures
|
36
|
-
search_field = $(this)
|
37
|
-
|
38
|
-
window.ajaxChosenDelayTimer = setTimeout ->
|
39
|
-
return false if val is search_field.readAttribute('data-prevVal')
|
40
|
-
|
41
|
-
# Set the current search term so we don't execute the ajax call if
|
42
|
-
# the user hits a key that isn't an input letter/number/symbol
|
43
|
-
search_field.writeAttribute('data-prevVal', val)
|
44
|
-
|
45
|
-
# I'm assuming that it's ok to use the parameter name `term` to send
|
46
|
-
# the form value during the ajax call. Change if absolutely needed.
|
47
|
-
query_key = options.query_key || "term"
|
48
|
-
(options.parameters ||= {})[query_key] = val
|
49
|
-
|
50
|
-
# If the user provided an ajax success callback, store it so we can
|
51
|
-
# call it after our bootstrapping is finished.
|
52
|
-
success = options.success
|
53
|
-
|
54
|
-
# Create our own callback that will be executed when the ajax call is
|
55
|
-
# finished.
|
56
|
-
options.onSuccess = (data) ->
|
57
|
-
# Exit if the data we're given is invalid
|
58
|
-
return if not data?
|
59
|
-
|
60
|
-
# Go through all of the <option> elements in the <select> and remove
|
61
|
-
# ones that have not been selected by the user.
|
62
|
-
select.childElements().each (el) -> el.remove() if not el.selected
|
63
|
-
|
64
|
-
# Send the ajax results to the user callback so we can get an object of
|
65
|
-
# value => text pairs to inject as <option> elements.
|
66
|
-
items = if callback then callback(data.responseJSON) else data.responseJSON
|
67
|
-
|
68
|
-
# Iterate through the given data and inject the <option> elements into
|
69
|
-
# the DOM
|
70
|
-
$H(items).each (pair) ->
|
71
|
-
if select.value != pair.key
|
72
|
-
select.insert
|
73
|
-
bottom:
|
74
|
-
new Element("option", {value: pair.key})
|
75
|
-
.update(pair.value)
|
76
|
-
|
77
|
-
val = search_field.value
|
78
|
-
|
79
|
-
# Tell chosen that the contents of the <select> input have been updated
|
80
|
-
# This makes chosen update its internal list of the input data.
|
81
|
-
select.fire("liszt:updated")
|
82
|
-
|
83
|
-
# For some reason, the contents of the input field get removed once you
|
84
|
-
# call trigger above. Often, this can be very annoying (and can make some
|
85
|
-
# searches impossible), so we add the value the user was typing back into
|
86
|
-
# the input field.
|
87
|
-
search_field.value = val
|
88
|
-
|
89
|
-
chosen.winnow_results()
|
90
|
-
|
91
|
-
# Finally, call the user supplied callback (if it exists)
|
92
|
-
success() if success?
|
93
|
-
|
94
|
-
# Execute the ajax call to search for autocomplete data
|
95
|
-
new Ajax.Request options.url, options
|
96
|
-
, 300
|
97
|
-
|
98
|
-
root.ajaxChosen = ajaxChosen
|
@@ -1,580 +0,0 @@
|
|
1
|
-
###
|
2
|
-
Chosen source: generate output using 'cake build'
|
3
|
-
Copyright (c) 2011 by Harvest
|
4
|
-
###
|
5
|
-
root = this
|
6
|
-
|
7
|
-
class Chosen extends AbstractChosen
|
8
|
-
|
9
|
-
setup: ->
|
10
|
-
@is_rtl = @form_field.hasClassName "chzn-rtl"
|
11
|
-
|
12
|
-
finish_setup: ->
|
13
|
-
@form_field.addClassName "chzn-done"
|
14
|
-
|
15
|
-
set_default_values: ->
|
16
|
-
super()
|
17
|
-
|
18
|
-
# HTML Templates
|
19
|
-
@single_temp = new Template('<a href="javascript:void(0)" class="chzn-single"><span>#{default}</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>')
|
20
|
-
@multi_temp = new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>')
|
21
|
-
@choice_temp = new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>')
|
22
|
-
@no_results_temp = new Template('<li class="no-results">' + @results_none_found + ' "<span>#{terms}</span>"</li>')
|
23
|
-
|
24
|
-
set_up_html: ->
|
25
|
-
@container_id = @form_field.identify().replace(/(:|\.)/g, '_') + "_chzn"
|
26
|
-
|
27
|
-
@f_width = if @form_field.getStyle("width") then parseInt @form_field.getStyle("width"), 10 else @form_field.getWidth()
|
28
|
-
|
29
|
-
container_props =
|
30
|
-
'id': @container_id
|
31
|
-
'class': "chzn-container#{ if @is_rtl then ' chzn-rtl' else '' }"
|
32
|
-
'style': 'width: ' + (@f_width) + 'px' #use parens around @f_width so coffeescript doesn't think + ' px' is a function parameter
|
33
|
-
|
34
|
-
@default_text = if @form_field.readAttribute 'data-placeholder' then @form_field.readAttribute 'data-placeholder' else @default_text_default
|
35
|
-
|
36
|
-
base_template = if @is_multiple then new Element('div', container_props).update( @multi_temp.evaluate({ "default": @default_text}) ) else new Element('div', container_props).update( @single_temp.evaluate({ "default":@default_text }) )
|
37
|
-
|
38
|
-
@form_field.hide().insert({ after: base_template })
|
39
|
-
@container = $(@container_id)
|
40
|
-
@container.addClassName( "chzn-container-" + (if @is_multiple then "multi" else "single") )
|
41
|
-
@container.addClassName "chzn-container-single-nosearch" if not @is_multiple and @form_field.options.length <= @disable_search_threshold
|
42
|
-
@dropdown = @container.down('div.chzn-drop')
|
43
|
-
|
44
|
-
dd_top = @container.getHeight()
|
45
|
-
dd_width = (@f_width - get_side_border_padding(@dropdown))
|
46
|
-
|
47
|
-
@dropdown.setStyle({"width": dd_width + "px", "top": dd_top + "px"})
|
48
|
-
|
49
|
-
@search_field = @container.down('input')
|
50
|
-
@search_results = @container.down('ul.chzn-results')
|
51
|
-
this.search_field_scale()
|
52
|
-
|
53
|
-
@search_no_results = @container.down('li.no-results')
|
54
|
-
|
55
|
-
if @is_multiple
|
56
|
-
@search_choices = @container.down('ul.chzn-choices')
|
57
|
-
@search_container = @container.down('li.search-field')
|
58
|
-
else
|
59
|
-
@search_container = @container.down('div.chzn-search')
|
60
|
-
@selected_item = @container.down('.chzn-single')
|
61
|
-
sf_width = dd_width - get_side_border_padding(@search_container) - get_side_border_padding(@search_field)
|
62
|
-
@search_field.setStyle( {"width" : sf_width + "px"} )
|
63
|
-
|
64
|
-
this.results_build()
|
65
|
-
this.set_tab_index()
|
66
|
-
@form_field.fire("liszt:ready", {chosen: this})
|
67
|
-
|
68
|
-
register_observers: ->
|
69
|
-
@container.observe "mousedown", (evt) => this.container_mousedown(evt)
|
70
|
-
@container.observe "mouseup", (evt) => this.container_mouseup(evt)
|
71
|
-
@container.observe "mouseenter", (evt) => this.mouse_enter(evt)
|
72
|
-
@container.observe "mouseleave", (evt) => this.mouse_leave(evt)
|
73
|
-
|
74
|
-
@search_results.observe "mouseup", (evt) => this.search_results_mouseup(evt)
|
75
|
-
@search_results.observe "mouseover", (evt) => this.search_results_mouseover(evt)
|
76
|
-
@search_results.observe "mouseout", (evt) => this.search_results_mouseout(evt)
|
77
|
-
|
78
|
-
@form_field.observe "liszt:updated", (evt) => this.results_update_field(evt)
|
79
|
-
|
80
|
-
@search_field.observe "blur", (evt) => this.input_blur(evt)
|
81
|
-
@search_field.observe "keyup", (evt) => this.keyup_checker(evt)
|
82
|
-
@search_field.observe "keydown", (evt) => this.keydown_checker(evt)
|
83
|
-
|
84
|
-
if @is_multiple
|
85
|
-
@search_choices.observe "click", (evt) => this.choices_click(evt)
|
86
|
-
@search_field.observe "focus", (evt) => this.input_focus(evt)
|
87
|
-
|
88
|
-
search_field_disabled: ->
|
89
|
-
@is_disabled = @form_field.disabled
|
90
|
-
if(@is_disabled)
|
91
|
-
@container.addClassName 'chzn-disabled'
|
92
|
-
@search_field.disabled = true
|
93
|
-
@selected_item.stopObserving "focus", @activate_action if !@is_multiple
|
94
|
-
this.close_field()
|
95
|
-
else
|
96
|
-
@container.removeClassName 'chzn-disabled'
|
97
|
-
@search_field.disabled = false
|
98
|
-
@selected_item.observe "focus", @activate_action if !@is_multiple
|
99
|
-
|
100
|
-
container_mousedown: (evt) ->
|
101
|
-
if !@is_disabled
|
102
|
-
target_closelink = if evt? then evt.target.hasClassName "search-choice-close" else false
|
103
|
-
if evt and evt.type is "mousedown" and not @results_showing
|
104
|
-
evt.stop()
|
105
|
-
if not @pending_destroy_click and not target_closelink
|
106
|
-
if not @active_field
|
107
|
-
@search_field.clear() if @is_multiple
|
108
|
-
document.observe "click", @click_test_action
|
109
|
-
this.results_show()
|
110
|
-
else if not @is_multiple and evt and (evt.target is @selected_item || evt.target.up("a.chzn-single"))
|
111
|
-
this.results_toggle()
|
112
|
-
|
113
|
-
this.activate_field()
|
114
|
-
else
|
115
|
-
@pending_destroy_click = false
|
116
|
-
|
117
|
-
container_mouseup: (evt) ->
|
118
|
-
this.results_reset(evt) if evt.target.nodeName is "ABBR"
|
119
|
-
|
120
|
-
blur_test: (evt) ->
|
121
|
-
this.close_field() if not @active_field and @container.hasClassName("chzn-container-active")
|
122
|
-
|
123
|
-
close_field: ->
|
124
|
-
document.stopObserving "click", @click_test_action
|
125
|
-
|
126
|
-
if not @is_multiple
|
127
|
-
@selected_item.tabIndex = @search_field.tabIndex
|
128
|
-
@search_field.tabIndex = -1
|
129
|
-
|
130
|
-
@active_field = false
|
131
|
-
this.results_hide()
|
132
|
-
|
133
|
-
@container.removeClassName "chzn-container-active"
|
134
|
-
this.winnow_results_clear()
|
135
|
-
this.clear_backstroke()
|
136
|
-
|
137
|
-
this.show_search_field_default()
|
138
|
-
this.search_field_scale()
|
139
|
-
|
140
|
-
activate_field: ->
|
141
|
-
if not @is_multiple and not @active_field
|
142
|
-
@search_field.tabIndex = @selected_item.tabIndex
|
143
|
-
@selected_item.tabIndex = -1
|
144
|
-
|
145
|
-
@container.addClassName "chzn-container-active"
|
146
|
-
@active_field = true
|
147
|
-
|
148
|
-
@search_field.value = @search_field.value
|
149
|
-
@search_field.focus()
|
150
|
-
|
151
|
-
|
152
|
-
test_active_click: (evt) ->
|
153
|
-
if evt.target.up('#' + @container_id)
|
154
|
-
@active_field = true
|
155
|
-
else
|
156
|
-
this.close_field()
|
157
|
-
|
158
|
-
results_build: ->
|
159
|
-
startTime = new Date()
|
160
|
-
@parsing = true
|
161
|
-
@results_data = root.SelectParser.select_to_array @form_field
|
162
|
-
|
163
|
-
if @is_multiple and @choices > 0
|
164
|
-
@search_choices.select("li.search-choice").invoke("remove")
|
165
|
-
@choices = 0
|
166
|
-
else if not @is_multiple
|
167
|
-
@selected_item.down("span").update(@default_text)
|
168
|
-
|
169
|
-
content = ''
|
170
|
-
for data in @results_data
|
171
|
-
if data.group
|
172
|
-
content += this.result_add_group data
|
173
|
-
else if !data.empty
|
174
|
-
content += this.result_add_option data
|
175
|
-
if data.selected and @is_multiple
|
176
|
-
this.choice_build data
|
177
|
-
else if data.selected and not @is_multiple
|
178
|
-
@selected_item.down("span").update( data.html )
|
179
|
-
this.single_deselect_control_build() if @allow_single_deselect
|
180
|
-
|
181
|
-
this.search_field_disabled()
|
182
|
-
this.show_search_field_default()
|
183
|
-
this.search_field_scale()
|
184
|
-
|
185
|
-
@search_results.update content
|
186
|
-
@parsing = false
|
187
|
-
|
188
|
-
|
189
|
-
result_add_group: (group) ->
|
190
|
-
if not group.disabled
|
191
|
-
group.dom_id = @container_id + "_g_" + group.array_index
|
192
|
-
'<li id="' + group.dom_id + '" class="group-result">' + group.label.escapeHTML() + '</li>'
|
193
|
-
else
|
194
|
-
""
|
195
|
-
|
196
|
-
result_do_highlight: (el) ->
|
197
|
-
this.result_clear_highlight()
|
198
|
-
|
199
|
-
@result_highlight = el
|
200
|
-
@result_highlight.addClassName "highlighted"
|
201
|
-
|
202
|
-
maxHeight = parseInt @search_results.getStyle('maxHeight'), 10
|
203
|
-
visible_top = @search_results.scrollTop
|
204
|
-
visible_bottom = maxHeight + visible_top
|
205
|
-
|
206
|
-
high_top = @result_highlight.positionedOffset().top
|
207
|
-
high_bottom = high_top + @result_highlight.getHeight()
|
208
|
-
|
209
|
-
if high_bottom >= visible_bottom
|
210
|
-
@search_results.scrollTop = if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0
|
211
|
-
else if high_top < visible_top
|
212
|
-
@search_results.scrollTop = high_top
|
213
|
-
|
214
|
-
result_clear_highlight: ->
|
215
|
-
@result_highlight.removeClassName('highlighted') if @result_highlight
|
216
|
-
@result_highlight = null
|
217
|
-
|
218
|
-
results_show: ->
|
219
|
-
if not @is_multiple
|
220
|
-
@selected_item.addClassName('chzn-single-with-drop')
|
221
|
-
if @result_single_selected
|
222
|
-
this.result_do_highlight( @result_single_selected )
|
223
|
-
|
224
|
-
dd_top = if @is_multiple then @container.getHeight() else (@container.getHeight() - 1)
|
225
|
-
@dropdown.setStyle {"top": dd_top + "px", "left":0}
|
226
|
-
@results_showing = true
|
227
|
-
|
228
|
-
@search_field.focus()
|
229
|
-
@search_field.value = @search_field.value
|
230
|
-
|
231
|
-
this.winnow_results()
|
232
|
-
|
233
|
-
results_hide: ->
|
234
|
-
@selected_item.removeClassName('chzn-single-with-drop') unless @is_multiple
|
235
|
-
this.result_clear_highlight()
|
236
|
-
@dropdown.setStyle({"left":"-9000px"})
|
237
|
-
@results_showing = false
|
238
|
-
|
239
|
-
|
240
|
-
set_tab_index: (el) ->
|
241
|
-
if @form_field.tabIndex
|
242
|
-
ti = @form_field.tabIndex
|
243
|
-
@form_field.tabIndex = -1
|
244
|
-
|
245
|
-
if @is_multiple
|
246
|
-
@search_field.tabIndex = ti
|
247
|
-
else
|
248
|
-
@selected_item.tabIndex = ti
|
249
|
-
@search_field.tabIndex = -1
|
250
|
-
|
251
|
-
show_search_field_default: ->
|
252
|
-
if @is_multiple and @choices < 1 and not @active_field
|
253
|
-
@search_field.value = @default_text
|
254
|
-
@search_field.addClassName "default"
|
255
|
-
else
|
256
|
-
@search_field.value = ""
|
257
|
-
@search_field.removeClassName "default"
|
258
|
-
|
259
|
-
search_results_mouseup: (evt) ->
|
260
|
-
target = if evt.target.hasClassName("active-result") then evt.target else evt.target.up(".active-result")
|
261
|
-
if target
|
262
|
-
@result_highlight = target
|
263
|
-
this.result_select(evt)
|
264
|
-
|
265
|
-
search_results_mouseover: (evt) ->
|
266
|
-
target = if evt.target.hasClassName("active-result") then evt.target else evt.target.up(".active-result")
|
267
|
-
this.result_do_highlight( target ) if target
|
268
|
-
|
269
|
-
search_results_mouseout: (evt) ->
|
270
|
-
this.result_clear_highlight() if evt.target.hasClassName('active-result') or evt.target.up('.active-result')
|
271
|
-
|
272
|
-
|
273
|
-
choices_click: (evt) ->
|
274
|
-
evt.preventDefault()
|
275
|
-
if( @active_field and not(evt.target.hasClassName('search-choice') or evt.target.up('.search-choice')) and not @results_showing )
|
276
|
-
this.results_show()
|
277
|
-
|
278
|
-
choice_build: (item) ->
|
279
|
-
choice_id = @container_id + "_c_" + item.array_index
|
280
|
-
@choices += 1
|
281
|
-
@search_container.insert
|
282
|
-
before: @choice_temp.evaluate
|
283
|
-
id: choice_id
|
284
|
-
choice: item.html
|
285
|
-
position: item.array_index
|
286
|
-
link = $(choice_id).down('a')
|
287
|
-
link.observe "click", (evt) => this.choice_destroy_link_click(evt)
|
288
|
-
|
289
|
-
choice_destroy_link_click: (evt) ->
|
290
|
-
evt.preventDefault()
|
291
|
-
if not @is_disabled
|
292
|
-
@pending_destroy_click = true
|
293
|
-
this.choice_destroy evt.target
|
294
|
-
|
295
|
-
choice_destroy: (link) ->
|
296
|
-
@choices -= 1
|
297
|
-
this.show_search_field_default()
|
298
|
-
|
299
|
-
this.results_hide() if @is_multiple and @choices > 0 and @search_field.value.length < 1
|
300
|
-
|
301
|
-
this.result_deselect link.readAttribute("rel")
|
302
|
-
link.up('li').remove()
|
303
|
-
|
304
|
-
results_reset: (evt) ->
|
305
|
-
@form_field.options[0].selected = true
|
306
|
-
@selected_item.down("span").update(@default_text)
|
307
|
-
this.show_search_field_default()
|
308
|
-
evt.target.remove()
|
309
|
-
@form_field.simulate("change") if typeof Event.simulate is 'function'
|
310
|
-
this.results_hide() if @active_field
|
311
|
-
|
312
|
-
result_select: (evt) ->
|
313
|
-
if @result_highlight
|
314
|
-
high = @result_highlight
|
315
|
-
this.result_clear_highlight()
|
316
|
-
|
317
|
-
if @is_multiple
|
318
|
-
this.result_deactivate high
|
319
|
-
else
|
320
|
-
@search_results.descendants(".result-selected").invoke "removeClassName", "result-selected"
|
321
|
-
@result_single_selected = high
|
322
|
-
|
323
|
-
high.addClassName("result-selected")
|
324
|
-
|
325
|
-
position = high.id.substr(high.id.lastIndexOf("_") + 1 )
|
326
|
-
item = @results_data[position]
|
327
|
-
item.selected = true
|
328
|
-
|
329
|
-
@form_field.options[item.options_index].selected = true
|
330
|
-
|
331
|
-
if @is_multiple
|
332
|
-
this.choice_build item
|
333
|
-
else
|
334
|
-
@selected_item.down("span").update(item.html)
|
335
|
-
this.single_deselect_control_build() if @allow_single_deselect
|
336
|
-
|
337
|
-
@on_option_add(item.value) if @on_option_add
|
338
|
-
|
339
|
-
this.results_hide() unless evt.metaKey and @is_multiple
|
340
|
-
|
341
|
-
@search_field.value = ""
|
342
|
-
|
343
|
-
@form_field.simulate("change") if typeof Event.simulate is 'function'
|
344
|
-
this.search_field_scale()
|
345
|
-
else if @options.allow_option_creation
|
346
|
-
new_option = @search_field.value
|
347
|
-
return unless new_option
|
348
|
-
if @allow_creation(new_option)
|
349
|
-
@form_field.insert(Element('option', {selected: true, value: new_option}).update(new_option))
|
350
|
-
@results_update_field(evt)
|
351
|
-
@on_option_add(new_option) if @on_option_add
|
352
|
-
@form_field.simulate("change") if typeof Event.simulate is 'function'
|
353
|
-
@search_field.value = ""
|
354
|
-
@results_hide()
|
355
|
-
|
356
|
-
allow_creation: (new_option) ->
|
357
|
-
if @is_multiple
|
358
|
-
matches = @search_choices.getElementsBySelector("li.search-choice span").select (el) ->
|
359
|
-
console.debug(el)
|
360
|
-
el.innerHTML.toLowerCase() == new_option.toLowerCase()
|
361
|
-
console.debug(matches)
|
362
|
-
!matches.length
|
363
|
-
else
|
364
|
-
@selected_item.getElementsBySelector('span').innerHTML.toLowerCase() != new_option.toLowerCase()
|
365
|
-
|
366
|
-
result_activate: (el) ->
|
367
|
-
el.addClassName("active-result")
|
368
|
-
|
369
|
-
result_deactivate: (el) ->
|
370
|
-
el.removeClassName("active-result")
|
371
|
-
|
372
|
-
result_deselect: (pos) ->
|
373
|
-
result_data = @results_data[pos]
|
374
|
-
result_data.selected = false
|
375
|
-
|
376
|
-
option = @form_field.options[result_data.options_index]
|
377
|
-
option.selected = false
|
378
|
-
@on_option_remove(option.value) if @on_option_remove
|
379
|
-
|
380
|
-
result = $(@container_id + "_o_" + pos)
|
381
|
-
result.removeClassName("result-selected").addClassName("active-result").show()
|
382
|
-
|
383
|
-
this.result_clear_highlight()
|
384
|
-
this.winnow_results()
|
385
|
-
|
386
|
-
@form_field.simulate("change") if typeof Event.simulate is 'function'
|
387
|
-
this.search_field_scale()
|
388
|
-
|
389
|
-
single_deselect_control_build: ->
|
390
|
-
@selected_item.down("span").insert { after: "<abbr class=\"search-choice-close\"></abbr>" } if @allow_single_deselect and not @selected_item.down("abbr")
|
391
|
-
|
392
|
-
winnow_results: ->
|
393
|
-
startTime = new Date()
|
394
|
-
this.no_results_clear()
|
395
|
-
|
396
|
-
results = 0
|
397
|
-
|
398
|
-
searchText = if @search_field.value is @default_text then "" else @search_field.value.strip().escapeHTML()
|
399
|
-
textToSearch = searchText.replace(/[\-\[\]\{\}\(\)\*\+\?\.,\\\^\$\|\#\s]/g, "\\$&")
|
400
|
-
regex = new RegExp('^' + textToSearch, 'i')
|
401
|
-
zregex = new RegExp(textToSearch, 'i')
|
402
|
-
fregex = new RegExp("^" + textToSearch + "$", 'i')
|
403
|
-
|
404
|
-
for option in @results_data
|
405
|
-
if not option.disabled and not option.empty
|
406
|
-
if option.group
|
407
|
-
$(option.dom_id).hide()
|
408
|
-
else if not (@is_multiple and option.selected)
|
409
|
-
found = false
|
410
|
-
result_id = option.dom_id
|
411
|
-
|
412
|
-
if @options.allow_option_creation && searchText && fregex.test(option.html)
|
413
|
-
found = true
|
414
|
-
results += 1
|
415
|
-
@result_do_highlight($(option.dom_id))
|
416
|
-
else if regex.test option.html
|
417
|
-
found = true
|
418
|
-
results += 1
|
419
|
-
else if option.html.indexOf(" ") >= 0 or option.html.indexOf("[") == 0
|
420
|
-
#TODO: replace this substitution of /\[\]/ with a list of characters to skip.
|
421
|
-
parts = option.html.replace(/\[|\]/g, "").split(" ")
|
422
|
-
if parts.length
|
423
|
-
for part in parts
|
424
|
-
if regex.test part
|
425
|
-
found = true
|
426
|
-
results += 1
|
427
|
-
|
428
|
-
if found
|
429
|
-
if searchText.length
|
430
|
-
startpos = option.html.search zregex
|
431
|
-
text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length)
|
432
|
-
text = text.substr(0, startpos) + '<em>' + text.substr(startpos)
|
433
|
-
else
|
434
|
-
text = option.html
|
435
|
-
|
436
|
-
$(result_id).update text if $(result_id).innerHTML != text
|
437
|
-
|
438
|
-
this.result_activate $(result_id)
|
439
|
-
|
440
|
-
$(@results_data[option.group_array_index].dom_id).show() if option.group_array_index?
|
441
|
-
else
|
442
|
-
this.result_clear_highlight() if $(result_id) is @result_highlight
|
443
|
-
this.result_deactivate $(result_id)
|
444
|
-
|
445
|
-
if results < 1 and searchText.length
|
446
|
-
this.no_results(searchText)
|
447
|
-
@results_hide() if @options.allow_option_creation && @is_multiple
|
448
|
-
else if not @options.allow_option_creation
|
449
|
-
this.winnow_results_set_highlight()
|
450
|
-
|
451
|
-
winnow_results_clear: ->
|
452
|
-
@search_field.clear()
|
453
|
-
lis = @search_results.select("li")
|
454
|
-
|
455
|
-
for li in lis
|
456
|
-
if li.hasClassName("group-result")
|
457
|
-
li.show()
|
458
|
-
else if not @is_multiple or not li.hasClassName("result-selected")
|
459
|
-
this.result_activate li
|
460
|
-
|
461
|
-
winnow_results_set_highlight: ->
|
462
|
-
if not @result_highlight
|
463
|
-
|
464
|
-
if not @is_multiple
|
465
|
-
do_high = @search_results.down(".result-selected.active-result")
|
466
|
-
|
467
|
-
if not do_high?
|
468
|
-
do_high = @search_results.down(".active-result")
|
469
|
-
|
470
|
-
this.result_do_highlight do_high if do_high?
|
471
|
-
|
472
|
-
no_results: (terms) ->
|
473
|
-
return if !@is_multiple && @options.allow_option_creation
|
474
|
-
@search_results.insert @no_results_temp.evaluate( terms: terms )
|
475
|
-
|
476
|
-
no_results_clear: ->
|
477
|
-
nr = null
|
478
|
-
nr.remove() while nr = @search_results.down(".no-results")
|
479
|
-
|
480
|
-
|
481
|
-
keydown_arrow: ->
|
482
|
-
actives = @search_results.select("li.active-result")
|
483
|
-
if actives.length
|
484
|
-
if not @result_highlight
|
485
|
-
this.result_do_highlight actives.first()
|
486
|
-
else if @results_showing
|
487
|
-
sibs = @result_highlight.nextSiblings()
|
488
|
-
nexts = sibs.intersect(actives)
|
489
|
-
this.result_do_highlight nexts.first() if nexts.length
|
490
|
-
this.results_show() if not @results_showing
|
491
|
-
|
492
|
-
keyup_arrow: ->
|
493
|
-
if not @results_showing and not @is_multiple
|
494
|
-
this.results_show()
|
495
|
-
else if @result_highlight
|
496
|
-
sibs = @result_highlight.previousSiblings()
|
497
|
-
actives = @search_results.select("li.active-result")
|
498
|
-
prevs = sibs.intersect(actives)
|
499
|
-
|
500
|
-
if prevs.length
|
501
|
-
this.result_do_highlight prevs.first()
|
502
|
-
else
|
503
|
-
this.results_hide() if @choices > 0
|
504
|
-
this.result_clear_highlight()
|
505
|
-
|
506
|
-
keydown_backstroke: ->
|
507
|
-
if @pending_backstroke
|
508
|
-
this.choice_destroy @pending_backstroke.down("a")
|
509
|
-
this.clear_backstroke()
|
510
|
-
else
|
511
|
-
@pending_backstroke = @search_container.siblings("li.search-choice").last()
|
512
|
-
@pending_backstroke.addClassName("search-choice-focus")
|
513
|
-
|
514
|
-
clear_backstroke: ->
|
515
|
-
@pending_backstroke.removeClassName("search-choice-focus") if @pending_backstroke
|
516
|
-
@pending_backstroke = null
|
517
|
-
|
518
|
-
keydown_checker: (evt) ->
|
519
|
-
stroke = evt.which ? evt.keyCode
|
520
|
-
this.search_field_scale()
|
521
|
-
|
522
|
-
this.clear_backstroke() if stroke != 8 and this.pending_backstroke
|
523
|
-
|
524
|
-
switch stroke
|
525
|
-
when 8
|
526
|
-
@backstroke_length = this.search_field.value.length
|
527
|
-
break
|
528
|
-
when 9
|
529
|
-
this.result_select(evt) if this.results_showing and not @is_multiple
|
530
|
-
@mouse_on_container = false
|
531
|
-
break
|
532
|
-
when 13
|
533
|
-
evt.preventDefault()
|
534
|
-
break
|
535
|
-
when 38
|
536
|
-
evt.preventDefault()
|
537
|
-
this.keyup_arrow()
|
538
|
-
break
|
539
|
-
when 40
|
540
|
-
this.keydown_arrow()
|
541
|
-
break
|
542
|
-
|
543
|
-
search_field_scale: ->
|
544
|
-
if @is_multiple
|
545
|
-
h = 0
|
546
|
-
w = 0
|
547
|
-
|
548
|
-
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"
|
549
|
-
styles = ['font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing']
|
550
|
-
|
551
|
-
for style in styles
|
552
|
-
style_block += style + ":" + @search_field.getStyle(style) + ";"
|
553
|
-
|
554
|
-
div = new Element('div', { 'style' : style_block }).update(@search_field.value.escapeHTML())
|
555
|
-
document.body.appendChild(div)
|
556
|
-
|
557
|
-
w = Element.measure(div, 'width') + 25
|
558
|
-
div.remove()
|
559
|
-
|
560
|
-
if( w > @f_width-10 )
|
561
|
-
w = @f_width - 10
|
562
|
-
|
563
|
-
@search_field.setStyle({'width': w + 'px'})
|
564
|
-
|
565
|
-
dd_top = @container.getHeight()
|
566
|
-
@dropdown.setStyle({"top": dd_top + "px"})
|
567
|
-
|
568
|
-
root.Chosen = Chosen
|
569
|
-
|
570
|
-
# Prototype does not support version numbers so we add it ourselves
|
571
|
-
if Prototype.Browser.IE
|
572
|
-
if /MSIE (\d+\.\d+);/.test(navigator.userAgent)
|
573
|
-
Prototype.BrowserFeatures['Version'] = new Number(RegExp.$1);
|
574
|
-
|
575
|
-
|
576
|
-
get_side_border_padding = (elmt) ->
|
577
|
-
layout = new Element.Layout(elmt)
|
578
|
-
side_border_padding = layout.get("border-left") + layout.get("border-right") + layout.get("padding-left") + layout.get("padding-right")
|
579
|
-
|
580
|
-
root.get_side_border_padding = get_side_border_padding
|