fat_free_crm 0.16.4 → 0.17.1
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 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +44 -5
- data/.rubocop_todo.yml +23 -359
- data/.travis.yml +21 -21
- data/CHANGELOG.md +42 -9
- data/Capfile +2 -0
- data/Gemfile +4 -1
- data/Gemfile.lock +27 -25
- data/Guardfile +2 -0
- data/README.md +5 -5
- data/Rakefile +2 -0
- data/Vagrantfile +92 -0
- data/app/assets/javascripts/application.js.erb +0 -2
- data/app/assets/javascripts/crm.js.coffee +16 -20
- data/app/assets/stylesheets/application.css.erb +0 -2
- data/app/controllers/admin/application_controller.rb +3 -1
- data/app/controllers/admin/field_groups_controller.rb +2 -0
- data/app/controllers/admin/fields_controller.rb +4 -5
- data/app/controllers/admin/groups_controller.rb +2 -0
- data/app/controllers/admin/plugins_controller.rb +3 -7
- data/app/controllers/admin/settings_controller.rb +3 -5
- data/app/controllers/admin/tags_controller.rb +3 -5
- data/app/controllers/admin/users_controller.rb +4 -2
- data/app/controllers/application_controller.rb +16 -16
- data/app/controllers/authentications_controller.rb +4 -2
- data/app/controllers/comments_controller.rb +5 -4
- data/app/controllers/emails_controller.rb +2 -0
- data/app/controllers/entities/accounts_controller.rb +14 -7
- data/app/controllers/entities/campaigns_controller.rb +15 -8
- data/app/controllers/entities/contacts_controller.rb +28 -21
- data/app/controllers/entities/leads_controller.rb +33 -22
- data/app/controllers/entities/opportunities_controller.rb +33 -26
- data/app/controllers/entities_controller.rb +15 -1
- data/app/controllers/home_controller.rb +10 -5
- data/app/controllers/lists_controller.rb +3 -5
- data/app/controllers/passwords_controller.rb +3 -1
- data/app/controllers/tasks_controller.rb +11 -9
- data/app/controllers/users_controller.rb +4 -1
- data/app/helpers/accounts_helper.rb +14 -19
- data/app/helpers/addresses_helper.rb +2 -0
- data/app/helpers/admin/application_helper.rb +3 -2
- data/app/helpers/admin/field_groups_helper.rb +2 -0
- data/app/helpers/admin/fields_helper.rb +2 -0
- data/app/helpers/admin/plugins_helper.rb +2 -0
- data/app/helpers/admin/settings_helper.rb +2 -0
- data/app/helpers/admin/tags_helper.rb +2 -0
- data/app/helpers/admin/users_helper.rb +37 -17
- data/app/helpers/application_helper.rb +62 -68
- data/app/helpers/authentications_helper.rb +2 -0
- data/app/helpers/campaigns_helper.rb +3 -1
- data/app/helpers/comments_helper.rb +2 -0
- data/app/helpers/contacts_helper.rb +5 -3
- data/app/helpers/emails_helper.rb +2 -0
- data/app/helpers/fields_helper.rb +2 -0
- data/app/helpers/groups_helper.rb +2 -0
- data/app/helpers/home_helper.rb +2 -0
- data/app/helpers/javascript_helper.rb +2 -0
- data/app/helpers/leads_helper.rb +4 -3
- data/app/helpers/lists_helper.rb +2 -0
- data/app/helpers/opportunities_helper.rb +11 -11
- data/app/helpers/passwords_helper.rb +2 -0
- data/app/helpers/remote_link_pagination_helper.rb +2 -0
- data/app/helpers/tags_helper.rb +4 -2
- data/app/helpers/tasks_helper.rb +11 -10
- data/app/helpers/users_helper.rb +3 -1
- data/app/helpers/versions_helper.rb +2 -0
- data/app/inputs/date_pair_input.rb +2 -0
- data/app/inputs/date_time_input.rb +2 -0
- data/app/inputs/datetime_pair_input.rb +2 -0
- data/app/inputs/text_input.rb +2 -0
- data/app/mailers/dropbox_mailer.rb +2 -0
- data/app/mailers/subscription_mailer.rb +14 -8
- data/app/mailers/user_mailer.rb +3 -2
- data/app/models/entities/account.rb +17 -9
- data/app/models/entities/account_contact.rb +3 -1
- data/app/models/entities/account_opportunity.rb +3 -1
- data/app/models/entities/campaign.rb +3 -1
- data/app/models/entities/contact.rb +9 -7
- data/app/models/entities/contact_opportunity.rb +2 -0
- data/app/models/entities/lead.rb +3 -1
- data/app/models/entities/opportunity.rb +3 -1
- data/app/models/fields/core_field.rb +3 -0
- data/app/models/fields/custom_field.rb +8 -5
- data/app/models/fields/custom_field_date_pair.rb +3 -1
- data/app/models/fields/custom_field_datetime_pair.rb +3 -1
- data/app/models/fields/custom_field_pair.rb +2 -0
- data/app/models/fields/field.rb +9 -4
- data/app/models/fields/field_group.rb +3 -1
- data/app/models/list.rb +2 -0
- data/app/models/observers/entity_observer.rb +2 -0
- data/app/models/observers/lead_observer.rb +3 -1
- data/app/models/observers/opportunity_observer.rb +5 -3
- data/app/models/observers/task_observer.rb +2 -0
- data/app/models/polymorphic/address.rb +2 -0
- data/app/models/polymorphic/avatar.rb +2 -0
- data/app/models/polymorphic/comment.rb +2 -0
- data/app/models/polymorphic/email.rb +2 -0
- data/app/models/polymorphic/tag.rb +2 -0
- data/app/models/polymorphic/tagging.rb +2 -0
- data/app/models/polymorphic/task.rb +9 -8
- data/app/models/polymorphic/version.rb +3 -1
- data/app/models/setting.rb +16 -0
- data/app/models/users/ability.rb +2 -0
- data/app/models/users/authentication.rb +2 -0
- data/app/models/users/group.rb +2 -0
- data/app/models/users/permission.rb +2 -0
- data/app/models/users/preference.rb +2 -0
- data/app/models/users/user.rb +15 -15
- data/app/views/accounts/_account.html.haml +3 -3
- data/app/views/accounts/_contact_info.html.haml +7 -7
- data/app/views/accounts/_edit.html.haml +8 -8
- data/app/views/accounts/_index_brief.html.haml +11 -11
- data/app/views/accounts/_index_long.html.haml +12 -12
- data/app/views/accounts/_new.html.haml +9 -9
- data/app/views/accounts/_sidebar_index.html.haml +5 -5
- data/app/views/accounts/_sidebar_show.html.haml +11 -11
- data/app/views/accounts/_title_bar.html.haml +2 -2
- data/app/views/accounts/_top_section.html.haml +8 -8
- data/app/views/accounts/create.js.haml +3 -3
- data/app/views/accounts/destroy.js.haml +1 -1
- data/app/views/accounts/edit.js.haml +4 -4
- data/app/views/accounts/index.js.haml +4 -4
- data/app/views/accounts/index.xls.builder +3 -1
- data/app/views/accounts/new.js.haml +1 -1
- data/app/views/accounts/show.html.haml +8 -8
- data/app/views/accounts/show.js.haml +1 -1
- data/app/views/accounts/update.js.haml +2 -2
- data/app/views/admin/custom_fields/_base_field.html.haml +4 -2
- data/app/views/admin/custom_fields/_check_boxes_field.html.haml +2 -2
- data/app/views/admin/custom_fields/_date_field.html.haml +1 -1
- data/app/views/admin/custom_fields/_date_pair_field.html.haml +2 -2
- data/app/views/admin/custom_fields/_datetime_field.html.haml +1 -1
- data/app/views/admin/custom_fields/_datetime_pair_field.html.haml +2 -2
- data/app/views/admin/custom_fields/_radio_field.html.haml +2 -2
- data/app/views/admin/custom_fields/_select_field.html.haml +1 -1
- data/app/views/admin/custom_fields/_string_field.html.haml +1 -1
- data/app/views/admin/field_groups/_confirm.html.haml +1 -1
- data/app/views/admin/field_groups/_edit.html.haml +3 -3
- data/app/views/admin/field_groups/_field_group.html.haml +9 -9
- data/app/views/admin/field_groups/_new.html.haml +4 -4
- data/app/views/admin/field_groups/_top_section.html.haml +3 -3
- data/app/views/admin/field_groups/confirm.js.haml +1 -1
- data/app/views/admin/field_groups/create.js.haml +2 -2
- 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 +1 -1
- data/app/views/admin/fields/_field.html.haml +4 -4
- data/app/views/admin/fields/_form.html.haml +10 -10
- data/app/views/admin/fields/_subform.html.haml +2 -2
- data/app/views/admin/fields/create.js.haml +2 -2
- data/app/views/admin/fields/edit.js.haml +1 -1
- data/app/views/admin/fields/index.html.haml +6 -6
- data/app/views/admin/fields/show.html.haml +1 -1
- data/app/views/admin/fields/update.js.haml +2 -2
- data/app/views/admin/groups/_edit.html.haml +3 -3
- data/app/views/admin/groups/_form.html.haml +1 -1
- data/app/views/admin/groups/_group.html.haml +4 -4
- data/app/views/admin/groups/_new.html.haml +3 -3
- data/app/views/admin/groups/create.js.haml +2 -2
- data/app/views/admin/groups/edit.js.haml +2 -2
- data/app/views/admin/groups/index.html.haml +3 -3
- data/app/views/admin/groups/index.js.haml +2 -2
- data/app/views/admin/groups/new.js.haml +1 -1
- data/app/views/admin/groups/update.js.haml +2 -2
- data/app/views/admin/plugins/_plugin.html.haml +1 -1
- data/app/views/admin/tags/_confirm.html.haml +2 -2
- data/app/views/admin/tags/_edit.html.haml +3 -3
- data/app/views/admin/tags/_new.html.haml +3 -3
- data/app/views/admin/tags/_tag.html.haml +4 -4
- data/app/views/admin/tags/confirm.js.haml +1 -1
- data/app/views/admin/tags/create.js.haml +2 -2
- data/app/views/admin/tags/edit.js.haml +3 -3
- data/app/views/admin/tags/index.html.haml +3 -3
- data/app/views/admin/tags/new.js.haml +1 -1
- data/app/views/admin/tags/update.js.haml +2 -2
- data/app/views/admin/users/_confirm.html.haml +1 -1
- data/app/views/admin/users/_edit.html.haml +3 -3
- data/app/views/admin/users/_new.html.haml +3 -3
- data/app/views/admin/users/_profile.html.haml +3 -3
- data/app/views/admin/users/_user.html.haml +16 -16
- data/app/views/admin/users/confirm.js.haml +1 -1
- data/app/views/admin/users/create.js.haml +2 -2
- data/app/views/admin/users/edit.js.haml +3 -3
- data/app/views/admin/users/index.html.haml +3 -3
- data/app/views/admin/users/index.js.haml +2 -2
- data/app/views/admin/users/new.js.haml +1 -1
- data/app/views/admin/users/reactivate.js.haml +1 -1
- data/app/views/admin/users/suspend.js.haml +1 -1
- data/app/views/admin/users/update.js.haml +2 -2
- data/app/views/application/_auto_complete.html.haml +3 -3
- data/app/views/application/index.atom.builder +10 -6
- data/app/views/application/index.rss.builder +3 -1
- data/app/views/application/show.atom.builder +11 -7
- data/app/views/application/show.rss.builder +4 -2
- data/app/views/authentications/new.html.haml +1 -1
- data/app/views/campaigns/_campaign.html.haml +3 -3
- data/app/views/campaigns/_edit.html.haml +7 -7
- data/app/views/campaigns/_index_brief.html.haml +3 -3
- data/app/views/campaigns/_index_long.html.haml +5 -5
- data/app/views/campaigns/_metrics.html.haml +5 -5
- data/app/views/campaigns/_new.html.haml +8 -8
- data/app/views/campaigns/_objectives.html.haml +6 -6
- data/app/views/campaigns/_sidebar_index.html.haml +5 -5
- data/app/views/campaigns/_sidebar_show.html.haml +10 -10
- data/app/views/campaigns/_status.html.haml +1 -1
- data/app/views/campaigns/_title_bar.html.haml +2 -2
- data/app/views/campaigns/_top_section.html.haml +9 -9
- data/app/views/campaigns/create.js.haml +3 -3
- data/app/views/campaigns/destroy.js.haml +1 -1
- data/app/views/campaigns/edit.js.haml +4 -4
- data/app/views/campaigns/index.js.haml +4 -4
- data/app/views/campaigns/index.xls.builder +22 -20
- data/app/views/campaigns/new.js.haml +1 -1
- data/app/views/campaigns/show.html.haml +9 -9
- data/app/views/campaigns/show.js.haml +1 -1
- data/app/views/campaigns/update.js.haml +2 -2
- data/app/views/comments/_comment.html.haml +5 -5
- data/app/views/comments/_edit.html.haml +5 -5
- data/app/views/comments/_new.html.haml +15 -15
- data/app/views/comments/_subscription_links.html.haml +3 -3
- data/app/views/comments/create.js.haml +1 -1
- data/app/views/comments/edit.js.haml +2 -2
- data/app/views/comments/update.js.haml +2 -2
- data/app/views/contacts/_contact.html.haml +3 -3
- data/app/views/contacts/_contacts.html.haml +2 -2
- data/app/views/contacts/_edit.html.haml +9 -9
- data/app/views/contacts/_extra.html.haml +3 -3
- data/app/views/contacts/_index_brief.html.haml +3 -3
- data/app/views/contacts/_index_full.html.haml +11 -11
- data/app/views/contacts/_index_long.html.haml +5 -5
- data/app/views/contacts/_new.html.haml +10 -10
- data/app/views/contacts/_section_extra.html.haml +1 -1
- data/app/views/contacts/_section_general.html.haml +1 -1
- data/app/views/contacts/_sidebar_show.html.haml +8 -8
- data/app/views/contacts/_title_bar.html.haml +2 -2
- data/app/views/contacts/_top_section.html.haml +9 -9
- data/app/views/contacts/create.js.haml +4 -4
- data/app/views/contacts/destroy.js.haml +2 -2
- data/app/views/contacts/edit.js.haml +4 -4
- data/app/views/contacts/index.js.haml +4 -4
- data/app/views/contacts/index.xls.builder +3 -1
- data/app/views/contacts/new.js.haml +1 -1
- data/app/views/contacts/show.html.haml +7 -7
- data/app/views/contacts/show.js.haml +1 -1
- data/app/views/contacts/update.js.haml +3 -3
- data/app/views/emails/_email.html.haml +6 -6
- data/app/views/entities/_basic_search.html.haml +3 -3
- data/app/views/entities/_permissions.html.haml +10 -10
- data/app/views/entities/_search.html.haml +6 -6
- data/app/views/entities/_section_custom_fields.html.haml +3 -3
- data/app/views/entities/_title_bar.html.haml +3 -3
- data/app/views/entities/attach.js.haml +2 -2
- data/app/views/entities/contacts.js.haml +2 -2
- 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/_edit_custom_field_group.html.haml +2 -2
- data/app/views/fields/_group.html.haml +5 -5
- data/app/views/fields/_group_table.html.haml +2 -2
- data/app/views/fields/_groups.html.haml +1 -1
- data/app/views/fields/_sidebar_show.html.haml +1 -1
- data/app/views/fields/group.js.erb +1 -1
- data/app/views/home/_account.html.haml +11 -11
- data/app/views/home/_activity.html.haml +7 -7
- data/app/views/home/_assets_menu.html.haml +1 -1
- data/app/views/home/_opportunity.html.haml +8 -8
- data/app/views/home/_options.html.haml +2 -2
- data/app/views/home/_task.html.haml +7 -7
- data/app/views/home/index.atom.builder +5 -3
- data/app/views/home/index.html.haml +6 -6
- data/app/views/home/index.js.haml +3 -3
- data/app/views/home/index.rss.builder +2 -0
- data/app/views/home/options.js.haml +1 -1
- data/app/views/layouts/500.html.haml +2 -2
- data/app/views/layouts/_footer.html.haml +1 -1
- data/app/views/layouts/_header.html.haml +3 -3
- data/app/views/layouts/_jumpbox.html.haml +1 -1
- data/app/views/layouts/_tabbed.html.haml +4 -4
- data/app/views/layouts/_tabless.html.haml +1 -1
- data/app/views/layouts/admin/_header.html.haml +3 -3
- data/app/views/layouts/admin/application.html.haml +5 -5
- data/app/views/layouts/application.html.haml +3 -3
- data/app/views/layouts/header.xls.builder +2 -0
- data/app/views/leads/_contact.html.haml +2 -2
- data/app/views/leads/_convert.html.haml +2 -2
- data/app/views/leads/_convert_permissions.html.haml +10 -10
- data/app/views/leads/_edit.html.haml +10 -10
- data/app/views/leads/_index_brief.html.haml +6 -6
- data/app/views/leads/_index_long.html.haml +7 -7
- data/app/views/leads/_lead.html.haml +3 -3
- data/app/views/leads/_leads.html.haml +2 -2
- data/app/views/leads/_new.html.haml +11 -11
- data/app/views/leads/_opportunity.html.haml +6 -6
- data/app/views/leads/_sidebar_index.html.haml +5 -5
- data/app/views/leads/_sidebar_show.html.haml +13 -13
- data/app/views/leads/_status.html.haml +7 -7
- data/app/views/leads/_title_bar.html.haml +3 -3
- data/app/views/leads/_top_section.html.haml +8 -8
- data/app/views/leads/convert.js.haml +4 -4
- data/app/views/leads/create.js.haml +3 -3
- data/app/views/leads/destroy.js.haml +1 -1
- data/app/views/leads/edit.js.haml +4 -4
- data/app/views/leads/index.js.haml +4 -4
- data/app/views/leads/index.xls.builder +3 -1
- data/app/views/leads/new.js.haml +1 -1
- data/app/views/leads/promote.js.haml +4 -4
- data/app/views/leads/reject.js.haml +1 -1
- data/app/views/leads/show.html.haml +6 -6
- data/app/views/leads/show.js.haml +1 -1
- data/app/views/leads/update.js.haml +3 -3
- data/app/views/lists/_lists.html.haml +2 -2
- data/app/views/lists/_sidebar.html.haml +8 -8
- data/app/views/opportunities/_edit.html.haml +7 -7
- data/app/views/opportunities/_index_brief.html.haml +4 -4
- data/app/views/opportunities/_index_long.html.haml +11 -11
- data/app/views/opportunities/_new.html.haml +8 -8
- data/app/views/opportunities/_opportunities.html.haml +2 -2
- data/app/views/opportunities/_opportunity.html.haml +3 -3
- data/app/views/opportunities/_sidebar_index.html.haml +5 -5
- data/app/views/opportunities/_sidebar_show.html.haml +12 -12
- data/app/views/opportunities/_title_bar.html.haml +2 -2
- data/app/views/opportunities/_top_section.html.haml +14 -14
- data/app/views/opportunities/contacts.js.haml +2 -2
- data/app/views/opportunities/create.js.haml +4 -4
- data/app/views/opportunities/destroy.js.haml +2 -2
- data/app/views/opportunities/edit.js.haml +4 -4
- data/app/views/opportunities/index.js.haml +4 -4
- data/app/views/opportunities/index.xls.builder +3 -1
- data/app/views/opportunities/new.js.haml +1 -1
- data/app/views/opportunities/show.html.haml +7 -7
- data/app/views/opportunities/show.js.haml +1 -1
- data/app/views/opportunities/update.js.haml +3 -3
- data/app/views/passwords/edit.html.haml +2 -2
- data/app/views/passwords/new.html.haml +1 -1
- data/app/views/shared/_address.html.haml +3 -3
- data/app/views/shared/_comment.html.haml +1 -1
- data/app/views/shared/_edit_comment.html.haml +5 -5
- data/app/views/shared/_empty.html.haml +1 -1
- data/app/views/shared/_paginate_with_per_page.html.haml +1 -1
- data/app/views/shared/_recent.html.haml +2 -2
- data/app/views/shared/_recently.html.haml +1 -1
- data/app/views/shared/_search.html.haml +2 -2
- data/app/views/shared/_tags.html.haml +2 -2
- data/app/views/shared/_tasks.html.haml +5 -5
- data/app/views/subscription_mailer/comment_notification.text.erb +2 -2
- data/app/views/tasks/_assigned.html.haml +4 -4
- data/app/views/tasks/_completed.html.haml +2 -2
- data/app/views/tasks/_edit.html.haml +4 -4
- data/app/views/tasks/_empty.html.haml +1 -1
- data/app/views/tasks/_new.html.haml +3 -3
- data/app/views/tasks/_pending.html.haml +7 -7
- data/app/views/tasks/_related.html.haml +2 -2
- data/app/views/tasks/_selector.html.haml +4 -4
- data/app/views/tasks/_sidebar_index.html.haml +7 -7
- data/app/views/tasks/_title.html.haml +2 -2
- data/app/views/tasks/_top_section.html.haml +9 -9
- data/app/views/tasks/complete.js.haml +2 -2
- data/app/views/tasks/create.js.haml +6 -6
- data/app/views/tasks/edit.js.haml +3 -3
- data/app/views/tasks/index.html.haml +4 -4
- data/app/views/tasks/index.xls.builder +5 -3
- data/app/views/tasks/new.js.haml +1 -1
- data/app/views/tasks/update.js.haml +1 -1
- data/app/views/users/_avatar.html.haml +5 -5
- data/app/views/users/_password.html.haml +3 -3
- data/app/views/users/_profile.html.haml +10 -10
- data/app/views/users/_user.html.haml +3 -3
- data/app/views/users/_user_report.html.haml +2 -2
- data/app/views/users/avatar.js.haml +1 -1
- data/app/views/users/change_password.js.haml +1 -1
- data/app/views/users/edit.js.haml +1 -1
- data/app/views/users/new.html.haml +2 -2
- data/app/views/users/opportunities_overview.html.haml +2 -2
- data/app/views/users/password.js.haml +1 -1
- data/app/views/users/show.html.haml +4 -4
- data/app/views/users/update.js.haml +4 -2
- data/app/views/users/upload_avatar.js.haml +2 -2
- data/app/views/versions/_version.html.haml +3 -3
- data/app/views/versions/_version_item.html.haml +3 -3
- data/app/views/versions/_versions.html.haml +2 -2
- data/bin/bundle +2 -0
- data/bin/rails +3 -1
- data/bin/rake +2 -0
- data/config.ru +3 -1
- data/config/application.rb +2 -0
- data/config/boot.rb +2 -0
- data/config/brakeman.ignore +139 -0
- data/config/deploy.example.rb +2 -0
- data/config/environment.rb +2 -0
- data/config/environments/development.rb +2 -0
- data/config/environments/production.rb +2 -0
- data/config/environments/staging.rb +2 -0
- data/config/environments/test.rb +2 -0
- data/config/initializers/action_mailer.rb +2 -0
- data/config/initializers/assets.rb +3 -1
- data/config/initializers/authlogic.rb +2 -0
- data/config/initializers/backtrace_silencers.rb +2 -0
- data/config/initializers/constants.rb +2 -0
- data/config/initializers/cookies_serializer.rb +2 -0
- data/config/initializers/custom_field_ransack_translations.rb +2 -0
- data/config/initializers/filter_parameter_logging.rb +2 -0
- data/config/initializers/gravatar.rb +2 -0
- data/config/initializers/inflections.rb +2 -0
- data/config/initializers/locale.rb +2 -0
- data/config/initializers/mime_types.rb +2 -0
- data/config/initializers/paginate_arrays.rb +2 -0
- data/config/initializers/paper_trail.rb +2 -0
- data/config/initializers/ransack.rb +2 -0
- data/config/initializers/relative_url_root.rb +2 -0
- data/config/initializers/secret_token.rb +2 -0
- data/config/initializers/session_store.rb +2 -0
- data/config/initializers/simple_form.rb +2 -0
- data/config/initializers/views.rb +3 -2
- data/config/initializers/wrap_parameters.rb +2 -0
- data/config/locales/fat_free_crm.de.yml +1 -0
- data/config/locales/fat_free_crm.en-GB.yml +7 -5
- data/config/locales/fat_free_crm.en-US.yml +7 -5
- data/config/locales/fat_free_crm.es-CL.yml +2 -1
- data/config/locales/fat_free_crm.es.yml +17 -16
- data/config/locales/fat_free_crm.fr.yml +1 -0
- data/config/locales/fat_free_crm.ja.yml +555 -184
- data/config/locales/fat_free_crm.nl.yml +2 -1
- data/config/locales/fat_free_crm.pt-BR.yml +1 -0
- data/config/locales/fat_free_crm.ru.yml +1 -0
- data/config/puma.rb +2 -0
- data/config/routes.rb +3 -1
- data/custom_plan.rb +2 -0
- data/db/demo/accounts.yml +1 -1
- data/db/demo/emails.yml +1 -1
- data/db/migrate/20100928030598_create_sessions.rb +2 -0
- data/db/migrate/20100928030599_create_users.rb +3 -1
- data/db/migrate/20100928030600_create_openid_tables.rb +3 -1
- data/db/migrate/20100928030601_create_accounts.rb +2 -0
- data/db/migrate/20100928030602_create_permissions.rb +4 -2
- data/db/migrate/20100928030603_create_settings.rb +2 -0
- data/db/migrate/20100928030604_create_preferences.rb +2 -0
- data/db/migrate/20100928030605_create_campaigns.rb +3 -1
- data/db/migrate/20100928030606_create_leads.rb +3 -1
- data/db/migrate/20100928030607_create_contacts.rb +3 -1
- data/db/migrate/20100928030608_create_opportunities.rb +3 -1
- data/db/migrate/20100928030609_create_account_contacts.rb +2 -0
- data/db/migrate/20100928030610_create_account_opportunities.rb +2 -0
- data/db/migrate/20100928030611_create_contact_opportunities.rb +2 -0
- data/db/migrate/20100928030612_create_tasks.rb +2 -0
- data/db/migrate/20100928030613_create_comments.rb +4 -2
- data/db/migrate/20100928030614_create_activities.rb +7 -5
- data/db/migrate/20100928030615_create_avatars.rb +5 -3
- data/db/migrate/20100928030616_rename_remember_token.rb +2 -0
- data/db/migrate/20100928030617_drop_openid_tables.rb +3 -1
- data/db/migrate/20100928030618_add_admin_to_users.rb +3 -1
- data/db/migrate/20100928030619_add_suspended_to_users.rb +2 -0
- data/db/migrate/20100928030620_remove_uuid.rb +2 -0
- data/db/migrate/20100928030621_add_email_to_accounts.rb +2 -0
- data/db/migrate/20100928030622_add_background_info_to_models.rb +2 -0
- data/db/migrate/20100928030623_create_addresses.rb +2 -0
- data/db/migrate/20100928030624_add_index_on_permissions.rb +2 -0
- data/db/migrate/20100928030625_create_emails.rb +11 -9
- data/db/migrate/20100928030626_add_state_to_timeline_objects.rb +2 -0
- data/db/migrate/20100928030627_acts_as_taggable_on_migration.rb +2 -0
- data/db/migrate/20101221123456_add_single_access_token_to_users.rb +2 -0
- data/db/migrate/20101221345678_add_rating_and_category_to_accounts.rb +2 -0
- data/db/migrate/20110719082054_add_skype_to_contacts_and_leads.rb +2 -0
- data/db/migrate/20111101083437_create_fields.rb +2 -0
- data/db/migrate/20111101090312_create_field_groups.rb +2 -0
- data/db/migrate/20111116091952_add_field_groups_tag_id.rb +2 -0
- data/db/migrate/20111117041311_change_fields_collection_to_text.rb +2 -0
- data/db/migrate/20111201030535_add_field_groups_klass_name.rb +2 -0
- data/db/migrate/20120121054235_create_lists.rb +2 -0
- data/db/migrate/20120216031616_create_versions.rb +4 -2
- data/db/migrate/20120216042541_is_paranoid_to_paper_trail.rb +2 -0
- data/db/migrate/20120220233724_add_versions_object_changes.rb +2 -0
- data/db/migrate/20120224073107_remove_default_value_and_clear_settings.rb +2 -0
- data/db/migrate/20120309070209_add_versions_related.rb +2 -0
- data/db/migrate/20120314080441_add_subscribed_users_to_entities.rb +2 -0
- data/db/migrate/20120316045804_activities_to_versions.rb +13 -12
- data/db/migrate/20120405080727_change_subscribed_users_to_set.rb +2 -0
- data/db/migrate/20120405080742_change_further_subscribed_users_to_set.rb +2 -0
- data/db/migrate/20120406082136_create_groups.rb +2 -0
- data/db/migrate/20120413034923_add_index_on_versions_item_type.rb +2 -0
- data/db/migrate/20120510025219_add_not_null_constraints_for_timestamp_columns.rb +5 -4
- data/db/migrate/20120528102124_increase_length_of_version_events.rb +2 -0
- data/db/migrate/20120801032706_add_pair_id_to_fields.rb +2 -0
- data/db/migrate/20121003063155_add_settings_to_custom_fields.rb +2 -0
- data/db/migrate/20121221033947_fix_country_mapping.rb +2 -0
- data/db/migrate/20131207033244_add_user_id_to_lists.rb +2 -0
- data/db/migrate/20140916011927_add_created_at_index_on_versions.rb +2 -0
- data/db/migrate/20140916012922_add_indexes_to_model_associations.rb +2 -0
- data/db/migrate/20141126031837_increase_email_to254_chars.rb +2 -0
- data/db/migrate/20141230021159_add_transaction_id_column_to_versions.rb +2 -0
- data/db/migrate/20141230205453_add_missing_unique_indices.acts_as_taggable_on_engine.rb +2 -0
- data/db/migrate/20141230205454_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +2 -0
- data/db/migrate/20141230205455_add_missing_taggable_index.acts_as_taggable_on_engine.rb +2 -0
- data/db/migrate/20150123060900_convert_radio_to_radio_buttons.rb +2 -0
- data/db/migrate/20150227123054_remove_last_request_at_from_users.rb +2 -0
- data/db/migrate/20150427131956_create_index_related_type.rb +2 -0
- data/db/migrate/20160511053730_add_account_contacts_index.rb +2 -0
- data/db/migrate/20180102075234_add_account_counter_caches.rb +24 -0
- data/db/migrate/20180103223438_add_minlength_to_field.rb +7 -0
- data/db/schema.rb +300 -316
- data/db/seeds.rb +1 -0
- data/db/seeds/fields.rb +2 -0
- data/fat_free_crm.gemspec +4 -4
- data/lib/development_tasks/gem.rake +2 -0
- data/lib/development_tasks/license.rake +2 -0
- data/lib/development_tasks/rdoc.rake +2 -0
- data/lib/development_tasks/rspec.rake +2 -0
- data/lib/fat_free_crm.rb +2 -0
- data/lib/fat_free_crm/callback.rb +2 -0
- data/lib/fat_free_crm/comment_extensions.rb +2 -0
- data/lib/fat_free_crm/core_ext.rb +2 -0
- data/lib/fat_free_crm/core_ext/alias_method_chain.rb +7 -6
- data/lib/fat_free_crm/core_ext/nil.rb +2 -0
- data/lib/fat_free_crm/core_ext/string.rb +4 -2
- data/lib/fat_free_crm/custom_fields.rb +2 -0
- data/lib/fat_free_crm/engine.rb +2 -0
- data/lib/fat_free_crm/errors.rb +2 -0
- data/lib/fat_free_crm/exceptions.rb +2 -0
- data/lib/fat_free_crm/export_csv.rb +3 -1
- data/lib/fat_free_crm/exportable.rb +2 -0
- data/lib/fat_free_crm/fields.rb +2 -0
- data/lib/fat_free_crm/gem_dependencies.rb +2 -0
- data/lib/fat_free_crm/gem_ext.rb +2 -0
- data/lib/fat_free_crm/gem_ext/action_controller/base.rb +2 -0
- data/lib/fat_free_crm/gem_ext/active_support/buffered_logger.rb +4 -2
- data/lib/fat_free_crm/gem_ext/rails/engine.rb +9 -8
- data/lib/fat_free_crm/gem_ext/rake/task.rb +2 -0
- data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +2 -0
- data/lib/fat_free_crm/i18n.rb +2 -0
- data/lib/fat_free_crm/load_settings.rb +2 -0
- data/lib/fat_free_crm/mail_processor/base.rb +11 -8
- data/lib/fat_free_crm/mail_processor/comment_replies.rb +2 -0
- data/lib/fat_free_crm/mail_processor/dropbox.rb +5 -3
- data/lib/fat_free_crm/permissions.rb +8 -9
- data/lib/fat_free_crm/renderers.rb +2 -0
- data/lib/fat_free_crm/secret_token_generator.rb +2 -0
- data/lib/fat_free_crm/sortable.rb +2 -0
- data/lib/fat_free_crm/tabs.rb +2 -0
- data/lib/fat_free_crm/version.rb +4 -2
- data/lib/fat_free_crm/view_factory.rb +3 -1
- data/lib/gravatar_image_tag.rb +2 -0
- data/lib/missing_translation_detector.rb +2 -0
- data/lib/tasks/ffcrm/comment_replies.rake +2 -0
- data/lib/tasks/ffcrm/config.rake +2 -0
- data/lib/tasks/ffcrm/demo.rake +3 -1
- data/lib/tasks/ffcrm/dropbox.rake +2 -0
- data/lib/tasks/ffcrm/missing_translations.rake +8 -7
- data/lib/tasks/ffcrm/secret.rake +2 -0
- data/lib/tasks/ffcrm/settings.rake +2 -0
- data/lib/tasks/ffcrm/setup.rake +2 -0
- data/lib/tasks/ffcrm/update_data.rake +98 -96
- data/script/rails +4 -2
- data/spec/controllers/admin/groups_controller_spec.rb +2 -0
- data/spec/controllers/admin/users_controller_spec.rb +3 -1
- data/spec/controllers/applications_controller_spec.rb +2 -0
- data/spec/controllers/authentications_controller_spec.rb +2 -0
- data/spec/controllers/comments_controller_spec.rb +3 -1
- data/spec/controllers/emails_controller_spec.rb +3 -1
- data/spec/controllers/entities/accounts_controller_spec.rb +4 -2
- data/spec/controllers/entities/campaigns_controller_spec.rb +4 -2
- data/spec/controllers/entities/contacts_controller_spec.rb +4 -2
- data/spec/controllers/entities/leads_controller_spec.rb +4 -2
- data/spec/controllers/entities/opportunities_controller_spec.rb +4 -2
- data/spec/controllers/entities_controller_spec.rb +2 -0
- data/spec/controllers/home_controller_spec.rb +14 -10
- data/spec/controllers/lists_controller_spec.rb +2 -0
- data/spec/controllers/passwords_controller_spec.rb +2 -0
- data/spec/controllers/tasks_controller_spec.rb +3 -1
- data/spec/controllers/users_controller_spec.rb +20 -18
- data/spec/factories/account_factories.rb +2 -0
- data/spec/factories/campaign_factories.rb +2 -0
- data/spec/factories/contact_factories.rb +2 -0
- data/spec/factories/field_factories.rb +2 -0
- data/spec/factories/lead_factories.rb +2 -0
- data/spec/factories/list_factories.rb +2 -0
- data/spec/factories/opportunity_factories.rb +2 -0
- data/spec/factories/sequences.rb +4 -2
- data/spec/factories/setting_factories.rb +2 -0
- data/spec/factories/shared_factories.rb +3 -1
- data/spec/factories/subscription_factories.rb +2 -0
- data/spec/factories/tag_factories.rb +2 -0
- data/spec/factories/task_factories.rb +2 -0
- data/spec/factories/user_factories.rb +3 -1
- data/spec/features/acceptance_helper.rb +2 -0
- data/spec/features/accounts_spec.rb +5 -1
- data/spec/features/admin/groups_spec.rb +4 -3
- data/spec/features/admin/users_spec.rb +4 -3
- data/spec/features/campaigns_spec.rb +2 -1
- data/spec/features/contacts_spec.rb +3 -1
- data/spec/features/dashboard_spec.rb +2 -1
- data/spec/features/leads_spec.rb +7 -2
- data/spec/features/opportunities_overview_spec.rb +2 -1
- data/spec/features/opportunities_spec.rb +3 -2
- data/spec/features/support/browser.rb +2 -0
- data/spec/features/support/headless.rb +2 -0
- data/spec/features/support/helpers.rb +2 -0
- data/spec/features/support/maintain_sessions.rb +2 -0
- data/spec/features/support/paths.rb +2 -0
- data/spec/features/support/selector_helpers.rb +2 -6
- data/spec/features/tasks_spec.rb +8 -7
- data/spec/helpers/accounts_helper_spec.rb +2 -0
- data/spec/helpers/admin/field_groups_helper_spec.rb +2 -0
- data/spec/helpers/admin/plugins_helper_spec.rb +2 -0
- data/spec/helpers/admin/settings_helper_spec.rb +2 -0
- data/spec/helpers/admin/users_helper_spec.rb +2 -0
- data/spec/helpers/application_helper_spec.rb +6 -3
- data/spec/helpers/authentications_helper_spec.rb +2 -0
- data/spec/helpers/campaigns_helper_spec.rb +2 -0
- data/spec/helpers/comments_helper_spec.rb +2 -0
- data/spec/helpers/contacts_helper_spec.rb +2 -0
- data/spec/helpers/emails_helper_spec.rb +2 -0
- data/spec/helpers/fields_helper_spec.rb +2 -0
- data/spec/helpers/groups_helper_spec.rb +2 -0
- data/spec/helpers/home_helper_spec.rb +2 -0
- data/spec/helpers/leads_helper_spec.rb +2 -0
- data/spec/helpers/lists_helper_spec.rb +2 -0
- data/spec/helpers/opportunities_helper_spec.rb +2 -0
- data/spec/helpers/passwords_helper_spec.rb +2 -0
- data/spec/helpers/tasks_helper_spec.rb +2 -0
- data/spec/helpers/users_helper_spec.rb +2 -0
- data/spec/lib/comment_extensions_spec.rb +2 -0
- data/spec/lib/core_ext/string_spec.rb +2 -0
- data/spec/lib/errors_spec.rb +2 -0
- data/spec/lib/fields_spec.rb +2 -0
- data/spec/lib/mail_processor/base_spec.rb +2 -0
- data/spec/lib/mail_processor/comment_replies_spec.rb +2 -0
- data/spec/lib/mail_processor/dropbox_spec.rb +2 -0
- data/spec/lib/mail_processor/sample_emails/dropbox.rb +166 -164
- data/spec/lib/permissions_spec.rb +2 -0
- data/spec/lib/secret_token_generator_spec.rb +2 -0
- data/spec/lib/view_factory_spec.rb +2 -0
- data/spec/mailers/subscription_mailer_spec.rb +15 -16
- data/spec/mailers/user_mailer_spec.rb +2 -0
- data/spec/models/entities/account_contact_spec.rb +3 -0
- data/spec/models/entities/account_opportunity_spec.rb +3 -0
- data/spec/models/entities/account_spec.rb +3 -1
- data/spec/models/entities/campaign_spec.rb +3 -1
- data/spec/models/entities/contact_opportunity_spec.rb +2 -0
- data/spec/models/entities/contact_spec.rb +35 -21
- data/spec/models/entities/lead_spec.rb +3 -1
- data/spec/models/entities/opportunity_spec.rb +39 -27
- data/spec/models/fields/custom_field_date_pair_spec.rb +2 -0
- data/spec/models/fields/custom_field_pair_spec.rb +2 -0
- data/spec/models/fields/custom_field_spec.rb +2 -0
- data/spec/models/fields/field_group_spec.rb +2 -0
- data/spec/models/fields/field_spec.rb +8 -4
- data/spec/models/list_spec.rb +2 -0
- data/spec/models/observers/entity_observer_spec.rb +2 -0
- data/spec/models/polymorphic/address_spec.rb +2 -4
- data/spec/models/polymorphic/avatar_spec.rb +2 -0
- data/spec/models/polymorphic/comment_spec.rb +2 -4
- data/spec/models/polymorphic/email_spec.rb +2 -0
- data/spec/models/polymorphic/task_spec.rb +6 -4
- data/spec/models/polymorphic/version_spec.rb +7 -10
- data/spec/models/setting_spec.rb +23 -0
- data/spec/models/users/abilities/user_ability_spec.rb +2 -0
- data/spec/models/users/authentication_spec.rb +2 -0
- data/spec/models/users/group_spec.rb +2 -0
- data/spec/models/users/permission_spec.rb +2 -0
- data/spec/models/users/preference_spec.rb +2 -0
- data/spec/models/users/user_spec.rb +11 -17
- data/spec/routing/accounts_routing_spec.rb +2 -0
- data/spec/routing/admin/users_routing_spec.rb +2 -0
- data/spec/routing/campaigns_routing_spec.rb +2 -0
- data/spec/routing/comments_routing_spec.rb +2 -0
- data/spec/routing/contacts_routing_spec.rb +2 -0
- data/spec/routing/emails_routing_spec.rb +2 -0
- data/spec/routing/leads_routing_spec.rb +2 -0
- data/spec/routing/opportunities_routing_spec.rb +2 -0
- data/spec/routing/tasks_routing_spec.rb +2 -0
- data/spec/routing/users_routing_spec.rb +2 -0
- data/spec/shared/controllers.rb +2 -0
- data/spec/shared/models.rb +2 -0
- data/spec/spec_helper.rb +7 -5
- data/spec/support/assert_select.rb +2 -0
- data/spec/support/auth_macros.rb +5 -12
- data/spec/support/macros.rb +9 -7
- data/spec/support/mail_processor_mocks.rb +2 -0
- data/spec/support/uploaded_file.rb +2 -0
- data/spec/views/accounts/_edit.haml_spec.rb +4 -3
- data/spec/views/accounts/_new.haml_spec.rb +3 -1
- data/spec/views/accounts/create.js.haml_spec.rb +3 -1
- data/spec/views/accounts/destroy.js.haml_spec.rb +3 -1
- data/spec/views/accounts/edit.js.haml_spec.rb +3 -1
- data/spec/views/accounts/index.haml_spec.rb +3 -1
- data/spec/views/accounts/index.js.haml_spec.rb +3 -1
- data/spec/views/accounts/new.js.haml_spec.rb +3 -1
- data/spec/views/accounts/show.haml_spec.rb +6 -1
- data/spec/views/accounts/update.js.haml_spec.rb +3 -1
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +3 -1
- data/spec/views/admin/field_groups/destroy.js.haml_spec.rb +3 -1
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +3 -1
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +3 -1
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +3 -1
- data/spec/views/admin/users/_create.haml_spec.rb +3 -1
- data/spec/views/admin/users/create.js.haml_spec.rb +3 -1
- data/spec/views/admin/users/destroy.js.haml_spec.rb +3 -1
- data/spec/views/admin/users/edit.js.haml_spec.rb +3 -1
- data/spec/views/admin/users/index.haml_spec.rb +3 -1
- data/spec/views/admin/users/index.js.haml_spec.rb +3 -1
- data/spec/views/admin/users/new.js.haml_spec.rb +3 -1
- data/spec/views/admin/users/reactivate.js.haml_spec.rb +3 -1
- data/spec/views/admin/users/show.haml_spec.rb +2 -0
- data/spec/views/admin/users/suspend.js.haml_spec.rb +3 -1
- data/spec/views/admin/users/update.js.haml_spec.rb +3 -1
- data/spec/views/application/auto_complete.haml_spec.rb +3 -1
- data/spec/views/authentications/new.haml_spec.rb +2 -0
- data/spec/views/campaigns/_edit.haml_spec.rb +3 -1
- data/spec/views/campaigns/_new.haml_spec.rb +3 -1
- data/spec/views/campaigns/create.js.haml_spec.rb +3 -1
- data/spec/views/campaigns/destroy.js.haml_spec.rb +3 -1
- data/spec/views/campaigns/edit.js.haml_spec.rb +3 -1
- data/spec/views/campaigns/index.haml_spec.rb +3 -1
- data/spec/views/campaigns/index.js.haml_spec.rb +3 -1
- data/spec/views/campaigns/new.js.haml_spec.rb +3 -1
- data/spec/views/campaigns/show.haml_spec.rb +6 -1
- data/spec/views/campaigns/update.js.haml_spec.rb +3 -1
- data/spec/views/comments/edit.js.haml_spec.rb +5 -4
- data/spec/views/contacts/_edit.haml_spec.rb +3 -1
- data/spec/views/contacts/_new.haml_spec.rb +3 -1
- data/spec/views/contacts/create.js.haml_spec.rb +3 -1
- data/spec/views/contacts/destroy.js.haml_spec.rb +3 -1
- data/spec/views/contacts/edit.js.haml_spec.rb +3 -1
- data/spec/views/contacts/index.haml_spec.rb +3 -1
- data/spec/views/contacts/index.js.html_spec.rb +3 -1
- data/spec/views/contacts/new.js.haml_spec.rb +3 -1
- data/spec/views/contacts/show.haml_spec.rb +6 -1
- data/spec/views/contacts/update.js.haml_spec.rb +3 -1
- data/spec/views/home/index.haml_spec.rb +3 -1
- data/spec/views/home/index.js.haml_spec.rb +3 -1
- data/spec/views/home/options.js.haml_spec.rb +4 -2
- data/spec/views/leads/_convert.haml_spec.rb +3 -1
- data/spec/views/leads/_edit.haml_spec.rb +3 -1
- data/spec/views/leads/_new.haml_spec.rb +3 -1
- data/spec/views/leads/_sidebar_show.haml_spec.rb +3 -1
- data/spec/views/leads/convert.js.haml_spec.rb +3 -1
- data/spec/views/leads/create.js.haml_spec.rb +3 -1
- data/spec/views/leads/destroy.js.haml_spec.rb +3 -1
- data/spec/views/leads/edit.js.haml_spec.rb +3 -1
- data/spec/views/leads/index.haml_spec.rb +3 -1
- data/spec/views/leads/index.js.haml_spec.rb +3 -1
- data/spec/views/leads/new.js.haml_spec.rb +3 -1
- data/spec/views/leads/promote.js.haml_spec.rb +3 -1
- data/spec/views/leads/reject.js.haml_spec.rb +3 -1
- data/spec/views/leads/show.haml_spec.rb +6 -1
- data/spec/views/leads/update.js.haml_spec.rb +3 -1
- data/spec/views/opportunities/_edit.haml_spec.rb +3 -1
- data/spec/views/opportunities/_new.haml_spec.rb +3 -1
- data/spec/views/opportunities/create.js.haml_spec.rb +3 -1
- data/spec/views/opportunities/destroy.js.haml_spec.rb +3 -1
- data/spec/views/opportunities/edit.js.haml_spec.rb +3 -1
- data/spec/views/opportunities/index.haml_spec.rb +3 -1
- data/spec/views/opportunities/index.js.haml_spec.rb +3 -1
- data/spec/views/opportunities/new.js.haml_spec.rb +3 -1
- data/spec/views/opportunities/show.haml_spec.rb +6 -1
- data/spec/views/opportunities/update.js.haml_spec.rb +3 -1
- data/spec/views/tasks/_edit.haml_spec.rb +3 -1
- data/spec/views/tasks/complete.js.haml_spec.rb +3 -1
- data/spec/views/tasks/create.js.haml_spec.rb +3 -1
- data/spec/views/tasks/destroy.js.haml_spec.rb +3 -1
- data/spec/views/tasks/edit.js.haml_spec.rb +3 -1
- data/spec/views/tasks/index.haml_spec.rb +6 -4
- data/spec/views/tasks/new.js.haml_spec.rb +3 -1
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +3 -1
- data/spec/views/tasks/update.js.haml_spec.rb +3 -1
- data/spec/views/users/avatar.js.haml_spec.rb +3 -1
- data/spec/views/users/change_password.js.haml_spec.rb +3 -1
- data/spec/views/users/edit.js.haml_spec.rb +3 -1
- data/spec/views/users/password.js.haml_spec.rb +3 -1
- data/spec/views/users/update.js.haml_spec.rb +3 -1
- data/spec/views/users/upload_avatar.js.haml_spec.rb +4 -2
- data/vendor/assets/javascripts/textarea_autocomplete.js +1 -1
- data/vendor/gems/globby-0.1.2/lib/globby/glob.rb +1 -1
- metadata +8 -12
- data/app/assets/javascripts/crm_chosen.js.coffee +0 -29
- data/app/assets/stylesheets/ffcrm_chosen.scss +0 -69
- data/vendor/assets/javascripts/ajax-chosen-jquery.js +0 -2
- data/vendor/assets/javascripts/ajax-chosen.jquery.coffee +0 -171
- data/vendor/assets/javascripts/chosen-jquery.js +0 -3
- data/vendor/assets/javascripts/chosen.jquery.coffee +0 -574
- data/vendor/assets/javascripts/lib/abstract-chosen.coffee +0 -110
- data/vendor/assets/stylesheets/chosen.css.sass +0 -361
@@ -1,574 +0,0 @@
|
|
1
|
-
###
|
2
|
-
Chosen source: generate output using 'cake build'
|
3
|
-
Copyright (c) 2011 by Harvest
|
4
|
-
###
|
5
|
-
root = this
|
6
|
-
$ = jQuery
|
7
|
-
|
8
|
-
$.fn.extend({
|
9
|
-
chosen: (options) ->
|
10
|
-
# Do no harm and return as soon as possible for unsupported browsers, namely IE6 and IE7
|
11
|
-
return this if $.browser.msie and ($.browser.version is "6.0" or $.browser.version is "7.0")
|
12
|
-
$(this).each((input_field) ->
|
13
|
-
new Chosen(this, options) unless ($ this).hasClass "chzn-done"
|
14
|
-
)
|
15
|
-
})
|
16
|
-
|
17
|
-
class Chosen extends AbstractChosen
|
18
|
-
|
19
|
-
setup: ->
|
20
|
-
@form_field_jq = $ @form_field
|
21
|
-
@is_rtl = @form_field_jq.hasClass "chzn-rtl"
|
22
|
-
|
23
|
-
finish_setup: ->
|
24
|
-
@form_field_jq.addClass "chzn-done"
|
25
|
-
|
26
|
-
set_up_html: ->
|
27
|
-
@container_id = if @form_field.id.length then @form_field.id.replace(/(:|\.)/g, '_') else this.generate_field_id()
|
28
|
-
@container_id += "_chzn"
|
29
|
-
|
30
|
-
@f_width = @form_field_jq.outerWidth()
|
31
|
-
|
32
|
-
@default_text = if @form_field_jq.data 'placeholder' then @form_field_jq.data 'placeholder' else @default_text_default
|
33
|
-
|
34
|
-
container_div = ($ "<div />", {
|
35
|
-
id: @container_id
|
36
|
-
class: "chzn-container#{ if @is_rtl then ' chzn-rtl' else '' }"
|
37
|
-
style: 'width: ' + (@f_width) + 'px;' #use parens around @f_width so coffeescript doesn't think + ' px' is a function parameter
|
38
|
-
})
|
39
|
-
|
40
|
-
if @is_multiple
|
41
|
-
container_div.html '<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'
|
42
|
-
else
|
43
|
-
container_div.html '<a href="javascript:void(0)" class="chzn-single"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'
|
44
|
-
|
45
|
-
@form_field_jq.hide().after container_div
|
46
|
-
@container = ($ '#' + @container_id)
|
47
|
-
@container.addClass( "chzn-container-" + (if @is_multiple then "multi" else "single") )
|
48
|
-
@container.addClass "chzn-container-single-nosearch" if not @is_multiple and @form_field.options.length <= @disable_search_threshold
|
49
|
-
@dropdown = @container.find('div.chzn-drop').first()
|
50
|
-
|
51
|
-
dd_top = @container.height()
|
52
|
-
dd_width = (@f_width - get_side_border_padding(@dropdown))
|
53
|
-
|
54
|
-
@dropdown.css({"width": dd_width + "px", "top": dd_top + "px"})
|
55
|
-
|
56
|
-
@search_field = @container.find('input').first()
|
57
|
-
@search_results = @container.find('ul.chzn-results').first()
|
58
|
-
this.search_field_scale()
|
59
|
-
|
60
|
-
@search_no_results = @container.find('li.no-results').first()
|
61
|
-
|
62
|
-
if @is_multiple
|
63
|
-
@search_choices = @container.find('ul.chzn-choices').first()
|
64
|
-
@search_container = @container.find('li.search-field').first()
|
65
|
-
else
|
66
|
-
@search_container = @container.find('div.chzn-search').first()
|
67
|
-
@selected_item = @container.find('.chzn-single').first()
|
68
|
-
sf_width = dd_width - get_side_border_padding(@search_container) - get_side_border_padding(@search_field)
|
69
|
-
@search_field.css( {"width" : sf_width + "px"} )
|
70
|
-
|
71
|
-
this.results_build()
|
72
|
-
this.set_tab_index()
|
73
|
-
@form_field_jq.trigger("liszt:ready", {chosen: this})
|
74
|
-
|
75
|
-
register_observers: ->
|
76
|
-
@container.mousedown (evt) => this.container_mousedown(evt)
|
77
|
-
@container.mouseup (evt) => this.container_mouseup(evt)
|
78
|
-
@container.mouseenter (evt) => this.mouse_enter(evt)
|
79
|
-
@container.mouseleave (evt) => this.mouse_leave(evt)
|
80
|
-
|
81
|
-
@search_results.mouseup (evt) => this.search_results_mouseup(evt)
|
82
|
-
@search_results.mouseover (evt) => this.search_results_mouseover(evt)
|
83
|
-
@search_results.mouseout (evt) => this.search_results_mouseout(evt)
|
84
|
-
|
85
|
-
@form_field_jq.bind "liszt:updated", (evt) => this.results_update_field(evt)
|
86
|
-
|
87
|
-
@search_field.blur (evt) => this.input_blur(evt)
|
88
|
-
@search_field.keyup (evt) => this.keyup_checker(evt)
|
89
|
-
@search_field.keydown (evt) => this.keydown_checker(evt)
|
90
|
-
|
91
|
-
if @is_multiple
|
92
|
-
@search_choices.click (evt) => this.choices_click(evt)
|
93
|
-
@search_field.focus (evt) => this.input_focus(evt)
|
94
|
-
|
95
|
-
search_field_disabled: ->
|
96
|
-
@is_disabled = @form_field_jq.attr 'disabled'
|
97
|
-
if(@is_disabled)
|
98
|
-
@container.addClass 'chzn-disabled'
|
99
|
-
@search_field.attr 'disabled', true
|
100
|
-
@selected_item.unbind "focus", @activate_action if !@is_multiple
|
101
|
-
this.close_field()
|
102
|
-
else
|
103
|
-
@container.removeClass 'chzn-disabled'
|
104
|
-
@search_field.attr 'disabled', false
|
105
|
-
@selected_item.bind "focus", @activate_action if !@is_multiple
|
106
|
-
|
107
|
-
container_mousedown: (evt) ->
|
108
|
-
if !@is_disabled
|
109
|
-
target_closelink = if evt? then ($ evt.target).hasClass "search-choice-close" else false
|
110
|
-
if evt and evt.type is "mousedown" and not @results_showing
|
111
|
-
evt.stopPropagation()
|
112
|
-
if not @pending_destroy_click and not target_closelink
|
113
|
-
if not @active_field
|
114
|
-
@search_field.val "" if @is_multiple
|
115
|
-
$(document).click @click_test_action
|
116
|
-
this.results_show()
|
117
|
-
else if not @is_multiple and evt and ($(evt.target) is @selected_item || $(evt.target).parents("a.chzn-single").length)
|
118
|
-
evt.preventDefault()
|
119
|
-
this.results_toggle()
|
120
|
-
|
121
|
-
this.activate_field()
|
122
|
-
else
|
123
|
-
@pending_destroy_click = false
|
124
|
-
|
125
|
-
container_mouseup: (evt) ->
|
126
|
-
this.results_reset(evt) if evt.target.nodeName is "ABBR"
|
127
|
-
|
128
|
-
blur_test: (evt) ->
|
129
|
-
this.close_field() if not @active_field and @container.hasClass "chzn-container-active"
|
130
|
-
|
131
|
-
close_field: ->
|
132
|
-
$(document).unbind "click", @click_test_action
|
133
|
-
|
134
|
-
if not @is_multiple
|
135
|
-
@selected_item.attr "tabindex", @search_field.attr("tabindex")
|
136
|
-
@search_field.attr "tabindex", -1
|
137
|
-
|
138
|
-
@active_field = false
|
139
|
-
this.results_hide()
|
140
|
-
|
141
|
-
@container.removeClass "chzn-container-active"
|
142
|
-
this.winnow_results_clear()
|
143
|
-
this.clear_backstroke()
|
144
|
-
|
145
|
-
this.show_search_field_default()
|
146
|
-
this.search_field_scale()
|
147
|
-
|
148
|
-
activate_field: ->
|
149
|
-
if not @is_multiple and not @active_field
|
150
|
-
@search_field.attr "tabindex", (@selected_item.attr "tabindex")
|
151
|
-
@selected_item.attr "tabindex", -1
|
152
|
-
|
153
|
-
@container.addClass "chzn-container-active"
|
154
|
-
@active_field = true
|
155
|
-
|
156
|
-
@search_field.val(@search_field.val())
|
157
|
-
@search_field.focus()
|
158
|
-
|
159
|
-
|
160
|
-
test_active_click: (evt) ->
|
161
|
-
if $(evt.target).parents('#' + @container_id).length
|
162
|
-
@active_field = true
|
163
|
-
else
|
164
|
-
this.close_field()
|
165
|
-
|
166
|
-
results_build: ->
|
167
|
-
startTime = new Date()
|
168
|
-
@parsing = true
|
169
|
-
@results_data = root.SelectParser.select_to_array @form_field
|
170
|
-
|
171
|
-
if @is_multiple and @choices > 0
|
172
|
-
@search_choices.find("li.search-choice").remove()
|
173
|
-
@choices = 0
|
174
|
-
else if not @is_multiple
|
175
|
-
@selected_item.find("span").text @default_text
|
176
|
-
|
177
|
-
content = ''
|
178
|
-
for data in @results_data
|
179
|
-
if data.group
|
180
|
-
content += this.result_add_group data
|
181
|
-
else if !data.empty
|
182
|
-
content += this.result_add_option data
|
183
|
-
if data.selected and @is_multiple
|
184
|
-
this.choice_build data
|
185
|
-
else if data.selected and not @is_multiple
|
186
|
-
@selected_item.find("span").text data.text
|
187
|
-
this.single_deselect_control_build() if @allow_single_deselect
|
188
|
-
|
189
|
-
this.search_field_disabled()
|
190
|
-
this.show_search_field_default()
|
191
|
-
this.search_field_scale()
|
192
|
-
|
193
|
-
@search_results.html content
|
194
|
-
@parsing = false
|
195
|
-
|
196
|
-
|
197
|
-
result_add_group: (group) ->
|
198
|
-
if not group.disabled
|
199
|
-
group.dom_id = @container_id + "_g_" + group.array_index
|
200
|
-
'<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>'
|
201
|
-
else
|
202
|
-
""
|
203
|
-
|
204
|
-
result_do_highlight: (el) ->
|
205
|
-
if el.length
|
206
|
-
this.result_clear_highlight()
|
207
|
-
|
208
|
-
@result_highlight = el
|
209
|
-
@result_highlight.addClass "highlighted"
|
210
|
-
|
211
|
-
maxHeight = parseInt @search_results.css("maxHeight"), 10
|
212
|
-
visible_top = @search_results.scrollTop()
|
213
|
-
visible_bottom = maxHeight + visible_top
|
214
|
-
|
215
|
-
high_top = @result_highlight.position().top + @search_results.scrollTop()
|
216
|
-
high_bottom = high_top + @result_highlight.outerHeight()
|
217
|
-
|
218
|
-
if high_bottom >= visible_bottom
|
219
|
-
@search_results.scrollTop if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0
|
220
|
-
else if high_top < visible_top
|
221
|
-
@search_results.scrollTop high_top
|
222
|
-
|
223
|
-
result_clear_highlight: ->
|
224
|
-
@result_highlight.removeClass "highlighted" if @result_highlight
|
225
|
-
@result_highlight = null
|
226
|
-
|
227
|
-
results_show: ->
|
228
|
-
if not @is_multiple
|
229
|
-
@selected_item.addClass "chzn-single-with-drop"
|
230
|
-
if @result_single_selected
|
231
|
-
this.result_do_highlight( @result_single_selected )
|
232
|
-
|
233
|
-
dd_top = if @is_multiple then @container.height() else (@container.height() - 1)
|
234
|
-
@dropdown.css {"top": dd_top + "px", "left":0}
|
235
|
-
@results_showing = true
|
236
|
-
|
237
|
-
@search_field.focus()
|
238
|
-
@search_field.val @search_field.val()
|
239
|
-
|
240
|
-
this.winnow_results()
|
241
|
-
|
242
|
-
results_hide: ->
|
243
|
-
@selected_item.removeClass "chzn-single-with-drop" unless @is_multiple
|
244
|
-
this.result_clear_highlight()
|
245
|
-
@dropdown.css {"left":"-9000px"}
|
246
|
-
@results_showing = false
|
247
|
-
|
248
|
-
|
249
|
-
set_tab_index: (el) ->
|
250
|
-
if @form_field_jq.attr "tabindex"
|
251
|
-
ti = @form_field_jq.attr "tabindex"
|
252
|
-
@form_field_jq.attr "tabindex", -1
|
253
|
-
|
254
|
-
if @is_multiple
|
255
|
-
@search_field.attr "tabindex", ti
|
256
|
-
else
|
257
|
-
@selected_item.attr "tabindex", ti
|
258
|
-
@search_field.attr "tabindex", -1
|
259
|
-
|
260
|
-
show_search_field_default: ->
|
261
|
-
if @is_multiple and @choices < 1 and not @active_field
|
262
|
-
@search_field.val(@default_text)
|
263
|
-
@search_field.addClass "default"
|
264
|
-
else
|
265
|
-
@search_field.val("")
|
266
|
-
@search_field.removeClass "default"
|
267
|
-
|
268
|
-
search_results_mouseup: (evt) ->
|
269
|
-
target = if $(evt.target).hasClass "active-result" then $(evt.target) else $(evt.target).parents(".active-result").first()
|
270
|
-
if target.length
|
271
|
-
@result_highlight = target
|
272
|
-
this.result_select(evt)
|
273
|
-
|
274
|
-
search_results_mouseover: (evt) ->
|
275
|
-
target = if $(evt.target).hasClass "active-result" then $(evt.target) else $(evt.target).parents(".active-result").first()
|
276
|
-
this.result_do_highlight( target ) if target
|
277
|
-
|
278
|
-
search_results_mouseout: (evt) ->
|
279
|
-
this.result_clear_highlight() if $(evt.target).hasClass "active-result" or $(evt.target).parents('.active-result').first()
|
280
|
-
|
281
|
-
|
282
|
-
choices_click: (evt) ->
|
283
|
-
evt.preventDefault()
|
284
|
-
if( @active_field and not($(evt.target).hasClass "search-choice" or $(evt.target).parents('.search-choice').first) and not @results_showing )
|
285
|
-
this.results_show()
|
286
|
-
|
287
|
-
choice_build: (item) ->
|
288
|
-
choice_id = @container_id + "_c_" + item.array_index
|
289
|
-
@choices += 1
|
290
|
-
@search_container.before '<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>'
|
291
|
-
link = $('#' + choice_id).find("a").first()
|
292
|
-
link.click (evt) => this.choice_destroy_link_click(evt)
|
293
|
-
|
294
|
-
choice_destroy_link_click: (evt) ->
|
295
|
-
evt.preventDefault()
|
296
|
-
if not @is_disabled
|
297
|
-
@pending_destroy_click = true
|
298
|
-
this.choice_destroy $(evt.target)
|
299
|
-
else
|
300
|
-
evt.stopPropagation
|
301
|
-
|
302
|
-
choice_destroy: (link) ->
|
303
|
-
@choices -= 1
|
304
|
-
this.show_search_field_default()
|
305
|
-
|
306
|
-
this.results_hide() if @is_multiple and @choices > 0 and @search_field.val().length < 1
|
307
|
-
|
308
|
-
this.result_deselect (link.attr "rel")
|
309
|
-
link.parents('li').first().remove()
|
310
|
-
|
311
|
-
results_reset: (evt) ->
|
312
|
-
@form_field.options[0].selected = true
|
313
|
-
@selected_item.find("span").text @default_text
|
314
|
-
this.show_search_field_default()
|
315
|
-
$(evt.target).remove();
|
316
|
-
@form_field_jq.trigger "change"
|
317
|
-
this.results_hide() if @active_field
|
318
|
-
|
319
|
-
result_select: (evt) ->
|
320
|
-
if @result_highlight
|
321
|
-
high = @result_highlight
|
322
|
-
high_id = high.attr "id"
|
323
|
-
|
324
|
-
this.result_clear_highlight()
|
325
|
-
|
326
|
-
if @is_multiple
|
327
|
-
this.result_deactivate high
|
328
|
-
else
|
329
|
-
@search_results.find(".result-selected").removeClass "result-selected"
|
330
|
-
@result_single_selected = high
|
331
|
-
|
332
|
-
high.addClass "result-selected"
|
333
|
-
|
334
|
-
position = high_id.substr(high_id.lastIndexOf("_") + 1 )
|
335
|
-
item = @results_data[position]
|
336
|
-
item.selected = true
|
337
|
-
|
338
|
-
@form_field.options[item.options_index].selected = true
|
339
|
-
|
340
|
-
if @is_multiple
|
341
|
-
this.choice_build item
|
342
|
-
else
|
343
|
-
@selected_item.find("span").first().text item.text
|
344
|
-
this.single_deselect_control_build() if @allow_single_deselect
|
345
|
-
|
346
|
-
this.results_hide() unless evt.metaKey and @is_multiple
|
347
|
-
|
348
|
-
@search_field.val ""
|
349
|
-
|
350
|
-
@form_field_jq.trigger "change", {'selected': @form_field.options[item.options_index].value} if @is_multiple || @form_field.selectedIndex != @current_selectedIndex
|
351
|
-
this.search_field_scale()
|
352
|
-
else if @options.allow_option_creation
|
353
|
-
new_option = @search_field.val()
|
354
|
-
return unless new_option
|
355
|
-
if @allow_creation(new_option)
|
356
|
-
$('<option>', {selected: true, value: new_option}).text(new_option).appendTo(@form_field_jq)
|
357
|
-
@results_update_field(evt)
|
358
|
-
@form_field_jq.trigger "change"
|
359
|
-
@search_field.val("")
|
360
|
-
@results_hide()
|
361
|
-
|
362
|
-
allow_creation: (new_option) ->
|
363
|
-
if @is_multiple
|
364
|
-
matches = @search_choices.find("li.search-choice span").filter ->
|
365
|
-
$(this).text().toLowerCase() == new_option.toLowerCase()
|
366
|
-
!matches.length
|
367
|
-
else
|
368
|
-
@selected_item.find('span').text().toLowerCase() != new_option.toLowerCase()
|
369
|
-
|
370
|
-
result_activate: (el) ->
|
371
|
-
el.addClass("active-result")
|
372
|
-
|
373
|
-
result_deactivate: (el) ->
|
374
|
-
el.removeClass("active-result")
|
375
|
-
|
376
|
-
result_deselect: (pos) ->
|
377
|
-
result_data = @results_data[pos]
|
378
|
-
result_data.selected = false
|
379
|
-
|
380
|
-
@form_field.options[result_data.options_index].selected = false
|
381
|
-
result = $("#" + @container_id + "_o_" + pos)
|
382
|
-
result.removeClass("result-selected").addClass("active-result").show()
|
383
|
-
|
384
|
-
this.result_clear_highlight()
|
385
|
-
this.winnow_results()
|
386
|
-
|
387
|
-
@form_field_jq.trigger "change", {deselected: @form_field.options[result_data.options_index].value}
|
388
|
-
this.search_field_scale()
|
389
|
-
|
390
|
-
single_deselect_control_build: ->
|
391
|
-
@selected_item.find("span").first().after "<abbr class=\"search-choice-close\"></abbr>" if @allow_single_deselect and @selected_item.find("abbr").length < 1
|
392
|
-
|
393
|
-
winnow_results: ->
|
394
|
-
startTime = new Date()
|
395
|
-
this.no_results_clear()
|
396
|
-
|
397
|
-
results = 0
|
398
|
-
|
399
|
-
searchText = if @search_field.val() is @default_text then "" else $('<div/>').text($.trim(@search_field.val())).html()
|
400
|
-
textToSearch = searchText.replace(/[\-\[\]\{\}\(\)\*\+\?\.,\\\^\$\|\#\s]/g, "\\$&")
|
401
|
-
regex = new RegExp('^' + textToSearch, 'i')
|
402
|
-
zregex = new RegExp(textToSearch, 'i')
|
403
|
-
fregex = new RegExp("^" + textToSearch + "$", 'i')
|
404
|
-
|
405
|
-
for option in @results_data
|
406
|
-
if not option.disabled and not option.empty
|
407
|
-
if option.group
|
408
|
-
$('#' + option.dom_id).hide()
|
409
|
-
else if not (@is_multiple and option.selected)
|
410
|
-
found = false
|
411
|
-
result_id = option.dom_id
|
412
|
-
|
413
|
-
if @options.allow_option_creation && searchText && fregex.test(option.html)
|
414
|
-
found = true
|
415
|
-
results += 1
|
416
|
-
@result_do_highlight($('#' + option.dom_id))
|
417
|
-
else if regex.test option.html
|
418
|
-
found = true
|
419
|
-
results += 1
|
420
|
-
else if option.html.indexOf(" ") >= 0 or option.html.indexOf("[") == 0
|
421
|
-
#TODO: replace this substitution of /\[\]/ with a list of characters to skip.
|
422
|
-
parts = option.html.replace(/\[|\]/g, "").split(" ")
|
423
|
-
if parts.length
|
424
|
-
for part in parts
|
425
|
-
if regex.test part
|
426
|
-
found = true
|
427
|
-
results += 1
|
428
|
-
|
429
|
-
if found
|
430
|
-
if searchText.length
|
431
|
-
startpos = option.html.search zregex
|
432
|
-
text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length)
|
433
|
-
text = text.substr(0, startpos) + '<em>' + text.substr(startpos)
|
434
|
-
else
|
435
|
-
text = option.html
|
436
|
-
|
437
|
-
$("#" + result_id).html text if $("#" + result_id).html != text
|
438
|
-
|
439
|
-
this.result_activate $("#" + result_id)
|
440
|
-
|
441
|
-
$("#" + @results_data[option.group_array_index].dom_id).show() if option.group_array_index?
|
442
|
-
else
|
443
|
-
this.result_clear_highlight() if @result_highlight and result_id is @result_highlight.attr 'id'
|
444
|
-
this.result_deactivate $("#" + result_id)
|
445
|
-
|
446
|
-
if results < 1 and searchText.length
|
447
|
-
this.no_results searchText
|
448
|
-
@results_hide() if @options.allow_option_creation && @is_multiple
|
449
|
-
else if not @options.allow_option_creation
|
450
|
-
this.winnow_results_set_highlight()
|
451
|
-
|
452
|
-
winnow_results_clear: ->
|
453
|
-
@search_field.val ""
|
454
|
-
lis = @search_results.find("li")
|
455
|
-
|
456
|
-
for li in lis
|
457
|
-
li = $(li)
|
458
|
-
if li.hasClass "group-result"
|
459
|
-
li.show()
|
460
|
-
else if not @is_multiple or not li.hasClass "result-selected"
|
461
|
-
this.result_activate li
|
462
|
-
|
463
|
-
winnow_results_set_highlight: ->
|
464
|
-
if not @result_highlight
|
465
|
-
|
466
|
-
selected_results = if not @is_multiple then @search_results.find(".result-selected.active-result") else []
|
467
|
-
do_high = if selected_results.length then selected_results.first() else @search_results.find(".active-result").first()
|
468
|
-
|
469
|
-
this.result_do_highlight do_high if do_high?
|
470
|
-
|
471
|
-
no_results: (terms) ->
|
472
|
-
return if !@is_multiple && @options.allow_option_creation
|
473
|
-
no_results_html = $('<li class="no-results">' + @results_none_found + ' "<span></span>"</li>')
|
474
|
-
no_results_html.find("span").first().html(terms)
|
475
|
-
|
476
|
-
@search_results.append no_results_html
|
477
|
-
|
478
|
-
no_results_clear: ->
|
479
|
-
@search_results.find(".no-results").remove()
|
480
|
-
|
481
|
-
keydown_arrow: ->
|
482
|
-
if not @result_highlight
|
483
|
-
first_active = @search_results.find("li.active-result").first()
|
484
|
-
this.result_do_highlight $(first_active) if first_active
|
485
|
-
else if @results_showing
|
486
|
-
next_sib = @result_highlight.nextAll("li.active-result").first()
|
487
|
-
this.result_do_highlight next_sib if next_sib
|
488
|
-
this.results_show() if not @results_showing
|
489
|
-
|
490
|
-
keyup_arrow: ->
|
491
|
-
if not @results_showing and not @is_multiple
|
492
|
-
this.results_show()
|
493
|
-
else if @result_highlight
|
494
|
-
prev_sibs = @result_highlight.prevAll("li.active-result")
|
495
|
-
|
496
|
-
if prev_sibs.length
|
497
|
-
this.result_do_highlight prev_sibs.first()
|
498
|
-
else
|
499
|
-
this.results_hide() if @choices > 0
|
500
|
-
this.result_clear_highlight()
|
501
|
-
|
502
|
-
keydown_backstroke: ->
|
503
|
-
if @pending_backstroke
|
504
|
-
this.choice_destroy @pending_backstroke.find("a").first()
|
505
|
-
this.clear_backstroke()
|
506
|
-
else
|
507
|
-
@pending_backstroke = @search_container.siblings("li.search-choice").last()
|
508
|
-
@pending_backstroke.addClass "search-choice-focus"
|
509
|
-
|
510
|
-
clear_backstroke: ->
|
511
|
-
@pending_backstroke.removeClass "search-choice-focus" if @pending_backstroke
|
512
|
-
@pending_backstroke = null
|
513
|
-
|
514
|
-
keydown_checker: (evt) ->
|
515
|
-
stroke = evt.which ? evt.keyCode
|
516
|
-
this.search_field_scale()
|
517
|
-
|
518
|
-
this.clear_backstroke() if stroke != 8 and this.pending_backstroke
|
519
|
-
|
520
|
-
switch stroke
|
521
|
-
when 8
|
522
|
-
@backstroke_length = this.search_field.val().length
|
523
|
-
break
|
524
|
-
when 9
|
525
|
-
this.result_select(evt) if this.results_showing and not @is_multiple
|
526
|
-
@mouse_on_container = false
|
527
|
-
break
|
528
|
-
when 13
|
529
|
-
evt.preventDefault()
|
530
|
-
break
|
531
|
-
when 38
|
532
|
-
evt.preventDefault()
|
533
|
-
this.keyup_arrow()
|
534
|
-
break
|
535
|
-
when 40
|
536
|
-
this.keydown_arrow()
|
537
|
-
break
|
538
|
-
|
539
|
-
search_field_scale: ->
|
540
|
-
if @is_multiple
|
541
|
-
h = 0
|
542
|
-
w = 0
|
543
|
-
|
544
|
-
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"
|
545
|
-
styles = ['font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing']
|
546
|
-
|
547
|
-
for style in styles
|
548
|
-
style_block += style + ":" + @search_field.css(style) + ";"
|
549
|
-
|
550
|
-
div = $('<div />', { 'style' : style_block })
|
551
|
-
div.text @search_field.val()
|
552
|
-
$('body').append div
|
553
|
-
|
554
|
-
w = div.width() + 25
|
555
|
-
div.remove()
|
556
|
-
|
557
|
-
if( w > @f_width-10 )
|
558
|
-
w = @f_width - 10
|
559
|
-
|
560
|
-
@search_field.css({'width': w + 'px'})
|
561
|
-
|
562
|
-
dd_top = @container.height()
|
563
|
-
@dropdown.css({"top": dd_top + "px"})
|
564
|
-
|
565
|
-
generate_random_id: ->
|
566
|
-
string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char()
|
567
|
-
while $("#" + string).length > 0
|
568
|
-
string += this.generate_random_char()
|
569
|
-
string
|
570
|
-
|
571
|
-
get_side_border_padding = (elmt) ->
|
572
|
-
side_border_padding = elmt.outerWidth() - elmt.width()
|
573
|
-
|
574
|
-
root.get_side_border_padding = get_side_border_padding
|