fat_free_crm 0.15.0.beta.2 → 0.15.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/.docker/nginx/sites-enabled/ffcrm.conf +8 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +4 -1
- data/.rubocop_todo.yml +190 -89
- data/.travis.yml +10 -3
- data/CHANGELOG.md +27 -0
- data/{CONTRIBUTORS → CONTRIBUTORS.md} +2 -1
- data/Dockerfile +15 -13
- data/Gemfile +7 -4
- data/Gemfile.lock +200 -167
- data/README.md +4 -2
- data/app/assets/javascripts/crm_sortable.js.coffee +5 -0
- data/app/assets/javascripts/timeago.js.coffee +5 -0
- data/app/assets/stylesheets/about.css.scss +5 -0
- data/app/assets/stylesheets/common.scss +2 -1
- data/app/controllers/admin/fields_controller.rb +1 -1
- data/app/controllers/admin/groups_controller.rb +5 -1
- data/app/controllers/admin/tags_controller.rb +1 -1
- data/app/controllers/admin/users_controller.rb +10 -6
- data/app/controllers/application_controller.rb +13 -13
- data/app/controllers/authentications_controller.rb +2 -2
- data/app/controllers/comments_controller.rb +3 -2
- data/app/controllers/entities/contacts_controller.rb +9 -7
- data/app/controllers/entities/opportunities_controller.rb +1 -1
- data/app/controllers/entities_controller.rb +4 -4
- data/app/controllers/home_controller.rb +9 -9
- data/app/controllers/passwords_controller.rb +1 -1
- data/app/controllers/tasks_controller.rb +2 -1
- data/app/controllers/users_controller.rb +4 -2
- data/app/helpers/application_helper.rb +9 -9
- data/app/helpers/javascript_helper.rb +5 -0
- data/app/helpers/opportunities_helper.rb +1 -1
- data/app/helpers/remote_link_pagination_helper.rb +5 -0
- data/app/inputs/date_pair_input.rb +1 -1
- data/app/models/entities/account.rb +2 -2
- data/app/models/entities/account_contact.rb +1 -1
- data/app/models/entities/campaign.rb +3 -3
- data/app/models/entities/contact.rb +3 -3
- data/app/models/entities/lead.rb +2 -2
- data/app/models/entities/opportunity.rb +3 -3
- data/app/models/fields/custom_field.rb +1 -1
- data/app/models/fields/custom_field_pair.rb +2 -2
- data/app/models/fields/field.rb +1 -1
- data/app/models/polymorphic/address.rb +2 -2
- data/app/models/polymorphic/avatar.rb +4 -2
- data/app/models/polymorphic/email.rb +8 -6
- data/app/models/polymorphic/task.rb +3 -1
- data/app/models/polymorphic/version.rb +3 -3
- data/app/models/users/ability.rb +1 -1
- data/app/models/users/permission.rb +2 -0
- data/app/models/users/user.rb +2 -2
- data/app/views/accounts/index.js.haml +1 -1
- data/app/views/admin/fields/_sort_by.html.haml +1 -1
- data/app/views/admin/users/_user.html.haml +1 -1
- data/app/views/campaigns/index.js.haml +1 -1
- data/app/views/contacts/index.js.haml +1 -1
- data/app/views/entities/_basic_search.html.haml +1 -1
- data/app/views/home/_duration_menu.html.haml +1 -1
- data/app/views/home/_events_menu.html.haml +1 -1
- data/app/views/home/_users_menu.html.haml +1 -1
- data/app/views/layouts/application.html.haml +1 -1
- data/app/views/leads/index.js.haml +1 -1
- data/app/views/opportunities/index.js.haml +1 -1
- data/app/views/shared/_naming.html.haml +1 -1
- data/app/views/users/_languages.html.haml +1 -1
- data/config/application.rb +2 -3
- data/config/boot.rb +2 -0
- data/config/deploy.example.rb +1 -1
- data/config/environments/development.rb +2 -0
- data/config/environments/production.rb +1 -1
- data/config/environments/test.rb +2 -2
- data/config/initializers/assets.rb +6 -1
- data/config/initializers/backtrace_silencers.rb +5 -0
- data/config/initializers/constants.rb +1 -1
- data/config/initializers/cookies_serializer.rb +5 -0
- data/config/initializers/custom_field_ransack_translations.rb +5 -0
- data/config/initializers/filter_parameter_logging.rb +5 -0
- data/config/initializers/inflections.rb +5 -0
- data/config/initializers/paper_trail.rb +5 -0
- data/config/initializers/ransack.rb +3 -3
- data/config/initializers/session_store.rb +5 -0
- data/config/initializers/wrap_parameters.rb +5 -0
- data/config/locales/et.yml +207 -0
- data/config/locales/et_fat_free_crm.yml +928 -0
- data/config/locales/pt-BR_ransack.yml +81 -0
- data/config/locales/th.rb +1 -1
- data/config/routes.rb +18 -18
- data/db/migrate/20100928030598_create_sessions.rb +1 -1
- data/db/migrate/20100928030599_create_users.rb +2 -2
- data/db/migrate/20100928030600_create_openid_tables.rb +1 -1
- data/db/migrate/20100928030601_create_accounts.rb +2 -2
- data/db/migrate/20100928030602_create_permissions.rb +1 -1
- data/db/migrate/20100928030603_create_settings.rb +1 -1
- data/db/migrate/20100928030604_create_preferences.rb +2 -2
- data/db/migrate/20100928030605_create_campaigns.rb +2 -2
- data/db/migrate/20100928030606_create_leads.rb +2 -2
- data/db/migrate/20100928030607_create_contacts.rb +2 -2
- data/db/migrate/20100928030608_create_opportunities.rb +2 -2
- data/db/migrate/20100928030609_create_account_contacts.rb +1 -1
- data/db/migrate/20100928030610_create_account_opportunities.rb +1 -1
- data/db/migrate/20100928030611_create_contact_opportunities.rb +1 -1
- data/db/migrate/20100928030612_create_tasks.rb +2 -2
- data/db/migrate/20100928030613_create_comments.rb +1 -1
- data/db/migrate/20100928030614_create_activities.rb +1 -1
- data/db/migrate/20100928030615_create_avatars.rb +1 -1
- data/db/migrate/20100928030616_rename_remember_token.rb +1 -1
- data/db/migrate/20100928030617_drop_openid_tables.rb +1 -1
- data/db/migrate/20100928030618_add_admin_to_users.rb +1 -1
- data/db/migrate/20100928030619_add_suspended_to_users.rb +1 -1
- data/db/migrate/20100928030620_remove_uuid.rb +2 -2
- data/db/migrate/20100928030621_add_email_to_accounts.rb +1 -1
- data/db/migrate/20100928030622_add_background_info_to_models.rb +1 -1
- data/db/migrate/20100928030623_create_addresses.rb +2 -2
- data/db/migrate/20100928030624_add_index_on_permissions.rb +3 -3
- data/db/migrate/20100928030625_create_emails.rb +2 -2
- data/db/migrate/20100928030626_add_state_to_timeline_objects.rb +1 -1
- data/db/migrate/20100928030627_acts_as_taggable_on_migration.rb +2 -2
- data/db/migrate/20101221123456_add_single_access_token_to_users.rb +1 -1
- data/db/migrate/20101221345678_add_rating_and_category_to_accounts.rb +1 -1
- data/db/migrate/20110719082054_add_skype_to_contacts_and_leads.rb +1 -1
- data/db/migrate/20111101083437_create_fields.rb +1 -1
- data/db/migrate/20111101090312_create_field_groups.rb +1 -1
- data/db/migrate/20111116091952_add_field_groups_tag_id.rb +1 -1
- data/db/migrate/20111117041311_change_fields_collection_to_text.rb +1 -1
- data/db/migrate/20111201030535_add_field_groups_klass_name.rb +2 -2
- data/db/migrate/20120121054235_create_lists.rb +1 -1
- data/db/migrate/20120216031616_create_versions.rb +3 -3
- data/db/migrate/20120216042541_is_paranoid_to_paper_trail.rb +1 -1
- data/db/migrate/20120220233724_add_versions_object_changes.rb +1 -1
- data/db/migrate/20120224073107_remove_default_value_and_clear_settings.rb +1 -1
- data/db/migrate/20120309070209_add_versions_related.rb +1 -1
- data/db/migrate/20120314080441_add_subscribed_users_to_entities.rb +2 -2
- data/db/migrate/20120316045804_activities_to_versions.rb +1 -1
- data/db/migrate/20120405080727_change_subscribed_users_to_set.rb +1 -1
- data/db/migrate/20120405080742_change_further_subscribed_users_to_set.rb +2 -2
- data/db/migrate/20120406082136_create_groups.rb +2 -2
- data/db/migrate/20120413034923_add_index_on_versions_item_type.rb +1 -1
- data/db/migrate/20120510025219_add_not_null_constraints_for_timestamp_columns.rb +3 -3
- data/db/migrate/20120528102124_increase_length_of_version_events.rb +1 -1
- data/db/migrate/20120801032706_add_pair_id_to_fields.rb +1 -1
- data/db/migrate/20121003063155_add_settings_to_custom_fields.rb +1 -1
- data/db/migrate/20121221033947_fix_country_mapping.rb +1 -1
- data/db/migrate/20131207033244_add_user_id_to_lists.rb +1 -1
- data/db/migrate/20140916011927_add_created_at_index_on_versions.rb +1 -1
- data/db/migrate/20140916012922_add_indexes_to_model_associations.rb +3 -3
- data/db/migrate/20141126031837_increase_email_to254_chars.rb +1 -1
- data/db/migrate/20141230021159_add_transaction_id_column_to_versions.rb +1 -1
- data/db/migrate/20141230205453_add_missing_unique_indices.acts_as_taggable_on_engine.rb +4 -4
- data/db/migrate/20141230205454_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +1 -1
- data/db/migrate/20141230205455_add_missing_taggable_index.acts_as_taggable_on_engine.rb +3 -3
- data/db/migrate/20150123060900_convert_radio_to_radio_buttons.rb +1 -1
- data/db/migrate/20150227123054_remove_last_request_at_from_users.rb +1 -1
- data/db/migrate/20150427131956_create_index_related_type.rb +3 -3
- data/db/migrate/20160511053730_add_account_contacts_index.rb +2 -2
- data/docker-compose.yml +17 -13
- data/fat_free_crm.gemspec +4 -6
- data/lib/development_tasks/license.rake +12 -9
- data/lib/fat_free_crm/callback.rb +4 -4
- data/lib/fat_free_crm/engine.rb +2 -2
- data/lib/fat_free_crm/exportable.rb +2 -2
- data/lib/fat_free_crm/fields.rb +2 -4
- data/lib/fat_free_crm/gem_ext.rb +0 -1
- data/lib/fat_free_crm/gem_ext/rake/task.rb +2 -0
- data/lib/fat_free_crm/mail_processor/base.rb +4 -4
- data/lib/fat_free_crm/mail_processor/dropbox.rb +1 -1
- data/lib/fat_free_crm/permissions.rb +5 -5
- data/lib/fat_free_crm/sortable.rb +1 -1
- data/lib/fat_free_crm/version.rb +1 -1
- data/lib/gravatar_image_tag.rb +1 -0
- data/lib/tasks/ffcrm/demo.rake +2 -2
- data/spec/controllers/admin/users_controller_spec.rb +25 -25
- data/spec/controllers/authentications_controller_spec.rb +9 -9
- data/spec/controllers/comments_controller_spec.rb +15 -15
- data/spec/controllers/emails_controller_spec.rb +2 -2
- data/spec/controllers/entities/accounts_controller_spec.rb +46 -46
- data/spec/controllers/entities/campaigns_controller_spec.rb +46 -46
- data/spec/controllers/entities/contacts_controller_spec.rb +55 -55
- data/spec/controllers/entities/leads_controller_spec.rb +85 -85
- data/spec/controllers/entities/opportunities_controller_spec.rb +74 -74
- data/spec/controllers/home_controller_spec.rb +11 -11
- data/spec/controllers/passwords_controller_spec.rb +2 -2
- data/spec/controllers/tasks_controller_spec.rb +37 -37
- data/spec/controllers/users_controller_spec.rb +31 -31
- data/spec/factories/campaign_factories.rb +1 -1
- data/spec/factories/contact_factories.rb +1 -1
- data/spec/factories/field_factories.rb +1 -1
- data/spec/factories/lead_factories.rb +2 -2
- data/spec/factories/opportunity_factories.rb +3 -3
- data/spec/factories/shared_factories.rb +1 -1
- data/spec/factories/task_factories.rb +1 -1
- data/spec/features/support/browser.rb +9 -1
- data/spec/lib/fields_spec.rb +2 -2
- data/spec/lib/permissions_spec.rb +38 -6
- data/spec/lib/view_factory_spec.rb +2 -2
- data/spec/models/fields/custom_field_spec.rb +3 -3
- data/spec/models/observers/entity_observer_spec.rb +1 -1
- data/spec/models/polymorphic/version_spec.rb +11 -11
- data/spec/models/users/abilities/user_ability_spec.rb +8 -3
- data/spec/models/users/permission_spec.rb +8 -0
- data/spec/models/users/user_spec.rb +1 -1
- data/spec/shared/controllers.rb +10 -10
- data/spec/spec_helper.rb +1 -1
- data/spec/views/accounts/index.haml_spec.rb +1 -1
- data/spec/views/accounts/update.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/update.js.haml_spec.rb +2 -2
- data/spec/views/application/auto_complete.haml_spec.rb +1 -1
- data/spec/views/campaigns/index.haml_spec.rb +1 -1
- data/spec/views/campaigns/update.js.haml_spec.rb +2 -2
- data/spec/views/contacts/index.haml_spec.rb +1 -1
- data/spec/views/contacts/update.js.haml_spec.rb +2 -2
- data/spec/views/home/options.js.haml_spec.rb +1 -1
- data/spec/views/leads/index.haml_spec.rb +1 -1
- data/spec/views/leads/promote.js.haml_spec.rb +2 -2
- data/spec/views/leads/update.js.haml_spec.rb +2 -2
- data/spec/views/opportunities/index.haml_spec.rb +1 -1
- data/spec/views/opportunities/update.js.haml_spec.rb +1 -1
- data/spec/views/tasks/_edit.haml_spec.rb +2 -2
- data/spec/views/tasks/create.js.haml_spec.rb +2 -2
- data/spec/views/tasks/edit.js.haml_spec.rb +1 -1
- data/spec/views/users/change_password.js.haml_spec.rb +2 -2
- data/spec/views/users/update.js.haml_spec.rb +2 -2
- data/spec/views/users/upload_avatar.js.haml_spec.rb +2 -2
- metadata +17 -20
- data/lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb +0 -27
data/fat_free_crm.gemspec
CHANGED
@@ -20,10 +20,9 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.required_ruby_version = '>= 2.0.0'
|
21
21
|
gem.license = 'MIT'
|
22
22
|
|
23
|
-
gem.add_dependency 'rails', '~>
|
23
|
+
gem.add_dependency 'rails', '~> 5.0.0'
|
24
24
|
gem.add_dependency 'rails-observers'
|
25
|
-
|
26
|
-
gem.add_dependency 'sprockets-rails', '2.2.2'
|
25
|
+
gem.add_dependency 'sprockets-rails', '>= 3.0.0'
|
27
26
|
gem.add_dependency 'responders', '~> 2.0'
|
28
27
|
gem.add_dependency 'jquery-rails'
|
29
28
|
gem.add_dependency 'jquery-migrate-rails'
|
@@ -35,7 +34,7 @@ Gem::Specification.new do |gem|
|
|
35
34
|
# Manually added paperclip gem dependency "cocaine" in order to fix load error: "no such file to load -- cocaine"
|
36
35
|
gem.add_dependency 'cocaine'
|
37
36
|
gem.add_dependency 'paper_trail', '~> 6.0.0'
|
38
|
-
gem.add_dependency 'authlogic', '>= 3.4.4'
|
37
|
+
gem.add_dependency 'authlogic', '>= 3.4.4'
|
39
38
|
gem.add_dependency 'acts_as_commentable'
|
40
39
|
gem.add_dependency 'acts-as-taggable-on', '>= 3.4.3'
|
41
40
|
gem.add_dependency 'dynamic_form'
|
@@ -49,7 +48,6 @@ Gem::Specification.new do |gem|
|
|
49
48
|
gem.add_dependency 'nokogiri'
|
50
49
|
gem.add_dependency 'responds_to_parent'
|
51
50
|
gem.add_dependency 'rails3-jquery-autocomplete'
|
52
|
-
gem.add_dependency 'psych', '~> 1' if RUBY_VERSION.to_f < 2.0
|
53
51
|
gem.add_dependency 'thor'
|
54
52
|
gem.add_dependency 'rails_autolink'
|
55
53
|
gem.add_dependency 'coffee-script-source', '~> 1.8', '>= 1.8.0' # pegged until https://github.com/jashkenas/coffeescript/issues/3829 is resolved
|
@@ -58,6 +56,6 @@ Gem::Specification.new do |gem|
|
|
58
56
|
# FatFreeCRM has released it's own versions of the following gems:
|
59
57
|
#-----------------------------------------------------------------
|
60
58
|
gem.add_dependency 'ransack_ui', '~> 1.3', '>= 1.3.1'
|
61
|
-
gem.add_dependency 'ransack', '~> 1.
|
59
|
+
gem.add_dependency 'ransack', '~> 1.7', '>= 1.6.2'
|
62
60
|
gem.add_dependency 'email_reply_parser_ffcrm'
|
63
61
|
end
|
@@ -22,11 +22,13 @@ namespace :license do
|
|
22
22
|
],
|
23
23
|
js: [
|
24
24
|
"app/assets/javascripts/**/*.js",
|
25
|
+
"app/assets/javascripts/**/*.js.erb",
|
25
26
|
"app/assets/stylesheets/**/*.sass", # Sass also uses javascript style comments
|
26
27
|
"app/assets/stylesheets/**/*.scss"
|
27
28
|
],
|
28
29
|
css: [
|
29
|
-
"app/assets/stylesheets/**/*.css"
|
30
|
+
"app/assets/stylesheets/**/*.css",
|
31
|
+
"app/assets/stylesheets/**/*.css.erb"
|
30
32
|
] }
|
31
33
|
|
32
34
|
LICENSE_RB = %{# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
@@ -37,12 +39,11 @@ namespace :license do
|
|
37
39
|
}
|
38
40
|
LICENSES = { ruby: LICENSE_RB,
|
39
41
|
js: LICENSE_RB.gsub(/^#/, "//"),
|
40
|
-
css: LICENSE_RB.gsub(
|
41
|
-
.gsub(/^#/, " \*").sub(/---\n/, "---\n */") }
|
42
|
+
css: "/*\n" + LICENSE_RB.gsub(/^#/, ' *').sub(/---\n/, "---\n */\n") }
|
42
43
|
|
43
|
-
REGEXPS = { ruby: /^#
|
44
|
-
js: /^\/\/
|
45
|
-
css: /^\/\*\n \*
|
44
|
+
REGEXPS = { ruby: /^# Copyright \(c\).*?\n(?:#.*\n)*?#-{10}-*\n/,
|
45
|
+
js: /^\/\/ Copyright \(c\).*?\n(?:\/\/.*\n)*?\/\/-{10}-*\n/,
|
46
|
+
css: /^\/\*\n \* Copyright \(c\).*?\n(?: \*.*\n)*? \*-{10}-*\n \*\/\n/ }
|
46
47
|
|
47
48
|
def expand_globs(globs)
|
48
49
|
globs.map { |f| Dir.glob(f) }.flatten.uniq
|
@@ -52,11 +53,13 @@ namespace :license do
|
|
52
53
|
task :add do
|
53
54
|
FILES.each do |lang, globs|
|
54
55
|
expand_globs(globs).each do |file|
|
55
|
-
puts "== Adding license to '#{file}'..."
|
56
56
|
old_content = File.read(file)
|
57
57
|
new_content = LICENSES[lang] + old_content.sub(REGEXPS[lang], '')
|
58
58
|
|
59
|
-
|
59
|
+
if new_content != old_content
|
60
|
+
File.open(file, "wb") { |f| f.puts new_content }
|
61
|
+
puts "== Added license to #{file}"
|
62
|
+
end
|
60
63
|
end
|
61
64
|
end
|
62
65
|
end
|
@@ -69,7 +72,7 @@ namespace :license do
|
|
69
72
|
new_content = old_content.sub(REGEXPS[lang], '')
|
70
73
|
if new_content != old_content
|
71
74
|
File.open(file, "wb") { |f| f.puts new_content }
|
72
|
-
puts "Removed license from
|
75
|
+
puts "== Removed license from #{file}"
|
73
76
|
end
|
74
77
|
end
|
75
78
|
end
|
@@ -98,7 +98,7 @@ module FatFreeCRM
|
|
98
98
|
add_view_hook(hook, proc { "" }, :replace)
|
99
99
|
end
|
100
100
|
end
|
101
|
-
end
|
101
|
+
end
|
102
102
|
|
103
103
|
# This makes it possible to call hook() without FatFreeCRM::Callback prefix.
|
104
104
|
# Returns stringified data when called from within templates, and the actual
|
@@ -137,9 +137,9 @@ module FatFreeCRM
|
|
137
137
|
FatFreeCRM::Callback.hook(method, caller, context)
|
138
138
|
end
|
139
139
|
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
143
|
|
144
144
|
ActionView::Base.send(:include, FatFreeCRM::Callback::Helper)
|
145
145
|
ActionController::Base.send(:include, FatFreeCRM::Callback::Helper)
|
data/lib/fat_free_crm/engine.rb
CHANGED
@@ -8,8 +8,8 @@ module FatFreeCRM
|
|
8
8
|
config.autoload_paths += Dir[root.join("app/models/**")] +
|
9
9
|
Dir[root.join("app/controllers/entities")]
|
10
10
|
|
11
|
-
config.active_record.observers = [
|
12
|
-
|
11
|
+
config.active_record.observers = %i[lead_observer opportunity_observer
|
12
|
+
task_observer entity_observer]
|
13
13
|
|
14
14
|
initializer "model_core.factories", after: "factory_girl.set_factory_paths" do
|
15
15
|
FactoryGirl.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryGirl)
|
data/lib/fat_free_crm/fields.rb
CHANGED
@@ -22,7 +22,7 @@ module FatFreeCRM
|
|
22
22
|
|
23
23
|
module SingletonMethods
|
24
24
|
def field_groups
|
25
|
-
if ActiveRecord::Base.connection.
|
25
|
+
if ActiveRecord::Base.connection.data_source_exists? 'field_groups'
|
26
26
|
FieldGroup.where(klass_name: name).order(:position)
|
27
27
|
else
|
28
28
|
[]
|
@@ -35,9 +35,7 @@ module FatFreeCRM
|
|
35
35
|
|
36
36
|
def serialize_custom_fields!
|
37
37
|
fields.each do |field|
|
38
|
-
|
39
|
-
serialize(field.name.to_sym, Array)
|
40
|
-
end
|
38
|
+
serialize(field.name.to_sym, Array) if field.as == 'check_boxes'
|
41
39
|
end
|
42
40
|
end
|
43
41
|
|
data/lib/fat_free_crm/gem_ext.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
4
4
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
5
5
|
#------------------------------------------------------------------------------
|
6
|
-
require "fat_free_crm/gem_ext/active_record/schema_dumper"
|
7
6
|
require "fat_free_crm/gem_ext/active_support/buffered_logger"
|
8
7
|
require "fat_free_crm/gem_ext/action_controller/base"
|
9
8
|
require "fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper"
|
@@ -3,6 +3,8 @@
|
|
3
3
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
4
4
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
5
5
|
#------------------------------------------------------------------------------
|
6
|
+
require 'rake/task'
|
7
|
+
|
6
8
|
module Rake
|
7
9
|
Task.class_eval do
|
8
10
|
# Removes a Rake task
|
@@ -12,7 +12,7 @@ require 'nokogiri'
|
|
12
12
|
module FatFreeCRM
|
13
13
|
module MailProcessor
|
14
14
|
class Base
|
15
|
-
KEYWORDS = %w
|
15
|
+
KEYWORDS = %w[account campaign contact lead opportunity].freeze
|
16
16
|
|
17
17
|
#--------------------------------------------------------------------------------------
|
18
18
|
def initialize
|
@@ -94,7 +94,7 @@ module FatFreeCRM
|
|
94
94
|
|
95
95
|
#--------------------------------------------------------------------------------------
|
96
96
|
def with_new_emails
|
97
|
-
@imap.uid_search(%w
|
97
|
+
@imap.uid_search(%w[NOT SEEN]).each do |uid|
|
98
98
|
begin
|
99
99
|
email = Mail.new(@imap.uid_fetch(uid, 'RFC822').first.attr['RFC822'])
|
100
100
|
log "fetched new message...", email
|
@@ -104,7 +104,7 @@ module FatFreeCRM
|
|
104
104
|
discard(uid)
|
105
105
|
end
|
106
106
|
rescue Exception => e
|
107
|
-
if %w
|
107
|
+
if %w[test development].include?(Rails.env)
|
108
108
|
$stderr.puts e
|
109
109
|
$stderr.puts e.backtrace
|
110
110
|
end
|
@@ -184,7 +184,7 @@ module FatFreeCRM
|
|
184
184
|
# Centralized logging.
|
185
185
|
#--------------------------------------------------------------------------------------
|
186
186
|
def log(message, email = nil)
|
187
|
-
unless %w
|
187
|
+
unless %w[test cucumber].include?(Rails.env)
|
188
188
|
klass = self.class.to_s.split("::").last
|
189
189
|
klass << " [Dry Run]" if @dry_run
|
190
190
|
puts "[#{Time.now.rfc822}] #{klass}: #{message}"
|
@@ -8,7 +8,7 @@ require 'fat_free_crm/mail_processor/base'
|
|
8
8
|
module FatFreeCRM
|
9
9
|
module MailProcessor
|
10
10
|
class Dropbox < Base
|
11
|
-
KEYWORDS = %w
|
11
|
+
KEYWORDS = %w[account campaign contact lead opportunity].freeze
|
12
12
|
|
13
13
|
#--------------------------------------------------------------------------------------
|
14
14
|
def initialize
|
@@ -33,7 +33,7 @@ module FatFreeCRM
|
|
33
33
|
module InstanceMethods
|
34
34
|
# Save shared permissions to the model, if any.
|
35
35
|
#--------------------------------------------------------------------------
|
36
|
-
%w
|
36
|
+
%w[group user].each do |model|
|
37
37
|
class_eval %{
|
38
38
|
|
39
39
|
def #{model}_ids=(value)
|
@@ -44,7 +44,7 @@ module FatFreeCRM
|
|
44
44
|
permissions_to_remove = Permission.where(
|
45
45
|
#{model}_id: self.#{model}_ids - value,
|
46
46
|
asset_id: self.id,
|
47
|
-
asset_type: self.class
|
47
|
+
asset_type: self.class.name
|
48
48
|
)
|
49
49
|
permissions_to_remove.each {|p| (permissions.delete(p); p.destroy)}
|
50
50
|
(value - self.#{model}_ids).each {|id| permissions.build(:#{model}_id => id)}
|
@@ -69,7 +69,7 @@ module FatFreeCRM
|
|
69
69
|
def remove_permissions
|
70
70
|
# we don't use dependent => :destroy so must manually remove
|
71
71
|
if id && self.class
|
72
|
-
permissions_to_remove = Permission.where(asset_id: id, asset_type: self.class.
|
72
|
+
permissions_to_remove = Permission.where(asset_id: id, asset_type: self.class.name).to_a
|
73
73
|
else
|
74
74
|
permissions_to_remove = []
|
75
75
|
end
|
@@ -103,7 +103,7 @@ module FatFreeCRM
|
|
103
103
|
|
104
104
|
module SingletonMethods
|
105
105
|
end
|
106
|
-
end
|
107
|
-
end
|
106
|
+
end
|
107
|
+
end
|
108
108
|
|
109
109
|
ActiveRecord::Base.send(:include, FatFreeCRM::Permissions)
|
data/lib/fat_free_crm/version.rb
CHANGED
data/lib/gravatar_image_tag.rb
CHANGED
@@ -22,6 +22,7 @@ module GravatarImageTag
|
|
22
22
|
|
23
23
|
module InstanceMethods
|
24
24
|
def gravatar_image_tag(email, options = {})
|
25
|
+
raise ArgumentError, "Options must be a hash, got #{options.inspect}" unless options.is_a? Hash
|
25
26
|
options[:alt] ||= 'Gravatar'
|
26
27
|
image_tag(GravatarImageTag.gravatar_url(email, options.delete(:gravatar)), options)
|
27
28
|
end
|
data/lib/tasks/ffcrm/demo.rake
CHANGED
@@ -10,7 +10,7 @@ namespace :ffcrm do
|
|
10
10
|
# Load fixtures
|
11
11
|
require 'active_record/fixtures'
|
12
12
|
Dir.glob(FatFreeCRM.root.join('db', 'demo', '*.{yml,csv}')).each do |fixture_file|
|
13
|
-
ActiveRecord::
|
13
|
+
ActiveRecord::FixtureSet.create_fixtures(FatFreeCRM.root.join('db/demo'), File.basename(fixture_file, '.*'))
|
14
14
|
end
|
15
15
|
|
16
16
|
def create_version(options)
|
@@ -22,7 +22,7 @@ namespace :ffcrm do
|
|
22
22
|
# Simulate random user activities.
|
23
23
|
$stdout.sync = true
|
24
24
|
puts "Generating user activities..."
|
25
|
-
%w
|
25
|
+
%w[Account Address Campaign Comment Contact Email Lead Opportunity Task].map do |model|
|
26
26
|
model.constantize.all
|
27
27
|
end.flatten.each do |item|
|
28
28
|
user = if item.respond_to?(:user)
|
@@ -28,7 +28,7 @@ describe Admin::UsersController do
|
|
28
28
|
@amy = FactoryGirl.create(:user, username: "amy_anderson")
|
29
29
|
@bob = FactoryGirl.create(:user, username: "bob_builder")
|
30
30
|
|
31
|
-
get :index, query: "amy_anderson"
|
31
|
+
get :index, params: { query: "amy_anderson" }
|
32
32
|
expect(assigns[:users]).to eq([@amy])
|
33
33
|
expect(assigns[:current_query]).to eq("amy_anderson")
|
34
34
|
expect(session[:users_current_query]).to eq("amy_anderson")
|
@@ -42,7 +42,7 @@ describe Admin::UsersController do
|
|
42
42
|
it "assigns the requested user as @user and renders [show] template" do
|
43
43
|
@user = FactoryGirl.create(:user)
|
44
44
|
|
45
|
-
get :show, id: @user.id
|
45
|
+
get :show, params: { id: @user.id }
|
46
46
|
expect(assigns[:user]).to eq(@user)
|
47
47
|
expect(response).to render_template("admin/users/show")
|
48
48
|
end
|
@@ -53,7 +53,7 @@ describe Admin::UsersController do
|
|
53
53
|
#----------------------------------------------------------------------------
|
54
54
|
describe "GET new" do
|
55
55
|
it "assigns a new user as @user and renders [new] template" do
|
56
|
-
|
56
|
+
get :new, xhr: true
|
57
57
|
expect(assigns[:user]).to be_new_record
|
58
58
|
expect(response).to render_template("admin/users/new")
|
59
59
|
end
|
@@ -65,7 +65,7 @@ describe Admin::UsersController do
|
|
65
65
|
it "assigns the requested user as @user and renders [edit] template" do
|
66
66
|
@user = FactoryGirl.create(:user)
|
67
67
|
|
68
|
-
|
68
|
+
get :edit, params: { id: @user.id }, xhr: true
|
69
69
|
expect(assigns[:user]).to eq(@user)
|
70
70
|
expect(assigns[:previous]).to eq(nil)
|
71
71
|
expect(response).to render_template("admin/users/edit")
|
@@ -75,7 +75,7 @@ describe Admin::UsersController do
|
|
75
75
|
@user = FactoryGirl.create(:user)
|
76
76
|
@previous = FactoryGirl.create(:user)
|
77
77
|
|
78
|
-
|
78
|
+
get :edit, params: { id: @user.id, previous: @previous.id }, xhr: true
|
79
79
|
expect(assigns[:previous]).to eq(@previous)
|
80
80
|
end
|
81
81
|
|
@@ -83,7 +83,7 @@ describe Admin::UsersController do
|
|
83
83
|
@user = FactoryGirl.create(:user)
|
84
84
|
@user.destroy
|
85
85
|
|
86
|
-
|
86
|
+
get :edit, params: { id: @user.id }, xhr: true
|
87
87
|
expect(flash[:warning]).not_to eq(nil)
|
88
88
|
expect(response.body).to eq("window.location.reload();")
|
89
89
|
end
|
@@ -93,7 +93,7 @@ describe Admin::UsersController do
|
|
93
93
|
@previous = FactoryGirl.create(:user)
|
94
94
|
@previous.destroy
|
95
95
|
|
96
|
-
|
96
|
+
get :edit, params: { id: @user.id, previous: @previous.id }, xhr: true
|
97
97
|
expect(flash[:warning]).to eq(nil) # no warning, just silently remove the div
|
98
98
|
expect(assigns[:previous]).to eq(@previous.id)
|
99
99
|
expect(response).to render_template("admin/users/edit")
|
@@ -115,19 +115,19 @@ describe Admin::UsersController do
|
|
115
115
|
@user = FactoryGirl.build(:user, username: @username, email: @email)
|
116
116
|
allow(User).to receive(:new).and_return(@user)
|
117
117
|
|
118
|
-
|
118
|
+
post :create, params: { user: { username: @username, email: @email, password: @password, password_confirmation: @password } }, xhr: true
|
119
119
|
expect(assigns[:user]).to eq(@user)
|
120
120
|
expect(response).to render_template("admin/users/create")
|
121
121
|
end
|
122
122
|
|
123
123
|
it "creates admin user when requested so" do
|
124
|
-
|
124
|
+
post :create, params: { user: { username: @username, email: @email, admin: "1", password: @password, password_confirmation: @password } }, xhr: true
|
125
125
|
expect(assigns[:user].admin).to eq(true)
|
126
126
|
expect(response).to render_template("admin/users/create")
|
127
127
|
end
|
128
128
|
|
129
129
|
it "doesn't create admin user unless requested so" do
|
130
|
-
|
130
|
+
post :create, params: { user: { username: @username, email: @email, admin: "0", password: @password, password_confirmation: @password } }, xhr: true
|
131
131
|
expect(assigns[:user].admin).to eq(false)
|
132
132
|
expect(response).to render_template("admin/users/create")
|
133
133
|
end
|
@@ -138,7 +138,7 @@ describe Admin::UsersController do
|
|
138
138
|
@user = FactoryGirl.build(:user, username: "", email: "")
|
139
139
|
allow(User).to receive(:new).and_return(@user)
|
140
140
|
|
141
|
-
|
141
|
+
post :create, params: { user: {} }, xhr: true
|
142
142
|
expect(assigns[:user]).to eq(@user)
|
143
143
|
expect(response).to render_template("admin/users/create")
|
144
144
|
end
|
@@ -153,7 +153,7 @@ describe Admin::UsersController do
|
|
153
153
|
it "updates the requested user, assigns it to @user, and renders [update] template" do
|
154
154
|
@user = FactoryGirl.create(:user, username: "flip", email: "flip@example.com")
|
155
155
|
|
156
|
-
|
156
|
+
put :update, params: { id: @user.id, user: { username: "flop", email: "flop@example.com" } }, xhr: true
|
157
157
|
expect(assigns[:user]).to eq(@user.reload)
|
158
158
|
expect(assigns[:user].username).to eq("flop")
|
159
159
|
expect(response).to render_template("admin/users/update")
|
@@ -163,14 +163,14 @@ describe Admin::UsersController do
|
|
163
163
|
@user = FactoryGirl.create(:user)
|
164
164
|
@user.destroy
|
165
165
|
|
166
|
-
|
166
|
+
put :update, params: { id: @user.id, user: { username: "flop", email: "flop@example.com" } }, xhr: true
|
167
167
|
expect(flash[:warning]).not_to eq(nil)
|
168
168
|
expect(response.body).to eq("window.location.reload();")
|
169
169
|
end
|
170
170
|
|
171
171
|
it "assigns admin rights when requested so" do
|
172
172
|
@user = FactoryGirl.create(:user, admin: false)
|
173
|
-
|
173
|
+
put :update, params: { id: @user.id, user: { admin: "1", username: @user.username, email: @user.email } }, xhr: true
|
174
174
|
expect(assigns[:user]).to eq(@user.reload)
|
175
175
|
expect(assigns[:user].admin).to eq(true)
|
176
176
|
expect(response).to render_template("admin/users/update")
|
@@ -178,7 +178,7 @@ describe Admin::UsersController do
|
|
178
178
|
|
179
179
|
it "revokes admin rights when requested so" do
|
180
180
|
@user = FactoryGirl.create(:user, admin: true)
|
181
|
-
|
181
|
+
put :update, params: { id: @user.id, user: { admin: "0", username: @user.username, email: @user.email } }, xhr: true
|
182
182
|
expect(assigns[:user]).to eq(@user.reload)
|
183
183
|
expect(assigns[:user].admin).to eq(false)
|
184
184
|
expect(response).to render_template("admin/users/update")
|
@@ -189,7 +189,7 @@ describe Admin::UsersController do
|
|
189
189
|
it "doesn't update the requested user, but assigns it to @user and renders [update] template" do
|
190
190
|
@user = FactoryGirl.create(:user, username: "flip", email: "flip@example.com")
|
191
191
|
|
192
|
-
|
192
|
+
put :update, params: { id: @user.id, user: {} }, xhr: true
|
193
193
|
expect(assigns[:user]).to eq(@user.reload)
|
194
194
|
expect(assigns[:user].username).to eq("flip")
|
195
195
|
expect(response).to render_template("admin/users/update")
|
@@ -203,7 +203,7 @@ describe Admin::UsersController do
|
|
203
203
|
it "assigns the requested user as @user and renders [confirm] template" do
|
204
204
|
@user = FactoryGirl.create(:user)
|
205
205
|
|
206
|
-
|
206
|
+
get :confirm, params: { id: @user.id }, xhr: true
|
207
207
|
expect(assigns[:user]).to eq(@user)
|
208
208
|
expect(response).to render_template("admin/users/confirm")
|
209
209
|
end
|
@@ -212,7 +212,7 @@ describe Admin::UsersController do
|
|
212
212
|
@user = FactoryGirl.create(:user)
|
213
213
|
@user.destroy
|
214
214
|
|
215
|
-
|
215
|
+
get :confirm, params: { id: @user.id }, xhr: true
|
216
216
|
expect(flash[:warning]).not_to eq(nil)
|
217
217
|
expect(response.body).to eq("window.location.reload();")
|
218
218
|
end
|
@@ -225,7 +225,7 @@ describe Admin::UsersController do
|
|
225
225
|
it "destroys the requested user and renders [destroy] template" do
|
226
226
|
@user = FactoryGirl.create(:user)
|
227
227
|
|
228
|
-
|
228
|
+
delete :destroy, params: { id: @user.id }, xhr: true
|
229
229
|
expect { User.find(@user.id) }.to raise_error(ActiveRecord::RecordNotFound)
|
230
230
|
expect(response).to render_template("admin/users/destroy")
|
231
231
|
end
|
@@ -234,7 +234,7 @@ describe Admin::UsersController do
|
|
234
234
|
@user = FactoryGirl.create(:user)
|
235
235
|
@account = FactoryGirl.create(:account, user: @user) # Plant artifact to prevent the user from being deleted.
|
236
236
|
|
237
|
-
|
237
|
+
delete :destroy, params: { id: @user.id }, xhr: true
|
238
238
|
expect(flash[:warning]).not_to eq(nil)
|
239
239
|
expect { User.find(@user.id) }.not_to raise_error
|
240
240
|
expect(response).to render_template("admin/users/destroy")
|
@@ -258,7 +258,7 @@ describe Admin::UsersController do
|
|
258
258
|
it "suspends the requested user" do
|
259
259
|
@user = FactoryGirl.create(:user)
|
260
260
|
|
261
|
-
|
261
|
+
put :suspend, params: { id: @user.id }, xhr: true
|
262
262
|
expect(assigns[:user].suspended?).to eq(true)
|
263
263
|
expect(response).to render_template("admin/users/suspend")
|
264
264
|
end
|
@@ -266,7 +266,7 @@ describe Admin::UsersController do
|
|
266
266
|
it "doesn't suspend current user" do
|
267
267
|
@user = current_user
|
268
268
|
|
269
|
-
|
269
|
+
put :suspend, params: { id: @user.id }, xhr: true
|
270
270
|
expect(assigns[:user].suspended?).to eq(false)
|
271
271
|
expect(response).to render_template("admin/users/suspend")
|
272
272
|
end
|
@@ -275,7 +275,7 @@ describe Admin::UsersController do
|
|
275
275
|
@user = FactoryGirl.create(:user)
|
276
276
|
@user.destroy
|
277
277
|
|
278
|
-
|
278
|
+
put :suspend, params: { id: @user.id }, xhr: true
|
279
279
|
expect(flash[:warning]).not_to eq(nil)
|
280
280
|
expect(response.body).to eq("window.location.reload();")
|
281
281
|
end
|
@@ -288,7 +288,7 @@ describe Admin::UsersController do
|
|
288
288
|
it "re-activates the requested user" do
|
289
289
|
@user = FactoryGirl.create(:user, suspended_at: Time.now.yesterday)
|
290
290
|
|
291
|
-
|
291
|
+
put :reactivate, params: { id: @user.id }, xhr: true
|
292
292
|
expect(assigns[:user].suspended?).to eq(false)
|
293
293
|
expect(response).to render_template("admin/users/reactivate")
|
294
294
|
end
|
@@ -297,7 +297,7 @@ describe Admin::UsersController do
|
|
297
297
|
@user = FactoryGirl.create(:user)
|
298
298
|
@user.destroy
|
299
299
|
|
300
|
-
|
300
|
+
put :reactivate, params: { id: @user.id }, xhr: true
|
301
301
|
expect(flash[:warning]).not_to eq(nil)
|
302
302
|
expect(response.body).to eq("window.location.reload();")
|
303
303
|
end
|