fat_free_crm 0.11.0
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.
- data/.gitignore +32 -0
- data/.travis.yml +48 -0
- data/CHANGELOG +1839 -0
- data/CONTRIBUTORS +50 -0
- data/Gemfile +40 -0
- data/Gemfile.ci +13 -0
- data/Gemfile.lock +256 -0
- data/Guardfile +45 -0
- data/LICENSE +620 -0
- data/Procfile +1 -0
- data/README.md +239 -0
- data/Rakefile +9 -0
- data/acceptance/acceptance_helper.rb +7 -0
- data/acceptance/accounts_spec.rb +74 -0
- data/acceptance/support/browser.rb +13 -0
- data/acceptance/support/database_cleaner.rb +16 -0
- data/acceptance/support/headless.rb +15 -0
- data/acceptance/support/helpers.rb +19 -0
- data/acceptance/support/maintain_sessions.rb +5 -0
- data/acceptance/support/paths.rb +9 -0
- data/app/assets/images/1x1.gif +0 -0
- data/app/assets/images/asterisk.gif +0 -0
- data/app/assets/images/avatar.jpg +0 -0
- data/app/assets/images/blog.gif +0 -0
- data/app/assets/images/facebook-close.gif +0 -0
- data/app/assets/images/facebook.gif +0 -0
- data/app/assets/images/iconset_attribution.png +0 -0
- data/app/assets/images/info.png +0 -0
- data/app/assets/images/info_tiny.png +0 -0
- data/app/assets/images/linkedin.gif +0 -0
- data/app/assets/images/loading.gif +0 -0
- data/app/assets/images/skype.gif +0 -0
- data/app/assets/images/sortable.gif +0 -0
- data/app/assets/images/stars.gif +0 -0
- data/app/assets/images/twitter.gif +0 -0
- data/app/assets/javascripts/admin/field_groups.js.coffee +3 -0
- data/app/assets/javascripts/application.js.erb +42 -0
- data/app/assets/javascripts/crm.js +487 -0
- data/app/assets/javascripts/crm_chosen.js.coffee +28 -0
- data/app/assets/javascripts/crm_classes.js +230 -0
- data/app/assets/javascripts/crm_fields.js +47 -0
- data/app/assets/javascripts/crm_loginout.js +41 -0
- data/app/assets/javascripts/jquery-noconflict.js +1 -0
- data/app/assets/javascripts/lists.js.coffee +37 -0
- data/app/assets/javascripts/search.js.coffee +40 -0
- data/app/assets/stylesheets/admin/field_groups.css.scss +3 -0
- data/app/assets/stylesheets/application.css.erb +37 -0
- data/app/assets/stylesheets/base.scss +90 -0
- data/app/assets/stylesheets/common.scss +688 -0
- data/app/assets/stylesheets/ffcrm_chosen.scss +64 -0
- data/app/assets/stylesheets/fields.scss +8 -0
- data/app/assets/stylesheets/header.scss +129 -0
- data/app/assets/stylesheets/lists.css.scss +3 -0
- data/app/assets/stylesheets/print.css.scss +80 -0
- data/app/assets/stylesheets/rails.scss +136 -0
- data/app/assets/stylesheets/safari.scss +23 -0
- data/app/controllers/accounts_controller.rb +207 -0
- data/app/controllers/admin/application_controller.rb +42 -0
- data/app/controllers/admin/field_groups_controller.rb +128 -0
- data/app/controllers/admin/fields_controller.rb +148 -0
- data/app/controllers/admin/plugins_controller.rb +33 -0
- data/app/controllers/admin/settings_controller.rb +31 -0
- data/app/controllers/admin/tags_controller.rb +131 -0
- data/app/controllers/admin/users_controller.rb +200 -0
- data/app/controllers/application_controller.rb +219 -0
- data/app/controllers/authentications_controller.rb +66 -0
- data/app/controllers/base_controller.rb +155 -0
- data/app/controllers/campaigns_controller.rb +205 -0
- data/app/controllers/comments_controller.rb +145 -0
- data/app/controllers/contacts_controller.rb +214 -0
- data/app/controllers/emails_controller.rb +64 -0
- data/app/controllers/home_controller.rb +170 -0
- data/app/controllers/leads_controller.rb +286 -0
- data/app/controllers/lists_controller.rb +27 -0
- data/app/controllers/opportunities_controller.rb +256 -0
- data/app/controllers/passwords_controller.rb +78 -0
- data/app/controllers/tasks_controller.rb +213 -0
- data/app/controllers/users_controller.rb +163 -0
- data/app/helpers/accounts_helper.rb +54 -0
- data/app/helpers/addresses_helper.rb +28 -0
- data/app/helpers/admin/application_helper.rb +29 -0
- data/app/helpers/admin/field_groups_helper.rb +36 -0
- data/app/helpers/admin/fields_helper.rb +32 -0
- data/app/helpers/admin/plugins_helper.rb +20 -0
- data/app/helpers/admin/settings_helper.rb +20 -0
- data/app/helpers/admin/tags_helper.rb +22 -0
- data/app/helpers/admin/users_helper.rb +65 -0
- data/app/helpers/application_helper.rb +421 -0
- data/app/helpers/authentications_helper.rb +20 -0
- data/app/helpers/campaigns_helper.rb +55 -0
- data/app/helpers/comments_helper.rb +20 -0
- data/app/helpers/contacts_helper.rb +34 -0
- data/app/helpers/crm_tags_helper.rb +50 -0
- data/app/helpers/emails_helper.rb +19 -0
- data/app/helpers/fields_helper.rb +20 -0
- data/app/helpers/home_helper.rb +70 -0
- data/app/helpers/leads_helper.rb +116 -0
- data/app/helpers/lists_helper.rb +2 -0
- data/app/helpers/opportunities_helper.rb +53 -0
- data/app/helpers/passwords_helper.rb +20 -0
- data/app/helpers/tasks_helper.rb +176 -0
- data/app/helpers/users_helper.rb +40 -0
- data/app/inputs/date_time_input.rb +39 -0
- data/app/inputs/text_input.rb +6 -0
- data/app/models/base/account.rb +138 -0
- data/app/models/base/account_contact.rb +37 -0
- data/app/models/base/account_opportunity.rb +37 -0
- data/app/models/base/campaign.rb +123 -0
- data/app/models/base/contact.rb +191 -0
- data/app/models/base/contact_opportunity.rb +38 -0
- data/app/models/base/lead.rb +188 -0
- data/app/models/base/opportunity.rb +188 -0
- data/app/models/base/task.rb +241 -0
- data/app/models/fields/core_field.rb +48 -0
- data/app/models/fields/custom_field.rb +138 -0
- data/app/models/fields/field.rb +124 -0
- data/app/models/fields/field_group.rb +81 -0
- data/app/models/list.rb +8 -0
- data/app/models/mailers/notifier.rb +44 -0
- data/app/models/observers/activity_observer.rb +84 -0
- data/app/models/polymorphic/activity.rb +106 -0
- data/app/models/polymorphic/address.rb +58 -0
- data/app/models/polymorphic/avatar.rb +58 -0
- data/app/models/polymorphic/comment.rb +55 -0
- data/app/models/polymorphic/email.rb +69 -0
- data/app/models/polymorphic/tag.rb +14 -0
- data/app/models/polymorphic/tagging.rb +2 -0
- data/app/models/setting.rb +142 -0
- data/app/models/users/authentication.rb +64 -0
- data/app/models/users/permission.rb +36 -0
- data/app/models/users/preference.rb +62 -0
- data/app/models/users/user.rb +171 -0
- data/app/views/accounts/_account.html.haml +35 -0
- data/app/views/accounts/_contact_info.html.haml +37 -0
- data/app/views/accounts/_edit.html.haml +19 -0
- data/app/views/accounts/_new.html.haml +19 -0
- data/app/views/accounts/_options.html.haml +20 -0
- data/app/views/accounts/_permissions.html.haml +24 -0
- data/app/views/accounts/_sidebar_index.html.haml +21 -0
- data/app/views/accounts/_sidebar_show.html.haml +57 -0
- data/app/views/accounts/_top_section.html.haml +29 -0
- data/app/views/accounts/contacts.js.rjs +3 -0
- data/app/views/accounts/create.js.rjs +15 -0
- data/app/views/accounts/destroy.js.rjs +3 -0
- data/app/views/accounts/edit.js.rjs +35 -0
- data/app/views/accounts/index.html.haml +25 -0
- data/app/views/accounts/index.js.rjs +6 -0
- data/app/views/accounts/new.js.rjs +11 -0
- data/app/views/accounts/opportunities.js.rjs +3 -0
- data/app/views/accounts/options.js.rjs +10 -0
- data/app/views/accounts/show.html.haml +42 -0
- data/app/views/accounts/update.js.rjs +17 -0
- data/app/views/admin/field_groups/_confirm.html.haml +5 -0
- data/app/views/admin/field_groups/_edit.html.haml +8 -0
- data/app/views/admin/field_groups/_field_group.html.haml +27 -0
- data/app/views/admin/field_groups/_new.html.haml +10 -0
- data/app/views/admin/field_groups/_top_section.html.haml +13 -0
- data/app/views/admin/field_groups/confirm.js.rjs +6 -0
- data/app/views/admin/field_groups/create.js.rjs +21 -0
- data/app/views/admin/field_groups/destroy.js.rjs +11 -0
- data/app/views/admin/field_groups/edit.js.rjs +14 -0
- data/app/views/admin/field_groups/new.js.rjs +9 -0
- data/app/views/admin/field_groups/update.js.rjs +9 -0
- data/app/views/admin/fields/_edit.html.haml +9 -0
- data/app/views/admin/fields/_field.html.haml +15 -0
- data/app/views/admin/fields/_new.html.haml +10 -0
- data/app/views/admin/fields/_options.html.haml +12 -0
- data/app/views/admin/fields/_sidebar_index.html.haml +1 -0
- data/app/views/admin/fields/_sidebar_show.html.haml +1 -0
- data/app/views/admin/fields/_sort_by.html.haml +10 -0
- data/app/views/admin/fields/_top_section.html.haml +54 -0
- data/app/views/admin/fields/create.js.rjs +16 -0
- data/app/views/admin/fields/destroy.js.rjs +11 -0
- data/app/views/admin/fields/edit.js.rjs +35 -0
- data/app/views/admin/fields/index.html.haml +36 -0
- data/app/views/admin/fields/index.js.rjs +6 -0
- data/app/views/admin/fields/new.js.rjs +8 -0
- data/app/views/admin/fields/options.js.rjs +10 -0
- data/app/views/admin/fields/show.html.haml +41 -0
- data/app/views/admin/fields/update.js.rjs +17 -0
- data/app/views/admin/plugins/_plugin.html.haml +13 -0
- data/app/views/admin/plugins/index.html.haml +9 -0
- data/app/views/admin/settings/index.html.haml +3 -0
- data/app/views/admin/tags/_confirm.html.haml +5 -0
- data/app/views/admin/tags/_edit.html.haml +9 -0
- data/app/views/admin/tags/_new.html.haml +10 -0
- data/app/views/admin/tags/_tag.html.haml +29 -0
- data/app/views/admin/tags/_top_section.html.haml +6 -0
- data/app/views/admin/tags/confirm.js.rjs +6 -0
- data/app/views/admin/tags/create.js.rjs +12 -0
- data/app/views/admin/tags/destroy.js.rjs +11 -0
- data/app/views/admin/tags/edit.js.rjs +21 -0
- data/app/views/admin/tags/index.html.haml +17 -0
- data/app/views/admin/tags/new.js.rjs +8 -0
- data/app/views/admin/tags/update.js.rjs +10 -0
- data/app/views/admin/users/_confirm.html.haml +5 -0
- data/app/views/admin/users/_edit.html.haml +11 -0
- data/app/views/admin/users/_new.html.haml +11 -0
- data/app/views/admin/users/_profile.html.haml +43 -0
- data/app/views/admin/users/_sidebar_index.html.haml +2 -0
- data/app/views/admin/users/_user.html.haml +56 -0
- data/app/views/admin/users/confirm.js.rjs +6 -0
- data/app/views/admin/users/create.js.rjs +11 -0
- data/app/views/admin/users/destroy.js.rjs +11 -0
- data/app/views/admin/users/edit.js.rjs +21 -0
- data/app/views/admin/users/index.html.haml +13 -0
- data/app/views/admin/users/index.js.rjs +2 -0
- data/app/views/admin/users/new.js.rjs +8 -0
- data/app/views/admin/users/reactivate.js.rjs +3 -0
- data/app/views/admin/users/show.html.haml +5 -0
- data/app/views/admin/users/suspend.js.rjs +3 -0
- data/app/views/admin/users/update.js.rjs +10 -0
- data/app/views/authentications/new.html.haml +31 -0
- data/app/views/base/_advanced_search.html.haml +12 -0
- data/app/views/base/_condition_fields.html.haml +14 -0
- data/app/views/base/_grouping_fields.html.haml +12 -0
- data/app/views/base/_sort_fields.html.haml +3 -0
- data/app/views/base/advanced_search.js.rjs +9 -0
- data/app/views/campaigns/_campaign.html.haml +17 -0
- data/app/views/campaigns/_edit.html.haml +16 -0
- data/app/views/campaigns/_metrics.html.haml +16 -0
- data/app/views/campaigns/_new.html.haml +15 -0
- data/app/views/campaigns/_objectives.html.haml +30 -0
- data/app/views/campaigns/_options.html.haml +20 -0
- data/app/views/campaigns/_permissions.html.haml +24 -0
- data/app/views/campaigns/_sidebar_index.html.haml +20 -0
- data/app/views/campaigns/_sidebar_show.html.haml +91 -0
- data/app/views/campaigns/_status.html.haml +24 -0
- data/app/views/campaigns/_top_section.html.haml +29 -0
- data/app/views/campaigns/create.js.rjs +21 -0
- data/app/views/campaigns/destroy.js.rjs +3 -0
- data/app/views/campaigns/edit.js.rjs +38 -0
- data/app/views/campaigns/index.html.haml +25 -0
- data/app/views/campaigns/index.js.rjs +6 -0
- data/app/views/campaigns/leads.js.rjs +3 -0
- data/app/views/campaigns/new.js.rjs +13 -0
- data/app/views/campaigns/opportunities.js.rjs +3 -0
- data/app/views/campaigns/options.js.rjs +10 -0
- data/app/views/campaigns/show.html.haml +44 -0
- data/app/views/campaigns/update.js.rjs +23 -0
- data/app/views/comments/_comment.html.haml +25 -0
- data/app/views/comments/_edit.html.haml +12 -0
- data/app/views/comments/_new.html.haml +27 -0
- data/app/views/comments/create.js.rjs +11 -0
- data/app/views/comments/destroy.js.rjs +6 -0
- data/app/views/comments/edit.js.rjs +11 -0
- data/app/views/comments/new.js.rjs +12 -0
- data/app/views/comments/update.js.rjs +11 -0
- data/app/views/contacts/_contact.html.haml +34 -0
- data/app/views/contacts/_edit.html.haml +17 -0
- data/app/views/contacts/_extra.html.haml +36 -0
- data/app/views/contacts/_new.html.haml +17 -0
- data/app/views/contacts/_options.html.haml +21 -0
- data/app/views/contacts/_permissions.html.haml +24 -0
- data/app/views/contacts/_sidebar_index.html.haml +3 -0
- data/app/views/contacts/_sidebar_show.html.haml +41 -0
- data/app/views/contacts/_top_section.html.haml +54 -0
- data/app/views/contacts/_web.html.haml +31 -0
- data/app/views/contacts/create.js.rjs +20 -0
- data/app/views/contacts/destroy.js.rjs +7 -0
- data/app/views/contacts/edit.js.rjs +38 -0
- data/app/views/contacts/index.html.haml +26 -0
- data/app/views/contacts/index.js.rjs +6 -0
- data/app/views/contacts/new.js.rjs +13 -0
- data/app/views/contacts/opportunities.js.rjs +3 -0
- data/app/views/contacts/options.js.rjs +10 -0
- data/app/views/contacts/show.html.haml +38 -0
- data/app/views/contacts/update.js.rjs +22 -0
- data/app/views/emails/_email.html.haml +27 -0
- data/app/views/emails/destroy.js.rjs +6 -0
- data/app/views/fields/_group.html.haml +20 -0
- data/app/views/fields/_groups.html.haml +11 -0
- data/app/views/fields/_sidebar_show.html.haml +8 -0
- data/app/views/fields/group.js.rjs +7 -0
- data/app/views/home/_actions_menu.html.haml +8 -0
- data/app/views/home/_activity.html.haml +22 -0
- data/app/views/home/_assets_menu.html.haml +7 -0
- data/app/views/home/_duration_menu.html.haml +8 -0
- data/app/views/home/_options.html.haml +14 -0
- data/app/views/home/_users_menu.html.haml +8 -0
- data/app/views/home/index.atom.builder +24 -0
- data/app/views/home/index.html.haml +19 -0
- data/app/views/home/index.js.rjs +6 -0
- data/app/views/home/index.rss.builder +20 -0
- data/app/views/home/options.js.rjs +8 -0
- data/app/views/layouts/500.html.haml +29 -0
- data/app/views/layouts/_about.html.haml +17 -0
- data/app/views/layouts/_footer.html.haml +13 -0
- data/app/views/layouts/_header.html.haml +20 -0
- data/app/views/layouts/_jumpbox.html.haml +32 -0
- data/app/views/layouts/_sidebar.html.haml +14 -0
- data/app/views/layouts/_tabbed.html.haml +19 -0
- data/app/views/layouts/_tabless.html.haml +3 -0
- data/app/views/layouts/admin/_header.html.haml +14 -0
- data/app/views/layouts/admin/application.html.haml +25 -0
- data/app/views/layouts/application.html.haml +43 -0
- data/app/views/leads/_contact.html.haml +38 -0
- data/app/views/leads/_convert.html.haml +36 -0
- data/app/views/leads/_convert_permissions.html.haml +26 -0
- data/app/views/leads/_edit.html.haml +21 -0
- data/app/views/leads/_lead.html.haml +43 -0
- data/app/views/leads/_new.html.haml +21 -0
- data/app/views/leads/_opportunity.html.haml +37 -0
- data/app/views/leads/_options.html.haml +21 -0
- data/app/views/leads/_permissions.html.haml +28 -0
- data/app/views/leads/_sidebar_index.html.haml +20 -0
- data/app/views/leads/_sidebar_show.html.haml +58 -0
- data/app/views/leads/_status.html.haml +36 -0
- data/app/views/leads/_top_section.html.haml +29 -0
- data/app/views/leads/_web.html.haml +31 -0
- data/app/views/leads/convert.js.rjs +38 -0
- data/app/views/leads/create.js.rjs +20 -0
- data/app/views/leads/destroy.js.rjs +7 -0
- data/app/views/leads/edit.js.rjs +38 -0
- data/app/views/leads/index.html.haml +25 -0
- data/app/views/leads/index.js.rjs +6 -0
- data/app/views/leads/new.js.rjs +11 -0
- data/app/views/leads/options.js.rjs +10 -0
- data/app/views/leads/promote.js.rjs +28 -0
- data/app/views/leads/reject.js.rjs +10 -0
- data/app/views/leads/show.html.haml +35 -0
- data/app/views/leads/update.js.rjs +27 -0
- data/app/views/lists/create.js.rjs +9 -0
- data/app/views/lists/destroy.js.rjs +1 -0
- data/app/views/notifier/dropbox_ack_notification.html.haml +9 -0
- data/app/views/notifier/password_reset_instructions.html.haml +6 -0
- data/app/views/opportunities/_edit.html.haml +16 -0
- data/app/views/opportunities/_new.html.haml +16 -0
- data/app/views/opportunities/_opportunity.html.haml +45 -0
- data/app/views/opportunities/_options.html.haml +20 -0
- data/app/views/opportunities/_permissions.html.haml +24 -0
- data/app/views/opportunities/_sidebar_index.html.haml +20 -0
- data/app/views/opportunities/_sidebar_show.html.haml +61 -0
- data/app/views/opportunities/_top_section.html.haml +65 -0
- data/app/views/opportunities/contacts.js.rjs +3 -0
- data/app/views/opportunities/create.js.rjs +31 -0
- data/app/views/opportunities/destroy.js.rjs +11 -0
- data/app/views/opportunities/edit.js.rjs +39 -0
- data/app/views/opportunities/index.html.haml +28 -0
- data/app/views/opportunities/index.js.rjs +6 -0
- data/app/views/opportunities/new.js.rjs +16 -0
- data/app/views/opportunities/options.js.rjs +10 -0
- data/app/views/opportunities/show.html.haml +36 -0
- data/app/views/opportunities/update.js.rjs +27 -0
- data/app/views/passwords/edit.html.haml +15 -0
- data/app/views/passwords/new.html.haml +10 -0
- data/app/views/shared/_address.html.haml +44 -0
- data/app/views/shared/_address_show.html.haml +24 -0
- data/app/views/shared/_comment.html.haml +11 -0
- data/app/views/shared/_edit_comment.html.haml +13 -0
- data/app/views/shared/_empty.html.haml +8 -0
- data/app/views/shared/_export.html.haml +1 -0
- data/app/views/shared/_inline_styles.html.haml +31 -0
- data/app/views/shared/_lists.html.haml +25 -0
- data/app/views/shared/_naming.html.haml +9 -0
- data/app/views/shared/_outline.html.haml +9 -0
- data/app/views/shared/_paginate.haml +1 -0
- data/app/views/shared/_per_page.html.haml +10 -0
- data/app/views/shared/_recent.html.haml +4 -0
- data/app/views/shared/_recently.html.haml +7 -0
- data/app/views/shared/_search.html.haml +11 -0
- data/app/views/shared/_select_popup.html.haml +21 -0
- data/app/views/shared/_sort_by.html.haml +10 -0
- data/app/views/shared/_tags.html.haml +9 -0
- data/app/views/shared/_tasks.html.haml +10 -0
- data/app/views/shared/_timeline.html.haml +3 -0
- data/app/views/shared/_total.html.haml +4 -0
- data/app/views/shared/attach.js.rjs +24 -0
- data/app/views/shared/auto_complete.html.haml +10 -0
- data/app/views/shared/discard.rjs +7 -0
- data/app/views/shared/index.atom.builder +34 -0
- data/app/views/shared/index.rss.builder +31 -0
- data/app/views/tasks/_assigned.html.haml +47 -0
- data/app/views/tasks/_completed.html.haml +23 -0
- data/app/views/tasks/_edit.html.haml +19 -0
- data/app/views/tasks/_empty.html.haml +4 -0
- data/app/views/tasks/_new.html.haml +14 -0
- data/app/views/tasks/_pending.html.haml +52 -0
- data/app/views/tasks/_related.html.haml +33 -0
- data/app/views/tasks/_selector.html.haml +8 -0
- data/app/views/tasks/_sidebar_index.html.haml +18 -0
- data/app/views/tasks/_title.html.haml +8 -0
- data/app/views/tasks/_top_section.html.haml +32 -0
- data/app/views/tasks/complete.js.rjs +17 -0
- data/app/views/tasks/create.js.rjs +42 -0
- data/app/views/tasks/destroy.js.rjs +7 -0
- data/app/views/tasks/discard.rjs +1 -0
- data/app/views/tasks/edit.js.rjs +25 -0
- data/app/views/tasks/filter.js.rjs +1 -0
- data/app/views/tasks/index.html.haml +20 -0
- data/app/views/tasks/new.js.rjs +11 -0
- data/app/views/tasks/update.js.rjs +22 -0
- data/app/views/users/_avatar.html.haml +20 -0
- data/app/views/users/_languages.html.haml +9 -0
- data/app/views/users/_password.html.haml +27 -0
- data/app/views/users/_profile.html.haml +67 -0
- data/app/views/users/_user.html.haml +28 -0
- data/app/views/users/avatar.js.rjs +10 -0
- data/app/views/users/change_password.js.rjs +15 -0
- data/app/views/users/edit.js.rjs +10 -0
- data/app/views/users/index.html.haml +3 -0
- data/app/views/users/new.html.haml +19 -0
- data/app/views/users/password.js.rjs +11 -0
- data/app/views/users/show.html.haml +16 -0
- data/app/views/users/update.js.rjs +10 -0
- data/app/views/users/upload_avatar.js.rjs +8 -0
- data/app/views/versions/_version.html.haml +30 -0
- data/config.ru +4 -0
- data/config/application.rb +75 -0
- data/config/boot.rb +6 -0
- data/config/database.mysql.mac.yml +31 -0
- data/config/database.mysql.yml +32 -0
- data/config/database.postgres.yml +25 -0
- data/config/database.sqlite.yml +22 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +39 -0
- data/config/environments/production.rb +67 -0
- data/config/environments/staging.rb +14 -0
- data/config/environments/test.rb +48 -0
- data/config/initializers/action_mailer.rb +3 -0
- data/config/initializers/authlogic.rb +1 -0
- data/config/initializers/mime_types.rb +8 -0
- data/config/initializers/paginate_arrays.rb +7 -0
- data/config/initializers/paper_trail.rb +1 -0
- data/config/initializers/sass.rb +13 -0
- data/config/initializers/secret_token.rb +13 -0
- data/config/initializers/simple_form.rb +96 -0
- data/config/locales/cz.yml +213 -0
- data/config/locales/cz_fat_free_crm.yml +695 -0
- data/config/locales/de.yml +193 -0
- data/config/locales/de_fat_free_crm.yml +637 -0
- data/config/locales/en-GB.yml +180 -0
- data/config/locales/en-GB_fat_free_crm.yml +670 -0
- data/config/locales/en-US.yml +182 -0
- data/config/locales/en-US_fat_free_crm.yml +832 -0
- data/config/locales/es.yml +184 -0
- data/config/locales/es_fat_free_crm.yml +642 -0
- data/config/locales/fr-CA.yml +187 -0
- data/config/locales/fr-CA_fat_free_crm.yml +635 -0
- data/config/locales/fr.yml +182 -0
- data/config/locales/fr_fat_free_crm.yml +633 -0
- data/config/locales/it.yml +183 -0
- data/config/locales/it_fat_free_crm.yml +665 -0
- data/config/locales/ja.yml +188 -0
- data/config/locales/ja_fat_free_crm.yml +636 -0
- data/config/locales/pl.yml +194 -0
- data/config/locales/pl_fat_free_crm.yml +646 -0
- data/config/locales/pt-BR.yml +199 -0
- data/config/locales/pt-BR_fat_free_crm.yml +639 -0
- data/config/locales/ru.yml +303 -0
- data/config/locales/ru_fat_free_crm.yml +661 -0
- data/config/locales/simple_form.en.yml +24 -0
- data/config/locales/sv-SE.yml +232 -0
- data/config/locales/sv-SE_fat_free_crm.yml +638 -0
- data/config/locales/th.rb +200 -0
- data/config/locales/th_fat_free_crm.yml +643 -0
- data/config/locales/zh-CN.yml +210 -0
- data/config/locales/zh-CN_fat_free_crm.yml +631 -0
- data/config/routes.rb +172 -0
- data/config/settings.default.yml +325 -0
- data/db/demo/account_contacts.yml +24 -0
- data/db/demo/account_opportunities.yml +24 -0
- data/db/demo/accounts.yml +48 -0
- data/db/demo/activities.yml +16 -0
- data/db/demo/addresses.yml +46 -0
- data/db/demo/avatars.yml +16 -0
- data/db/demo/campaigns.yml +144 -0
- data/db/demo/comments.yml +30 -0
- data/db/demo/contact_opportunities.yml +25 -0
- data/db/demo/contacts.yml +70 -0
- data/db/demo/emails.yml +53 -0
- data/db/demo/leads.yml +71 -0
- data/db/demo/opportunities.yml +48 -0
- data/db/demo/permissions.yml +13 -0
- data/db/demo/preferences.yml +13 -0
- data/db/demo/settings.yml +12 -0
- data/db/demo/tasks.yml +64 -0
- data/db/demo/users.yml +249 -0
- data/db/migrate/20100928030598_create_sessions.rb +17 -0
- data/db/migrate/20100928030599_create_users.rb +46 -0
- data/db/migrate/20100928030600_create_openid_tables.rb +24 -0
- data/db/migrate/20100928030601_create_accounts.rb +27 -0
- data/db/migrate/20100928030602_create_permissions.rb +16 -0
- data/db/migrate/20100928030603_create_settings.rb +16 -0
- data/db/migrate/20100928030604_create_preferences.rb +16 -0
- data/db/migrate/20100928030605_create_campaigns.rb +35 -0
- data/db/migrate/20100928030606_create_leads.rb +39 -0
- data/db/migrate/20100928030607_create_contacts.rb +39 -0
- data/db/migrate/20100928030608_create_opportunities.rb +28 -0
- data/db/migrate/20100928030609_create_account_contacts.rb +15 -0
- data/db/migrate/20100928030610_create_account_opportunities.rb +15 -0
- data/db/migrate/20100928030611_create_contact_opportunities.rb +16 -0
- data/db/migrate/20100928030612_create_tasks.rb +27 -0
- data/db/migrate/20100928030613_create_comments.rb +17 -0
- data/db/migrate/20100928030614_create_activities.rb +20 -0
- data/db/migrate/20100928030615_create_avatars.rb +17 -0
- data/db/migrate/20100928030616_rename_remember_token.rb +12 -0
- data/db/migrate/20100928030617_drop_openid_tables.rb +23 -0
- data/db/migrate/20100928030618_add_admin_to_users.rb +12 -0
- data/db/migrate/20100928030619_add_suspended_to_users.rb +12 -0
- data/db/migrate/20100928030620_remove_uuid.rb +24 -0
- data/db/migrate/20100928030621_add_email_to_accounts.rb +10 -0
- data/db/migrate/20100928030622_add_background_info_to_models.rb +20 -0
- data/db/migrate/20100928030623_create_addresses.rb +51 -0
- data/db/migrate/20100928030624_add_index_on_permissions.rb +10 -0
- data/db/migrate/20100928030625_create_emails.rb +27 -0
- data/db/migrate/20100928030626_add_state_to_timeline_objects.rb +14 -0
- data/db/migrate/20100928030627_acts_as_taggable_on_migration.rb +30 -0
- data/db/migrate/20101221123456_add_single_access_token_to_users.rb +10 -0
- data/db/migrate/20101221345678_add_rating_and_category_to_accounts.rb +12 -0
- data/db/migrate/20110719082054_add_skype_to_contacts_and_leads.rb +12 -0
- data/db/migrate/20111101083437_create_fields.rb +28 -0
- data/db/migrate/20111101090312_create_field_groups.rb +16 -0
- data/db/migrate/20111116091952_add_field_groups_tag_id.rb +10 -0
- data/db/migrate/20111117041311_change_fields_collection_to_text.rb +10 -0
- data/db/migrate/20111201030535_add_field_groups_klass_name.rb +21 -0
- data/db/migrate/20120121054235_create_lists.rb +10 -0
- data/db/migrate/20120216031616_create_versions.rb +18 -0
- data/db/migrate/20120216042541_is_paranoid_to_paper_trail.rb +13 -0
- data/db/migrate/20120220233724_add_versions_object_changes.rb +9 -0
- data/db/migrate/20120224073107_remove_default_value_and_clear_settings.rb +16 -0
- data/db/schema.rb +415 -0
- data/db/seeds.rb +10 -0
- data/db/seeds/fields.rb +94 -0
- data/fat_free_crm.gemspec +45 -0
- data/lib/country_select/MIT-LICENSE +20 -0
- data/lib/country_select/README +14 -0
- data/lib/country_select/init.rb +1 -0
- data/lib/country_select/install.rb +2 -0
- data/lib/country_select/lib/country_select.rb +551 -0
- data/lib/country_select/uninstall.rb +2 -0
- data/lib/development_tasks/gem.rake +8 -0
- data/lib/development_tasks/license.rake +99 -0
- data/lib/development_tasks/rdoc.rake +15 -0
- data/lib/development_tasks/rspec.rake +23 -0
- data/lib/dynamic_form/MIT-LICENSE +20 -0
- data/lib/dynamic_form/README +13 -0
- data/lib/dynamic_form/Rakefile +10 -0
- data/lib/dynamic_form/dynamic_form.gemspec +12 -0
- data/lib/dynamic_form/init.rb +2 -0
- data/lib/dynamic_form/lib/action_view/helpers/dynamic_form.rb +301 -0
- data/lib/dynamic_form/lib/action_view/locale/en-US.yml +8 -0
- data/lib/dynamic_form/lib/dynamic_form.rb +6 -0
- data/lib/dynamic_form/test/dynamic_form_i18n_test.rb +42 -0
- data/lib/dynamic_form/test/dynamic_form_test.rb +370 -0
- data/lib/dynamic_form/test/test_helper.rb +10 -0
- data/lib/fat_free_crm.rb +52 -0
- data/lib/fat_free_crm/callback.rb +144 -0
- data/lib/fat_free_crm/core_ext.rb +18 -0
- data/lib/fat_free_crm/core_ext/array.rb +95 -0
- data/lib/fat_free_crm/core_ext/nil.rb +29 -0
- data/lib/fat_free_crm/core_ext/string.rb +74 -0
- data/lib/fat_free_crm/dropbox.rb +429 -0
- data/lib/fat_free_crm/engine.rb +9 -0
- data/lib/fat_free_crm/errors.rb +51 -0
- data/lib/fat_free_crm/exceptions.rb +34 -0
- data/lib/fat_free_crm/exportable.rb +63 -0
- data/lib/fat_free_crm/fields.rb +76 -0
- data/lib/fat_free_crm/gem_dependencies.rb +16 -0
- data/lib/fat_free_crm/gem_ext.rb +8 -0
- data/lib/fat_free_crm/gem_ext/action_controller/base.rb +28 -0
- data/lib/fat_free_crm/gem_ext/active_model/serializers/xml/serializer/attribute.rb +29 -0
- data/lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb +22 -0
- data/lib/fat_free_crm/gem_ext/active_support/buffered_logger.rb +32 -0
- data/lib/fat_free_crm/gem_ext/authlogic/session/cookies.rb +11 -0
- data/lib/fat_free_crm/gem_ext/rails/engine.rb +17 -0
- data/lib/fat_free_crm/gem_ext/rails/text_helper.rb +125 -0
- data/lib/fat_free_crm/gem_ext/rake/task.rb +8 -0
- data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +20 -0
- data/lib/fat_free_crm/i18n.rb +51 -0
- data/lib/fat_free_crm/permissions.rb +111 -0
- data/lib/fat_free_crm/plugin.rb +106 -0
- data/lib/fat_free_crm/plugin_dependencies.rb +6 -0
- data/lib/fat_free_crm/renderers.rb +21 -0
- data/lib/fat_free_crm/sortable.rb +59 -0
- data/lib/fat_free_crm/syck_yaml.rb +4 -0
- data/lib/fat_free_crm/tabs.rb +35 -0
- data/lib/fat_free_crm/version.rb +27 -0
- data/lib/gravatar_image_tag/Gemfile +8 -0
- data/lib/gravatar_image_tag/README.textile +108 -0
- data/lib/gravatar_image_tag/ROADMAP.textile +33 -0
- data/lib/gravatar_image_tag/Rakefile +50 -0
- data/lib/gravatar_image_tag/VERSION +1 -0
- data/lib/gravatar_image_tag/gravatar_image_tag.gemspec +45 -0
- data/lib/gravatar_image_tag/init.rb +2 -0
- data/lib/gravatar_image_tag/lib/gravatar_image_tag.rb +63 -0
- data/lib/gravatar_image_tag/spec/gravatar_image_tag_spec.rb +83 -0
- data/lib/gravatar_image_tag/spec/test_helper.rb +12 -0
- data/lib/responds_to_parent/MIT-LICENSE +20 -0
- data/lib/responds_to_parent/README +47 -0
- data/lib/responds_to_parent/Rakefile +22 -0
- data/lib/responds_to_parent/init.rb +2 -0
- data/lib/responds_to_parent/install.rb +2 -0
- data/lib/responds_to_parent/lib/responds_to_parent.rb +70 -0
- data/lib/responds_to_parent/test/responds_to_parent_test.rb +11 -0
- data/lib/responds_to_parent/test/test_helper.rb +7 -0
- data/lib/responds_to_parent/uninstall.rb +2 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/.gitkeep~master +0 -0
- data/lib/tasks/demo.rake +72 -0
- data/lib/tasks/dropbox.rake +32 -0
- data/lib/tasks/fat_free_crm.rake +130 -0
- data/lib/tasks/plugins.rake +77 -0
- data/lib/tasks/schema_upgrade.rake +31 -0
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/blank_iframe.html +2 -0
- data/public/favicon.ico +0 -0
- data/public/robots.txt +5 -0
- data/script/rails +6 -0
- data/spec/controllers/accounts_controller_spec.rb +626 -0
- data/spec/controllers/admin/users_controller_spec.rb +309 -0
- data/spec/controllers/authentications_controller_spec.rb +147 -0
- data/spec/controllers/campaigns_controller_spec.rb +666 -0
- data/spec/controllers/comments_controller_spec.rb +274 -0
- data/spec/controllers/contacts_controller_spec.rb +699 -0
- data/spec/controllers/emails_controller_spec.rb +32 -0
- data/spec/controllers/home_controller_spec.rb +99 -0
- data/spec/controllers/leads_controller_spec.rb +1047 -0
- data/spec/controllers/lists_controller_spec.rb +5 -0
- data/spec/controllers/opportunities_controller_spec.rb +932 -0
- data/spec/controllers/passwords_controller_spec.rb +11 -0
- data/spec/controllers/tasks_controller_spec.rb +508 -0
- data/spec/controllers/users_controller_spec.rb +344 -0
- data/spec/factories/account_factories.rb +35 -0
- data/spec/factories/campaign_factories.rb +23 -0
- data/spec/factories/contact_factories.rb +39 -0
- data/spec/factories/field_factories.rb +34 -0
- data/spec/factories/lead_factories.rb +29 -0
- data/spec/factories/list_factories.rb +6 -0
- data/spec/factories/opportunity_factories.rb +20 -0
- data/spec/factories/sequences.rb +26 -0
- data/spec/factories/setting_factories.rb +8 -0
- data/spec/factories/shared_factories.rb +70 -0
- data/spec/factories/tag_factories.rb +5 -0
- data/spec/factories/task_factories.rb +18 -0
- data/spec/factories/user_factories.rb +57 -0
- data/spec/fixtures/rails.png +0 -0
- data/spec/helpers/accounts_helper_spec.rb +12 -0
- data/spec/helpers/admin/field_groups_helper_spec.rb +13 -0
- data/spec/helpers/admin/plugins_helper_spec.rb +5 -0
- data/spec/helpers/admin/settings_helper_spec.rb +5 -0
- data/spec/helpers/admin/users_helper_spec.rb +5 -0
- data/spec/helpers/application_helper_spec.rb +67 -0
- data/spec/helpers/authentications_helper_spec.rb +12 -0
- data/spec/helpers/campaigns_helper_spec.rb +12 -0
- data/spec/helpers/comments_helper_spec.rb +12 -0
- data/spec/helpers/contacts_helper_spec.rb +12 -0
- data/spec/helpers/emails_helper_spec.rb +5 -0
- data/spec/helpers/fields_helper_spec.rb +6 -0
- data/spec/helpers/home_helper_spec.rb +12 -0
- data/spec/helpers/leads_helper_spec.rb +12 -0
- data/spec/helpers/lists_helper_spec.rb +15 -0
- data/spec/helpers/opportunities_helper_spec.rb +12 -0
- data/spec/helpers/passwords_helper_spec.rb +12 -0
- data/spec/helpers/tasks_helper_spec.rb +12 -0
- data/spec/helpers/users_helper_spec.rb +12 -0
- data/spec/lib/core_ext/string.rb +17 -0
- data/spec/lib/dropbox/email_samples.rb +77 -0
- data/spec/lib/dropbox_spec.rb +410 -0
- data/spec/lib/errors_spec.rb +25 -0
- data/spec/models/base/account_contact_spec.rb +27 -0
- data/spec/models/base/account_opportunity_spec.rb +27 -0
- data/spec/models/base/account_spec.rb +136 -0
- data/spec/models/base/campaign_spec.rb +135 -0
- data/spec/models/base/contact_opportunity_spec.rb +28 -0
- data/spec/models/base/contact_spec.rb +160 -0
- data/spec/models/base/lead_spec.rb +101 -0
- data/spec/models/base/opportunity_spec.rb +173 -0
- data/spec/models/base/task_spec.rb +263 -0
- data/spec/models/fields/custom_field_spec.rb +106 -0
- data/spec/models/fields/field_group_spec.rb +23 -0
- data/spec/models/fields/field_spec.rb +64 -0
- data/spec/models/list_spec.rb +12 -0
- data/spec/models/polymorphic/activity_spec.rb +303 -0
- data/spec/models/polymorphic/address_spec.rb +33 -0
- data/spec/models/polymorphic/avatar_spec.rb +41 -0
- data/spec/models/polymorphic/comment_spec.rb +29 -0
- data/spec/models/polymorphic/email_spec.rb +36 -0
- data/spec/models/setting_spec.rb +51 -0
- data/spec/models/users/authentication_spec.rb +13 -0
- data/spec/models/users/permission_spec.rb +27 -0
- data/spec/models/users/preference_spec.rb +60 -0
- data/spec/models/users/user_spec.rb +169 -0
- data/spec/routing/accounts_routing_spec.rb +55 -0
- data/spec/routing/admin/users_routing_spec.rb +35 -0
- data/spec/routing/campaigns_routing_spec.rb +58 -0
- data/spec/routing/comments_routing_spec.rb +35 -0
- data/spec/routing/contacts_routing_spec.rb +55 -0
- data/spec/routing/emails_routing_spec.rb +35 -0
- data/spec/routing/leads_routing_spec.rb +83 -0
- data/spec/routing/opportunities_routing_spec.rb +59 -0
- data/spec/routing/tasks_routing_spec.rb +62 -0
- data/spec/routing/users_routing_spec.rb +79 -0
- data/spec/shared/controllers.rb +102 -0
- data/spec/shared/models.rb +37 -0
- data/spec/spec_helper.rb +110 -0
- data/spec/support/assert_select.rb +158 -0
- data/spec/support/auth_macros.rb +44 -0
- data/spec/support/macros.rb +40 -0
- data/spec/support/rjs_support.rb +9 -0
- data/spec/views/accounts/_edit.haml_spec.rb +38 -0
- data/spec/views/accounts/_new.haml_spec.rb +37 -0
- data/spec/views/accounts/create.rjs_spec.rb +54 -0
- data/spec/views/accounts/destroy.rjs_spec.rb +30 -0
- data/spec/views/accounts/edit.rjs_spec.rb +69 -0
- data/spec/views/accounts/index.haml_spec.rb +33 -0
- data/spec/views/accounts/index.rjs_spec.rb +32 -0
- data/spec/views/accounts/new.rjs_spec.rb +47 -0
- data/spec/views/accounts/options.rjs_spec.rb +59 -0
- data/spec/views/accounts/show.haml_spec.rb +30 -0
- data/spec/views/accounts/update.rjs_spec.rb +99 -0
- data/spec/views/admin/users/_create.haml_spec.rb +17 -0
- data/spec/views/admin/users/create.rjs_spec.rb +42 -0
- data/spec/views/admin/users/destroy.rjs_spec.rb +47 -0
- data/spec/views/admin/users/edit.rjs_spec.rb +45 -0
- data/spec/views/admin/users/index.haml_spec.rb +16 -0
- data/spec/views/admin/users/index.rjs_spec.rb +23 -0
- data/spec/views/admin/users/new.rjs_spec.rb +31 -0
- data/spec/views/admin/users/reactivate.rjs_spec.rb +17 -0
- data/spec/views/admin/users/show.haml_spec.rb +12 -0
- data/spec/views/admin/users/suspend.rjs_spec.rb +17 -0
- data/spec/views/admin/users/update.rjs_spec.rb +36 -0
- data/spec/views/authentications/new.haml_spec.rb +25 -0
- data/spec/views/campaigns/_edit.haml_spec.rb +37 -0
- data/spec/views/campaigns/_new.haml_spec.rb +35 -0
- data/spec/views/campaigns/create.rjs_spec.rb +52 -0
- data/spec/views/campaigns/destroy.rjs_spec.rb +28 -0
- data/spec/views/campaigns/edit.rjs_spec.rb +78 -0
- data/spec/views/campaigns/index.haml_spec.rb +28 -0
- data/spec/views/campaigns/index.rjs_spec.rb +32 -0
- data/spec/views/campaigns/new.rjs_spec.rb +57 -0
- data/spec/views/campaigns/options.rjs_spec.rb +60 -0
- data/spec/views/campaigns/show.haml_spec.rb +31 -0
- data/spec/views/campaigns/update.rjs_spec.rb +87 -0
- data/spec/views/comments/new.rjs_spec.rb +21 -0
- data/spec/views/common/auto_complete.haml_spec.rb +43 -0
- data/spec/views/contacts/_edit.haml_spec.rb +67 -0
- data/spec/views/contacts/_new.haml_spec.rb +47 -0
- data/spec/views/contacts/create.rjs_spec.rb +69 -0
- data/spec/views/contacts/destroy.rjs_spec.rb +41 -0
- data/spec/views/contacts/edit.rjs_spec.rb +77 -0
- data/spec/views/contacts/index.haml_spec.rb +28 -0
- data/spec/views/contacts/index.rjs_spec.rb +32 -0
- data/spec/views/contacts/new.rjs_spec.rb +51 -0
- data/spec/views/contacts/options.rjs_spec.rb +61 -0
- data/spec/views/contacts/show.haml_spec.rb +27 -0
- data/spec/views/contacts/update.rjs_spec.rb +141 -0
- data/spec/views/home/index.haml_spec.rb +26 -0
- data/spec/views/home/index.rjs_spec.rb +30 -0
- data/spec/views/home/options.rjs_spec.rb +52 -0
- data/spec/views/leads/_convert.haml_spec.rb +25 -0
- data/spec/views/leads/_edit.haml_spec.rb +41 -0
- data/spec/views/leads/_new.haml_spec.rb +39 -0
- data/spec/views/leads/_sidebar_show.haml_spec.rb +25 -0
- data/spec/views/leads/convert.rjs_spec.rb +83 -0
- data/spec/views/leads/create.rjs_spec.rb +70 -0
- data/spec/views/leads/destroy.rjs_spec.rb +46 -0
- data/spec/views/leads/edit.rjs_spec.rb +79 -0
- data/spec/views/leads/index.haml_spec.rb +28 -0
- data/spec/views/leads/index.rjs_spec.rb +32 -0
- data/spec/views/leads/new.rjs_spec.rb +52 -0
- data/spec/views/leads/options.rjs_spec.rb +61 -0
- data/spec/views/leads/promote.rjs_spec.rb +154 -0
- data/spec/views/leads/reject.rjs_spec.rb +49 -0
- data/spec/views/leads/show.haml_spec.rb +24 -0
- data/spec/views/leads/update.rjs_spec.rb +134 -0
- data/spec/views/opportunities/_edit.haml_spec.rb +64 -0
- data/spec/views/opportunities/_new.haml_spec.rb +46 -0
- data/spec/views/opportunities/create.rjs_spec.rb +94 -0
- data/spec/views/opportunities/destroy.rjs_spec.rb +64 -0
- data/spec/views/opportunities/edit.rjs_spec.rb +79 -0
- data/spec/views/opportunities/index.haml_spec.rb +29 -0
- data/spec/views/opportunities/index.rjs_spec.rb +34 -0
- data/spec/views/opportunities/new.rjs_spec.rb +60 -0
- data/spec/views/opportunities/options.rjs_spec.rb +60 -0
- data/spec/views/opportunities/show.haml_spec.rb +27 -0
- data/spec/views/opportunities/update.rjs_spec.rb +162 -0
- data/spec/views/tasks/_edit.haml_spec.rb +45 -0
- data/spec/views/tasks/complete.rjs_spec.rb +68 -0
- data/spec/views/tasks/create.rjs_spec.rb +124 -0
- data/spec/views/tasks/destroy.rjs_spec.rb +53 -0
- data/spec/views/tasks/edit.rjs_spec.rb +78 -0
- data/spec/views/tasks/index.haml_spec.rb +40 -0
- data/spec/views/tasks/new.rjs_spec.rb +62 -0
- data/spec/views/tasks/update.rjs_spec.rb +152 -0
- data/spec/views/users/avatar.rjs_spec.rb +32 -0
- data/spec/views/users/change_password.rjs_spec.rb +49 -0
- data/spec/views/users/edit.rjs_spec.rb +32 -0
- data/spec/views/users/password.rjs_spec.rb +32 -0
- data/spec/views/users/update.rjs_spec.rb +50 -0
- data/spec/views/users/upload_avatar.rjs_spec.rb +42 -0
- data/vendor/assets/images/calendar_date_select/calendar.gif +0 -0
- data/vendor/assets/images/delete.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
- data/vendor/assets/javascripts/calendar_date_select/calendar_date_select.js +446 -0
- data/vendor/assets/javascripts/calendar_date_select/format_american.js +35 -0
- data/vendor/assets/javascripts/calendar_date_select/format_danish.js +31 -0
- data/vendor/assets/javascripts/calendar_date_select/format_db.js +27 -0
- data/vendor/assets/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
- data/vendor/assets/javascripts/calendar_date_select/format_euro_24hr_ymd.js +7 -0
- data/vendor/assets/javascripts/calendar_date_select/format_finnish.js +32 -0
- data/vendor/assets/javascripts/calendar_date_select/format_hyphen_ampm.js +37 -0
- data/vendor/assets/javascripts/calendar_date_select/format_iso_date.js +29 -0
- data/vendor/assets/javascripts/calendar_date_select/format_italian.js +24 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/ar.js +10 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/da.js +11 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/de.js +11 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/es.js +11 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/fr.js +11 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/it.js +9 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/ja.js +11 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/nl.js +11 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/pl.js +11 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/pt.js +11 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/ru.js +10 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/sl.js +11 -0
- data/vendor/assets/javascripts/calendar_date_select/locale/sv.js +9 -0
- data/vendor/assets/javascripts/event.simulate.js +64 -0
- data/vendor/assets/javascripts/facebooklist.js +548 -0
- data/vendor/assets/javascripts/facebooklist.simulate.js +28 -0
- data/vendor/assets/javascripts/modalbox.js +506 -0
- data/vendor/assets/javascripts/rating.js +162 -0
- data/vendor/assets/stylesheets/calendar_date_select/blue.css +130 -0
- data/vendor/assets/stylesheets/calendar_date_select/default.css +135 -0
- data/vendor/assets/stylesheets/calendar_date_select/green.css +142 -0
- data/vendor/assets/stylesheets/calendar_date_select/plain.css +128 -0
- data/vendor/assets/stylesheets/calendar_date_select/red.css +135 -0
- data/vendor/assets/stylesheets/calendar_date_select/silver.css +133 -0
- data/vendor/assets/stylesheets/facebooklist.css +47 -0
- data/vendor/assets/stylesheets/modalbox.css +107 -0
- data/vendor/plugins/.gitkeep +0 -0
- data/vendor/plugins/.gitkeep~master +0 -0
- metadata +1196 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
# Fat Free CRM
|
2
|
+
# Copyright (C) 2008-2011 by Michael Dvorkin
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU Affero General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU Affero General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Affero General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
#------------------------------------------------------------------------------
|
17
|
+
|
18
|
+
namespace :db do
|
19
|
+
namespace :schema do
|
20
|
+
desc "Upgrade your database schema from ids to timestamps"
|
21
|
+
task :upgrade => :environment do
|
22
|
+
timestamps = Dir.glob("db/migrate/*.rb").map{|f| File.basename(f)[/(\d+)/,1] }.sort
|
23
|
+
timestamps[0..30].each_with_index do |timestamp, i|
|
24
|
+
puts "== #{i+1} => #{timestamp}"
|
25
|
+
ActiveRecord::Base.connection.
|
26
|
+
execute("update schema_migrations set version=#{timestamp} where version='#{i+1}';")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
+
<%%= f.error_notification %>
|
3
|
+
|
4
|
+
<div class="inputs">
|
5
|
+
<%- attributes.each do |attribute| -%>
|
6
|
+
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
7
|
+
<%- end -%>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="actions">
|
11
|
+
<%%= f.button :submit %>
|
12
|
+
</div>
|
13
|
+
<%% end %>
|
data/public/404.html
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
data/public/422.html
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
data/public/500.html
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
data/public/favicon.ico
ADDED
Binary file
|
data/public/robots.txt
ADDED
data/script/rails
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,626 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe AccountsController do
|
4
|
+
def get_data_for_sidebar
|
5
|
+
@category = Setting.account_category.dup
|
6
|
+
end
|
7
|
+
|
8
|
+
before do
|
9
|
+
require_user
|
10
|
+
set_current_tab(:accounts)
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /accounts
|
14
|
+
# GET /accounts.xml
|
15
|
+
#----------------------------------------------------------------------------
|
16
|
+
describe "responding to GET index" do
|
17
|
+
before(:each) do
|
18
|
+
get_data_for_sidebar
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should expose all accounts as @accounts and render [index] template" do
|
22
|
+
@accounts = [ FactoryGirl.create(:account, :user => @current_user) ]
|
23
|
+
get :index
|
24
|
+
assigns[:accounts].should == @accounts
|
25
|
+
response.should render_template("accounts/index")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should collect the data for the accounts sidebar" do
|
29
|
+
@accounts = [ FactoryGirl.create(:account, :user => @current_user) ]
|
30
|
+
|
31
|
+
get :index
|
32
|
+
(assigns[:account_category_total].keys.map(&:to_sym) - (@category << :all << :other)).should == []
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should filter out accounts by category" do
|
36
|
+
categories = %w(customer vendor)
|
37
|
+
controller.session[:filter_by_account_category] = categories.join(',')
|
38
|
+
@accounts = [
|
39
|
+
FactoryGirl.create(:account, :user => @current_user, :category => categories.first),
|
40
|
+
FactoryGirl.create(:account, :user => @current_user, :category => categories.last)
|
41
|
+
]
|
42
|
+
# This one should be filtered out.
|
43
|
+
FactoryGirl.create(:account, :user => @current_user, :category => "competitor")
|
44
|
+
|
45
|
+
get :index
|
46
|
+
assigns[:accounts].should == @accounts
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should perform lookup using query string" do
|
50
|
+
@first = FactoryGirl.create(:account, :user => @current_user, :name => "The first one")
|
51
|
+
@second = FactoryGirl.create(:account, :user => @current_user, :name => "The second one")
|
52
|
+
|
53
|
+
get :index, :query => "second"
|
54
|
+
assigns[:accounts].should == [ @second ]
|
55
|
+
assigns[:current_query].should == "second"
|
56
|
+
session[:accounts_current_query].should == "second"
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "AJAX pagination" do
|
60
|
+
it "should pick up page number from params" do
|
61
|
+
@accounts = [ FactoryGirl.create(:account, :user => @current_user) ]
|
62
|
+
xhr :get, :index, :page => 42
|
63
|
+
|
64
|
+
assigns[:current_page].to_i.should == 42
|
65
|
+
assigns[:accounts].should == [] # page #42 should be empty if there's only one account ;-)
|
66
|
+
session[:accounts_current_page].to_i.should == 42
|
67
|
+
response.should render_template("accounts/index")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should pick up saved page number from session" do
|
71
|
+
session[:accounts_current_page] = 42
|
72
|
+
@accounts = [ FactoryGirl.create(:account, :user => @current_user) ]
|
73
|
+
xhr :get, :index
|
74
|
+
|
75
|
+
assigns[:current_page].should == 42
|
76
|
+
assigns[:accounts].should == []
|
77
|
+
response.should render_template("accounts/index")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "with mime type of JSON" do
|
82
|
+
it "should render all accounts as json" do
|
83
|
+
@controller.should_receive(:get_list_of_records).and_return(accounts = mock("Array of Accounts"))
|
84
|
+
accounts.should_receive(:to_json).and_return("generated JSON")
|
85
|
+
|
86
|
+
request.env["HTTP_ACCEPT"] = "application/json"
|
87
|
+
get :index
|
88
|
+
response.body.should == "generated JSON"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "with mime type of XML" do
|
93
|
+
it "should render all accounts as xml" do
|
94
|
+
@controller.should_receive(:get_list_of_records).and_return(accounts = mock("Array of Accounts"))
|
95
|
+
accounts.should_receive(:to_xml).and_return("generated XML")
|
96
|
+
|
97
|
+
request.env["HTTP_ACCEPT"] = "application/xml"
|
98
|
+
get :index
|
99
|
+
response.body.should == "generated XML"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# GET /accounts/1
|
105
|
+
# GET /accounts/1.xml HTML
|
106
|
+
#----------------------------------------------------------------------------
|
107
|
+
describe "responding to GET show" do
|
108
|
+
|
109
|
+
describe "with mime type of HTML" do
|
110
|
+
before do
|
111
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
112
|
+
@stage = Setting.unroll(:opportunity_stage)
|
113
|
+
@comment = Comment.new
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should expose the requested account as @account and render [show] template" do
|
117
|
+
get :show, :id => @account.id
|
118
|
+
assigns[:account].should == @account
|
119
|
+
assigns[:stage].should == @stage
|
120
|
+
assigns[:comment].attributes.should == @comment.attributes
|
121
|
+
response.should render_template("accounts/show")
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should update an activity when viewing the account" do
|
125
|
+
Activity.should_receive(:log).with(@current_user, @account, :viewed).once
|
126
|
+
get :show, :id => @account.id
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "with mime type of JSON" do
|
131
|
+
it "should render the requested account as json" do
|
132
|
+
Account.stub_chain(:my, :find).and_return(account = mock_model(Account, :name => ''))
|
133
|
+
account.should_receive(:to_json).and_return("generated JSON")
|
134
|
+
|
135
|
+
request.env["HTTP_ACCEPT"] = "application/json"
|
136
|
+
get :show, :id => 42
|
137
|
+
response.body.should == "generated JSON"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "with mime type of XML" do
|
142
|
+
it "should render the requested account as xml" do
|
143
|
+
Account.stub_chain(:my, :find).and_return(account = mock_model(Account, :name => ''))
|
144
|
+
account.should_receive(:to_xml).and_return("generated XML")
|
145
|
+
|
146
|
+
request.env["HTTP_ACCEPT"] = "application/xml"
|
147
|
+
get :show, :id => 42
|
148
|
+
response.body.should == "generated XML"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe "account got deleted or otherwise unavailable" do
|
153
|
+
it "should redirect to account index if the account got deleted" do
|
154
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
155
|
+
@account.destroy
|
156
|
+
|
157
|
+
get :show, :id => @account.id
|
158
|
+
flash[:warning].should_not == nil
|
159
|
+
response.should redirect_to(accounts_path)
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should redirect to account index if the account is protected" do
|
163
|
+
@private = FactoryGirl.create(:account, :user => FactoryGirl.create(:user), :access => "Private")
|
164
|
+
|
165
|
+
get :show, :id => @private.id
|
166
|
+
flash[:warning].should_not == nil
|
167
|
+
response.should redirect_to(accounts_path)
|
168
|
+
end
|
169
|
+
|
170
|
+
it "should return 404 (Not Found) JSON error" do
|
171
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
172
|
+
@account.destroy
|
173
|
+
request.env["HTTP_ACCEPT"] = "application/json"
|
174
|
+
|
175
|
+
get :show, :id => @account.id
|
176
|
+
response.code.should == "404" # :not_found
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should return 404 (Not Found) XML error" do
|
180
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
181
|
+
@account.destroy
|
182
|
+
request.env["HTTP_ACCEPT"] = "application/xml"
|
183
|
+
|
184
|
+
get :show, :id => @account.id
|
185
|
+
response.code.should == "404" # :not_found
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
# GET /accounts/new
|
192
|
+
# GET /accounts/new.xml AJAX
|
193
|
+
#----------------------------------------------------------------------------
|
194
|
+
describe "responding to GET new" do
|
195
|
+
|
196
|
+
it "should expose a new account as @account and render [new] template" do
|
197
|
+
@account = Account.new(:user => @current_user)
|
198
|
+
@users = [ FactoryGirl.create(:user) ]
|
199
|
+
|
200
|
+
xhr :get, :new
|
201
|
+
assigns[:account].attributes.should == @account.attributes
|
202
|
+
assigns[:users].should == @users
|
203
|
+
assigns[:contact].should == nil
|
204
|
+
response.should render_template("accounts/new")
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should created an instance of related object when necessary" do
|
208
|
+
@contact = FactoryGirl.create(:contact, :id => 42)
|
209
|
+
|
210
|
+
xhr :get, :new, :related => "contact_42"
|
211
|
+
assigns[:contact].should == @contact
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
|
216
|
+
# GET /accounts/1/edit AJAX
|
217
|
+
#----------------------------------------------------------------------------
|
218
|
+
describe "responding to GET edit" do
|
219
|
+
|
220
|
+
it "should expose the requested account as @account and render [edit] template" do
|
221
|
+
@account = FactoryGirl.create(:account, :id => 42, :user => @current_user)
|
222
|
+
@users = [ FactoryGirl.create(:user) ]
|
223
|
+
|
224
|
+
xhr :get, :edit, :id => 42
|
225
|
+
assigns[:account].should == @account
|
226
|
+
assigns[:users].should == @users
|
227
|
+
assigns[:previous].should == nil
|
228
|
+
response.should render_template("accounts/edit")
|
229
|
+
end
|
230
|
+
|
231
|
+
it "should expose previous account as @previous when necessary" do
|
232
|
+
@account = FactoryGirl.create(:account, :id => 42)
|
233
|
+
@previous = FactoryGirl.create(:account, :id => 41)
|
234
|
+
|
235
|
+
xhr :get, :edit, :id => 42, :previous => 41
|
236
|
+
assigns[:previous].should == @previous
|
237
|
+
end
|
238
|
+
|
239
|
+
describe "(account got deleted or is otherwise unavailable)" do
|
240
|
+
it "should reload current page with the flash message if the account got deleted" do
|
241
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
242
|
+
@account.destroy
|
243
|
+
|
244
|
+
xhr :get, :edit, :id => @account.id
|
245
|
+
flash[:warning].should_not == nil
|
246
|
+
response.body.should == "window.location.reload();"
|
247
|
+
end
|
248
|
+
|
249
|
+
it "should reload current page with the flash message if the account is protected" do
|
250
|
+
@private = FactoryGirl.create(:account, :user => FactoryGirl.create(:user), :access => "Private")
|
251
|
+
|
252
|
+
xhr :get, :edit, :id => @private.id
|
253
|
+
flash[:warning].should_not == nil
|
254
|
+
response.body.should == "window.location.reload();"
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
describe "(previous account got deleted or is otherwise unavailable)" do
|
259
|
+
before do
|
260
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
261
|
+
@previous = FactoryGirl.create(:account, :user => FactoryGirl.create(:user))
|
262
|
+
end
|
263
|
+
|
264
|
+
it "should notify the view if previous account got deleted" do
|
265
|
+
@previous.destroy
|
266
|
+
|
267
|
+
xhr :get, :edit, :id => @account.id, :previous => @previous.id
|
268
|
+
flash[:warning].should == nil # no warning, just silently remove the div
|
269
|
+
assigns[:previous].should == @previous.id
|
270
|
+
response.should render_template("accounts/edit")
|
271
|
+
end
|
272
|
+
|
273
|
+
it "should notify the view if previous account got protected" do
|
274
|
+
@previous.update_attribute(:access, "Private")
|
275
|
+
|
276
|
+
xhr :get, :edit, :id => @account.id, :previous => @previous.id
|
277
|
+
flash[:warning].should == nil
|
278
|
+
assigns[:previous].should == @previous.id
|
279
|
+
response.should render_template("accounts/edit")
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
end
|
284
|
+
|
285
|
+
# POST /accounts
|
286
|
+
# POST /accounts.xml AJAX
|
287
|
+
#----------------------------------------------------------------------------
|
288
|
+
describe "responding to POST create" do
|
289
|
+
|
290
|
+
describe "with valid params" do
|
291
|
+
|
292
|
+
it "should expose a newly created account as @account and render [create] template" do
|
293
|
+
@account = FactoryGirl.build(:account, :name => "Hello world", :user => @current_user)
|
294
|
+
Account.stub!(:new).and_return(@account)
|
295
|
+
@users = [ FactoryGirl.create(:user) ]
|
296
|
+
|
297
|
+
xhr :post, :create, :account => { :name => "Hello world" }, :users => %w(1 2 3)
|
298
|
+
assigns(:account).should == @account
|
299
|
+
assigns(:users).should == @users
|
300
|
+
response.should render_template("accounts/create")
|
301
|
+
end
|
302
|
+
|
303
|
+
# Note: [Create Account] is shown only on Accounts index page.
|
304
|
+
it "should reload accounts to update pagination" do
|
305
|
+
@account = FactoryGirl.build(:account, :user => @current_user)
|
306
|
+
Account.stub!(:new).and_return(@account)
|
307
|
+
|
308
|
+
xhr :post, :create, :account => { :name => "Hello" }, :users => %w(1 2 3)
|
309
|
+
assigns[:accounts].should == [ @account ]
|
310
|
+
end
|
311
|
+
|
312
|
+
it "should get data to update account sidebar" do
|
313
|
+
@account = FactoryGirl.build(:account, :name => "Hello", :user => @current_user)
|
314
|
+
Campaign.stub!(:new).and_return(@account)
|
315
|
+
@users = [ FactoryGirl.create(:user) ]
|
316
|
+
|
317
|
+
xhr :post, :create, :account => { :name => "Hello" }, :users => %w(1 2 3)
|
318
|
+
assigns[:account_category_total].should be_instance_of(HashWithIndifferentAccess)
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
describe "with invalid params" do
|
323
|
+
it "should expose a newly created but unsaved account as @account and still render [create] template" do
|
324
|
+
@account = FactoryGirl.build(:account, :name => nil, :user => nil)
|
325
|
+
Account.stub!(:new).and_return(@account)
|
326
|
+
@users = [ FactoryGirl.create(:user) ]
|
327
|
+
|
328
|
+
xhr :post, :create, :account => {}, :users => []
|
329
|
+
assigns(:account).should == @account
|
330
|
+
assigns(:users).should == @users
|
331
|
+
response.should render_template("accounts/create")
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
end
|
336
|
+
|
337
|
+
# PUT /accounts/1
|
338
|
+
# PUT /accounts/1.xml AJAX
|
339
|
+
#----------------------------------------------------------------------------
|
340
|
+
describe "responding to PUT update" do
|
341
|
+
|
342
|
+
describe "with valid params" do
|
343
|
+
it "should update the requested account, expose the requested account as @account, and render [update] template" do
|
344
|
+
@account = FactoryGirl.create(:account, :id => 42, :name => "Hello people")
|
345
|
+
|
346
|
+
xhr :put, :update, :id => 42, :account => { :name => "Hello world" }
|
347
|
+
@account.reload.name.should == "Hello world"
|
348
|
+
assigns(:account).should == @account
|
349
|
+
response.should render_template("accounts/update")
|
350
|
+
end
|
351
|
+
|
352
|
+
it "should get data for accounts sidebar when called from Campaigns index" do
|
353
|
+
@account = FactoryGirl.create(:account, :id => 42)
|
354
|
+
request.env["HTTP_REFERER"] = "http://localhost/accounts"
|
355
|
+
|
356
|
+
xhr :put, :update, :id => 42, :account => { :name => "Hello" }, :users => []
|
357
|
+
assigns(:account).should == @account
|
358
|
+
assigns[:account_category_total].should be_instance_of(HashWithIndifferentAccess)
|
359
|
+
end
|
360
|
+
|
361
|
+
it "should update account permissions when sharing with specific users" do
|
362
|
+
@account = FactoryGirl.create(:account, :id => 42, :access => "Public")
|
363
|
+
he = FactoryGirl.create(:user, :id => 7)
|
364
|
+
she = FactoryGirl.create(:user, :id => 8)
|
365
|
+
|
366
|
+
xhr :put, :update, :id => 42, :account => { :name => "Hello", :access => "Shared" }, :users => %w(7 8)
|
367
|
+
@account.reload.access.should == "Shared"
|
368
|
+
@account.permissions.map(&:user_id).sort.should == [ 7, 8 ]
|
369
|
+
assigns[:account].should == @account
|
370
|
+
end
|
371
|
+
|
372
|
+
describe "account got deleted or otherwise unavailable" do
|
373
|
+
it "should reload current page is the account got deleted" do
|
374
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
375
|
+
@account.destroy
|
376
|
+
|
377
|
+
xhr :put, :update, :id => @account.id
|
378
|
+
flash[:warning].should_not == nil
|
379
|
+
response.body.should == "window.location.reload();"
|
380
|
+
end
|
381
|
+
|
382
|
+
it "should reload current page with the flash message if the account is protected" do
|
383
|
+
@private = FactoryGirl.create(:account, :user => FactoryGirl.create(:user), :access => "Private")
|
384
|
+
|
385
|
+
xhr :put, :update, :id => @private.id
|
386
|
+
flash[:warning].should_not == nil
|
387
|
+
response.body.should == "window.location.reload();"
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
describe "with invalid params" do
|
393
|
+
it "should not update the requested account but still expose the requested account as @account, and render [update] template" do
|
394
|
+
@account = FactoryGirl.create(:account, :id => 42, :name => "Hello people")
|
395
|
+
|
396
|
+
xhr :put, :update, :id => 42, :account => { :name => nil }
|
397
|
+
@account.reload.name.should == "Hello people"
|
398
|
+
assigns(:account).should == @account
|
399
|
+
response.should render_template("accounts/update")
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
end
|
404
|
+
|
405
|
+
# DELETE /accounts/1
|
406
|
+
# DELETE /accounts/1.xml
|
407
|
+
#----------------------------------------------------------------------------
|
408
|
+
describe "responding to DELETE destroy" do
|
409
|
+
before do
|
410
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
411
|
+
end
|
412
|
+
|
413
|
+
describe "AJAX request" do
|
414
|
+
it "should destroy the requested account and render [destroy] template" do
|
415
|
+
@another_account = FactoryGirl.create(:account, :user => @current_user)
|
416
|
+
xhr :delete, :destroy, :id => @account.id
|
417
|
+
|
418
|
+
lambda { Account.find(@account) }.should raise_error(ActiveRecord::RecordNotFound)
|
419
|
+
assigns[:accounts].should == [ @another_account ] # @account got deleted
|
420
|
+
response.should render_template("accounts/destroy")
|
421
|
+
end
|
422
|
+
|
423
|
+
it "should get data for accounts sidebar" do
|
424
|
+
xhr :delete, :destroy, :id => @account.id
|
425
|
+
|
426
|
+
assigns[:account_category_total].should be_instance_of(HashWithIndifferentAccess)
|
427
|
+
end
|
428
|
+
|
429
|
+
it "should try previous page and render index action if current page has no accounts" do
|
430
|
+
session[:accounts_current_page] = 42
|
431
|
+
|
432
|
+
xhr :delete, :destroy, :id => @account.id
|
433
|
+
session[:accounts_current_page].should == 41
|
434
|
+
response.should render_template("accounts/index")
|
435
|
+
end
|
436
|
+
|
437
|
+
it "should render index action when deleting last account" do
|
438
|
+
session[:accounts_current_page] = 1
|
439
|
+
|
440
|
+
xhr :delete, :destroy, :id => @account.id
|
441
|
+
session[:accounts_current_page].should == 1
|
442
|
+
response.should render_template("accounts/index")
|
443
|
+
end
|
444
|
+
|
445
|
+
describe "account got deleted or otherwise unavailable" do
|
446
|
+
it "should reload current page is the account got deleted" do
|
447
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
448
|
+
@account.destroy
|
449
|
+
|
450
|
+
xhr :delete, :destroy, :id => @account.id
|
451
|
+
flash[:warning].should_not == nil
|
452
|
+
response.body.should == "window.location.reload();"
|
453
|
+
end
|
454
|
+
|
455
|
+
it "should reload current page with the flash message if the account is protected" do
|
456
|
+
@private = FactoryGirl.create(:account, :user => FactoryGirl.create(:user), :access => "Private")
|
457
|
+
|
458
|
+
xhr :delete, :destroy, :id => @private.id
|
459
|
+
flash[:warning].should_not == nil
|
460
|
+
response.body.should == "window.location.reload();"
|
461
|
+
end
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
describe "HTML request" do
|
466
|
+
it "should redirect to Accounts index when an account gets deleted from its landing page" do
|
467
|
+
delete :destroy, :id => @account.id
|
468
|
+
|
469
|
+
flash[:notice].should_not == nil
|
470
|
+
response.should redirect_to(accounts_path)
|
471
|
+
end
|
472
|
+
|
473
|
+
it "should redirect to account index with the flash message is the account got deleted" do
|
474
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
475
|
+
@account.destroy
|
476
|
+
|
477
|
+
delete :destroy, :id => @account.id
|
478
|
+
flash[:warning].should_not == nil
|
479
|
+
response.should redirect_to(accounts_path)
|
480
|
+
end
|
481
|
+
|
482
|
+
it "should redirect to account index with the flash message if the account is protected" do
|
483
|
+
@private = FactoryGirl.create(:account, :user => FactoryGirl.create(:user), :access => "Private")
|
484
|
+
|
485
|
+
delete :destroy, :id => @private.id
|
486
|
+
flash[:warning].should_not == nil
|
487
|
+
response.should redirect_to(accounts_path)
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
end
|
492
|
+
|
493
|
+
# PUT /accounts/1/attach
|
494
|
+
# PUT /accounts/1/attach.xml AJAX
|
495
|
+
#----------------------------------------------------------------------------
|
496
|
+
describe "responding to PUT attach" do
|
497
|
+
describe "tasks" do
|
498
|
+
before do
|
499
|
+
@model = FactoryGirl.create(:account)
|
500
|
+
@attachment = FactoryGirl.create(:task, :asset => nil)
|
501
|
+
end
|
502
|
+
it_should_behave_like("attach")
|
503
|
+
end
|
504
|
+
|
505
|
+
describe "contacts" do
|
506
|
+
before do
|
507
|
+
@model = FactoryGirl.create(:account)
|
508
|
+
@attachment = FactoryGirl.create(:contact, :account => nil)
|
509
|
+
end
|
510
|
+
it_should_behave_like("attach")
|
511
|
+
end
|
512
|
+
end
|
513
|
+
|
514
|
+
# POST /accounts/1/discard
|
515
|
+
# POST /accounts/1/discard.xml AJAX
|
516
|
+
#----------------------------------------------------------------------------
|
517
|
+
describe "responding to POST discard" do
|
518
|
+
describe "tasks" do
|
519
|
+
before do
|
520
|
+
@model = FactoryGirl.create(:account)
|
521
|
+
@attachment = FactoryGirl.create(:task, :asset => @model)
|
522
|
+
end
|
523
|
+
it_should_behave_like("discard")
|
524
|
+
end
|
525
|
+
|
526
|
+
describe "contacts" do
|
527
|
+
before do
|
528
|
+
@attachment = FactoryGirl.create(:contact)
|
529
|
+
@model = FactoryGirl.create(:account)
|
530
|
+
@model.contacts << @attachment
|
531
|
+
end
|
532
|
+
it_should_behave_like("discard")
|
533
|
+
end
|
534
|
+
|
535
|
+
describe "opportunities" do
|
536
|
+
before do
|
537
|
+
@attachment = FactoryGirl.create(:opportunity)
|
538
|
+
@model = FactoryGirl.create(:account)
|
539
|
+
@model.opportunities << @attachment
|
540
|
+
end
|
541
|
+
# 'super from singleton method that is defined to multiple classes is not supported;'
|
542
|
+
# TODO: Uncomment this when it is fixed in 1.9.3
|
543
|
+
# it_should_behave_like("discard")
|
544
|
+
end
|
545
|
+
end
|
546
|
+
|
547
|
+
# POST /accounts/auto_complete/query AJAX
|
548
|
+
#----------------------------------------------------------------------------
|
549
|
+
describe "responding to POST auto_complete" do
|
550
|
+
before do
|
551
|
+
@auto_complete_matches = [ FactoryGirl.create(:account, :name => "Hello World", :user => @current_user) ]
|
552
|
+
end
|
553
|
+
|
554
|
+
it_should_behave_like("auto complete")
|
555
|
+
end
|
556
|
+
|
557
|
+
# GET /accounts/options AJAX
|
558
|
+
#----------------------------------------------------------------------------
|
559
|
+
describe "responding to GET options" do
|
560
|
+
it "should set current user preferences when showing options" do
|
561
|
+
@per_page = FactoryGirl.create(:preference, :user => @current_user, :name => "accounts_per_page", :value => Base64.encode64(Marshal.dump(42)))
|
562
|
+
@outline = FactoryGirl.create(:preference, :user => @current_user, :name => "accounts_outline", :value => Base64.encode64(Marshal.dump("option_long")))
|
563
|
+
@sort_by = FactoryGirl.create(:preference, :user => @current_user, :name => "accounts_sort_by", :value => Base64.encode64(Marshal.dump("accounts.name ASC")))
|
564
|
+
|
565
|
+
xhr :get, :options
|
566
|
+
assigns[:per_page].should == 42
|
567
|
+
assigns[:outline].should == "option_long"
|
568
|
+
assigns[:sort_by].should == "accounts.name ASC"
|
569
|
+
end
|
570
|
+
|
571
|
+
it "should not assign instance variables when hiding options" do
|
572
|
+
xhr :get, :options, :cancel => "true"
|
573
|
+
assigns[:per_page].should == nil
|
574
|
+
assigns[:outline].should == nil
|
575
|
+
assigns[:sort_by].should == nil
|
576
|
+
end
|
577
|
+
end
|
578
|
+
|
579
|
+
# POST /accounts/redraw AJAX
|
580
|
+
#----------------------------------------------------------------------------
|
581
|
+
describe "responding to POST redraw" do
|
582
|
+
it "should save user selected account preference" do
|
583
|
+
xhr :post, :redraw, :per_page => 42, :outline => "brief", :sort_by => "name"
|
584
|
+
@current_user.preference[:accounts_per_page].should == "42"
|
585
|
+
@current_user.preference[:accounts_outline].should == "brief"
|
586
|
+
@current_user.preference[:accounts_sort_by].should == "accounts.name ASC"
|
587
|
+
end
|
588
|
+
|
589
|
+
it "should reset current page to 1" do
|
590
|
+
xhr :post, :redraw, :per_page => 42, :outline => "brief", :sort_by => "name"
|
591
|
+
session[:accounts_current_page].should == 1
|
592
|
+
end
|
593
|
+
|
594
|
+
it "should select @accounts and render [index] template" do
|
595
|
+
@accounts = [
|
596
|
+
FactoryGirl.create(:account, :name => "A", :user => @current_user),
|
597
|
+
FactoryGirl.create(:account, :name => "B", :user => @current_user)
|
598
|
+
]
|
599
|
+
|
600
|
+
xhr :post, :redraw, :per_page => 1, :sort_by => "name"
|
601
|
+
assigns(:accounts).should == [ @accounts.first ]
|
602
|
+
response.should render_template("accounts/index")
|
603
|
+
end
|
604
|
+
end
|
605
|
+
|
606
|
+
# POST /accounts/filter AJAX
|
607
|
+
#----------------------------------------------------------------------------
|
608
|
+
describe "responding to POST filter" do
|
609
|
+
it "should expose filtered accounts as @accounts and render [index] template" do
|
610
|
+
session[:filter_by_account_category] = "customer,vendor"
|
611
|
+
@accounts = [ FactoryGirl.create(:account, :category => "partner", :user => @current_user) ]
|
612
|
+
|
613
|
+
xhr :post, :filter, :category => "partner"
|
614
|
+
assigns(:accounts).should == @accounts
|
615
|
+
response.should render_template("accounts/index")
|
616
|
+
end
|
617
|
+
|
618
|
+
it "should reset current page to 1" do
|
619
|
+
@accounts = []
|
620
|
+
xhr :post, :filter, :category => "partner"
|
621
|
+
|
622
|
+
session[:accounts_current_page].should == 1
|
623
|
+
end
|
624
|
+
end
|
625
|
+
end
|
626
|
+
|