fat_free_crm 0.12.3 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fat_free_crm might be problematic. Click here for more details.
- checksums.yaml +5 -13
- data/.travis.yml +1 -11
- data/Gemfile +7 -19
- data/Gemfile.lock +166 -166
- data/Procfile +1 -1
- data/README.md +20 -20
- data/app/assets/javascripts/admin/fields.js.coffee +3 -3
- data/app/assets/javascripts/application.js.erb +3 -0
- data/app/assets/javascripts/crm.js +1 -0
- data/app/assets/javascripts/crm_comments.js.coffee +66 -0
- data/app/assets/javascripts/lists.js.coffee +45 -2
- data/app/assets/javascripts/search.js.coffee +2 -0
- data/app/assets/javascripts/timeago.js +17 -0
- data/app/assets/stylesheets/advanced_search.css.scss +49 -25
- data/app/assets/stylesheets/application.css.erb +3 -0
- data/app/assets/stylesheets/common.scss +13 -0
- data/app/assets/stylesheets/format_buttons.css.scss +15 -10
- data/app/assets/stylesheets/header.scss +3 -0
- data/app/assets/stylesheets/lists.css.scss +4 -0
- data/app/controllers/admin/fields_controller.rb +5 -5
- data/app/controllers/admin/users_controller.rb +1 -3
- data/app/controllers/application_controller.rb +23 -23
- data/app/controllers/comments_controller.rb +3 -31
- data/app/controllers/entities/accounts_controller.rb +3 -3
- data/app/controllers/entities/campaigns_controller.rb +4 -4
- data/app/controllers/entities/contacts_controller.rb +2 -2
- data/app/controllers/entities/leads_controller.rb +3 -3
- data/app/controllers/entities/opportunities_controller.rb +4 -3
- data/app/controllers/entities_controller.rb +6 -6
- data/app/controllers/home_controller.rb +1 -1
- data/app/controllers/lists_controller.rb +8 -1
- data/app/controllers/tasks_controller.rb +1 -1
- data/app/controllers/users_controller.rb +46 -23
- data/app/helpers/admin/application_helper.rb +1 -3
- data/app/helpers/admin/field_groups_helper.rb +2 -1
- data/app/helpers/application_helper.rb +37 -16
- data/app/helpers/home_helper.rb +1 -2
- data/app/helpers/leads_helper.rb +5 -6
- data/app/helpers/tasks_helper.rb +36 -50
- data/app/models/entities/account.rb +10 -7
- data/app/models/entities/campaign.rb +4 -4
- data/app/models/entities/contact.rb +8 -5
- data/app/models/entities/lead.rb +8 -8
- data/app/models/entities/opportunity.rb +13 -18
- data/app/models/fields/custom_field.rb +10 -0
- data/app/models/fields/field.rb +3 -3
- data/app/models/fields/field_group.rb +1 -1
- data/app/models/list.rb +1 -0
- data/app/models/polymorphic/address.rb +3 -3
- data/app/models/polymorphic/comment.rb +2 -4
- data/app/models/polymorphic/task.rb +32 -27
- data/app/models/setting.rb +3 -9
- data/app/models/users/ability.rb +2 -13
- data/app/models/users/user.rb +12 -15
- data/app/views/accounts/_edit.html.haml +1 -1
- data/app/views/accounts/_index_brief.html.haml +3 -3
- data/app/views/accounts/_index_long.html.haml +3 -3
- data/app/views/accounts/_new.html.haml +1 -1
- data/app/views/accounts/create.js.haml +17 -0
- data/app/views/accounts/destroy.js.haml +6 -0
- data/app/views/accounts/edit.js.haml +32 -0
- data/app/views/accounts/index.js.haml +11 -0
- data/app/views/accounts/index.xls.builder +9 -7
- data/app/views/accounts/new.js.haml +11 -0
- data/app/views/accounts/show.js.haml +5 -0
- data/app/views/accounts/update.js.haml +17 -0
- data/app/views/admin/field_groups/_edit.html.haml +1 -1
- data/app/views/admin/field_groups/_new.html.haml +1 -1
- data/app/views/admin/field_groups/confirm.js.haml +7 -0
- data/app/views/admin/field_groups/create.js.haml +20 -0
- data/app/views/admin/field_groups/destroy.js.haml +9 -0
- data/app/views/admin/field_groups/edit.js.haml +12 -0
- data/app/views/admin/field_groups/new.js.haml +8 -0
- data/app/views/admin/field_groups/update.js.haml +8 -0
- data/app/views/admin/fields/_field.html.haml +2 -2
- data/app/views/admin/fields/_form.html.haml +2 -2
- data/app/views/admin/fields/create.js.haml +17 -0
- data/app/views/admin/fields/destroy.js.haml +8 -0
- data/app/views/admin/fields/edit.js.haml +3 -0
- data/app/views/admin/fields/update.js.haml +13 -0
- data/app/views/admin/groups/_edit.html.haml +1 -1
- data/app/views/admin/groups/_new.html.haml +1 -1
- data/app/views/admin/groups/create.js.haml +10 -0
- data/app/views/admin/groups/destroy.js.haml +9 -0
- data/app/views/admin/groups/edit.js.haml +14 -0
- data/app/views/admin/groups/index.html.haml +1 -1
- data/app/views/admin/groups/index.js.haml +2 -0
- data/app/views/admin/groups/new.js.haml +9 -0
- data/app/views/admin/groups/update.js.haml +9 -0
- data/app/views/admin/tags/_edit.html.haml +1 -1
- data/app/views/admin/tags/_new.html.haml +1 -1
- data/app/views/admin/tags/confirm.js.haml +7 -0
- data/app/views/admin/tags/create.js.haml +11 -0
- data/app/views/admin/tags/destroy.js.haml +10 -0
- data/app/views/admin/tags/edit.js.haml +20 -0
- data/app/views/admin/tags/new.js.haml +7 -0
- data/app/views/admin/tags/update.js.haml +9 -0
- data/app/views/admin/users/_edit.html.haml +1 -1
- data/app/views/admin/users/_new.html.haml +1 -1
- data/app/views/admin/users/_user.html.haml +1 -1
- data/app/views/admin/users/confirm.js.haml +7 -0
- data/app/views/admin/users/create.js.haml +10 -0
- data/app/views/admin/users/destroy.js.haml +10 -0
- data/app/views/admin/users/edit.js.haml +20 -0
- data/app/views/admin/users/index.js.haml +2 -0
- data/app/views/admin/users/new.js.haml +9 -0
- data/app/views/admin/users/reactivate.js.haml +3 -0
- data/app/views/admin/users/suspend.js.haml +3 -0
- data/app/views/admin/users/update.js.haml +9 -0
- data/app/views/authentications/new.html.haml +1 -1
- data/app/views/campaigns/_edit.html.haml +1 -1
- data/app/views/campaigns/_new.html.haml +1 -1
- data/app/views/campaigns/create.js.haml +20 -0
- data/app/views/campaigns/destroy.js.haml +6 -0
- data/app/views/campaigns/edit.js.haml +33 -0
- data/app/views/campaigns/index.js.haml +11 -0
- data/app/views/campaigns/index.xls.builder +9 -7
- data/app/views/campaigns/new.js.haml +11 -0
- data/app/views/campaigns/show.js.haml +5 -0
- data/app/views/campaigns/update.js.haml +20 -0
- data/app/views/comments/_comment.html.haml +1 -1
- data/app/views/comments/_edit.html.haml +1 -1
- data/app/views/comments/_new.html.haml +3 -2
- data/app/views/comments/create.js.haml +14 -0
- data/app/views/comments/destroy.js.haml +5 -0
- data/app/views/comments/edit.js.haml +11 -0
- data/app/views/comments/update.js.haml +9 -0
- data/app/views/contacts/_edit.html.haml +1 -1
- data/app/views/contacts/_index_full.html.haml +1 -1
- data/app/views/contacts/_index_long.html.haml +2 -1
- data/app/views/contacts/_new.html.haml +1 -1
- data/app/views/contacts/_section_general.html.haml +3 -3
- data/app/views/contacts/create.js.haml +23 -0
- data/app/views/contacts/destroy.js.haml +9 -0
- data/app/views/contacts/edit.js.haml +35 -0
- data/app/views/contacts/index.js.haml +11 -0
- data/app/views/contacts/index.xls.builder +9 -7
- data/app/views/contacts/new.js.haml +13 -0
- data/app/views/contacts/show.js.haml +5 -0
- data/app/views/contacts/update.js.haml +22 -0
- data/app/views/emails/destroy.js.haml +5 -0
- data/app/views/entities/_permissions.html.haml +1 -1
- data/app/views/entities/attach.js.haml +21 -0
- data/app/views/entities/contacts.js.haml +3 -0
- data/app/views/entities/discard.js.haml +6 -0
- data/app/views/entities/leads.js.haml +3 -0
- data/app/views/entities/opportunities.js.haml +3 -0
- data/app/views/entities/subscription_update.js.haml +4 -0
- data/app/views/entities/versions.js.haml +3 -0
- data/app/views/fields/group.js.erb +3 -0
- data/app/views/home/_account.html.haml +3 -3
- data/app/views/home/_opportunity.html.haml +3 -3
- data/app/views/home/index.atom.builder +3 -3
- data/app/views/home/index.js.haml +7 -0
- data/app/views/home/index.rss.builder +2 -2
- data/app/views/home/options.js.haml +7 -0
- data/app/views/layouts/_footer.html.haml +0 -4
- data/app/views/layouts/_sidebar.html.haml +1 -0
- data/app/views/layouts/_tabbed.html.haml +1 -4
- data/app/views/layouts/admin/application.html.haml +0 -1
- data/app/views/layouts/application.html.haml +5 -7
- data/app/views/leads/_convert.html.haml +1 -1
- data/app/views/leads/_edit.html.haml +1 -1
- data/app/views/leads/_index_long.html.haml +2 -2
- data/app/views/leads/_new.html.haml +1 -1
- data/app/views/leads/convert.js.haml +35 -0
- data/app/views/leads/create.js.haml +21 -0
- data/app/views/leads/destroy.js.haml +9 -0
- data/app/views/leads/edit.js.haml +35 -0
- data/app/views/leads/index.js.haml +11 -0
- data/app/views/leads/index.xls.builder +9 -7
- data/app/views/leads/new.js.haml +11 -0
- data/app/views/leads/promote.js.haml +26 -0
- data/app/views/leads/reject.js.haml +12 -0
- data/app/views/leads/show.js.haml +5 -0
- data/app/views/leads/update.js.haml +26 -0
- data/app/views/lists/_personal_sidebar.html.haml +28 -0
- data/app/views/lists/_sidebar.html.haml +10 -7
- data/app/views/lists/create.js.haml +10 -0
- data/app/views/lists/destroy.js.haml +1 -0
- data/app/views/opportunities/_edit.html.haml +1 -1
- data/app/views/opportunities/_index_brief.html.haml +3 -3
- data/app/views/opportunities/_index_long.html.haml +3 -3
- data/app/views/opportunities/_new.html.haml +1 -2
- data/app/views/opportunities/_top_section.html.haml +4 -0
- data/app/views/opportunities/contacts.js.haml +3 -0
- data/app/views/opportunities/create.js.haml +29 -0
- data/app/views/opportunities/destroy.js.haml +13 -0
- data/app/views/opportunities/edit.js.haml +35 -0
- data/app/views/opportunities/index.js.haml +11 -0
- data/app/views/opportunities/index.xls.builder +9 -7
- data/app/views/opportunities/new.js.haml +13 -0
- data/app/views/opportunities/show.js.haml +5 -0
- data/app/views/opportunities/update.js.haml +25 -0
- data/app/views/passwords/edit.html.haml +1 -1
- data/app/views/passwords/new.html.haml +1 -1
- data/app/views/shared/_comment.html.haml +1 -1
- data/app/views/shared/_inline_styles.html.haml +1 -1
- data/app/views/tasks/_edit.html.haml +1 -1
- data/app/views/tasks/_new.html.haml +1 -1
- data/app/views/tasks/complete.js.haml +14 -0
- data/app/views/tasks/create.js.haml +39 -0
- data/app/views/tasks/destroy.js.haml +7 -0
- data/app/views/tasks/discard.js.haml +1 -0
- data/app/views/tasks/edit.js.haml +26 -0
- data/app/views/tasks/filter.js.haml +4 -0
- data/app/views/tasks/index.xls.builder +7 -5
- data/app/views/tasks/new.js.haml +8 -0
- data/app/views/tasks/update.js.haml +19 -0
- data/app/views/users/_password.html.haml +1 -1
- data/app/views/users/_profile.html.haml +1 -1
- data/app/views/users/avatar.js.haml +9 -0
- data/app/views/users/change_password.js.haml +13 -0
- data/app/views/users/edit.js.haml +9 -0
- data/app/views/users/new.html.haml +1 -1
- data/app/views/users/password.js.haml +10 -0
- data/app/views/users/update.js.haml +9 -0
- data/app/views/users/upload_avatar.js.haml +7 -0
- data/app/views/versions/_version.html.haml +1 -1
- data/config/application.rb +1 -4
- data/config/environments/production.rb +3 -2
- data/config/initializers/custom_field_ransack_translations.rb +15 -0
- data/config/initializers/locale.rb +9 -1
- data/config/initializers/secret_token.rb +1 -25
- data/config/initializers/views.rb +20 -20
- data/config/locales/cz.yml +245 -211
- data/config/locales/cz_fat_free_crm.yml +105 -181
- data/config/locales/de.yml +162 -118
- data/config/locales/de_fat_free_crm.yml +760 -731
- data/config/locales/de_ransack.yml +91 -0
- data/config/locales/en-GB.yml +158 -119
- data/config/locales/en-GB_fat_free_crm.yml +161 -279
- data/config/locales/en-US.yml +158 -121
- data/config/locales/en-US_fat_free_crm.yml +185 -179
- data/config/locales/en-US_ransack.yml +81 -82
- data/config/locales/es.yml +164 -123
- data/config/locales/es_fat_free_crm.yml +151 -209
- data/config/locales/fr-CA.yml +167 -130
- data/config/locales/fr-CA_fat_free_crm.yml +142 -202
- data/config/locales/fr.yml +170 -125
- data/config/locales/fr_fat_free_crm.yml +199 -302
- data/config/locales/it.yml +158 -122
- data/config/locales/it_fat_free_crm.yml +105 -168
- data/config/locales/ja.yml +162 -131
- data/config/locales/ja_fat_free_crm.yml +118 -188
- data/config/locales/pl.yml +168 -132
- data/config/locales/pl_fat_free_crm.yml +115 -186
- data/config/locales/pt-BR.yml +160 -127
- data/config/locales/pt-BR_fat_free_crm.yml +125 -182
- data/config/locales/ru.yml +256 -233
- data/config/locales/ru_fat_free_crm.yml +136 -193
- data/config/locales/sv-SE.yml +164 -181
- data/config/locales/sv-SE_fat_free_crm.yml +129 -193
- data/config/locales/th_fat_free_crm.yml +114 -194
- data/config/locales/zh-CN.yml +176 -149
- data/config/locales/zh-CN_fat_free_crm.yml +78 -167
- data/config/routes.rb +1 -1
- data/config/settings.default.yml +74 -23
- data/custom_plan.rb +11 -0
- data/db/migrate/20131207033244_add_user_id_to_lists.rb +6 -0
- data/db/schema.rb +4 -1
- data/fat_free_crm.gemspec +3 -3
- data/lib/fat_free_crm.rb +1 -11
- data/lib/fat_free_crm/export_csv.rb +3 -3
- data/lib/fat_free_crm/fields.rb +10 -0
- data/lib/fat_free_crm/gem_dependencies.rb +1 -2
- data/lib/fat_free_crm/i18n.rb +9 -5
- data/lib/fat_free_crm/version.rb +2 -2
- data/lib/fat_free_crm/view_factory.rb +8 -5
- data/lib/tasks/ffcrm/config.rake +9 -12
- data/lib/tasks/ffcrm/missing_translations.rake +2 -1
- data/spec/controllers/admin/users_controller_spec.rb +6 -4
- data/spec/controllers/applications_controller_spec.rb +4 -4
- data/spec/controllers/authentications_controller_spec.rb +15 -15
- data/spec/controllers/comments_controller_spec.rb +9 -87
- data/spec/controllers/emails_controller_spec.rb +1 -1
- data/spec/controllers/entities/accounts_controller_spec.rb +7 -7
- data/spec/controllers/entities/campaigns_controller_spec.rb +5 -5
- data/spec/controllers/entities/contacts_controller_spec.rb +7 -7
- data/spec/controllers/entities/leads_controller_spec.rb +14 -14
- data/spec/controllers/entities/opportunities_controller_spec.rb +8 -8
- data/spec/controllers/home_controller_spec.rb +6 -6
- data/spec/controllers/tasks_controller_spec.rb +7 -7
- data/spec/controllers/users_controller_spec.rb +22 -50
- data/spec/features/support/selector_helpers.rb +1 -6
- data/spec/features/tasks_spec.rb +2 -2
- data/spec/helpers/application_helper_spec.rb +15 -15
- data/spec/lib/fields_spec.rb +29 -29
- data/spec/lib/mail_processor/base_spec.rb +7 -7
- data/spec/lib/mail_processor/dropbox_spec.rb +3 -3
- data/spec/lib/view_factory_spec.rb +14 -14
- data/spec/models/entities/opportunity_spec.rb +1 -1
- data/spec/models/fields/custom_field_date_pair_spec.rb +14 -14
- data/spec/models/fields/custom_field_pair_spec.rb +13 -13
- data/spec/models/fields/custom_field_spec.rb +5 -5
- data/spec/models/fields/field_spec.rb +2 -2
- data/spec/models/observers/entity_observer_spec.rb +2 -2
- data/spec/models/users/user_spec.rb +7 -7
- data/spec/routing/comments_routing_spec.rb +0 -9
- data/spec/shared/controllers.rb +75 -77
- data/spec/shared/models.rb +1 -1
- data/spec/spec_helper.rb +1 -2
- data/spec/support/auth_macros.rb +3 -3
- data/spec/support/mail_processor_mocks.rb +13 -13
- data/spec/views/accounts/_edit.haml_spec.rb +1 -1
- data/spec/views/accounts/{create.rjs_spec.rb → create.js.haml_spec.rb} +9 -14
- data/spec/views/accounts/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +6 -8
- data/spec/views/accounts/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +10 -18
- data/spec/views/accounts/{index.rjs_spec.rb → index.js.haml_spec.rb} +7 -11
- data/spec/views/accounts/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -8
- data/spec/views/accounts/show.haml_spec.rb +1 -1
- data/spec/views/accounts/{update.rjs_spec.rb → update.js.haml_spec.rb} +16 -25
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +31 -0
- data/spec/views/admin/field_groups/destroy.js.haml_spec.rb +31 -0
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +24 -0
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +25 -0
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +30 -0
- data/spec/views/admin/users/_create.haml_spec.rb +1 -1
- data/spec/views/admin/users/{create.rjs_spec.rb → create.js.haml_spec.rb} +6 -9
- data/spec/views/admin/users/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +6 -7
- data/spec/views/admin/users/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +6 -12
- data/spec/views/admin/users/index.haml_spec.rb +0 -0
- data/spec/views/admin/users/{index.rjs_spec.rb → index.js.haml_spec.rb} +3 -5
- data/spec/views/admin/users/{new.rjs_spec.rb → new.js.haml_spec.rb} +4 -6
- data/spec/views/admin/users/{reactivate.rjs_spec.rb → reactivate.js.haml_spec.rb} +2 -4
- data/spec/views/admin/users/show.haml_spec.rb +0 -0
- data/spec/views/admin/users/{suspend.rjs_spec.rb → suspend.js.haml_spec.rb} +2 -4
- data/spec/views/admin/users/{update.rjs_spec.rb → update.js.haml_spec.rb} +6 -10
- data/spec/views/campaigns/{create.rjs_spec.rb → create.js.haml_spec.rb} +9 -14
- data/spec/views/campaigns/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +6 -7
- data/spec/views/campaigns/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +11 -19
- data/spec/views/campaigns/{index.rjs_spec.rb → index.js.haml_spec.rb} +5 -9
- data/spec/views/campaigns/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -8
- data/spec/views/campaigns/{update.rjs_spec.rb → update.js.haml_spec.rb} +14 -21
- data/spec/views/comments/{new.rjs_spec.rb → edit.js.haml_spec.rb} +12 -9
- data/spec/views/contacts/{create.rjs_spec.rb → create.js.haml_spec.rb} +9 -16
- data/spec/views/contacts/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +6 -8
- data/spec/views/contacts/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +12 -19
- data/spec/views/contacts/index.haml_spec.rb +1 -1
- data/spec/views/contacts/{index.rjs_spec.rb → index.js.html_spec.rb} +7 -11
- data/spec/views/contacts/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -7
- data/spec/views/contacts/{update.rjs_spec.rb → update.js.haml_spec.rb} +20 -35
- data/spec/views/home/{index.rjs_spec.rb → index.js.haml_spec.rb} +2 -4
- data/spec/views/home/{options.rjs_spec.rb → options.js.haml_spec.rb} +7 -12
- data/spec/views/leads/{convert.rjs_spec.rb → convert.js.haml_spec.rb} +12 -20
- data/spec/views/leads/{create.rjs_spec.rb → create.js.haml_spec.rb} +13 -19
- data/spec/views/leads/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +9 -12
- data/spec/views/leads/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +12 -20
- data/spec/views/leads/{index.rjs_spec.rb → index.js.haml_spec.rb} +5 -9
- data/spec/views/leads/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -8
- data/spec/views/leads/{promote.rjs_spec.rb → promote.js.haml_spec.rb} +28 -43
- data/spec/views/leads/{reject.rjs_spec.rb → reject.js.haml_spec.rb} +10 -17
- data/spec/views/leads/{update.rjs_spec.rb → update.js.haml_spec.rb} +25 -38
- data/spec/views/opportunities/{create.rjs_spec.rb → create.js.haml_spec.rb} +16 -26
- data/spec/views/opportunities/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +13 -16
- data/spec/views/opportunities/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +10 -18
- data/spec/views/opportunities/{index.rjs_spec.rb → index.js.haml_spec.rb} +7 -12
- data/spec/views/opportunities/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -8
- data/spec/views/opportunities/{update.rjs_spec.rb → update.js.haml_spec.rb} +29 -46
- data/spec/views/tasks/_edit.haml_spec.rb +1 -1
- data/spec/views/tasks/{complete.rjs_spec.rb → complete.js.haml_spec.rb} +9 -14
- data/spec/views/tasks/{create.rjs_spec.rb → create.js.haml_spec.rb} +25 -33
- data/spec/views/tasks/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +9 -11
- data/spec/views/tasks/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +9 -14
- data/spec/views/tasks/index.haml_spec.rb +1 -2
- data/spec/views/tasks/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -8
- data/spec/views/tasks/{update.rjs_spec.rb → update.js.haml_spec.rb} +28 -41
- data/spec/views/users/{avatar.rjs_spec.rb → avatar.js.haml_spec.rb} +7 -9
- data/spec/views/users/{change_password.rjs_spec.rb → change_password.js.haml_spec.rb} +10 -12
- data/spec/views/users/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +8 -10
- data/spec/views/users/{password.rjs_spec.rb → password.js.haml_spec.rb} +9 -11
- data/spec/views/users/{update.rjs_spec.rb → update.js.haml_spec.rb} +7 -15
- data/spec/views/users/{upload_avatar.rjs_spec.rb → upload_avatar.js.haml_spec.rb} +8 -10
- data/vendor/assets/javascripts/ajax-chosen-jquery.js +2 -0
- data/vendor/assets/javascripts/ajax-chosen-prototype.js +2 -0
- data/vendor/assets/javascripts/ajax-chosen.jquery.coffee +81 -0
- data/vendor/assets/javascripts/ajax-chosen.proto.coffee +98 -0
- data/vendor/assets/javascripts/jquery_timeago/index.js +17 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.cz.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.de.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.en-GB.js +20 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.en-US.js +20 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.es.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.fr-CA.js +17 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.fr.js +17 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.it.js +16 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.ja.js +19 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.js +194 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.pl.js +31 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.pt-BR.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.ru.js +34 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.sv-SE.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.th.js +20 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.zh-CN.js +20 -0
- data/zeus.json +2 -1
- metadata +240 -245
- data/app/assets/images/delete.png +0 -0
- data/app/assets/images/iconset_attribution.png +0 -0
- data/app/views/accounts/create.js.rjs +0 -14
- data/app/views/accounts/destroy.js.rjs +0 -3
- data/app/views/accounts/edit.js.rjs +0 -33
- data/app/views/accounts/index.js.rjs +0 -8
- data/app/views/accounts/new.js.rjs +0 -9
- data/app/views/accounts/show.js.erb +0 -2
- data/app/views/accounts/update.js.rjs +0 -17
- data/app/views/admin/field_groups/confirm.js.rjs +0 -6
- data/app/views/admin/field_groups/create.js.rjs +0 -20
- data/app/views/admin/field_groups/destroy.js.rjs +0 -11
- data/app/views/admin/field_groups/edit.js.rjs +0 -14
- data/app/views/admin/field_groups/new.js.rjs +0 -9
- data/app/views/admin/field_groups/update.js.rjs +0 -9
- data/app/views/admin/fields/create.js.erb +0 -19
- data/app/views/admin/fields/destroy.js.erb +0 -9
- data/app/views/admin/fields/edit.js.erb +0 -1
- data/app/views/admin/fields/update.js.erb +0 -13
- data/app/views/admin/groups/create.js.rjs +0 -11
- data/app/views/admin/groups/destroy.js.rjs +0 -11
- data/app/views/admin/groups/edit.js.rjs +0 -21
- data/app/views/admin/groups/index.js.rjs +0 -2
- data/app/views/admin/groups/new.js.rjs +0 -9
- data/app/views/admin/groups/update.js.rjs +0 -10
- data/app/views/admin/tags/confirm.js.rjs +0 -6
- data/app/views/admin/tags/create.js.rjs +0 -12
- data/app/views/admin/tags/destroy.js.rjs +0 -11
- data/app/views/admin/tags/edit.js.rjs +0 -21
- data/app/views/admin/tags/new.js.rjs +0 -8
- data/app/views/admin/tags/update.js.rjs +0 -10
- data/app/views/admin/users/confirm.js.rjs +0 -6
- data/app/views/admin/users/create.js.rjs +0 -11
- data/app/views/admin/users/destroy.js.rjs +0 -11
- data/app/views/admin/users/edit.js.rjs +0 -21
- data/app/views/admin/users/index.js.rjs +0 -3
- data/app/views/admin/users/new.js.rjs +0 -8
- data/app/views/admin/users/reactivate.js.rjs +0 -3
- data/app/views/admin/users/suspend.js.rjs +0 -3
- data/app/views/admin/users/update.js.rjs +0 -10
- data/app/views/campaigns/create.js.rjs +0 -18
- data/app/views/campaigns/destroy.js.rjs +0 -3
- data/app/views/campaigns/edit.js.rjs +0 -34
- data/app/views/campaigns/index.js.rjs +0 -8
- data/app/views/campaigns/new.js.rjs +0 -9
- data/app/views/campaigns/show.js.erb +0 -2
- data/app/views/campaigns/update.js.rjs +0 -21
- data/app/views/comments/create.js.rjs +0 -11
- data/app/views/comments/destroy.js.rjs +0 -6
- data/app/views/comments/edit.js.rjs +0 -11
- data/app/views/comments/new.js.rjs +0 -14
- data/app/views/comments/update.js.rjs +0 -11
- data/app/views/contacts/create.js.rjs +0 -19
- data/app/views/contacts/destroy.js.rjs +0 -7
- data/app/views/contacts/edit.js.rjs +0 -36
- data/app/views/contacts/index.js.rjs +0 -8
- data/app/views/contacts/new.js.rjs +0 -11
- data/app/views/contacts/show.js.erb +0 -2
- data/app/views/contacts/update.js.rjs +0 -22
- data/app/views/emails/destroy.js.rjs +0 -6
- data/app/views/entities/attach.js.rjs +0 -24
- data/app/views/entities/contacts.js.rjs +0 -3
- data/app/views/entities/discard.js.rjs +0 -7
- data/app/views/entities/leads.js.rjs +0 -3
- data/app/views/entities/opportunities.js.rjs +0 -3
- data/app/views/entities/subscription_update.js.rjs +0 -4
- data/app/views/entities/versions.js.erb +0 -3
- data/app/views/fields/group.js.rjs +0 -7
- data/app/views/home/index.js.rjs +0 -7
- data/app/views/home/options.js.rjs +0 -8
- data/app/views/leads/convert.js.rjs +0 -37
- data/app/views/leads/create.js.rjs +0 -19
- data/app/views/leads/destroy.js.rjs +0 -7
- data/app/views/leads/edit.js.rjs +0 -36
- data/app/views/leads/index.js.rjs +0 -8
- data/app/views/leads/new.js.rjs +0 -9
- data/app/views/leads/promote.js.rjs +0 -27
- data/app/views/leads/reject.js.rjs +0 -10
- data/app/views/leads/show.js.erb +0 -2
- data/app/views/leads/update.js.rjs +0 -27
- data/app/views/lists/create.js.rjs +0 -9
- data/app/views/lists/destroy.js.rjs +0 -1
- data/app/views/opportunities/contacts.js.rjs +0 -3
- data/app/views/opportunities/create.js.rjs +0 -29
- data/app/views/opportunities/destroy.js.rjs +0 -11
- data/app/views/opportunities/edit.js.rjs +0 -36
- data/app/views/opportunities/index.js.rjs +0 -8
- data/app/views/opportunities/new.js.rjs +0 -12
- data/app/views/opportunities/show.js.erb +0 -2
- data/app/views/opportunities/update.js.rjs +0 -26
- data/app/views/tasks/complete.js.rjs +0 -17
- data/app/views/tasks/create.js.rjs +0 -41
- data/app/views/tasks/destroy.js.rjs +0 -7
- data/app/views/tasks/discard.rjs +0 -1
- data/app/views/tasks/edit.js.rjs +0 -23
- data/app/views/tasks/filter.js.rjs +0 -1
- data/app/views/tasks/new.js.rjs +0 -9
- data/app/views/tasks/update.js.rjs +0 -21
- data/app/views/users/avatar.js.rjs +0 -10
- data/app/views/users/change_password.js.rjs +0 -15
- data/app/views/users/edit.js.rjs +0 -10
- data/app/views/users/password.js.rjs +0 -11
- data/app/views/users/update.js.rjs +0 -10
- data/app/views/users/upload_avatar.js.rjs +0 -8
- data/lib/fat_free_crm/secret_token_generator.rb +0 -65
- data/spec/lib/secret_token_generator_spec.rb +0 -79
- data/spec/models/users/abilities/user_ability_spec.rb +0 -58
- data/spec/support/rjs_support.rb +0 -14
- data/vendor/assets/images/brief.png +0 -0
- data/vendor/assets/images/full.png +0 -0
- data/vendor/assets/images/long.png +0 -0
- data/vendor/assets/images/tab_icons/accounts.png +0 -0
- data/vendor/assets/images/tab_icons/accounts_active.png +0 -0
- data/vendor/assets/images/tab_icons/campaigns.png +0 -0
- data/vendor/assets/images/tab_icons/campaigns_active.png +0 -0
- data/vendor/assets/images/tab_icons/contacts.png +0 -0
- data/vendor/assets/images/tab_icons/contacts_active.png +0 -0
- data/vendor/assets/images/tab_icons/dashboard.png +0 -0
- data/vendor/assets/images/tab_icons/dashboard_active.png +0 -0
- data/vendor/assets/images/tab_icons/leads.png +0 -0
- data/vendor/assets/images/tab_icons/leads_active.png +0 -0
- data/vendor/assets/images/tab_icons/opportunities.png +0 -0
- data/vendor/assets/images/tab_icons/opportunities_active.png +0 -0
- data/vendor/assets/images/tab_icons/tasks.png +0 -0
- data/vendor/assets/images/tab_icons/tasks_active.png +0 -0
@@ -99,7 +99,7 @@ describe OpportunitiesController do
|
|
99
99
|
|
100
100
|
describe "with mime type of JSON" do
|
101
101
|
it "should render all opportunities as JSON" do
|
102
|
-
@controller.should_receive(:get_opportunities).and_return(opportunities =
|
102
|
+
@controller.should_receive(:get_opportunities).and_return(opportunities = double("Array of Opportunities"))
|
103
103
|
opportunities.should_receive(:to_json).and_return("generated JSON")
|
104
104
|
|
105
105
|
request.env["HTTP_ACCEPT"] = "application/json"
|
@@ -110,7 +110,7 @@ describe OpportunitiesController do
|
|
110
110
|
|
111
111
|
describe "with mime type of JSON" do
|
112
112
|
it "should render all opportunities as JSON" do
|
113
|
-
@controller.should_receive(:get_opportunities).and_return(opportunities =
|
113
|
+
@controller.should_receive(:get_opportunities).and_return(opportunities = double("Array of Opportunities"))
|
114
114
|
opportunities.should_receive(:to_json).and_return("generated JSON")
|
115
115
|
|
116
116
|
request.env["HTTP_ACCEPT"] = "application/json"
|
@@ -121,7 +121,7 @@ describe OpportunitiesController do
|
|
121
121
|
|
122
122
|
describe "with mime type of XML" do
|
123
123
|
it "should render all opportunities as xml" do
|
124
|
-
@controller.should_receive(:get_opportunities).and_return(opportunities =
|
124
|
+
@controller.should_receive(:get_opportunities).and_return(opportunities = double("Array of Opportunities"))
|
125
125
|
opportunities.should_receive(:to_xml).and_return("generated XML")
|
126
126
|
|
127
127
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
@@ -348,7 +348,7 @@ describe OpportunitiesController do
|
|
348
348
|
|
349
349
|
before do
|
350
350
|
@opportunity = FactoryGirl.build(:opportunity, :user => current_user)
|
351
|
-
Opportunity.stub
|
351
|
+
Opportunity.stub(:new).and_return(@opportunity)
|
352
352
|
@stage = Setting.unroll(:opportunity_stage)
|
353
353
|
end
|
354
354
|
|
@@ -426,7 +426,7 @@ describe OpportunitiesController do
|
|
426
426
|
it "should update related campaign revenue if won" do
|
427
427
|
@campaign = FactoryGirl.create(:campaign, :revenue => 0)
|
428
428
|
@opportunity = FactoryGirl.build(:opportunity, :user => current_user, :stage => "won", :amount => 1100, :discount => 100)
|
429
|
-
Opportunity.stub
|
429
|
+
Opportunity.stub(:new).and_return(@opportunity)
|
430
430
|
|
431
431
|
xhr :post, :create, :opportunity => { :name => "Hello world" }, :campaign => @campaign.id, :account => { :name => "Test Account" }
|
432
432
|
assigns(:opportunity).should == @opportunity
|
@@ -436,7 +436,7 @@ describe OpportunitiesController do
|
|
436
436
|
|
437
437
|
it "should add a new comment to the newly created opportunity when specified" do
|
438
438
|
@opportunity = FactoryGirl.build(:opportunity, :user => current_user)
|
439
|
-
Opportunity.stub
|
439
|
+
Opportunity.stub(:new).and_return(@opportunity)
|
440
440
|
|
441
441
|
xhr :post, :create, :opportunity => { :name => "Opportunity Knocks" }, :account => { :name => "My Account" }, :comment_body => "Awesome comment is awesome"
|
442
442
|
@opportunity.reload.comments.map(&:comment).should include("Awesome comment is awesome")
|
@@ -449,7 +449,7 @@ describe OpportunitiesController do
|
|
449
449
|
@account = Account.new(:user => current_user)
|
450
450
|
@opportunity = FactoryGirl.build(:opportunity, :name => nil, :campaign => nil, :user => current_user,
|
451
451
|
:account => @account)
|
452
|
-
Opportunity.stub
|
452
|
+
Opportunity.stub(:new).and_return(@opportunity)
|
453
453
|
@stage = Setting.unroll(:opportunity_stage)
|
454
454
|
@accounts = [ FactoryGirl.create(:account, :user => current_user) ]
|
455
455
|
|
@@ -465,7 +465,7 @@ describe OpportunitiesController do
|
|
465
465
|
@account = FactoryGirl.create(:account, :id => 42, :user => current_user)
|
466
466
|
@opportunity = FactoryGirl.build(:opportunity, :name => nil, :campaign => nil, :user => current_user,
|
467
467
|
:account => @account)
|
468
|
-
Opportunity.stub
|
468
|
+
Opportunity.stub(:new).and_return(@opportunity)
|
469
469
|
@stage = Setting.unroll(:opportunity_stage)
|
470
470
|
|
471
471
|
# Expect to redraw [create] form with selected account.
|
@@ -157,19 +157,19 @@ describe HomeController do
|
|
157
157
|
describe "activity_user" do
|
158
158
|
|
159
159
|
before(:each) do
|
160
|
-
@user =
|
161
|
-
@cur_user =
|
160
|
+
@user = double(User, :id => 1, :is_a? => true)
|
161
|
+
@cur_user = double(User)
|
162
162
|
end
|
163
163
|
|
164
164
|
it "should find a user by email" do
|
165
|
-
@cur_user.stub
|
165
|
+
@cur_user.stub(:pref).and_return(:activity_user => 'billy@example.com')
|
166
166
|
controller.instance_variable_set(:@current_user, @cur_user)
|
167
167
|
User.should_receive(:where).with(:email => 'billy@example.com').and_return([@user])
|
168
168
|
controller.send(:activity_user).should == 1
|
169
169
|
end
|
170
170
|
|
171
171
|
it "should find a user by first name or last name" do
|
172
|
-
@cur_user.stub
|
172
|
+
@cur_user.stub(:pref).and_return(:activity_user => 'Billy')
|
173
173
|
controller.instance_variable_set(:@current_user, @cur_user)
|
174
174
|
User.should_receive(:where).with(:first_name => 'Billy').and_return([@user])
|
175
175
|
User.should_receive(:where).with(:last_name => 'Billy').and_return([@user])
|
@@ -177,7 +177,7 @@ describe HomeController do
|
|
177
177
|
end
|
178
178
|
|
179
179
|
it "should find a user by first name and last name" do
|
180
|
-
@cur_user.stub
|
180
|
+
@cur_user.stub(:pref).and_return(:activity_user => 'Billy Elliot')
|
181
181
|
controller.instance_variable_set(:@current_user, @cur_user)
|
182
182
|
User.should_receive(:where).with(:first_name => 'Billy', :last_name => "Elliot").and_return([@user])
|
183
183
|
User.should_receive(:where).with(:first_name => 'Elliot', :last_name => "Billy").and_return([@user])
|
@@ -185,7 +185,7 @@ describe HomeController do
|
|
185
185
|
end
|
186
186
|
|
187
187
|
it "should return nil when 'all_users' is specified" do
|
188
|
-
@cur_user.stub
|
188
|
+
@cur_user.stub(:pref).and_return(:activity_user => 'all_users')
|
189
189
|
controller.instance_variable_set(:@current_user, @cur_user)
|
190
190
|
User.should_not_receive(:where)
|
191
191
|
controller.send(:activity_user).should == nil
|
@@ -9,7 +9,7 @@ describe TasksController do
|
|
9
9
|
|
10
10
|
def update_sidebar
|
11
11
|
@task_total = { :key => :value, :pairs => :etc }
|
12
|
-
Task.stub
|
12
|
+
Task.stub(:totals).and_return(@task_total)
|
13
13
|
end
|
14
14
|
|
15
15
|
def produce_tasks(user, view)
|
@@ -120,7 +120,7 @@ describe TasksController do
|
|
120
120
|
TASK_STATUSES.each do |view|
|
121
121
|
|
122
122
|
it "should render the requested task as JSON for #{view} view" do
|
123
|
-
Task.stub_chain(:tracked_by, :find).and_return(task =
|
123
|
+
Task.stub_chain(:tracked_by, :find).and_return(task = double("Task"))
|
124
124
|
task.should_receive(:to_json).and_return("generated JSON")
|
125
125
|
|
126
126
|
request.env["HTTP_ACCEPT"] = "application/json"
|
@@ -129,7 +129,7 @@ describe TasksController do
|
|
129
129
|
end
|
130
130
|
|
131
131
|
it "should render the requested task as xml for #{view} view" do
|
132
|
-
Task.stub_chain(:tracked_by, :find).and_return(task =
|
132
|
+
Task.stub_chain(:tracked_by, :find).and_return(task = double("Task"))
|
133
133
|
task.should_receive(:to_xml).and_return("generated XML")
|
134
134
|
|
135
135
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
@@ -147,7 +147,7 @@ describe TasksController do
|
|
147
147
|
it "should expose a new task as @task and render [new] template" do
|
148
148
|
account = FactoryGirl.create(:account, :user => current_user)
|
149
149
|
@task = FactoryGirl.build(:task, :user => current_user, :asset => account)
|
150
|
-
Task.stub
|
150
|
+
Task.stub(:new).and_return(@task)
|
151
151
|
@bucket = Setting.unroll(:task_bucket)[1..-1] << [ "On Specific Date...", :specific_time ]
|
152
152
|
@category = Setting.unroll(:task_category)
|
153
153
|
|
@@ -268,7 +268,7 @@ describe TasksController do
|
|
268
268
|
|
269
269
|
it "should expose a newly created task as @task and render [create] template" do
|
270
270
|
@task = FactoryGirl.build(:task, :user => current_user)
|
271
|
-
Task.stub
|
271
|
+
Task.stub(:new).and_return(@task)
|
272
272
|
|
273
273
|
xhr :post, :create, :task => { :name => "Hello world" }
|
274
274
|
assigns(:task).should == @task
|
@@ -280,7 +280,7 @@ describe TasksController do
|
|
280
280
|
[ "", "?view=pending", "?view=assigned", "?view=completed" ].each do |view|
|
281
281
|
it "should update tasks sidebar when [create] is being called from [/tasks#{view}] page" do
|
282
282
|
@task = FactoryGirl.build(:task, :user => current_user)
|
283
|
-
Task.stub
|
283
|
+
Task.stub(:new).and_return(@task)
|
284
284
|
|
285
285
|
request.env["HTTP_REFERER"] = "http://localhost/tasks#{view}"
|
286
286
|
xhr :post, :create, :task => { :name => "Hello world" }
|
@@ -293,7 +293,7 @@ describe TasksController do
|
|
293
293
|
|
294
294
|
it "should expose a newly created but unsaved task as @lead and still render [create] template" do
|
295
295
|
@task = FactoryGirl.build(:task, :name => nil, :user => current_user)
|
296
|
-
Task.stub
|
296
|
+
Task.stub(:new).and_return(@task)
|
297
297
|
|
298
298
|
xhr :post, :create, :task => {}
|
299
299
|
assigns(:task).should == @task
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
4
4
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
5
5
|
#------------------------------------------------------------------------------
|
6
|
-
require 'spec_helper'
|
6
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
7
7
|
|
8
8
|
describe UsersController do
|
9
9
|
|
@@ -15,9 +15,11 @@ describe UsersController do
|
|
15
15
|
require_user
|
16
16
|
end
|
17
17
|
|
18
|
-
it "should render [show] template" do
|
19
|
-
|
20
|
-
|
18
|
+
it "should expose the requested user as @user and render [show] template" do
|
19
|
+
@user = FactoryGirl.create(:user)
|
20
|
+
|
21
|
+
get :show, :id => @user.id
|
22
|
+
assigns[:user].should == @user
|
21
23
|
response.should render_template("users/show")
|
22
24
|
end
|
23
25
|
|
@@ -27,30 +29,16 @@ describe UsersController do
|
|
27
29
|
response.should render_template("users/show")
|
28
30
|
end
|
29
31
|
|
30
|
-
it "should show user if admin user" do
|
31
|
-
@user = create(:user)
|
32
|
-
require_user(admin: true)
|
33
|
-
get :show, id: @user.id
|
34
|
-
assigns[:user].should == @user
|
35
|
-
response.should render_template("users/show")
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should not show user if not admin user" do
|
39
|
-
@user = create(:user)
|
40
|
-
get :show, id: @user.id
|
41
|
-
response.should redirect_to(root_url)
|
42
|
-
end
|
43
|
-
|
44
32
|
describe "with mime type of JSON" do
|
45
33
|
before(:each) do
|
46
34
|
request.env["HTTP_ACCEPT"] = "application/json"
|
47
35
|
end
|
48
36
|
|
49
37
|
it "should render the requested user as JSON" do
|
50
|
-
User.should_receive(:find).and_return(
|
51
|
-
|
38
|
+
User.should_receive(:find).and_return(user = double("User"))
|
39
|
+
user.should_receive(:to_json).and_return("generated JSON")
|
52
40
|
|
53
|
-
get :show, :id =>
|
41
|
+
get :show, :id => 42
|
54
42
|
response.body.should == "generated JSON"
|
55
43
|
end
|
56
44
|
|
@@ -68,10 +56,10 @@ describe UsersController do
|
|
68
56
|
end
|
69
57
|
|
70
58
|
it "should render the requested user as XML" do
|
71
|
-
User.should_receive(:find).and_return(
|
72
|
-
|
59
|
+
User.should_receive(:find).and_return(user = double("User"))
|
60
|
+
user.should_receive(:to_xml).and_return("generated XML")
|
73
61
|
|
74
|
-
get :show, :id =>
|
62
|
+
get :show, :id => 42
|
75
63
|
response.body.should == "generated XML"
|
76
64
|
end
|
77
65
|
|
@@ -91,9 +79,9 @@ describe UsersController do
|
|
91
79
|
|
92
80
|
describe "if user is allowed to sign up" do
|
93
81
|
it "should expose a new user as @user and render [new] template" do
|
94
|
-
|
82
|
+
@controller.should_receive(:can_signup?).and_return(true)
|
95
83
|
@user = FactoryGirl.build(:user)
|
96
|
-
User.stub
|
84
|
+
User.stub(:new).and_return(@user)
|
97
85
|
|
98
86
|
get :new
|
99
87
|
assigns[:user].should == @user
|
@@ -103,7 +91,7 @@ describe UsersController do
|
|
103
91
|
|
104
92
|
describe "if user is not allowed to sign up" do
|
105
93
|
it "should redirect to login_path" do
|
106
|
-
|
94
|
+
@controller.should_receive(:can_signup?).and_return(false)
|
107
95
|
|
108
96
|
get :new
|
109
97
|
response.should redirect_to(login_path)
|
@@ -114,27 +102,14 @@ describe UsersController do
|
|
114
102
|
# GET /users/1/edit AJAX
|
115
103
|
#----------------------------------------------------------------------------
|
116
104
|
describe "responding to GET edit" do
|
117
|
-
|
118
|
-
it "should expose current user as @user and render [edit] template" do
|
105
|
+
before(:each) do
|
119
106
|
require_user
|
120
107
|
@user = current_user
|
121
|
-
xhr :get, :edit, :id => @user.id
|
122
|
-
assigns[:user].should == current_user
|
123
|
-
response.should render_template("users/edit")
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should not allow current user to edit another user" do
|
127
|
-
@user = create(:user)
|
128
|
-
require_user
|
129
|
-
xhr :get, :edit, :id => @user.id
|
130
|
-
expect(response.body).to eql("window.location.reload();")
|
131
108
|
end
|
132
109
|
|
133
|
-
it "should
|
134
|
-
require_user(admin: true)
|
135
|
-
@user = create(:user)
|
110
|
+
it "should expose current user as @user and render [edit] template" do
|
136
111
|
xhr :get, :edit, :id => @user.id
|
137
|
-
assigns[:user].should ==
|
112
|
+
assigns[:user].should == current_user
|
138
113
|
response.should render_template("users/edit")
|
139
114
|
end
|
140
115
|
|
@@ -151,11 +126,10 @@ describe UsersController do
|
|
151
126
|
@email = @username + "@example.com"
|
152
127
|
@password = "secret"
|
153
128
|
@user = FactoryGirl.build(:user, :username => @username, :email => @email)
|
154
|
-
User.stub
|
129
|
+
User.stub(:new).and_return(@user)
|
155
130
|
end
|
156
131
|
|
157
132
|
it "exposes a newly created user as @user and redirect to profile page" do
|
158
|
-
require_user(admin: true)
|
159
133
|
post :create, :user => { :username => @username, :email => @email, :password => @password, :password_confirmation => @password }
|
160
134
|
assigns[:user].should == @user
|
161
135
|
flash[:notice].should =~ /welcome/
|
@@ -163,7 +137,7 @@ describe UsersController do
|
|
163
137
|
end
|
164
138
|
|
165
139
|
it "should redirect to login page if user signup needs approval" do
|
166
|
-
Setting.stub
|
140
|
+
Setting.stub(:user_signup).and_return(:needs_approval)
|
167
141
|
|
168
142
|
post :create, :user => { :username => @username, :email => @email, :password => @password, :password_confirmation => @password }
|
169
143
|
assigns[:user].should == @user
|
@@ -174,9 +148,8 @@ describe UsersController do
|
|
174
148
|
|
175
149
|
describe "with invalid params" do
|
176
150
|
it "assigns a newly created but unsaved user as @user and renders [new] template" do
|
177
|
-
require_user(admin: true)
|
178
151
|
@user = FactoryGirl.build(:user, :username => "", :email => "")
|
179
|
-
User.stub
|
152
|
+
User.stub(:new).and_return(@user)
|
180
153
|
|
181
154
|
post :create, :user => {}
|
182
155
|
assigns[:user].should == @user
|
@@ -288,7 +261,7 @@ describe UsersController do
|
|
288
261
|
# -------------------------- Fix later --------------------------------
|
289
262
|
# it "should return errors if the avatar failed to get uploaded and resized" do
|
290
263
|
# @image = fixture_file_upload("spec/fixtures/rails.png", "image/png")
|
291
|
-
# @user.stub
|
264
|
+
# @user.stub(:save).and_return(false) # make it fail
|
292
265
|
|
293
266
|
# xhr :put, :upload_avatar, :id => @user.id, :avatar => { :image => @image }
|
294
267
|
# @user.avatar.errors.should_not be_empty
|
@@ -319,7 +292,6 @@ describe UsersController do
|
|
319
292
|
describe "responding to PUT change_password" do
|
320
293
|
before(:each) do
|
321
294
|
require_user
|
322
|
-
User.stub(:find).and_return(current_user)
|
323
295
|
@current_user_session.stub(:unauthorized_record=).and_return(current_user)
|
324
296
|
@current_user_session.stub(:save).and_return(current_user)
|
325
297
|
@user = current_user
|
@@ -5,16 +5,11 @@
|
|
5
5
|
#------------------------------------------------------------------------------
|
6
6
|
module SelectorHelpers
|
7
7
|
def chosen_select(item_text, options)
|
8
|
-
field_id = find_field(options[:from])[:id]
|
8
|
+
field_id = find_field(options[:from], :visible => false)[:id]
|
9
9
|
option_value = page.evaluate_script("jQuery(\"##{field_id} option:contains('#{item_text}')\").val()")#page.evaluate_script("$(\"##{field_id} option:contains('#{item_text}')\").val()")
|
10
10
|
page.execute_script("jQuery('##{field_id}').val('#{option_value}')")
|
11
11
|
end
|
12
12
|
|
13
|
-
def check_filter(filter_name)
|
14
|
-
filter_checkbox = find(:xpath, "//input[@type='checkbox'][@value='due_#{filter_name}']")
|
15
|
-
filter_checkbox.click
|
16
|
-
end
|
17
|
-
|
18
13
|
def click_filter_tab(filter_name)
|
19
14
|
tab = find(:xpath, "//div[@class='filters']//td[contains(text(), '#{filter_name}')]")
|
20
15
|
tab.click
|
data/spec/features/tasks_spec.rb
CHANGED
@@ -54,11 +54,11 @@ feature 'Tasks', %q{
|
|
54
54
|
page.should have_content('The task has been created and assigned to Another User')
|
55
55
|
|
56
56
|
click_link 'Tasks'
|
57
|
-
|
57
|
+
page.uncheck('filters_due_tomorrow')
|
58
58
|
page.should_not have_content('Task For Someone Else')
|
59
59
|
|
60
60
|
click_filter_tab('Assigned')
|
61
|
-
|
61
|
+
page.check('filters_due_tomorrow')
|
62
62
|
find('#main').should have_content('Task For Someone Else')
|
63
63
|
find('#main').should have_content('Another User')
|
64
64
|
|
@@ -14,29 +14,29 @@ describe ApplicationHelper do
|
|
14
14
|
|
15
15
|
describe "link_to_emails" do
|
16
16
|
it "should add Bcc: if dropbox address is set" do
|
17
|
-
Setting.stub
|
17
|
+
Setting.stub(:email_dropbox).and_return({ :address => "drop@example.com" })
|
18
18
|
helper.link_to_email("hello@example.com").should == '<a href="mailto:hello@example.com?bcc=drop@example.com" title="hello@example.com">hello@example.com</a>'
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should not add Bcc: if dropbox address is not set" do
|
22
|
-
Setting.stub
|
22
|
+
Setting.stub(:email_dropbox).and_return({ :address => nil })
|
23
23
|
helper.link_to_email("hello@example.com").should == '<a href="mailto:hello@example.com" title="hello@example.com">hello@example.com</a>'
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should truncate long emails" do
|
27
|
-
Setting.stub
|
27
|
+
Setting.stub(:email_dropbox).and_return({ :address => nil })
|
28
28
|
helper.link_to_email("hello@example.com", 5).should == '<a href="mailto:hello@example.com" title="hello@example.com">he...</a>'
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should escape HTML entities" do
|
32
|
-
Setting.stub
|
32
|
+
Setting.stub(:email_dropbox).and_return({ :address => 'dr&op@example.com' })
|
33
33
|
helper.link_to_email("hell&o@example.com").should == '<a href="mailto:hell&o@example.com?bcc=dr&op@example.com" title="hell&o@example.com">hell&o@example.com</a>'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
it "link_to_discard" do
|
38
38
|
lead = FactoryGirl.create(:lead)
|
39
|
-
controller.request.stub
|
39
|
+
controller.request.stub(:fullpath).and_return("http://www.example.com/leads/#{lead.id}")
|
40
40
|
|
41
41
|
link = helper.link_to_discard(lead)
|
42
42
|
link.should =~ %r|leads/#{lead.id}/discard|
|
@@ -45,26 +45,26 @@ describe ApplicationHelper do
|
|
45
45
|
|
46
46
|
describe "shown_on_landing_page?" do
|
47
47
|
it "should return true for Ajax request made from the asset landing page" do
|
48
|
-
controller.request.stub
|
49
|
-
controller.request.stub
|
48
|
+
controller.request.stub(:xhr?).and_return(true)
|
49
|
+
controller.request.stub(:referer).and_return("http://www.example.com/leads/123")
|
50
50
|
helper.shown_on_landing_page?.should == true
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should return true for regular request to display asset landing page" do
|
54
|
-
controller.request.stub
|
55
|
-
controller.request.stub
|
54
|
+
controller.request.stub(:xhr?).and_return(false)
|
55
|
+
controller.request.stub(:fullpath).and_return("http://www.example.com/leads/123")
|
56
56
|
helper.shown_on_landing_page?.should == true
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should return false for Ajax request made from page other than the asset landing page" do
|
60
|
-
controller.request.stub
|
61
|
-
controller.request.stub
|
60
|
+
controller.request.stub(:xhr?).and_return(true)
|
61
|
+
controller.request.stub(:referer).and_return("http://www.example.com/leads")
|
62
62
|
helper.shown_on_landing_page?.should == false
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should return false for regular request to display page other than asset landing page" do
|
66
|
-
controller.request.stub
|
67
|
-
controller.request.stub
|
66
|
+
controller.request.stub(:xhr?).and_return(false)
|
67
|
+
controller.request.stub(:fullpath).and_return("http://www.example.com/leads")
|
68
68
|
helper.shown_on_landing_page?.should == false
|
69
69
|
end
|
70
70
|
end
|
@@ -73,8 +73,8 @@ describe ApplicationHelper do
|
|
73
73
|
|
74
74
|
before(:each) do
|
75
75
|
@user = mock_model(User)
|
76
|
-
helper.stub
|
77
|
-
controller.stub
|
76
|
+
helper.stub(:current_user).and_return(@user)
|
77
|
+
controller.stub(:params).and_return({'action' => 'show', 'controller' => 'contacts'})
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should return the contact 'show' outline stored in the user preferences" do
|