fat_free_crm 0.17.3 → 0.19.2
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 +1 -1
- data/.rubocop_todo.yml +71 -148
- data/.travis.yml +35 -14
- data/CHANGELOG.md +92 -6
- data/CONTRIBUTORS.md +96 -53
- data/Dockerfile +45 -14
- data/Gemfile +23 -13
- data/Gemfile.lock +256 -248
- data/Procfile +1 -1
- data/README.md +9 -6
- data/Rakefile +1 -1
- data/app/assets/javascripts/crm.js.coffee +3 -3
- data/app/assets/javascripts/crm_select2.js.coffee +15 -14
- data/app/assets/stylesheets/common.scss +1 -1
- data/app/controllers/admin/application_controller.rb +1 -1
- data/app/controllers/admin/field_groups_controller.rb +9 -4
- data/app/controllers/admin/fields_controller.rb +4 -4
- data/app/controllers/admin/groups_controller.rb +1 -1
- data/app/controllers/admin/tags_controller.rb +2 -4
- data/app/controllers/admin/users_controller.rb +5 -8
- data/app/controllers/application_controller.rb +22 -45
- data/app/controllers/comments_controller.rb +16 -11
- data/{config/initializers/authlogic.rb → app/controllers/confirmations_controller.rb} +4 -2
- data/app/controllers/emails_controller.rb +0 -2
- data/app/controllers/entities/accounts_controller.rb +1 -3
- data/app/controllers/entities/campaigns_controller.rb +8 -5
- data/app/controllers/entities/contacts_controller.rb +4 -24
- data/app/controllers/entities/leads_controller.rb +16 -12
- data/app/controllers/entities/opportunities_controller.rb +17 -16
- data/app/controllers/entities_controller.rb +31 -12
- data/app/controllers/home_controller.rb +2 -4
- data/app/controllers/lists_controller.rb +5 -1
- data/app/controllers/passwords_controller.rb +3 -59
- data/{spec/features/support/maintain_sessions.rb → app/controllers/registrations_controller.rb} +12 -5
- data/{lib/development_tasks/gem.rake → app/controllers/sessions_controller.rb} +6 -6
- data/app/controllers/tasks_controller.rb +22 -17
- data/app/controllers/users_controller.rb +8 -29
- data/app/helpers/accounts_helper.rb +1 -1
- data/app/helpers/admin/users_helper.rb +1 -1
- data/app/helpers/application_helper.rb +28 -33
- data/app/helpers/campaigns_helper.rb +1 -1
- data/app/helpers/contacts_helper.rb +1 -3
- data/app/helpers/leads_helper.rb +1 -1
- data/app/helpers/opportunities_helper.rb +48 -3
- data/app/helpers/tasks_helper.rb +1 -1
- data/app/helpers/users_helper.rb +1 -3
- data/{config/initializers/paper_trail.rb → app/mailers/devise_mailer.rb} +5 -1
- data/app/mailers/user_mailer.rb +0 -9
- data/app/models/entities/account.rb +10 -10
- data/app/models/entities/campaign.rb +4 -6
- data/app/models/entities/contact.rb +24 -12
- data/app/models/entities/lead.rb +7 -14
- data/app/models/entities/opportunity.rb +10 -11
- data/app/models/fields/custom_field.rb +1 -0
- data/app/models/fields/custom_field_date_pair.rb +2 -0
- data/app/models/fields/field.rb +1 -3
- data/app/models/list.rb +1 -1
- data/app/models/observers/entity_observer.rb +3 -7
- data/app/models/observers/lead_observer.rb +2 -4
- data/app/models/observers/opportunity_observer.rb +5 -7
- data/app/models/observers/task_observer.rb +1 -1
- data/app/models/polymorphic/email.rb +2 -2
- data/app/models/polymorphic/task.rb +13 -9
- data/app/models/polymorphic/version.rb +3 -2
- data/app/models/setting.rb +2 -0
- data/app/models/users/ability.rb +3 -4
- data/app/models/users/permission.rb +3 -3
- data/app/models/users/preference.rb +2 -1
- data/app/models/users/user.rb +67 -42
- data/app/views/accounts/_top_section.html.haml +1 -1
- data/app/views/accounts/edit.js.haml +1 -1
- data/app/views/accounts/update.js.haml +2 -2
- data/app/views/admin/users/_user.html.haml +4 -4
- data/app/views/campaigns/_metrics.html.haml +3 -3
- data/app/views/contacts/_index_brief.html.haml +1 -1
- data/app/views/contacts/_index_full.html.haml +1 -1
- data/app/views/contacts/_index_long.html.haml +1 -1
- data/app/views/devise/confirmations/new.html.haml +9 -0
- data/app/views/devise/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/devise/mailer/password_change.html.haml +3 -0
- data/app/views/devise/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/devise/passwords/edit.html.haml +18 -0
- data/app/views/devise/passwords/new.html.haml +10 -0
- data/app/views/devise/registrations/new.html.haml +21 -0
- data/app/views/devise/sessions/new.html.haml +32 -0
- data/app/views/home/_opportunity.html.haml +4 -19
- data/app/views/layouts/_about.html.haml +5 -5
- data/app/views/layouts/_header.html.haml +3 -3
- data/app/views/layouts/admin/_header.html.haml +1 -1
- data/app/views/opportunities/_index_long.html.haml +1 -24
- data/app/views/opportunities/_sidebar_show.html.haml +3 -3
- data/app/views/opportunities/_top_section.html.haml +1 -1
- data/app/views/shared/_address.html.haml +5 -5
- data/app/views/shared/_empty.html.haml +1 -1
- data/app/views/shared/_paginate_with_per_page.html.haml +1 -0
- data/app/views/users/_avatar.html.haml +1 -1
- data/bin/bundle +1 -1
- data/bin/rails +1 -1
- data/bin/setup +38 -0
- data/bin/update +33 -0
- data/bin/yarn +13 -0
- data/config/application.rb +8 -6
- data/config/boot.rb +1 -1
- data/config/brakeman.ignore +2 -2
- data/config/database.postgres.docker.yml +5 -5
- data/config/environment.rb +1 -1
- data/config/environments/development.rb +1 -0
- data/config/environments/test.rb +7 -0
- data/config/initializers/action_mailer.rb +1 -3
- data/config/initializers/application_controller_renderer.rb +9 -0
- data/config/initializers/assets.rb +6 -11
- data/config/initializers/backtrace_silencers.rb +0 -6
- data/config/initializers/content_security_policy.rb +26 -0
- data/config/initializers/cookies_serializer.rb +3 -6
- data/config/initializers/devise.rb +289 -0
- data/config/initializers/filter_parameter_logging.rb +0 -5
- data/config/initializers/gravatar.rb +0 -1
- data/config/initializers/inflections.rb +0 -6
- data/config/initializers/mime_types.rb +1 -9
- data/config/initializers/new_framework_defaults_5_2.rb +40 -0
- data/config/initializers/relative_url_root.rb +1 -3
- data/config/initializers/session_store.rb +1 -3
- data/config/initializers/wrap_parameters.rb +4 -9
- data/config/locales/fat_free_crm.en-GB.yml +5 -5
- data/config/locales/fat_free_crm.en-US.yml +5 -5
- data/config/locales/fat_free_crm.fr.yml +1 -1
- data/config/locales/fat_free_crm.ru.yml +1 -0
- data/config/routes.rb +20 -9
- data/db/demo/users.yml +62 -81
- data/db/migrate/20100928030620_remove_uuid.rb +1 -2
- data/db/migrate/20120316045804_activities_to_versions.rb +1 -0
- data/db/migrate/20120510025219_add_not_null_constraints_for_timestamp_columns.rb +1 -0
- data/db/migrate/20180107082701_authlogic_to_devise.rb +58 -0
- data/db/schema.rb +48 -46
- data/docker-compose.yml +10 -0
- data/fat_free_crm.gemspec +12 -14
- data/lib/development_tasks/license.rake +2 -2
- data/lib/fat_free_crm/callback.rb +2 -2
- data/lib/fat_free_crm/comment_extensions.rb +2 -4
- data/lib/fat_free_crm/core_ext/string.rb +1 -1
- data/lib/fat_free_crm/engine.rb +2 -2
- data/lib/fat_free_crm/errors.rb +1 -1
- data/lib/fat_free_crm/export_csv.rb +1 -0
- data/lib/fat_free_crm/exportable.rb +1 -1
- data/lib/fat_free_crm/fields.rb +2 -2
- data/lib/fat_free_crm/gem_dependencies.rb +1 -1
- data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +1 -3
- data/lib/fat_free_crm/i18n.rb +2 -2
- data/lib/fat_free_crm/mail_processor/base.rb +4 -10
- data/lib/fat_free_crm/mail_processor/dropbox.rb +5 -15
- data/lib/fat_free_crm/permissions.rb +7 -18
- data/lib/fat_free_crm/sortable.rb +1 -1
- data/lib/fat_free_crm/tabs.rb +2 -2
- data/lib/fat_free_crm/version.rb +2 -2
- data/lib/gravatar_image_tag.rb +7 -8
- data/lib/missing_translation_detector.rb +1 -0
- data/lib/tasks/ffcrm/missing_translations.rake +1 -0
- data/lib/tasks/ffcrm/setup.rake +13 -4
- data/lib/tasks/ffcrm/update_data.rake +2 -2
- data/script/rails +2 -2
- data/spec/controllers/admin/users_controller_spec.rb +25 -81
- data/spec/controllers/comments_controller_spec.rb +19 -19
- data/spec/controllers/emails_controller_spec.rb +2 -2
- data/spec/controllers/entities/accounts_controller_spec.rb +56 -56
- data/spec/controllers/entities/campaigns_controller_spec.rb +66 -66
- data/spec/controllers/entities/contacts_controller_spec.rb +69 -68
- data/spec/controllers/entities/leads_controller_spec.rb +126 -126
- data/spec/controllers/entities/opportunities_controller_spec.rb +101 -101
- data/spec/controllers/entities_controller_spec.rb +5 -0
- data/spec/controllers/home_controller_spec.rb +30 -30
- data/spec/controllers/tasks_controller_spec.rb +42 -40
- data/spec/controllers/users_controller_spec.rb +43 -113
- data/spec/factories/account_factories.rb +13 -13
- data/spec/factories/campaign_factories.rb +8 -8
- data/spec/factories/contact_factories.rb +18 -18
- data/spec/factories/field_factories.rb +11 -10
- data/spec/factories/lead_factories.rb +13 -13
- data/spec/factories/list_factories.rb +3 -3
- data/spec/factories/opportunity_factories.rb +9 -9
- data/spec/factories/sequences.rb +1 -1
- data/spec/factories/setting_factories.rb +5 -5
- data/spec/factories/shared_factories.rb +25 -23
- data/spec/factories/subscription_factories.rb +1 -1
- data/spec/factories/tag_factories.rb +1 -1
- data/spec/factories/task_factories.rb +11 -11
- data/spec/factories/user_factories.rb +27 -30
- data/spec/features/accounts_spec.rb +17 -4
- data/spec/features/admin/groups_spec.rb +2 -2
- data/spec/features/admin/users_spec.rb +4 -2
- data/spec/features/campaigns_spec.rb +5 -5
- data/spec/features/contacts_spec.rb +11 -5
- data/spec/features/dashboard_spec.rb +8 -8
- data/spec/features/devise/sign_in_spec.rb +58 -0
- data/spec/features/devise/sign_up_spec.rb +36 -0
- data/spec/features/leads_spec.rb +5 -5
- data/spec/features/opportunities_overview_spec.rb +16 -16
- data/spec/features/opportunities_spec.rb +35 -9
- data/spec/features/support/autocomlete_helper.rb +17 -0
- data/spec/features/support/browser.rb +5 -9
- data/spec/features/tasks_spec.rb +5 -5
- data/spec/helpers/admin/field_groups_helper_spec.rb +1 -1
- data/spec/helpers/application_helper_spec.rb +1 -1
- data/spec/helpers/tasks_helper_spec.rb +1 -1
- data/spec/helpers/users_helper_spec.rb +7 -7
- data/spec/lib/comment_extensions_spec.rb +11 -5
- data/spec/lib/errors_spec.rb +2 -2
- data/spec/lib/mail_processor/base_spec.rb +3 -3
- data/spec/lib/mail_processor/comment_replies_spec.rb +3 -3
- data/spec/lib/mail_processor/dropbox_spec.rb +17 -17
- data/spec/lib/mail_processor/sample_emails/dropbox.rb +8 -8
- data/spec/lib/permissions_spec.rb +15 -28
- data/spec/mailers/devise_mailer_spec.rb +35 -0
- data/spec/mailers/user_mailer_spec.rb +6 -32
- data/spec/models/entities/account_spec.rb +58 -32
- data/spec/models/entities/campaign_spec.rb +18 -25
- data/spec/models/entities/contact_spec.rb +113 -21
- data/spec/models/entities/lead_spec.rb +9 -11
- data/spec/models/entities/opportunity_spec.rb +45 -45
- data/spec/models/fields/custom_field_date_pair_spec.rb +4 -2
- data/spec/models/fields/custom_field_spec.rb +21 -19
- data/spec/models/list_spec.rb +2 -2
- data/spec/models/observers/entity_observer_spec.rb +7 -7
- data/spec/models/polymorphic/address_spec.rb +1 -1
- data/spec/models/polymorphic/avatar_spec.rb +5 -5
- data/spec/models/polymorphic/comment_spec.rb +5 -5
- data/spec/models/polymorphic/task_spec.rb +65 -58
- data/spec/models/polymorphic/version_spec.rb +31 -31
- data/spec/models/setting_spec.rb +2 -2
- data/spec/models/users/preference_spec.rb +6 -6
- data/spec/models/users/user_spec.rb +46 -50
- data/spec/routing/users_routing_spec.rb +30 -8
- data/spec/shared/controllers.rb +3 -9
- data/spec/shared/models.rb +22 -22
- data/spec/spec_helper.rb +12 -4
- data/spec/support/assert_select.rb +1 -0
- data/spec/support/devise_helpers.rb +28 -0
- data/spec/{features/support/helpers.rb → support/feature_helpers.rb} +11 -11
- data/spec/support/macros.rb +7 -4
- data/spec/views/accounts/_edit.haml_spec.rb +1 -1
- data/spec/views/accounts/create.js.haml_spec.rb +3 -3
- data/spec/views/accounts/destroy.js.haml_spec.rb +1 -1
- data/spec/views/accounts/edit.js.haml_spec.rb +2 -2
- data/spec/views/accounts/index.haml_spec.rb +2 -2
- data/spec/views/accounts/index.js.haml_spec.rb +1 -1
- data/spec/views/accounts/show.haml_spec.rb +4 -4
- data/spec/views/accounts/update.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/destroy.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/create.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/destroy.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/edit.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/index.haml_spec.rb +1 -1
- data/spec/views/admin/users/index.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/reactivate.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/suspend.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/update.js.haml_spec.rb +1 -1
- data/spec/views/application/auto_complete.haml_spec.rb +3 -3
- data/spec/views/campaigns/_edit.haml_spec.rb +1 -1
- data/spec/views/campaigns/create.js.haml_spec.rb +4 -4
- data/spec/views/campaigns/destroy.js.haml_spec.rb +1 -1
- data/spec/views/campaigns/edit.js.haml_spec.rb +4 -4
- data/spec/views/campaigns/index.haml_spec.rb +1 -1
- data/spec/views/campaigns/index.js.haml_spec.rb +2 -2
- data/spec/views/campaigns/show.haml_spec.rb +4 -4
- data/spec/views/campaigns/update.js.haml_spec.rb +2 -2
- data/spec/views/contacts/_edit.haml_spec.rb +7 -7
- data/spec/views/contacts/_new.haml_spec.rb +1 -1
- data/spec/views/contacts/create.js.haml_spec.rb +5 -5
- data/spec/views/contacts/destroy.js.haml_spec.rb +1 -1
- data/spec/views/contacts/edit.js.haml_spec.rb +4 -4
- data/spec/views/contacts/index.haml_spec.rb +1 -1
- data/spec/views/contacts/index.js.html_spec.rb +2 -2
- data/spec/views/contacts/new.js.haml_spec.rb +1 -1
- data/spec/views/contacts/show.haml_spec.rb +3 -3
- data/spec/views/contacts/update.js.haml_spec.rb +5 -5
- data/spec/views/home/index.haml_spec.rb +1 -1
- data/spec/views/home/index.js.haml_spec.rb +1 -1
- data/spec/views/home/options.js.haml_spec.rb +2 -2
- data/spec/views/leads/_convert.haml_spec.rb +3 -3
- data/spec/views/leads/_edit.haml_spec.rb +2 -2
- data/spec/views/leads/_new.haml_spec.rb +2 -2
- data/spec/views/leads/_sidebar_show.haml_spec.rb +5 -5
- data/spec/views/leads/convert.js.haml_spec.rb +4 -4
- data/spec/views/leads/create.js.haml_spec.rb +5 -5
- data/spec/views/leads/destroy.js.haml_spec.rb +2 -2
- data/spec/views/leads/edit.js.haml_spec.rb +4 -4
- data/spec/views/leads/index.haml_spec.rb +1 -1
- data/spec/views/leads/index.js.haml_spec.rb +1 -1
- data/spec/views/leads/new.js.haml_spec.rb +1 -1
- data/spec/views/leads/promote.js.haml_spec.rb +7 -7
- data/spec/views/leads/reject.js.haml_spec.rb +2 -2
- data/spec/views/leads/show.haml_spec.rb +2 -2
- data/spec/views/leads/update.js.haml_spec.rb +4 -4
- data/spec/views/opportunities/_edit.haml_spec.rb +7 -7
- data/spec/views/opportunities/_new.haml_spec.rb +2 -2
- data/spec/views/opportunities/create.js.haml_spec.rb +6 -6
- data/spec/views/opportunities/destroy.js.haml_spec.rb +3 -3
- data/spec/views/opportunities/edit.js.haml_spec.rb +3 -3
- data/spec/views/opportunities/index.haml_spec.rb +1 -1
- data/spec/views/opportunities/index.js.haml_spec.rb +1 -1
- data/spec/views/opportunities/new.js.haml_spec.rb +1 -1
- data/spec/views/opportunities/show.haml_spec.rb +3 -3
- data/spec/views/opportunities/update.js.haml_spec.rb +5 -5
- data/spec/views/tasks/_edit.haml_spec.rb +1 -1
- data/spec/views/tasks/complete.js.haml_spec.rb +4 -4
- data/spec/views/tasks/create.js.haml_spec.rb +6 -6
- data/spec/views/tasks/destroy.js.haml_spec.rb +2 -2
- data/spec/views/tasks/index.haml_spec.rb +4 -4
- data/spec/views/tasks/new.js.haml_spec.rb +1 -1
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +2 -2
- data/spec/views/tasks/update.js.haml_spec.rb +18 -18
- data/spec/views/users/upload_avatar.js.haml_spec.rb +2 -2
- metadata +49 -71
- data/app/controllers/authentications_controller.rb +0 -53
- data/app/models/users/authentication.rb +0 -56
- data/app/views/authentications/new.html.haml +0 -19
- data/app/views/passwords/edit.html.haml +0 -15
- data/app/views/passwords/new.html.haml +0 -10
- data/app/views/user_mailer/password_reset_instructions.html.haml +0 -6
- data/app/views/users/new.html.haml +0 -19
- data/spec/controllers/authentications_controller_spec.rb +0 -150
- data/spec/controllers/passwords_controller_spec.rb +0 -32
- data/spec/models/users/authentication_spec.rb +0 -19
- data/spec/support/auth_macros.rb +0 -49
- data/spec/views/authentications/new.haml_spec.rb +0 -31
data/Procfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
web: bundle exec
|
1
|
+
web: bundle exec puma -C config/puma.rb
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ Visit our website at http://www.fatfreecrm.com/
|
|
53
53
|
|
54
54
|
## System Requirements
|
55
55
|
|
56
|
-
* Ruby 2.
|
56
|
+
* Ruby 2.4+ recommended
|
57
57
|
* MySQL v4.1.1 or later (v5+ is recommended), SQLite v3.4 or later, or Postgres 8.4.8 or later.
|
58
58
|
* ImageMagick (optional, only needed if you would like to use avatars)
|
59
59
|
|
@@ -84,7 +84,7 @@ This is the best way to deploy Fat Free CRM if you need to add plugins or make a
|
|
84
84
|
|
85
85
|
## Upgrading from previous versions of Fat Free CRM
|
86
86
|
|
87
|
-
Please read the [
|
87
|
+
Please read the [Changelog](https://github.com/fatfreecrm/fat_free_crm/blob/master/CHANGELOG.md) document for more detailed information on upgrading from previous versions.
|
88
88
|
|
89
89
|
|
90
90
|
## Resources
|
@@ -116,15 +116,18 @@ Tests can easily be run by typing 'rake' but please note that they do take a whi
|
|
116
116
|
## Main contributors
|
117
117
|
|
118
118
|
* [Michael Dvorkin (@michaeldv)](https://github.com/michaeldv) - Founding creator
|
119
|
-
*
|
120
|
-
*
|
119
|
+
* CloCkWeRX
|
120
|
+
* johnnyshield
|
121
|
+
* DmitryAvramec
|
122
|
+
* steveyken
|
121
123
|
|
122
|
-
|
124
|
+
|
125
|
+
See the [contributors graph](https://github.com/fatfreecrm/fat_free_crm/graphs/contributors) and the [contributors file](https://github.com/fatfreecrm/fat_free_crm/blob/master/CONTRIBUTORS.md) for further details.
|
123
126
|
|
124
127
|
## License
|
125
128
|
|
126
129
|
Fat Free CRM
|
127
|
-
Copyright (c) 2008-
|
130
|
+
Copyright (c) 2008-2018 Michael Dvorkin and contributors.
|
128
131
|
|
129
132
|
Permission is hereby granted, free of charge, to any person obtaining
|
130
133
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
5
5
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
6
6
|
|
7
|
-
require File.expand_path('
|
7
|
+
require File.expand_path('config/application', __dir__)
|
8
8
|
|
9
9
|
FatFreeCRM::Application.load_tasks
|
10
10
|
|
@@ -374,9 +374,9 @@
|
|
374
374
|
source: (request, response) =>
|
375
375
|
request = {auto_complete_query: request['term'], related: related}
|
376
376
|
$.get @base_url + "/" + controller + "/auto_complete.json", request, (data) ->
|
377
|
-
response $.map(data, (value
|
378
|
-
label: value
|
379
|
-
value:
|
377
|
+
response $.map(data.results, (value) ->
|
378
|
+
label: value.text
|
379
|
+
value: value.id
|
380
380
|
)
|
381
381
|
|
382
382
|
# Attach to related asset.
|
@@ -11,22 +11,23 @@
|
|
11
11
|
|
12
12
|
crm.make_select2 = ->
|
13
13
|
$(".select2").not(".select2-container, .select2-offscreen, .select2-hidden-accessible").each ->
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
$(this).
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
$(this).
|
25
|
-
|
26
|
-
|
14
|
+
if $(this).data("url")
|
15
|
+
$(this).select2
|
16
|
+
'width':'resolve'
|
17
|
+
placeholder: $(this).attr("placeholder")
|
18
|
+
ajax:
|
19
|
+
url: $(this).data("url")
|
20
|
+
dataType: 'json'
|
21
|
+
else
|
22
|
+
$(this).select2
|
23
|
+
'width':'resolve'
|
24
|
+
placeholder: $(this).attr("placeholder")
|
25
|
+
|
26
|
+
if $(this).prop("disabled") == true
|
27
|
+
$(this).next('.select2-container').disable()
|
28
|
+
$(this).next('.select2-container').hide()
|
27
29
|
|
28
30
|
$(".select2_tag").not(".select2-container, .select2-offscreen").each ->
|
29
|
-
#$(".select2_tag").each ->
|
30
31
|
$(this).select2
|
31
32
|
'width':'resolve'
|
32
33
|
placeholder: $(this).data("placeholder")
|
@@ -89,7 +89,7 @@ $sidebar_width: 210px;
|
|
89
89
|
-moz-box-shadow: 5px 5px 15px #bbbbbb, -5px 0px 15px #bbbbbb;
|
90
90
|
-webkit-border-radius: 6px;
|
91
91
|
-webkit-box-shadow: 5px 5px 15px #bbbbbb, -5px 0px 15px #bbbbbb;
|
92
|
-
input[type="text"], input[type="password"] {
|
92
|
+
input[type="text"], input[type="email"], input[type="password"] {
|
93
93
|
font-size: 16px;
|
94
94
|
padding: 2px;
|
95
95
|
width: 355px; }
|
@@ -23,7 +23,7 @@ class Admin::ApplicationController < ApplicationController
|
|
23
23
|
|
24
24
|
#----------------------------------------------------------------------------
|
25
25
|
def require_admin_user
|
26
|
-
|
26
|
+
authenticate_user!
|
27
27
|
unless current_user&.admin?
|
28
28
|
flash[:notice] = t(:msg_require_admin)
|
29
29
|
redirect_to root_path
|
@@ -22,9 +22,7 @@ class Admin::FieldGroupsController < Admin::ApplicationController
|
|
22
22
|
def edit
|
23
23
|
@field_group = FieldGroup.find(params[:id])
|
24
24
|
|
25
|
-
if params[:previous].to_s =~ /(\d+)\z/
|
26
|
-
@previous = FieldGroup.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i
|
27
|
-
end
|
25
|
+
@previous = FieldGroup.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
|
28
26
|
|
29
27
|
respond_with(@field_group)
|
30
28
|
end
|
@@ -80,6 +78,13 @@ class Admin::FieldGroupsController < Admin::ApplicationController
|
|
80
78
|
protected
|
81
79
|
|
82
80
|
def field_group_params
|
83
|
-
params
|
81
|
+
params.require(:field_group).permit(
|
82
|
+
:name,
|
83
|
+
:label,
|
84
|
+
:position,
|
85
|
+
:hint,
|
86
|
+
:tag_id,
|
87
|
+
:klass_name
|
88
|
+
)
|
84
89
|
end
|
85
90
|
end
|
@@ -43,10 +43,10 @@ class Admin::FieldsController < Admin::ApplicationController
|
|
43
43
|
def create
|
44
44
|
as = field_params[:as]
|
45
45
|
@field =
|
46
|
-
if as
|
46
|
+
if as.match?(/pair/)
|
47
47
|
CustomFieldPair.create_pair(params).first
|
48
48
|
elsif as.present?
|
49
|
-
klass = Field.lookup_class(as)
|
49
|
+
klass = find_class(Field.lookup_class(as))
|
50
50
|
klass.create(field_params)
|
51
51
|
else
|
52
52
|
Field.new(field_params).tap(&:valid?)
|
@@ -59,7 +59,7 @@ class Admin::FieldsController < Admin::ApplicationController
|
|
59
59
|
# PUT /fields/1.xml AJAX
|
60
60
|
#----------------------------------------------------------------------------
|
61
61
|
def update
|
62
|
-
if field_params[:as]
|
62
|
+
if field_params[:as].match?(/pair/)
|
63
63
|
@field = CustomFieldPair.update_pair(params).first
|
64
64
|
else
|
65
65
|
@field = Field.find(params[:id])
|
@@ -102,7 +102,7 @@ class Admin::FieldsController < Admin::ApplicationController
|
|
102
102
|
Field.find(id).tap { |f| f.as = as }
|
103
103
|
else
|
104
104
|
field_group_id = field[:field_group_id]
|
105
|
-
klass = Field.lookup_class(as)
|
105
|
+
klass = find_class(Field.lookup_class(as))
|
106
106
|
klass.new(field_group_id: field_group_id, as: as)
|
107
107
|
end
|
108
108
|
|
@@ -28,9 +28,7 @@ class Admin::TagsController < Admin::ApplicationController
|
|
28
28
|
# GET /admin/tags/1/edit AJAX
|
29
29
|
#----------------------------------------------------------------------------
|
30
30
|
def edit
|
31
|
-
if params[:previous].to_s =~ /(\d+)\z/
|
32
|
-
@previous = Tag.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i
|
33
|
-
end
|
31
|
+
@previous = Tag.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
|
34
32
|
end
|
35
33
|
|
36
34
|
# POST /admin/tags
|
@@ -68,7 +66,7 @@ class Admin::TagsController < Admin::ApplicationController
|
|
68
66
|
protected
|
69
67
|
|
70
68
|
def tag_params
|
71
|
-
params
|
69
|
+
params.require(:tag).permit(:name, :taggings_count)
|
72
70
|
end
|
73
71
|
|
74
72
|
def setup_current_tab
|
@@ -35,9 +35,7 @@ class Admin::UsersController < Admin::ApplicationController
|
|
35
35
|
# GET /admin/users/1/edit AJAX
|
36
36
|
#----------------------------------------------------------------------------
|
37
37
|
def edit
|
38
|
-
if params[:previous].to_s =~ /(\d+)\z/
|
39
|
-
@previous = User.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i
|
40
|
-
end
|
38
|
+
@previous = User.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
|
41
39
|
|
42
40
|
respond_with(@user)
|
43
41
|
end
|
@@ -48,7 +46,7 @@ class Admin::UsersController < Admin::ApplicationController
|
|
48
46
|
def create
|
49
47
|
@user = User.new(user_params)
|
50
48
|
@user.suspend_if_needs_approval
|
51
|
-
@user.
|
49
|
+
@user.save
|
52
50
|
|
53
51
|
respond_with(@user)
|
54
52
|
end
|
@@ -59,7 +57,7 @@ class Admin::UsersController < Admin::ApplicationController
|
|
59
57
|
def update
|
60
58
|
@user = User.find(params[:id])
|
61
59
|
@user.attributes = user_params
|
62
|
-
@user.
|
60
|
+
@user.save
|
63
61
|
|
64
62
|
respond_with(@user)
|
65
63
|
end
|
@@ -74,9 +72,7 @@ class Admin::UsersController < Admin::ApplicationController
|
|
74
72
|
# DELETE /admin/users/1.xml AJAX
|
75
73
|
#----------------------------------------------------------------------------
|
76
74
|
def destroy
|
77
|
-
unless @user.destroyable?(current_user) && @user.destroy
|
78
|
-
flash[:warning] = t(:msg_cant_delete_user, @user.full_name)
|
79
|
-
end
|
75
|
+
flash[:warning] = t(:msg_cant_delete_user, @user.full_name) unless @user.destroyable?(current_user) && @user.destroy
|
80
76
|
|
81
77
|
respond_with(@user)
|
82
78
|
end
|
@@ -107,6 +103,7 @@ class Admin::UsersController < Admin::ApplicationController
|
|
107
103
|
|
108
104
|
def user_params
|
109
105
|
return {} unless params[:user]
|
106
|
+
|
110
107
|
params[:user][:email].try(:strip!)
|
111
108
|
params[:user][:password_confirmation] = nil if params[:user][:password_confirmation].blank?
|
112
109
|
|
@@ -8,8 +8,9 @@
|
|
8
8
|
class ApplicationController < ActionController::Base
|
9
9
|
protect_from_forgery with: :exception
|
10
10
|
|
11
|
+
before_action :configure_devise_parameters, if: :devise_controller?
|
12
|
+
before_action :authenticate_user!
|
11
13
|
before_action :set_paper_trail_whodunnit
|
12
|
-
|
13
14
|
before_action :set_context
|
14
15
|
before_action :clear_setting_cache
|
15
16
|
before_action :cors_preflight_check
|
@@ -17,7 +18,6 @@ class ApplicationController < ActionController::Base
|
|
17
18
|
after_action { hook(:app_after_filter, self) }
|
18
19
|
after_action :cors_set_access_control_headers
|
19
20
|
|
20
|
-
helper_method :current_user_session, :current_user, :can_signup?
|
21
21
|
helper_method :called_from_index_page?, :called_from_landing_page?
|
22
22
|
helper_method :klass
|
23
23
|
|
@@ -73,16 +73,17 @@ class ApplicationController < ActionController::Base
|
|
73
73
|
end
|
74
74
|
|
75
75
|
#
|
76
|
-
# Takes { :
|
76
|
+
# Takes { related: 'campaigns/7' } or { related: '5' }
|
77
77
|
# and returns array of object ids that should be excluded from search
|
78
78
|
# assumes controller_name is a method on 'related' class that returns a collection
|
79
79
|
#----------------------------------------------------------------------------
|
80
80
|
def auto_complete_ids_to_exclude(related)
|
81
81
|
return [] if related.blank?
|
82
82
|
return [related.to_i].compact unless related.index('/')
|
83
|
+
|
83
84
|
related_class, id = related.split('/')
|
84
85
|
obj = related_class.classify.constantize.find_by_id(id)
|
85
|
-
if obj
|
86
|
+
if obj&.respond_to?(controller_name)
|
86
87
|
obj.send(controller_name).map(&:id)
|
87
88
|
else
|
88
89
|
[]
|
@@ -114,47 +115,6 @@ class ApplicationController < ActionController::Base
|
|
114
115
|
@current_tab = tab
|
115
116
|
end
|
116
117
|
|
117
|
-
#----------------------------------------------------------------------------
|
118
|
-
def current_user_session
|
119
|
-
@current_user_session ||= Authentication.find
|
120
|
-
@current_user_session = nil if @current_user_session&.record&.suspended?
|
121
|
-
@current_user_session
|
122
|
-
end
|
123
|
-
|
124
|
-
#----------------------------------------------------------------------------
|
125
|
-
def current_user
|
126
|
-
unless @current_user
|
127
|
-
@current_user = (current_user_session&.record)
|
128
|
-
if @current_user
|
129
|
-
@current_user.set_individual_locale
|
130
|
-
@current_user.set_single_access_token
|
131
|
-
end
|
132
|
-
User.current_user = @current_user
|
133
|
-
end
|
134
|
-
@current_user
|
135
|
-
end
|
136
|
-
|
137
|
-
#----------------------------------------------------------------------------
|
138
|
-
def require_user
|
139
|
-
unless current_user
|
140
|
-
store_location
|
141
|
-
flash[:notice] = t(:msg_login_needed) if request.fullpath != "/"
|
142
|
-
respond_to do |format|
|
143
|
-
format.html { redirect_to login_url }
|
144
|
-
format.js { render plain: "window.location = '#{login_url}';" }
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
#----------------------------------------------------------------------------
|
150
|
-
def require_no_user
|
151
|
-
if current_user
|
152
|
-
store_location
|
153
|
-
flash[:notice] = t(:msg_logout_needed)
|
154
|
-
redirect_to profile_url
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
118
|
#----------------------------------------------------------------------------
|
159
119
|
def store_location
|
160
120
|
session[:return_to] = request.fullpath
|
@@ -281,4 +241,21 @@ class ApplicationController < ActionController::Base
|
|
281
241
|
render plain: ''
|
282
242
|
end
|
283
243
|
end
|
244
|
+
|
245
|
+
def configure_devise_parameters
|
246
|
+
devise_parameter_sanitizer.permit(:sign_up) do |user_params|
|
247
|
+
user_params.permit(:username, :email, :password, :password_confirmation)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def find_class(asset)
|
252
|
+
Rails.application.eager_load! unless Rails.application.config.cache_classes
|
253
|
+
classes = ActiveRecord::Base.descendants.map(&:name)
|
254
|
+
find = classes.find { |m| m == asset.classify }
|
255
|
+
if find
|
256
|
+
find.safe_constantize
|
257
|
+
else
|
258
|
+
raise "Unknown resource"
|
259
|
+
end
|
260
|
+
end
|
284
261
|
end
|
@@ -6,8 +6,6 @@
|
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
8
|
class CommentsController < ApplicationController
|
9
|
-
before_action :require_user
|
10
|
-
|
11
9
|
# GET /comments
|
12
10
|
# GET /comments.json
|
13
11
|
# GET /comments.xml
|
@@ -15,7 +13,7 @@ class CommentsController < ApplicationController
|
|
15
13
|
def index
|
16
14
|
@commentable = extract_commentable_name(params)
|
17
15
|
if @commentable
|
18
|
-
@asset = @commentable.
|
16
|
+
@asset = find_class(@commentable).my(current_user).find(params[:"#{@commentable}_id"])
|
19
17
|
@comments = @asset.comments.order("created_at DESC")
|
20
18
|
end
|
21
19
|
respond_with(@comments) do |format|
|
@@ -35,11 +33,9 @@ class CommentsController < ApplicationController
|
|
35
33
|
def edit
|
36
34
|
@comment = Comment.find(params[:id])
|
37
35
|
|
38
|
-
model = @comment.commentable_type
|
36
|
+
model = find_class(@comment.commentable_type)
|
39
37
|
id = @comment.commentable_id
|
40
|
-
unless model.
|
41
|
-
respond_to_related_not_found(model.downcase)
|
42
|
-
end
|
38
|
+
respond_to_related_not_found(model.downcase) unless model.my(current_user).find_by_id(id)
|
43
39
|
end
|
44
40
|
|
45
41
|
# POST /comments
|
@@ -51,13 +47,13 @@ class CommentsController < ApplicationController
|
|
51
47
|
comment_params.merge(user_id: current_user.id)
|
52
48
|
)
|
53
49
|
# Make sure commentable object exists and is accessible to the current user.
|
54
|
-
model = @comment.commentable_type
|
50
|
+
model = find_class(@comment.commentable_type)
|
55
51
|
id = @comment.commentable_id
|
56
|
-
if model.
|
52
|
+
if model.my(current_user).find_by_id(id)
|
57
53
|
@comment.save
|
58
54
|
respond_with(@comment)
|
59
55
|
else
|
60
|
-
respond_to_related_not_found(model.downcase)
|
56
|
+
respond_to_related_not_found(model.name.downcase)
|
61
57
|
end
|
62
58
|
end
|
63
59
|
|
@@ -85,7 +81,16 @@ class CommentsController < ApplicationController
|
|
85
81
|
|
86
82
|
def comment_params
|
87
83
|
return {} unless params[:comment]
|
88
|
-
|
84
|
+
|
85
|
+
params.require(:comment).permit(
|
86
|
+
:user_id,
|
87
|
+
:commentable_type,
|
88
|
+
:commentable_id,
|
89
|
+
:private,
|
90
|
+
:title,
|
91
|
+
:comment,
|
92
|
+
:state
|
93
|
+
)
|
89
94
|
end
|
90
95
|
|
91
96
|
private
|
@@ -4,5 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
|
8
|
-
|
7
|
+
class ConfirmationsController < Devise::ConfirmationsController
|
8
|
+
respond_to :html
|
9
|
+
append_view_path 'app/views/devise'
|
10
|
+
end
|