fat_free_crm 0.13.6 → 0.14.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/.travis.yml +8 -5
- data/CHANGELOG +26 -0
- data/Gemfile +26 -26
- data/Gemfile.lock +280 -250
- data/Guardfile +0 -1
- data/README.md +7 -9
- data/Rakefile +1 -1
- data/app/assets/javascripts/application.js.erb +1 -0
- data/app/assets/javascripts/crm.js.coffee +6 -7
- data/app/assets/javascripts/search.js.coffee +7 -1
- data/app/assets/stylesheets/about.css.scss +10 -0
- data/app/assets/stylesheets/application.css.erb +2 -0
- data/app/assets/stylesheets/common.scss +1 -1
- data/app/controllers/admin/application_controller.rb +3 -3
- data/app/controllers/admin/field_groups_controller.rb +12 -7
- data/app/controllers/admin/fields_controller.rb +21 -17
- data/app/controllers/admin/groups_controller.rb +10 -4
- data/app/controllers/admin/plugins_controller.rb +1 -2
- data/app/controllers/admin/settings_controller.rb +1 -2
- data/app/controllers/admin/tags_controller.rb +10 -4
- data/app/controllers/admin/users_controller.rb +32 -12
- data/app/controllers/application_controller.rb +58 -38
- data/app/controllers/authentications_controller.rb +5 -8
- data/app/controllers/comments_controller.rb +15 -11
- data/app/controllers/emails_controller.rb +1 -2
- data/app/controllers/entities/accounts_controller.rb +20 -20
- data/app/controllers/entities/campaigns_controller.rb +25 -22
- data/app/controllers/entities/contacts_controller.rb +25 -24
- data/app/controllers/entities/leads_controller.rb +33 -31
- data/app/controllers/entities/opportunities_controller.rb +31 -28
- data/app/controllers/entities_controller.rb +26 -22
- data/app/controllers/home_controller.rb +18 -18
- data/app/controllers/lists_controller.rb +11 -7
- data/app/controllers/passwords_controller.rb +5 -6
- data/app/controllers/tasks_controller.rb +23 -18
- data/app/controllers/users_controller.rb +31 -7
- data/app/helpers/accounts_helper.rb +40 -42
- data/app/helpers/addresses_helper.rb +1 -3
- data/app/helpers/admin/application_helper.rb +4 -4
- data/app/helpers/admin/field_groups_helper.rb +5 -7
- data/app/helpers/admin/fields_helper.rb +2 -3
- data/app/helpers/admin/plugins_helper.rb +0 -1
- data/app/helpers/admin/settings_helper.rb +0 -1
- data/app/helpers/admin/tags_helper.rb +1 -1
- data/app/helpers/admin/users_helper.rb +16 -18
- data/app/helpers/application_helper.rb +127 -119
- data/app/helpers/authentications_helper.rb +0 -1
- data/app/helpers/campaigns_helper.rb +5 -7
- data/app/helpers/comments_helper.rb +0 -1
- data/app/helpers/contacts_helper.rb +0 -1
- data/app/helpers/home_helper.rb +14 -14
- data/app/helpers/javascript_helper.rb +30 -0
- data/app/helpers/leads_helper.rb +7 -7
- data/app/helpers/opportunities_helper.rb +8 -10
- data/app/helpers/passwords_helper.rb +0 -1
- data/app/helpers/tags_helper.rb +1 -3
- data/app/helpers/tasks_helper.rb +24 -26
- data/app/helpers/users_helper.rb +6 -7
- data/app/helpers/versions_helper.rb +3 -5
- data/app/inputs/date_pair_input.rb +6 -7
- data/app/inputs/date_time_input.rb +3 -4
- data/app/inputs/datetime_pair_input.rb +0 -1
- data/app/inputs/text_input.rb +2 -2
- data/app/mailers/dropbox_mailer.rb +4 -7
- data/app/mailers/subscription_mailer.rb +4 -5
- data/app/mailers/user_mailer.rb +7 -9
- data/app/models/entities/account.rb +31 -28
- data/app/models/entities/account_contact.rb +2 -1
- data/app/models/entities/account_opportunity.rb +1 -1
- data/app/models/entities/campaign.rb +22 -19
- data/app/models/entities/contact.rb +55 -53
- data/app/models/entities/contact_opportunity.rb +1 -1
- data/app/models/entities/lead.rb +49 -41
- data/app/models/entities/opportunity.rb +38 -38
- data/app/models/fields/custom_field.rb +21 -27
- data/app/models/fields/custom_field_date_pair.rb +7 -8
- data/app/models/fields/custom_field_datetime_pair.rb +0 -2
- data/app/models/fields/custom_field_pair.rb +8 -10
- data/app/models/fields/field.rb +29 -30
- data/app/models/fields/field_group.rb +4 -4
- data/app/models/list.rb +1 -1
- data/app/models/observers/entity_observer.rb +1 -1
- data/app/models/observers/lead_observer.rb +1 -1
- data/app/models/observers/opportunity_observer.rb +1 -1
- data/app/models/observers/task_observer.rb +1 -1
- data/app/models/polymorphic/address.rb +7 -7
- data/app/models/polymorphic/avatar.rb +8 -9
- data/app/models/polymorphic/comment.rb +16 -10
- data/app/models/polymorphic/email.rb +13 -6
- data/app/models/polymorphic/tag.rb +2 -2
- data/app/models/polymorphic/task.rb +45 -45
- data/{config/initializers/paper_trail.rb → app/models/polymorphic/version.rb} +26 -31
- data/app/models/setting.rb +12 -17
- data/app/models/users/ability.rb +5 -6
- data/app/models/users/authentication.rb +6 -5
- data/app/models/users/group.rb +1 -3
- data/app/models/users/permission.rb +3 -3
- data/app/models/users/preference.rb +7 -7
- data/app/models/users/user.rb +36 -43
- data/app/views/accounts/_top_section.html.haml +2 -2
- data/app/views/accounts/edit.js.haml +0 -1
- data/app/views/admin/fields/_field.html.haml +1 -1
- data/app/views/admin/tags/_tag.html.haml +1 -1
- data/app/views/admin/users/_user.html.haml +4 -4
- data/app/views/campaigns/_top_section.html.haml +1 -1
- data/app/views/campaigns/edit.js.haml +0 -2
- data/app/views/contacts/_top_section.html.haml +1 -1
- data/app/views/contacts/edit.js.haml +0 -1
- data/app/views/entities/_basic_search.html.haml +1 -1
- data/app/views/home/_account.html.haml +2 -2
- data/app/views/home/_opportunity.html.haml +2 -2
- data/app/views/layouts/_about.html.haml +1 -1
- data/app/views/leads/_top_section.html.haml +1 -1
- data/app/views/leads/edit.js.haml +0 -2
- data/app/views/lists/_sidebar.html.haml +1 -1
- data/app/views/opportunities/_top_section.html.haml +2 -2
- data/app/views/opportunities/edit.js.haml +0 -1
- data/app/views/shared/_tags.html.haml +2 -1
- data/app/views/tasks/_edit.html.haml +2 -3
- data/app/views/tasks/_top_section.html.haml +1 -1
- data/app/views/users/_user.html.haml +2 -1
- data/app/views/users/opportunities_overview.html.haml +2 -2
- data/bin/bundle +3 -0
- data/bin/rails +4 -0
- data/bin/rake +4 -0
- data/config/application.rb +16 -33
- data/config/boot.rb +1 -1
- data/config/database.mysql.mac.yml +1 -0
- data/config/database.mysql.yml +1 -0
- data/config/database.postgres.docker.yml +1 -1
- data/config/database.postgres.yml +1 -0
- data/config/database.sqlite.yml +1 -0
- data/config/deploy.example.rb +3 -5
- data/config/environments/development.rb +13 -14
- data/config/environments/production.rb +8 -7
- data/config/environments/staging.rb +43 -41
- data/config/environments/test.rb +12 -14
- data/config/initializers/assets.rb +14 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/cookies_serializer.rb +3 -0
- data/config/initializers/custom_field_ransack_translations.rb +1 -1
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/mime_types.rb +0 -1
- data/config/initializers/paginate_arrays.rb +0 -1
- data/config/initializers/ransack.rb +5 -5
- data/config/initializers/session_store.rb +5 -0
- data/config/initializers/simple_form.rb +1 -1
- data/config/initializers/views.rb +33 -33
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/cz_fat_free_crm.yml +1 -1
- data/config/locales/de_fat_free_crm.yml +2 -2
- data/config/locales/en-GB_fat_free_crm.yml +2 -3
- data/config/locales/en-US_fat_free_crm.yml +2 -3
- data/config/locales/en.yml +23 -0
- data/config/locales/es-CL.yml +227 -0
- data/config/locales/es-CL_fat_free_crm.yml +929 -0
- data/config/locales/es-CL_ransack.yml +91 -0
- data/config/locales/es.yml +53 -59
- data/config/locales/es_fat_free_crm.yml +708 -370
- data/config/locales/es_ransack.yml +91 -0
- data/config/locales/fr-CA_fat_free_crm.yml +7 -7
- data/config/locales/fr_fat_free_crm.yml +285 -81
- data/config/locales/it_fat_free_crm.yml +1 -1
- data/config/locales/ja_fat_free_crm.yml +1 -1
- data/config/locales/nl.yml +210 -0
- data/config/locales/nl_fat_free_crm.yml +920 -0
- data/config/locales/nl_ransack.yml +91 -0
- data/config/locales/pl_fat_free_crm.yml +1 -1
- data/config/locales/pt-BR_fat_free_crm.yml +111 -38
- data/config/locales/ru_fat_free_crm.yml +3 -4
- data/config/locales/sv-SE_fat_free_crm.yml +1 -1
- data/config/locales/th.rb +157 -158
- data/config/locales/th_fat_free_crm.yml +1 -1
- data/config/locales/zh-CN_fat_free_crm.yml +3 -4
- data/config/routes.rb +93 -94
- data/config/unicorn.rb +25 -2
- data/custom_plan.rb +0 -2
- data/db/demo/accounts.yml +4 -5
- data/db/demo/addresses.yml +5 -5
- data/db/demo/campaigns.yml +2 -2
- data/db/demo/comments.yml +1 -1
- data/db/demo/contacts.yml +8 -8
- data/db/demo/emails.yml +5 -5
- data/db/demo/leads.yml +10 -10
- data/db/demo/opportunities.yml +2 -2
- data/db/demo/tasks.yml +2 -2
- data/db/demo/users.yml +12 -16
- data/db/migrate/20100928030598_create_sessions.rb +1 -2
- data/db/migrate/20100928030599_create_users.rb +24 -25
- data/db/migrate/20100928030600_create_openid_tables.rb +11 -12
- data/db/migrate/20100928030601_create_accounts.rb +14 -15
- data/db/migrate/20100928030602_create_permissions.rb +2 -3
- data/db/migrate/20100928030603_create_settings.rb +4 -5
- data/db/migrate/20100928030604_create_preferences.rb +3 -4
- data/db/migrate/20100928030605_create_campaigns.rb +19 -20
- data/db/migrate/20100928030606_create_leads.rb +26 -27
- data/db/migrate/20100928030607_create_contacts.rb +26 -27
- data/db/migrate/20100928030608_create_opportunities.rb +15 -16
- data/db/migrate/20100928030609_create_account_contacts.rb +2 -3
- data/db/migrate/20100928030610_create_account_opportunities.rb +2 -3
- data/db/migrate/20100928030611_create_contact_opportunities.rb +3 -4
- data/db/migrate/20100928030612_create_tasks.rb +14 -15
- data/db/migrate/20100928030613_create_comments.rb +6 -7
- data/db/migrate/20100928030614_create_activities.rb +6 -7
- data/db/migrate/20100928030615_create_avatars.rb +5 -6
- data/db/migrate/20100928030616_rename_remember_token.rb +0 -1
- data/db/migrate/20100928030617_drop_openid_tables.rb +11 -11
- data/db/migrate/20100928030618_add_admin_to_users.rb +1 -2
- data/db/migrate/20100928030619_add_suspended_to_users.rb +0 -1
- data/db/migrate/20100928030620_remove_uuid.rb +3 -3
- data/db/migrate/20100928030621_add_email_to_accounts.rb +1 -2
- data/db/migrate/20100928030622_add_background_info_to_models.rb +0 -1
- data/db/migrate/20100928030623_create_addresses.rb +14 -16
- data/db/migrate/20100928030624_add_index_on_permissions.rb +2 -3
- data/db/migrate/20100928030625_create_emails.rb +15 -16
- data/db/migrate/20100928030626_add_state_to_timeline_objects.rb +2 -3
- data/db/migrate/20100928030627_acts_as_taggable_on_migration.rb +2 -3
- data/db/migrate/20101221123456_add_single_access_token_to_users.rb +0 -1
- data/db/migrate/20101221345678_add_rating_and_category_to_accounts.rb +2 -3
- data/db/migrate/20110719082054_add_skype_to_contacts_and_leads.rb +2 -3
- data/db/migrate/20111101083437_create_fields.rb +14 -15
- data/db/migrate/20111101090312_create_field_groups.rb +4 -5
- data/db/migrate/20111116091952_add_field_groups_tag_id.rb +0 -1
- data/db/migrate/20111117041311_change_fields_collection_to_text.rb +0 -1
- data/db/migrate/20111201030535_add_field_groups_klass_name.rb +4 -4
- data/db/migrate/20120121054235_create_lists.rb +1 -1
- data/db/migrate/20120216031616_create_versions.rb +5 -5
- data/db/migrate/20120216042541_is_paranoid_to_paper_trail.rb +1 -3
- data/db/migrate/20120224073107_remove_default_value_and_clear_settings.rb +1 -1
- data/db/migrate/20120316045804_activities_to_versions.rb +6 -6
- data/db/migrate/20120405080727_change_subscribed_users_to_set.rb +5 -5
- data/db/migrate/20120405080742_change_further_subscribed_users_to_set.rb +5 -5
- data/db/migrate/20120406082136_create_groups.rb +1 -1
- data/db/migrate/20120510025219_add_not_null_constraints_for_timestamp_columns.rb +2 -1
- data/db/migrate/20120528102124_increase_length_of_version_events.rb +2 -2
- data/db/migrate/20121003063155_add_settings_to_custom_fields.rb +1 -1
- data/db/migrate/20121221033947_fix_country_mapping.rb +0 -1
- data/db/migrate/20131207033244_add_user_id_to_lists.rb +1 -1
- data/db/migrate/20141126031837_increase_email_to254_chars.rb +14 -14
- data/db/migrate/20141230021159_add_transaction_id_column_to_versions.rb +11 -0
- data/db/migrate/20141230205453_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
- data/db/migrate/20141230205454_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
- data/db/migrate/20141230205455_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
- data/db/migrate/20150123060900_convert_radio_to_radio_buttons.rb +10 -0
- data/db/migrate/20150227123054_remove_last_request_at_from_users.rb +5 -0
- data/db/migrate/20150427131956_create_index_related_type.rb +9 -0
- data/db/migrate/20160511053730_add_account_contacts_index.rb +5 -0
- data/db/schema.rb +236 -228
- data/db/seeds.rb +1 -2
- data/db/seeds/fields.rb +36 -37
- data/{fig.yml → docker-compose.yml} +0 -0
- data/fat_free_crm.gemspec +31 -18
- data/lib/development_tasks/license.rake +29 -29
- data/lib/fat_free_crm.rb +1 -5
- data/lib/fat_free_crm/callback.rb +28 -20
- data/lib/fat_free_crm/comment_extensions.rb +1 -1
- data/lib/fat_free_crm/core_ext.rb +1 -1
- data/lib/fat_free_crm/core_ext/nil.rb +0 -3
- data/lib/fat_free_crm/core_ext/string.rb +7 -21
- data/lib/fat_free_crm/custom_fields.rb +2 -2
- data/lib/fat_free_crm/engine.rb +14 -0
- data/lib/fat_free_crm/errors.rb +0 -2
- data/lib/fat_free_crm/exceptions.rb +3 -4
- data/lib/fat_free_crm/export_csv.rb +0 -2
- data/lib/fat_free_crm/exportable.rb +5 -7
- data/lib/fat_free_crm/fields.rb +7 -8
- data/lib/fat_free_crm/gem_dependencies.rb +4 -1
- data/lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb +2 -2
- data/lib/fat_free_crm/gem_ext/active_support/buffered_logger.rb +0 -3
- data/lib/fat_free_crm/gem_ext/rails/engine.rb +5 -12
- data/lib/fat_free_crm/gem_ext/rake/task.rb +1 -1
- data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +1 -2
- data/lib/fat_free_crm/i18n.rb +2 -3
- data/lib/fat_free_crm/load_settings.rb +0 -2
- data/lib/fat_free_crm/mail_processor/base.rb +15 -16
- data/lib/fat_free_crm/mail_processor/comment_replies.rb +5 -10
- data/lib/fat_free_crm/mail_processor/dropbox.rb +56 -59
- data/lib/fat_free_crm/permissions.rb +18 -15
- data/lib/fat_free_crm/renderers.rb +2 -2
- data/lib/fat_free_crm/secret_token_generator.rb +3 -9
- data/lib/fat_free_crm/sortable.rb +4 -8
- data/lib/fat_free_crm/version.rb +2 -2
- data/lib/fat_free_crm/view_factory.rb +3 -8
- data/lib/gravatar_image_tag.rb +19 -24
- data/lib/missing_translation_detector.rb +10 -10
- data/lib/tasks/ffcrm/comment_replies.rake +3 -5
- data/lib/tasks/ffcrm/config.rake +3 -5
- data/lib/tasks/ffcrm/demo.rake +14 -16
- data/lib/tasks/ffcrm/dropbox.rake +3 -5
- data/lib/tasks/ffcrm/missing_translations.rake +1 -1
- data/lib/tasks/ffcrm/secret.rake +1 -3
- data/lib/tasks/ffcrm/settings.rake +2 -4
- data/lib/tasks/ffcrm/setup.rake +3 -6
- data/lib/tasks/ffcrm/update_data.rake +110 -116
- data/spec/controllers/admin/groups_controller_spec.rb +0 -1
- data/spec/controllers/admin/users_controller_spec.rb +98 -102
- data/spec/controllers/applications_controller_spec.rb +17 -21
- data/spec/controllers/authentications_controller_spec.rb +57 -61
- data/spec/controllers/comments_controller_spec.rb +32 -39
- data/spec/controllers/emails_controller_spec.rb +6 -7
- data/spec/controllers/entities/accounts_controller_spec.rb +204 -214
- data/spec/controllers/entities/campaigns_controller_spec.rb +210 -224
- data/spec/controllers/entities/contacts_controller_spec.rb +250 -270
- data/spec/controllers/entities/leads_controller_spec.rb +415 -438
- data/spec/controllers/entities/opportunities_controller_spec.rb +344 -359
- data/spec/controllers/entities_controller_spec.rb +10 -14
- data/spec/controllers/home_controller_spec.rb +85 -92
- data/spec/controllers/lists_controller_spec.rb +0 -1
- data/spec/controllers/passwords_controller_spec.rb +5 -9
- data/spec/controllers/tasks_controller_spec.rb +193 -210
- data/spec/controllers/users_controller_spec.rb +137 -146
- data/spec/factories/account_factories.rb +11 -13
- data/spec/factories/campaign_factories.rb +6 -6
- data/spec/factories/contact_factories.rb +21 -22
- data/spec/factories/field_factories.rb +8 -10
- data/spec/factories/lead_factories.rb +16 -16
- data/spec/factories/list_factories.rb +2 -2
- data/spec/factories/opportunity_factories.rb +8 -10
- data/spec/factories/sequences.rb +8 -9
- data/spec/factories/setting_factories.rb +2 -2
- data/spec/factories/shared_factories.rb +26 -30
- data/spec/factories/tag_factories.rb +1 -1
- data/spec/factories/task_factories.rb +11 -11
- data/spec/factories/user_factories.rb +22 -27
- data/spec/features/acceptance_helper.rb +1 -1
- data/spec/features/accounts_spec.rb +65 -61
- data/spec/features/admin/groups_spec.rb +11 -12
- data/spec/features/admin/users_spec.rb +17 -19
- data/spec/features/campaigns_spec.rb +61 -57
- data/spec/features/contacts_spec.rb +90 -59
- data/spec/features/dashboard_spec.rb +20 -21
- data/spec/features/leads_spec.rb +88 -67
- data/spec/features/opportunities_overview_spec.rb +31 -31
- data/spec/features/opportunities_spec.rb +64 -60
- data/spec/features/support/browser.rb +2 -2
- data/spec/features/support/headless.rb +1 -1
- data/spec/features/support/helpers.rb +5 -6
- data/spec/features/support/paths.rb +1 -2
- data/spec/features/support/selector_helpers.rb +2 -2
- data/spec/features/tasks_spec.rb +60 -54
- data/spec/helpers/accounts_helper_spec.rb +2 -5
- data/spec/helpers/admin/field_groups_helper_spec.rb +4 -4
- data/spec/helpers/admin/plugins_helper_spec.rb +0 -1
- data/spec/helpers/admin/settings_helper_spec.rb +0 -1
- data/spec/helpers/admin/users_helper_spec.rb +0 -1
- data/spec/helpers/application_helper_spec.rb +30 -33
- data/spec/helpers/authentications_helper_spec.rb +2 -5
- data/spec/helpers/campaigns_helper_spec.rb +2 -5
- data/spec/helpers/comments_helper_spec.rb +2 -5
- data/spec/helpers/contacts_helper_spec.rb +2 -5
- data/spec/helpers/emails_helper_spec.rb +0 -1
- data/spec/helpers/fields_helper_spec.rb +0 -1
- data/spec/helpers/groups_helper_spec.rb +0 -1
- data/spec/helpers/home_helper_spec.rb +2 -5
- data/spec/helpers/leads_helper_spec.rb +2 -5
- data/spec/helpers/lists_helper_spec.rb +0 -1
- data/spec/helpers/opportunities_helper_spec.rb +2 -5
- data/spec/helpers/passwords_helper_spec.rb +2 -5
- data/spec/helpers/tasks_helper_spec.rb +1 -5
- data/spec/helpers/users_helper_spec.rb +9 -11
- data/spec/lib/comment_extensions_spec.rb +3 -3
- data/spec/lib/core_ext/string_spec.rb +1 -1
- data/spec/lib/errors_spec.rb +10 -10
- data/spec/lib/fields_spec.rb +23 -33
- data/spec/lib/mail_processor/base_spec.rb +41 -43
- data/spec/lib/mail_processor/comment_replies_spec.rb +17 -17
- data/spec/lib/mail_processor/dropbox_spec.rb +91 -95
- data/spec/lib/mail_processor/sample_emails/dropbox.rb +13 -14
- data/spec/lib/permissions_spec.rb +44 -47
- data/spec/lib/secret_token_generator_spec.rb +16 -28
- data/spec/lib/view_factory_spec.rb +18 -24
- data/spec/mailers/subscription_mailer_spec.rb +14 -16
- data/spec/mailers/user_mailer_spec.rb +33 -34
- data/spec/models/entities/account_contact_spec.rb +2 -3
- data/spec/models/entities/account_opportunity_spec.rb +2 -3
- data/spec/models/entities/account_spec.rb +52 -59
- data/spec/models/entities/campaign_spec.rb +32 -39
- data/spec/models/entities/contact_opportunity_spec.rb +2 -3
- data/spec/models/entities/contact_spec.rb +71 -72
- data/spec/models/entities/lead_spec.rb +15 -22
- data/spec/models/entities/opportunity_spec.rb +104 -103
- data/spec/models/fields/custom_field_date_pair_spec.rb +38 -44
- data/spec/models/fields/custom_field_pair_spec.rb +28 -36
- data/spec/models/fields/custom_field_spec.rb +50 -56
- data/spec/models/fields/field_group_spec.rb +1 -2
- data/spec/models/fields/field_spec.rb +13 -15
- data/spec/models/list_spec.rb +4 -4
- data/spec/models/observers/entity_observer_spec.rb +18 -21
- data/spec/models/polymorphic/address_spec.rb +1 -3
- data/spec/models/polymorphic/avatar_spec.rb +6 -8
- data/spec/models/polymorphic/comment_spec.rb +7 -9
- data/spec/models/polymorphic/email_spec.rb +1 -2
- data/spec/models/polymorphic/task_spec.rb +130 -142
- data/spec/models/polymorphic/version_spec.rb +84 -91
- data/spec/models/setting_spec.rb +17 -19
- data/spec/models/users/abilities/user_ability_spec.rb +25 -20
- data/spec/models/users/authentication_spec.rb +0 -1
- data/spec/models/users/group_spec.rb +0 -1
- data/spec/models/users/permission_spec.rb +12 -13
- data/spec/models/users/preference_spec.rb +15 -15
- data/spec/models/users/user_spec.rb +53 -55
- data/spec/routing/accounts_routing_spec.rb +12 -14
- data/spec/routing/admin/users_routing_spec.rb +7 -9
- data/spec/routing/campaigns_routing_spec.rb +13 -14
- data/spec/routing/comments_routing_spec.rb +5 -6
- data/spec/routing/contacts_routing_spec.rb +12 -14
- data/spec/routing/emails_routing_spec.rb +7 -8
- data/spec/routing/leads_routing_spec.rb +19 -21
- data/spec/routing/opportunities_routing_spec.rb +13 -15
- data/spec/routing/tasks_routing_spec.rb +14 -15
- data/spec/routing/users_routing_spec.rb +18 -19
- data/spec/shared/controllers.rb +35 -35
- data/spec/shared/models.rb +52 -55
- data/spec/spec_helper.rb +21 -42
- data/spec/support/assert_select.rb +19 -18
- data/spec/support/auth_macros.rb +3 -3
- data/spec/support/macros.rb +5 -6
- data/spec/support/mail_processor_mocks.rb +11 -11
- data/spec/views/accounts/_edit.haml_spec.rb +9 -9
- data/spec/views/accounts/_new.haml_spec.rb +8 -9
- data/spec/views/accounts/create.js.haml_spec.rb +11 -12
- data/spec/views/accounts/destroy.js.haml_spec.rb +6 -7
- data/spec/views/accounts/edit.js.haml_spec.rb +12 -13
- data/spec/views/accounts/index.haml_spec.rb +8 -8
- data/spec/views/accounts/index.js.haml_spec.rb +7 -8
- data/spec/views/accounts/new.js.haml_spec.rb +7 -8
- data/spec/views/accounts/show.haml_spec.rb +11 -12
- data/spec/views/accounts/update.js.haml_spec.rb +18 -18
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +8 -10
- data/spec/views/admin/field_groups/destroy.js.haml_spec.rb +7 -9
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +5 -7
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +6 -8
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +7 -9
- data/spec/views/admin/users/_create.haml_spec.rb +4 -4
- data/spec/views/admin/users/create.js.haml_spec.rb +8 -9
- data/spec/views/admin/users/destroy.js.haml_spec.rb +6 -6
- data/spec/views/admin/users/edit.js.haml_spec.rb +7 -9
- data/spec/views/admin/users/index.haml_spec.rb +4 -5
- data/spec/views/admin/users/index.js.haml_spec.rb +6 -8
- data/spec/views/admin/users/new.js.haml_spec.rb +4 -6
- data/spec/views/admin/users/reactivate.js.haml_spec.rb +4 -4
- data/spec/views/admin/users/show.haml_spec.rb +0 -1
- data/spec/views/admin/users/suspend.js.haml_spec.rb +4 -4
- data/spec/views/admin/users/update.js.haml_spec.rb +6 -7
- data/spec/views/application/auto_complete.haml_spec.rb +12 -14
- data/spec/views/authentications/new.haml_spec.rb +6 -7
- data/spec/views/campaigns/_edit.haml_spec.rb +9 -9
- data/spec/views/campaigns/_new.haml_spec.rb +8 -8
- data/spec/views/campaigns/create.js.haml_spec.rb +11 -12
- data/spec/views/campaigns/destroy.js.haml_spec.rb +7 -8
- data/spec/views/campaigns/edit.js.haml_spec.rb +12 -20
- data/spec/views/campaigns/index.haml_spec.rb +6 -7
- data/spec/views/campaigns/index.js.haml_spec.rb +9 -10
- data/spec/views/campaigns/new.js.haml_spec.rb +7 -8
- data/spec/views/campaigns/show.haml_spec.rb +12 -13
- data/spec/views/campaigns/update.js.haml_spec.rb +16 -16
- data/spec/views/comments/edit.js.haml_spec.rb +7 -7
- data/spec/views/contacts/_edit.haml_spec.rb +21 -21
- data/spec/views/contacts/_new.haml_spec.rb +12 -13
- data/spec/views/contacts/create.js.haml_spec.rb +12 -13
- data/spec/views/contacts/destroy.js.haml_spec.rb +6 -7
- data/spec/views/contacts/edit.js.haml_spec.rb +15 -17
- data/spec/views/contacts/index.haml_spec.rb +6 -7
- data/spec/views/contacts/index.js.html_spec.rb +7 -8
- data/spec/views/contacts/new.js.haml_spec.rb +8 -9
- data/spec/views/contacts/show.haml_spec.rb +9 -10
- data/spec/views/contacts/update.js.haml_spec.rb +26 -26
- data/spec/views/home/index.haml_spec.rb +4 -5
- data/spec/views/home/index.js.haml_spec.rb +6 -7
- data/spec/views/home/options.js.haml_spec.rb +10 -10
- data/spec/views/leads/_convert.haml_spec.rb +5 -6
- data/spec/views/leads/_edit.haml_spec.rb +13 -13
- data/spec/views/leads/_new.haml_spec.rb +11 -11
- data/spec/views/leads/_sidebar_show.haml_spec.rb +9 -9
- data/spec/views/leads/convert.js.haml_spec.rb +16 -17
- data/spec/views/leads/create.js.haml_spec.rb +16 -17
- data/spec/views/leads/destroy.js.haml_spec.rb +10 -11
- data/spec/views/leads/edit.js.haml_spec.rb +16 -17
- data/spec/views/leads/index.haml_spec.rb +7 -8
- data/spec/views/leads/index.js.haml_spec.rb +10 -11
- data/spec/views/leads/new.js.haml_spec.rb +8 -9
- data/spec/views/leads/promote.js.haml_spec.rb +30 -31
- data/spec/views/leads/reject.js.haml_spec.rb +10 -11
- data/spec/views/leads/show.haml_spec.rb +7 -8
- data/spec/views/leads/update.js.haml_spec.rb +28 -29
- data/spec/views/opportunities/_edit.haml_spec.rb +19 -19
- data/spec/views/opportunities/_new.haml_spec.rb +10 -10
- data/spec/views/opportunities/create.js.haml_spec.rb +19 -20
- data/spec/views/opportunities/destroy.js.haml_spec.rb +14 -15
- data/spec/views/opportunities/edit.js.haml_spec.rb +14 -16
- data/spec/views/opportunities/index.haml_spec.rb +6 -7
- data/spec/views/opportunities/index.js.haml_spec.rb +7 -8
- data/spec/views/opportunities/new.js.haml_spec.rb +8 -9
- data/spec/views/opportunities/show.haml_spec.rb +9 -10
- data/spec/views/opportunities/update.js.haml_spec.rb +35 -35
- data/spec/views/tasks/_edit.haml_spec.rb +9 -9
- data/spec/views/tasks/complete.js.haml_spec.rb +11 -12
- data/spec/views/tasks/create.js.haml_spec.rb +29 -31
- data/spec/views/tasks/destroy.js.haml_spec.rb +8 -8
- data/spec/views/tasks/edit.js.haml_spec.rb +12 -15
- data/spec/views/tasks/index.haml_spec.rb +7 -7
- data/spec/views/tasks/new.js.haml_spec.rb +7 -8
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +6 -6
- data/spec/views/tasks/update.js.haml_spec.rb +41 -44
- data/spec/views/users/avatar.js.haml_spec.rb +7 -8
- data/spec/views/users/change_password.js.haml_spec.rb +9 -10
- data/spec/views/users/edit.js.haml_spec.rb +7 -8
- data/spec/views/users/password.js.haml_spec.rb +8 -9
- data/spec/views/users/update.js.haml_spec.rb +6 -7
- data/spec/views/users/upload_avatar.js.haml_spec.rb +9 -9
- data/vendor/assets/javascripts/jquery_timeago/index.js +2 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.es-CL.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.nl.js +20 -0
- data/vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-es-CL.js +20 -0
- data/vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-es-CL.js +23 -0
- data/vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-nl.js +21 -0
- data/vendor/assets/stylesheets/{jquery-ui.custom.css → jquery-ui.custom.scss} +52 -51
- data/vendor/gems/globby-0.1.2/LICENSE.txt +20 -0
- data/vendor/gems/globby-0.1.2/README.md +65 -0
- data/vendor/gems/globby-0.1.2/Rakefile +9 -0
- data/vendor/gems/globby-0.1.2/lib/globby.rb +47 -0
- data/vendor/gems/globby-0.1.2/lib/globby/glob.rb +90 -0
- data/vendor/gems/globby-0.1.2/lib/globby/globject.rb +18 -0
- data/vendor/gems/globby-0.1.2/lib/globby/result.rb +20 -0
- data/vendor/gems/globby-0.1.2/spec/gitignore_spec.rb +109 -0
- data/vendor/gems/globby-0.1.2/spec/globby_spec.rb +93 -0
- metadata +177 -55
- data/Gemfile.ci +0 -13
- data/config/initializers/sass.rb +0 -18
- data/lib/country_select.rb +0 -570
- data/lib/fat_free_crm/plugin.rb +0 -94
data/lib/fat_free_crm/version.rb
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
#------------------------------------------------------------------------------
|
6
6
|
|
7
7
|
module FatFreeCRM
|
8
|
-
|
9
8
|
# A view factory keeps track of views and the contexts in which they are available.
|
10
9
|
#----------------------------------------------------------------------------
|
11
10
|
#
|
@@ -16,7 +15,6 @@ module FatFreeCRM
|
|
16
15
|
# Icon is optional. If specified, it will be passed to asset_path.
|
17
16
|
#
|
18
17
|
class ViewFactory
|
19
|
-
|
20
18
|
include Comparable
|
21
19
|
|
22
20
|
@@views = []
|
@@ -25,7 +23,6 @@ module FatFreeCRM
|
|
25
23
|
# Class methods
|
26
24
|
#----------------------------------------------------------------------------
|
27
25
|
class << self
|
28
|
-
|
29
26
|
# Register with the view factory
|
30
27
|
#----------------------------------------------------------------------------
|
31
28
|
def register(view)
|
@@ -37,9 +34,9 @@ module FatFreeCRM
|
|
37
34
|
def views_for(options = {})
|
38
35
|
controller = options[:controller]
|
39
36
|
action = options[:action]
|
40
|
-
name = options[:name] #optional
|
37
|
+
name = options[:name] # optional
|
41
38
|
@@views.select do |view|
|
42
|
-
view.controllers.include?(controller)
|
39
|
+
view.controllers.include?(controller) && view.actions.include?(action) && (name.present? ? view.name == name : true)
|
43
40
|
end
|
44
41
|
end
|
45
42
|
|
@@ -50,7 +47,6 @@ module FatFreeCRM
|
|
50
47
|
view = views_for(options).first
|
51
48
|
view && view.template
|
52
49
|
end
|
53
|
-
|
54
50
|
end
|
55
51
|
|
56
52
|
# Instance methods
|
@@ -77,10 +73,9 @@ module FatFreeCRM
|
|
77
73
|
# This defines what it means for one view to be different to another
|
78
74
|
#----------------------------------------------------------------------------
|
79
75
|
def generate_id
|
80
|
-
|
76
|
+
[name, controllers.sort, actions.sort].flatten.map(&:to_s).map(&:underscore).join('_')
|
81
77
|
end
|
82
78
|
|
83
79
|
ActiveSupport.run_load_hooks(:fat_free_crm_view_factory, self)
|
84
|
-
|
85
80
|
end
|
86
81
|
end
|
data/lib/gravatar_image_tag.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module GravatarImageTag
|
2
|
-
|
3
2
|
class << self
|
4
3
|
attr_accessor :configuration
|
5
4
|
end
|
@@ -13,51 +12,47 @@ module GravatarImageTag
|
|
13
12
|
end
|
14
13
|
|
15
14
|
class Configuration
|
16
|
-
|
15
|
+
attr_accessor :default_image, :filetype, :rating, :size, :secure
|
17
16
|
end
|
18
17
|
|
19
18
|
def self.included(base)
|
20
|
-
GravatarImageTag.configure { |
|
19
|
+
GravatarImageTag.configure { |_c| nil }
|
21
20
|
base.send :include, InstanceMethods
|
22
21
|
end
|
23
22
|
|
24
23
|
module InstanceMethods
|
25
|
-
|
26
24
|
def gravatar_image_tag(email, options = {})
|
27
25
|
options[:alt] ||= 'Gravatar'
|
28
|
-
image_tag(GravatarImageTag
|
26
|
+
image_tag(GravatarImageTag.gravatar_url(email, options.delete(:gravatar)), options)
|
29
27
|
end
|
30
|
-
|
31
28
|
end
|
32
29
|
|
33
30
|
def self.gravatar_url(email, overrides = {})
|
34
31
|
overrides ||= {}
|
35
32
|
gravatar_params = {
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
}.merge(overrides).delete_if { |
|
33
|
+
default: GravatarImageTag.configuration.default_image,
|
34
|
+
filetype: GravatarImageTag.configuration.filetype,
|
35
|
+
rating: GravatarImageTag.configuration.rating,
|
36
|
+
secure: GravatarImageTag.configuration.secure,
|
37
|
+
size: GravatarImageTag.configuration.size
|
38
|
+
}.merge(overrides).delete_if { |_key, value| value.nil? }
|
42
39
|
"#{gravatar_url_base(gravatar_params.delete(:secure))}/#{gravatar_id(email, gravatar_params.delete(:filetype))}#{url_params(gravatar_params)}"
|
43
40
|
end
|
44
41
|
|
45
42
|
private
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
def self.gravatar_id(email, filetype = nil)
|
52
|
-
"#{ Digest::MD5.hexdigest(email) }#{ ".#{filetype}" unless filetype.nil? }" unless email.nil?
|
53
|
-
end
|
44
|
+
def self.gravatar_url_base(secure = false)
|
45
|
+
'http' + (!!secure ? 's://secure.' : '://') + 'gravatar.com/avatar'
|
46
|
+
end
|
54
47
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
48
|
+
def self.gravatar_id(email, filetype = nil)
|
49
|
+
"#{ Digest::MD5.hexdigest(email) }#{ ".#{filetype}" unless filetype.nil? }" unless email.nil?
|
50
|
+
end
|
59
51
|
|
52
|
+
def self.url_params(gravatar_params)
|
53
|
+
return nil if gravatar_params.keys.size == 0
|
54
|
+
"?#{gravatar_params.map { |key, value| "#{key}=#{URI.escape(value.is_a?(String) ? value : value.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))}" }.join('&')}"
|
55
|
+
end
|
60
56
|
end
|
61
57
|
|
62
58
|
ActionView::Base.send(:include, GravatarImageTag) if defined?(ActionView::Base)
|
63
|
-
|
@@ -1,27 +1,27 @@
|
|
1
1
|
# Compares two locale files and detects missing translations.
|
2
2
|
class MissingTranslationDetector
|
3
3
|
attr_reader :missing_translations
|
4
|
-
|
4
|
+
|
5
5
|
# @params [String] base_file_name File name of the base locale is i.e. en-US
|
6
6
|
# @params [String] target_file_name File name of a locale with missing translations is i.e. de
|
7
7
|
def initialize(base_file_name, target_file_name)
|
8
|
-
@base = yml_load base_file_name
|
9
|
-
@target = yml_load target_file_name
|
8
|
+
@base = yml_load base_file_name
|
9
|
+
@target = yml_load target_file_name
|
10
10
|
@missing_translations = []
|
11
11
|
end
|
12
12
|
|
13
13
|
# Detects missing translations within the target locale file
|
14
14
|
# and stores it in "missing_translations".
|
15
|
-
def detect(h
|
15
|
+
def detect(h = @base, keys = [])
|
16
16
|
h.each_key do |key|
|
17
17
|
key_path = keys.clone.push key
|
18
18
|
|
19
19
|
if h[key].is_a?(Hash)
|
20
|
-
detect h[key], key_path
|
20
|
+
detect h[key], key_path
|
21
21
|
elsif blank?(key_path)
|
22
|
-
missing_translations << OpenStruct.new(:
|
23
|
-
:
|
24
|
-
end
|
22
|
+
missing_translations << OpenStruct.new(key_path: key_path,
|
23
|
+
value: h[key])
|
24
|
+
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -34,9 +34,9 @@ class MissingTranslationDetector
|
|
34
34
|
|
35
35
|
def blank?(keys)
|
36
36
|
h = @target
|
37
|
-
|
37
|
+
|
38
38
|
keys.each do |key|
|
39
|
-
return true if !h.is_a?(Hash) || !h.
|
39
|
+
return true if !h.is_a?(Hash) || !h.key?(key)
|
40
40
|
h = h[key]
|
41
41
|
end
|
42
42
|
|
@@ -5,25 +5,23 @@
|
|
5
5
|
#------------------------------------------------------------------------------
|
6
6
|
namespace :ffcrm do
|
7
7
|
namespace :comment_replies do
|
8
|
-
|
9
8
|
desc "Run comment inbox crawler and process incoming emails"
|
10
|
-
task :
|
9
|
+
task run: :environment do
|
11
10
|
require "fat_free_crm/mail_processor/comment_replies"
|
12
11
|
FatFreeCRM::MailProcessor::CommentReplies.new.run(dry_run = false)
|
13
12
|
end
|
14
13
|
namespace :run do
|
15
14
|
desc "[Dry run] - Run comment inbox crawler and process incoming emails"
|
16
|
-
task :
|
15
|
+
task dry: :environment do
|
17
16
|
require "fat_free_crm/mail_processor/comment_replies"
|
18
17
|
FatFreeCRM::MailProcessor::CommentReplies.new.run(dry_run = true)
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
21
|
desc "Set up comment inbox based on currently loaded settings"
|
23
|
-
task :
|
22
|
+
task setup: :environment do
|
24
23
|
require "fat_free_crm/mail_processor/comment_replies"
|
25
24
|
FatFreeCRM::MailProcessor::CommentReplies.new.setup
|
26
25
|
end
|
27
|
-
|
28
26
|
end
|
29
27
|
end
|
data/lib/tasks/ffcrm/config.rake
CHANGED
@@ -5,13 +5,12 @@
|
|
5
5
|
#------------------------------------------------------------------------------
|
6
6
|
namespace :ffcrm do
|
7
7
|
namespace :config do
|
8
|
-
|
9
8
|
desc "Setup database.yml"
|
10
9
|
task :copy_database_yml do
|
11
10
|
require 'fileutils'
|
12
11
|
filename = "config/database.#{ENV['DB'] || 'postgres'}.yml"
|
13
12
|
orig, dest = FatFreeCRM.root.join(filename), Rails.root.join('config/database.yml')
|
14
|
-
unless File.
|
13
|
+
unless File.exist?(dest)
|
15
14
|
puts "Copying #{filename} to config/database.yml ..."
|
16
15
|
FileUtils.cp orig, dest
|
17
16
|
end
|
@@ -31,12 +30,11 @@ namespace :ffcrm do
|
|
31
30
|
Dir[File.join(Rails.root, 'config', '**', '*.yml')].each do |file|
|
32
31
|
YAML::ENGINE.yamler = 'syck'
|
33
32
|
puts "Converting #{file}"
|
34
|
-
yml = YAML.load(
|
33
|
+
yml = YAML.load(File.read(file))
|
35
34
|
FileUtils.cp file, "#{file}.bak"
|
36
35
|
YAML::ENGINE.yamler = 'psych'
|
37
|
-
File.open(file, 'w'){ |file| file.write(YAML.dump(yml)) }
|
36
|
+
File.open(file, 'w') { |file| file.write(YAML.dump(yml)) }
|
38
37
|
end
|
39
38
|
end
|
40
|
-
|
41
39
|
end
|
42
40
|
end
|
data/lib/tasks/ffcrm/demo.rake
CHANGED
@@ -5,9 +5,8 @@
|
|
5
5
|
#------------------------------------------------------------------------------
|
6
6
|
namespace :ffcrm do
|
7
7
|
namespace :demo do
|
8
|
-
|
9
8
|
desc "Load demo data"
|
10
|
-
task :
|
9
|
+
task load: :environment do
|
11
10
|
# Load fixtures
|
12
11
|
require 'active_record/fixtures'
|
13
12
|
Dir.glob(FatFreeCRM.root.join('db', 'demo', '*.{yml,csv}')).each do |fixture_file|
|
@@ -16,7 +15,7 @@ namespace :ffcrm do
|
|
16
15
|
|
17
16
|
def create_version(options)
|
18
17
|
version = Version.new
|
19
|
-
options.each { |k,v| version.send(k.to_s + '=', v) }
|
18
|
+
options.each { |k, v| version.send(k.to_s + '=', v) }
|
20
19
|
version.save!
|
21
20
|
end
|
22
21
|
|
@@ -27,27 +26,27 @@ namespace :ffcrm do
|
|
27
26
|
model.constantize.all
|
28
27
|
end.flatten.each do |item|
|
29
28
|
user = if item.respond_to?(:user)
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
item.user
|
30
|
+
elsif item.respond_to?(:addressable)
|
31
|
+
item.addressable.try(:user)
|
33
32
|
end
|
34
33
|
related = if item.respond_to?(:addressable)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
item.addressable
|
35
|
+
elsif item.respond_to?(:commentable)
|
36
|
+
item.commentable
|
37
|
+
elsif item.respond_to?(:mediator)
|
38
|
+
item.mediator
|
40
39
|
end
|
41
40
|
# Backdate within the last 30 days
|
42
41
|
created_at = item.created_at - (rand(30) + 1).days + rand(12 * 60).minutes
|
43
42
|
updated_at = created_at + rand(12 * 60).minutes
|
44
43
|
|
45
|
-
create_version(:
|
46
|
-
create_version(:
|
44
|
+
create_version(event: "create", created_at: created_at, user: user, item: item, related: related)
|
45
|
+
create_version(event: "update", created_at: updated_at, user: user, item: item, related: related)
|
47
46
|
|
48
47
|
if [Account, Campaign, Contact, Lead, Opportunity].include?(item.class)
|
49
48
|
viewed_at = created_at + rand(12 * 60).minutes
|
50
|
-
version = create_version(:
|
49
|
+
version = create_version(event: "view", created_at: viewed_at, user: user, item: item)
|
51
50
|
end
|
52
51
|
print "." if item.id % 10 == 0
|
53
52
|
end
|
@@ -55,10 +54,9 @@ namespace :ffcrm do
|
|
55
54
|
end
|
56
55
|
|
57
56
|
desc "Reset the database and reload demo data along with default application settings"
|
58
|
-
task :
|
57
|
+
task reload: :environment do
|
59
58
|
Rake::Task["db:migrate:reset"].invoke
|
60
59
|
Rake::Task["ffcrm:demo:load"].invoke
|
61
60
|
end
|
62
|
-
|
63
61
|
end
|
64
62
|
end
|
@@ -5,26 +5,24 @@
|
|
5
5
|
#------------------------------------------------------------------------------
|
6
6
|
namespace :ffcrm do
|
7
7
|
namespace :dropbox do
|
8
|
-
|
9
8
|
desc "Run dropbox crawler and process incoming emails"
|
10
|
-
task :
|
9
|
+
task run: :environment do
|
11
10
|
require "fat_free_crm/mail_processor/dropbox"
|
12
11
|
FatFreeCRM::MailProcessor::Dropbox.new.run(dry_run = false)
|
13
12
|
end
|
14
13
|
|
15
14
|
namespace :run do
|
16
15
|
desc "[Dry run] - Run dropbox crawler and process incoming emails"
|
17
|
-
task :
|
16
|
+
task dry: :environment do
|
18
17
|
require "fat_free_crm/mail_processor/dropbox"
|
19
18
|
FatFreeCRM::MailProcessor::Dropbox.new.run(dry_run = true)
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
22
|
desc "Set up email dropbox based on currently loaded settings"
|
24
|
-
task :
|
23
|
+
task setup: :environment do
|
25
24
|
require "fat_free_crm/mail_processor/dropbox"
|
26
25
|
FatFreeCRM::MailProcessor::Dropbox.new.setup
|
27
26
|
end
|
28
|
-
|
29
27
|
end
|
30
28
|
end
|
@@ -9,7 +9,7 @@ require 'missing_translation_detector'
|
|
9
9
|
namespace :ffcrm do
|
10
10
|
namespace :missing_translations do
|
11
11
|
desc 'Detects missing translations for a locale - Takes a locale and compares with "en-US".'
|
12
|
-
task :detect, [:locale] => [:environment] do |
|
12
|
+
task :detect, [:locale] => [:environment] do |_t, args|
|
13
13
|
base_locale = 'en-US'
|
14
14
|
|
15
15
|
[[base_locale, args[:locale]],
|
data/lib/tasks/ffcrm/secret.rake
CHANGED
@@ -5,13 +5,11 @@
|
|
5
5
|
#------------------------------------------------------------------------------
|
6
6
|
|
7
7
|
namespace :ffcrm do
|
8
|
-
|
9
8
|
desc "Generate a secret token for Rails to use."
|
10
9
|
task :secret do
|
11
10
|
require 'securerandom'
|
12
11
|
secret = SecureRandom.hex(64)
|
13
12
|
filename = File.join(Rails.root, 'config', 'initializers', 'secret_token.rb')
|
14
|
-
File.open(filename, 'w'){|f| f.puts "FatFreeCRM::Application.config.secret_token = '#{secret}'"}
|
13
|
+
File.open(filename, 'w') { |f| f.puts "FatFreeCRM::Application.config.secret_token = '#{secret}'" }
|
15
14
|
end
|
16
|
-
|
17
15
|
end
|
@@ -5,18 +5,16 @@
|
|
5
5
|
#------------------------------------------------------------------------------
|
6
6
|
namespace :ffcrm do
|
7
7
|
namespace :settings do
|
8
|
-
|
9
8
|
desc "Clear settings from database (reset to default)"
|
10
|
-
task :
|
9
|
+
task clear: :environment do
|
11
10
|
Setting.delete_all
|
12
11
|
end
|
13
12
|
|
14
13
|
desc "Show current settings in the database"
|
15
|
-
task :
|
14
|
+
task show: :environment do
|
16
15
|
Setting.select('name').order('name').pluck('name').each do |name|
|
17
16
|
puts "\n#{name}:\n #{Setting.send(name).inspect}"
|
18
17
|
end
|
19
18
|
end
|
20
|
-
|
21
19
|
end
|
22
20
|
end
|
data/lib/tasks/ffcrm/setup.rake
CHANGED
@@ -4,9 +4,8 @@
|
|
4
4
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
5
5
|
#------------------------------------------------------------------------------
|
6
6
|
namespace :ffcrm do
|
7
|
-
|
8
7
|
desc "Prepare the database"
|
9
|
-
task :
|
8
|
+
task setup: :environment do
|
10
9
|
if ENV["PROCEED"] != 'true'
|
11
10
|
puts "\nFatFree CRM is about to run migrations on your database. Make sure you have a backup before proceeding.\n\n"
|
12
11
|
proceed = false
|
@@ -24,12 +23,11 @@ namespace :ffcrm do
|
|
24
23
|
puts "Aborted setup."
|
25
24
|
end
|
26
25
|
end
|
27
|
-
|
28
26
|
end
|
29
27
|
|
30
28
|
namespace :setup do
|
31
29
|
desc "Create admin user"
|
32
|
-
task :
|
30
|
+
task admin: :environment do
|
33
31
|
username, password, email = ENV["USERNAME"], ENV["PASSWORD"], ENV["EMAIL"]
|
34
32
|
unless username && password && email
|
35
33
|
puts "\nTo create the admin user you will be prompted to enter username, password,"
|
@@ -74,11 +72,10 @@ namespace :ffcrm do
|
|
74
72
|
end
|
75
73
|
User.reset_column_information # Reload the class since we've added new fields in migrations.
|
76
74
|
user = User.find_by_username(username) || User.new
|
77
|
-
user.update_attributes(:
|
75
|
+
user.update_attributes(username: username, password: password, email: email)
|
78
76
|
user.update_attribute(:admin, true) # Mass assignments don't work for :admin because of the attr_protected
|
79
77
|
user.update_attribute(:suspended_at, nil) # Mass assignments don't work for :suspended_at because of the attr_protected
|
80
78
|
puts "Admin user has been created."
|
81
79
|
end
|
82
80
|
end
|
83
|
-
|
84
81
|
end
|
@@ -5,7 +5,6 @@
|
|
5
5
|
#------------------------------------------------------------------------------
|
6
6
|
namespace :ffcrm do
|
7
7
|
namespace :update_data do
|
8
|
-
|
9
8
|
#
|
10
9
|
# Important note about countries. Please read carefully!
|
11
10
|
#
|
@@ -27,8 +26,7 @@ namespace :ffcrm do
|
|
27
26
|
# If not, it asks you to run this rake task.
|
28
27
|
#
|
29
28
|
desc "Update country codes to ISO 3166-1"
|
30
|
-
task :
|
31
|
-
|
29
|
+
task fix_countries: :environment do
|
32
30
|
message = """This task is only designed to run once and we think you've run this before!!!
|
33
31
|
|
34
32
|
Please read the following carefully!
|
@@ -53,192 +51,188 @@ If you really want to run it again, you will have to set Setting.have_run_countr
|
|
53
51
|
in a console and continue. This is strongly discouraged. You have been warned!
|
54
52
|
|
55
53
|
"""
|
56
|
-
|
54
|
+
|
57
55
|
if Setting.have_run_country_migration == true
|
58
56
|
puts message
|
59
57
|
exit
|
60
58
|
end
|
61
|
-
|
59
|
+
|
62
60
|
convert_table = [
|
63
|
-
#["Aland Islands", "FI", "AX"], # this clashed with FI for Finland. We'll prefer Finland.
|
64
|
-
|
61
|
+
# ["Aland Islands", "FI", "AX"], # this clashed with FI for Finland. We'll prefer Finland.
|
62
|
+
%w(Algeria AG DZ),
|
65
63
|
["American Samoa", "AQ", "AS"],
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
%w(Andorra AN AD),
|
65
|
+
%w(Anguilla AV AI),
|
66
|
+
%w(Antarctica AY AQ),
|
69
67
|
["Antigua and Barbuda", "AC", "AG"],
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
68
|
+
%w(Aruba AA AW),
|
69
|
+
%w(Australia AS AU),
|
70
|
+
%w(Austria AU AT),
|
71
|
+
%w(Azerbaijan AJ AZ),
|
72
|
+
%w(Bahamas BF BS),
|
73
|
+
%w(Bahrain BA BH),
|
74
|
+
%w(Bangladesh BG BD),
|
75
|
+
%w(Belarus BO BY),
|
76
|
+
%w(Belize BH BZ),
|
77
|
+
%w(Benin BN BJ),
|
78
|
+
%w(Bermuda BD BM),
|
81
79
|
["Bosnia and Herzegovina", "BK", "BA"],
|
82
|
-
|
80
|
+
%w(Botswana BC BW),
|
83
81
|
["Brunei Darussalam", "BX", "BN"],
|
84
|
-
|
82
|
+
%w(Bulgaria BU BG),
|
85
83
|
["Burkina Faso", "UV", "BF"],
|
86
|
-
|
87
|
-
|
84
|
+
%w(Burundi BY BI),
|
85
|
+
%w(Cambodia CB KH),
|
88
86
|
["Cayman Islands", "CJ", "KY"],
|
89
87
|
["Central African Republic", "CT", "CF"],
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
%w(Chad CD TD),
|
89
|
+
%w(Chile CI CL),
|
90
|
+
%w(China CH CN),
|
93
91
|
["Christmas Island", "KT", "CX"],
|
94
92
|
["Cocos (Keeling) Islands", "CK", "CC"],
|
95
|
-
|
93
|
+
%w(Comoros CN KM),
|
96
94
|
["Congo, the Democratic Republic of the", "CF", "CD"],
|
97
95
|
["Cook Islands", "CW", "CK"],
|
98
96
|
["Costa Rica", "CS", "CR"],
|
99
97
|
["Czech Republic", "EZ", "CZ"],
|
100
|
-
|
101
|
-
|
98
|
+
%w(Denmark DA DK),
|
99
|
+
%w(Dominica DO DM),
|
102
100
|
["Dominican Republic", "DR", "DO"],
|
103
101
|
["El Salvador", "ES", "SV"],
|
104
102
|
["Equatorial Guinea", "EK", "GQ"],
|
105
|
-
|
103
|
+
%w(Estonia EN EE),
|
106
104
|
["French Guiana", "FG", "GF"],
|
107
105
|
["French Polynesia", "FP", "PF"],
|
108
106
|
["French Southern Territories", "FS", "TF"],
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
107
|
+
%w(Gabon GB GA),
|
108
|
+
%w(Gambia GA GM),
|
109
|
+
%w(Georgia GG GE),
|
110
|
+
%w(Germany GM DE),
|
111
|
+
%w(Grenada GJ GD),
|
112
|
+
%w(Guam GQ GU),
|
113
|
+
%w(Guernsey GK GG),
|
114
|
+
%w(Guinea GV GN),
|
117
115
|
["Guinea-Bissau", "PU", "GW"],
|
118
|
-
|
116
|
+
%w(Haiti HA HT),
|
119
117
|
["Holy See (Vatican City State)", "VT", "VA"],
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
118
|
+
%w(Honduras HO HN),
|
119
|
+
%w(Iceland IC IS),
|
120
|
+
%w(Iraq IZ IQ),
|
121
|
+
%w(Ireland EI IE),
|
122
|
+
%w(Israel IS IL),
|
123
|
+
%w(Japan JA JP),
|
124
|
+
%w(Kiribati KR KI),
|
127
125
|
["Korea, Democratic People's Republic of", "KN", "KP"],
|
128
126
|
["Korea, Republic of", "KS", "KR"],
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
127
|
+
%w(Kuwait KU KW),
|
128
|
+
%w(Latvia LG LV),
|
129
|
+
%w(Lebanon LE LB),
|
130
|
+
%w(Lesotho LT LS),
|
131
|
+
%w(Liberia LI LR),
|
132
|
+
%w(Liechtenstein LS LI),
|
133
|
+
%w(Lithuania LH LT),
|
134
|
+
%w(Macao MC MO),
|
135
|
+
%w(Madagascar MA MG),
|
136
|
+
%w(Malawi MI MW),
|
139
137
|
["Marshall Islands", "RM", "MH"],
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
138
|
+
%w(Martinique MB MQ),
|
139
|
+
%w(Mauritius MP MU),
|
140
|
+
%w(Mayotte MF YT),
|
141
|
+
%w(Monaco MN MC),
|
142
|
+
%w(Mongolia MG MN),
|
143
|
+
%w(Montenegro MJ ME),
|
144
|
+
%w(Montserrat MH MS),
|
145
|
+
%w(Morocco MO MA),
|
146
|
+
%w(Myanmar BM MM),
|
147
|
+
%w(Namibia WA NA),
|
148
|
+
%w(Nicaragua NU NI),
|
149
|
+
%w(Niger NG NE),
|
150
|
+
%w(Nigeria NI NG),
|
151
|
+
%w(Niue NE NU),
|
154
152
|
["Northern Mariana Islands", "CQ", "MP"],
|
155
|
-
|
156
|
-
|
153
|
+
%w(Oman MU OM),
|
154
|
+
%w(Palau PS PW),
|
157
155
|
["Palestinian Territory, Occupied", "WE", "PS"],
|
158
|
-
|
156
|
+
%w(Panama PM PA),
|
159
157
|
["Papua New Guinea", "PP", "PG"],
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
158
|
+
%w(Paraguay PA PY),
|
159
|
+
%w(Philippines RP PH),
|
160
|
+
%w(Pitcairn PC PN),
|
161
|
+
%w(Portugal PO PT),
|
164
162
|
["Puerto Rico", "RQ", "PR"],
|
165
163
|
["Russian Federation", "RS", "RU"],
|
166
164
|
["Saint Kitts and Nevis", "SC", "KN"],
|
167
165
|
["Saint Lucia", "ST", "LC"],
|
168
166
|
["Saint Pierre and Miquelon", "SB", "PM"],
|
169
167
|
["Sao Tome and Principe", "TP", "ST"],
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
168
|
+
%w(Senegal SG SN),
|
169
|
+
%w(Serbia RB RS),
|
170
|
+
%w(Seychelles SE SC),
|
171
|
+
%w(Singapore SN SG),
|
172
|
+
%w(Slovakia LO SK),
|
175
173
|
["Solomon Islands", "BP", "SB"],
|
176
174
|
["South Africa", "SF", "ZA"],
|
177
175
|
["South Georgia and the South Sandwich Islands", "SX", "GS"],
|
178
|
-
|
176
|
+
%w(Spain SP ES),
|
179
177
|
["Sri Lanka", "CE", "LK"],
|
180
|
-
|
181
|
-
|
178
|
+
%w(Sudan SU SD),
|
179
|
+
%w(Suriname NS SR),
|
182
180
|
["Svalbard and Jan Mayen", "SV", "SJ"],
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
181
|
+
%w(Swaziland WZ SZ),
|
182
|
+
%w(Sweden SW SE),
|
183
|
+
%w(Switzerland SZ CH),
|
184
|
+
%w(Tajikistan TI TJ),
|
187
185
|
["Timor-Leste", "TT", "TL"],
|
188
|
-
|
189
|
-
|
190
|
-
|
186
|
+
%w(Togo TO TG),
|
187
|
+
%w(Tokelau TL TK),
|
188
|
+
%w(Tonga TN TO),
|
191
189
|
["Trinidad and Tobago", "TD", "TT"],
|
192
|
-
|
193
|
-
|
194
|
-
|
190
|
+
%w(Tunisia TS TN),
|
191
|
+
%w(Turkey TU TR),
|
192
|
+
%w(Turkmenistan TX TM),
|
195
193
|
["Turks and Caicos Islands", "TK", "TC"],
|
196
|
-
|
194
|
+
%w(Ukraine UP UA),
|
197
195
|
["United Kingdom", "UK", "GB"],
|
198
|
-
|
196
|
+
%w(Vanuatu NH VU),
|
199
197
|
["Viet Nam", "VM", "VN"],
|
200
198
|
["Virgin Islands, British", "VI", "VG"],
|
201
199
|
["Virgin Islands, U.S.", "VQ", "VI"],
|
202
200
|
["Western Sahara", "WI", "EH"],
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
["United States", "USA", "US"]
|
201
|
+
%w(Yemen YM YE),
|
202
|
+
%w(Zambia ZA ZM),
|
203
|
+
%w(Zimbabwe ZI ZW),
|
204
|
+
["United States", "USA", "US"]
|
207
205
|
]
|
208
206
|
|
209
207
|
addresses_to_update = []
|
210
208
|
|
211
209
|
# e.g. convert AS -> AU and Australia -> AU
|
212
|
-
# SELECT "addresses".* FROM "addresses"
|
210
|
+
# SELECT "addresses".* FROM "addresses"
|
213
211
|
# WHERE (("addresses"."country" = 'AU' OR "addresses"."country" = 'Australia'))
|
214
|
-
convert_table.each
|
215
|
-
t=Address.arel_table
|
212
|
+
convert_table.each do |ct|
|
213
|
+
t = Address.arel_table
|
216
214
|
scope = t[:country].eq(ct[0]) # Australia
|
217
215
|
scope = scope.or(t[:country].eq(ct[1])) # AU
|
218
216
|
|
219
217
|
tmp = Address.where(scope)
|
220
|
-
tmp.map{ |t| t.country=ct[2] }
|
221
|
-
|
218
|
+
tmp.map { |t| t.country = ct[2] }
|
219
|
+
|
222
220
|
unless tmp.blank?
|
223
221
|
addresses_to_update << tmp
|
224
222
|
end
|
225
|
-
|
223
|
+
end
|
226
224
|
|
227
225
|
Address.transaction do
|
228
226
|
begin
|
229
|
-
addresses_to_update.each
|
230
|
-
address_arr.each
|
231
|
-
|
232
|
-
}
|
233
|
-
}
|
227
|
+
addresses_to_update.each do |address_arr|
|
228
|
+
address_arr.each(&:save!)
|
229
|
+
end
|
234
230
|
Setting.have_run_country_migration = true
|
235
231
|
rescue Exception => e
|
236
232
|
ActiveRecord::Rollback
|
237
233
|
puts e
|
238
234
|
end
|
239
235
|
end
|
240
|
-
|
241
236
|
end
|
242
237
|
end
|
243
|
-
|
244
238
|
end
|