fat_free_crm 0.21.0 → 0.22.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.

Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/fat_free_crm.js +3 -0
  3. data/app/assets/config/manifest.js +1 -3
  4. data/app/controllers/admin/field_groups_controller.rb +0 -2
  5. data/app/controllers/admin/tags_controller.rb +1 -1
  6. data/app/controllers/admin/users_controller.rb +1 -1
  7. data/app/controllers/application_controller.rb +11 -0
  8. data/app/controllers/comments_controller.rb +2 -0
  9. data/app/controllers/emails_controller.rb +2 -0
  10. data/app/controllers/entities/accounts_controller.rb +3 -1
  11. data/app/controllers/entities/campaigns_controller.rb +3 -1
  12. data/app/controllers/entities/contacts_controller.rb +3 -1
  13. data/app/controllers/entities/leads_controller.rb +4 -2
  14. data/app/controllers/entities/opportunities_controller.rb +3 -1
  15. data/app/controllers/entities_controller.rb +2 -0
  16. data/app/controllers/home_controller.rb +2 -0
  17. data/app/controllers/lists_controller.rb +2 -0
  18. data/app/controllers/tasks_controller.rb +3 -1
  19. data/app/controllers/users_controller.rb +2 -0
  20. data/app/models/fields/custom_field.rb +2 -2
  21. data/app/models/observers/entity_observer.rb +1 -1
  22. data/app/models/polymorphic/comment.rb +1 -1
  23. data/app/models/setting.rb +4 -5
  24. data/app/models/users/user.rb +1 -1
  25. data/bin/bundle +108 -2
  26. data/bin/rails +3 -3
  27. data/bin/rake +2 -2
  28. data/bin/setup +12 -15
  29. data/config/application.rb +9 -4
  30. data/config/boot.rb +3 -5
  31. data/config/cable.yml +10 -0
  32. data/config/database.yml +26 -0
  33. data/config/environment.rb +4 -3
  34. data/config/environments/development.rb +47 -14
  35. data/config/environments/production.rb +17 -15
  36. data/config/environments/test.rb +19 -9
  37. data/config/initializers/action_mailer.rb +1 -0
  38. data/config/initializers/content_security_policy.rb +21 -26
  39. data/config/initializers/custom_field_ransack_translations.rb +1 -0
  40. data/config/initializers/filter_parameter_logging.rb +6 -2
  41. data/config/initializers/inflections.rb +4 -4
  42. data/config/initializers/permissions_policy.rb +12 -0
  43. data/config/storage.yml +5 -5
  44. data/db/demo/field_groups.yml +2 -1
  45. data/db/migrate/20230526212613_convert_to_active_storage.rb +27 -11
  46. data/db/schema.rb +107 -105
  47. data/lib/fat_free_crm/callback.rb +2 -3
  48. data/lib/fat_free_crm/mail_processor/dropbox.rb +1 -1
  49. data/lib/fat_free_crm/version.rb +1 -1
  50. data/public/avatars/User/2/large_rails.png +0 -0
  51. data/public/avatars/User/2/medium_rails.png +0 -0
  52. data/public/avatars/User/2/original_rails.png +0 -0
  53. data/public/avatars/User/2/small_rails.png +0 -0
  54. data/public/avatars/User/2/thumb_rails.png +0 -0
  55. data/public/avatars/User/3/large_rails.png +0 -0
  56. data/public/avatars/User/3/medium_rails.png +0 -0
  57. data/public/avatars/User/3/original_rails.png +0 -0
  58. data/public/avatars/User/3/small_rails.png +0 -0
  59. data/public/avatars/User/3/thumb_rails.png +0 -0
  60. data/public/avatars/User/4/large_rails.png +0 -0
  61. data/public/avatars/User/4/medium_rails.png +0 -0
  62. data/public/avatars/User/4/original_rails.png +0 -0
  63. data/public/avatars/User/4/small_rails.png +0 -0
  64. data/public/avatars/User/4/thumb_rails.png +0 -0
  65. data/public/avatars/User/6/large_rails.png +0 -0
  66. data/public/avatars/User/6/medium_rails.png +0 -0
  67. data/public/avatars/User/6/original_rails.png +0 -0
  68. data/public/avatars/User/6/small_rails.png +0 -0
  69. data/public/avatars/User/6/thumb_rails.png +0 -0
  70. data/public/avatars/User/7/large_rails.png +0 -0
  71. data/public/avatars/User/7/medium_rails.png +0 -0
  72. data/public/avatars/User/7/original_rails.png +0 -0
  73. data/public/avatars/User/7/small_rails.png +0 -0
  74. data/public/avatars/User/7/thumb_rails.png +0 -0
  75. metadata +64 -16
  76. data/config/initializers/new_framework_defaults_6_0.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7da1fdcaaf08df0256e5075214129f236ce36d156c24cd8ae4a282f3430b1ecb
4
- data.tar.gz: 255b0d61c8eb6d84bb94de174d075531c92c6b8dfb32826c6e304beafe578dc5
3
+ metadata.gz: 325977901a3011b43c20379a5e03317660a3cd2b702e36ceb7aa255ec0f6ff17
4
+ data.tar.gz: 6badcc5bfcc41d304fe646a7ea07d1c4fce631b3a60efd08285752fe645e3572
5
5
  SHA512:
6
- metadata.gz: 95f133e5f454aad954dbb23ccb2da2fce1aa8dd5d6c9d9461b266b91f2339c4fed7db6b23ecb8199eab96473b183f5b492e55e60e0a60fcad574870e0f730ae2
7
- data.tar.gz: f83fa46bbe3312262e9845690c8f40ce7625a4b6f67ed018a1e39fab3b10af381fe0a305b7a585f52abdfd5638ba7526be704571e0096b94544296a3ed917f77
6
+ metadata.gz: 58f6a285322ca7ae834bbf2eeeaf0073a2c501f9dd71117b890c9d7a1403dd3b2e5f725e97d2b3814836f854595eb77f322e09a27a94202fb65ca7b28078cd47
7
+ data.tar.gz: 004b7dadb4c2c77e4863010b59a87dc89500142bc52fe0d90f81e71532d964b287f1bd97365bdd9460898249c0278e0ca389eba9edba1260c3410d0131302d0b
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -1,3 +1 @@
1
- //= link_tree ../images
2
- //= link_directory ../javascripts .js
3
- //= link_directory ../stylesheets .css
1
+ //= link fat_free_crm
@@ -22,8 +22,6 @@ class Admin::FieldGroupsController < Admin::ApplicationController
22
22
  def edit
23
23
  @field_group = FieldGroup.find(params[:id])
24
24
 
25
- @previous = FieldGroup.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
26
-
27
25
  respond_with(@field_group)
28
26
  end
29
27
 
@@ -28,7 +28,7 @@ class Admin::TagsController < Admin::ApplicationController
28
28
  # GET /admin/tags/1/edit AJAX
29
29
  #----------------------------------------------------------------------------
30
30
  def edit
31
- @previous = Tag.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
31
+ @previous = Tag.find_by_id(detect_previous_id) || detect_previous_id if detect_previous_id
32
32
  end
33
33
 
34
34
  # POST /admin/tags
@@ -35,7 +35,7 @@ class Admin::UsersController < Admin::ApplicationController
35
35
  # GET /admin/users/1/edit AJAX
36
36
  #----------------------------------------------------------------------------
37
37
  def edit
38
- @previous = User.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
38
+ @previous = User.find_by_id(detect_previous_id) || detect_previous_id if detect_previous_id
39
39
 
40
40
  respond_with(@user)
41
41
  end
@@ -268,4 +268,15 @@ class ApplicationController < ActionController::Base
268
268
  raise "Unknown resource"
269
269
  end
270
270
  end
271
+
272
+ # In a number of places, we pass ?previous=(id) or ?previous=crm.find_form...
273
+ # This method centralises all of the places we can pass in a previous param
274
+ # and extracts an int ID, or nil
275
+ def detect_previous_id
276
+ return unless params[:previous]
277
+ return if params[:previous].start_with?("crm")
278
+
279
+ params[:previous].to_i
280
+ end
281
+ ActiveSupport.run_load_hooks(:fat_free_crm_application_controller, self)
271
282
  end
@@ -99,4 +99,6 @@ class CommentsController < ApplicationController
99
99
  def extract_commentable_name(params)
100
100
  params.keys.detect { |x| x =~ /_id$/ }.try(:sub, /_id$/, '')
101
101
  end
102
+
103
+ ActiveSupport.run_load_hooks(:fat_free_crm_comments_controller, self)
102
104
  end
@@ -15,4 +15,6 @@ class EmailsController < ApplicationController
15
15
  @email.destroy
16
16
  respond_with(@email)
17
17
  end
18
+
19
+ ActiveSupport.run_load_hooks(:fat_free_crm_emails_controller, self)
18
20
  end
@@ -45,7 +45,7 @@ class AccountsController < EntitiesController
45
45
  # GET /accounts/1/edit AJAX
46
46
  #----------------------------------------------------------------------------
47
47
  def edit
48
- @previous = Account.my(current_user).find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
48
+ @previous = Account.my(current_user).find_by_id(detect_previous_id) || detect_previous_id if detect_previous_id
49
49
 
50
50
  respond_with(@account)
51
51
  end
@@ -160,4 +160,6 @@ class AccountsController < EntitiesController
160
160
  @account_category_total[:all] = Account.my(current_user).count
161
161
  @account_category_total[:other] = @account_category_total[:all] - categorized
162
162
  end
163
+
164
+ ActiveSupport.run_load_hooks(:fat_free_crm_accounts_controller, self)
163
165
  end
@@ -84,7 +84,7 @@ class CampaignsController < EntitiesController
84
84
  # GET /campaigns/1/edit AJAX
85
85
  #----------------------------------------------------------------------------
86
86
  def edit
87
- @previous = Campaign.my(current_user).find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
87
+ @previous = Campaign.my(current_user).find_by_id(detect_previous_id) || detect_previous_id if detect_previous_id
88
88
 
89
89
  respond_with(@campaign)
90
90
  end
@@ -204,4 +204,6 @@ class CampaignsController < EntitiesController
204
204
  end
205
205
  @campaign_status_total[:other] += @campaign_status_total[:all]
206
206
  end
207
+
208
+ ActiveSupport.run_load_hooks(:fat_free_crm_campaigns_controller, self)
207
209
  end
@@ -51,7 +51,7 @@ class ContactsController < EntitiesController
51
51
  #----------------------------------------------------------------------------
52
52
  def edit
53
53
  @account = @contact.account || Account.new(user: current_user)
54
- @previous = Contact.my(current_user).find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
54
+ @previous = Contact.my(current_user).find_by_id(detect_previous_id) || detect_previous_id if detect_previous_id
55
55
 
56
56
  respond_with(@contact)
57
57
  end
@@ -164,4 +164,6 @@ class ContactsController < EntitiesController
164
164
  redirect_to contacts_path
165
165
  end
166
166
  end
167
+
168
+ ActiveSupport.run_load_hooks(:fat_free_crm_contacts_controller, self)
167
169
  end
@@ -52,7 +52,7 @@ class LeadsController < EntitiesController
52
52
  def edit
53
53
  get_campaigns
54
54
 
55
- @previous = Lead.my(current_user).find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
55
+ @previous = Lead.my(current_user).find_by_id(detect_previous_id) || detect_previous_id if detect_previous_id
56
56
 
57
57
  respond_with(@lead)
58
58
  end
@@ -108,7 +108,7 @@ class LeadsController < EntitiesController
108
108
  @accounts = Account.my(current_user).order('name')
109
109
  @opportunity = Opportunity.new(user: current_user, access: "Lead", stage: "prospecting", campaign: @lead.campaign, source: @lead.source)
110
110
 
111
- @previous = Lead.my(current_user).find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
111
+ @previous = Lead.my(current_user).find_by_id(detect_previous_id) || detect_previous_id if detect_previous_id
112
112
 
113
113
  respond_with(@lead)
114
114
  end
@@ -268,4 +268,6 @@ class LeadsController < EntitiesController
268
268
  get_data_for_sidebar(:campaign)
269
269
  end
270
270
  end
271
+
272
+ ActiveSupport.run_load_hooks(:fat_free_crm_leads_controller, self)
271
273
  end
@@ -57,7 +57,7 @@ class OpportunitiesController < EntitiesController
57
57
  @account = @opportunity.account || Account.new(user: current_user)
58
58
  @accounts = Account.my(current_user).order('name')
59
59
 
60
- @previous = Opportunity.my(current_user).find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
60
+ @previous = Opportunity.my(current_user).find_by_id(detect_previous_id) || detect_previous_id if detect_previous_id
61
61
 
62
62
  respond_with(@opportunity)
63
63
  end
@@ -227,4 +227,6 @@ class OpportunitiesController < EntitiesController
227
227
  current_user.pref[:opportunities_sort_by] = Opportunity.sort_by_map[params[:sort_by]] if params[:sort_by]
228
228
  session[:opportunities_filter] = params[:stage] if params[:stage]
229
229
  end
230
+
231
+ ActiveSupport.run_load_hooks(:fat_free_crm_opportunities_controller, self)
230
232
  end
@@ -245,4 +245,6 @@ class EntitiesController < ApplicationController
245
245
  Account.new(user: user)
246
246
  end
247
247
  end
248
+
249
+ ActiveSupport.run_load_hooks(:fat_free_crm_entities_controller, self)
248
250
  end
@@ -165,4 +165,6 @@ class HomeController < ApplicationController
165
165
  %w[zero one two].index(words.first).send(words.last) if %w[one two].include?(words.first) && %w[hour day days week weeks month].include?(words.last)
166
166
  end
167
167
  end
168
+
169
+ ActiveSupport.run_load_hooks(:fat_free_crm_home_controller, self)
168
170
  end
@@ -39,4 +39,6 @@ class ListsController < ApplicationController
39
39
  :user_id
40
40
  )
41
41
  end
42
+
43
+ ActiveSupport.run_load_hooks(:fat_free_crm_lists_controller, self)
42
44
  end
@@ -58,7 +58,7 @@ class TasksController < ApplicationController
58
58
  @category = Setting.unroll(:task_category)
59
59
  @asset = @task.asset if @task.asset_id?
60
60
 
61
- @previous = Task.tracked_by(current_user).find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i if params[:previous].to_s =~ /(\d+)\z/
61
+ @previous = Task.tracked_by(current_user).find_by_id(detect_previous_id) || detect_previous_id if detect_previous_id
62
62
 
63
63
  respond_with(@task)
64
64
  end
@@ -224,4 +224,6 @@ class TasksController < ApplicationController
224
224
  views = Task::ALLOWED_VIEWS
225
225
  views.include?(view) ? view : views.first
226
226
  end
227
+
228
+ ActiveSupport.run_load_hooks(:fat_free_crm_tasks_controller, self)
227
229
  end
@@ -143,4 +143,6 @@ class UsersController < ApplicationController
143
143
  .permit(:image)
144
144
  .merge(entity: @user, user_id: @user.id)
145
145
  end
146
+
147
+ ActiveSupport.run_load_hooks(:fat_free_crm_users_controller, self)
146
148
  end
@@ -124,7 +124,7 @@ class CustomField < Field
124
124
  #------------------------------------------------------------------------------
125
125
  def add_column
126
126
  self.name = generate_column_name if name.blank?
127
- klass.connection.add_column(table_name, name, column_type, column_options)
127
+ klass.connection.add_column(table_name, name, column_type, **column_options)
128
128
  klass.reset_column_information
129
129
  klass.serialize_custom_fields!
130
130
  end
@@ -142,7 +142,7 @@ class CustomField < Field
142
142
  #------------------------------------------------------------------------------
143
143
  def update_column
144
144
  if errors.empty? && db_transition_safety(as_was) == :safe
145
- klass.connection.change_column(table_name, name, column_type, column_options)
145
+ klass.connection.change_column(table_name, name, column_type, **column_options)
146
146
  klass.reset_column_information
147
147
  klass.serialize_custom_fields!
148
148
  end
@@ -19,7 +19,7 @@ class EntityObserver < ActiveRecord::Observer
19
19
  private
20
20
 
21
21
  def send_notification_to_assignee(item)
22
- UserMailer.assigned_entity_notification(item, current_user).deliver_now if item.assignee.present? && current_user.present? && can_send_email?
22
+ UserMailer.assigned_entity_notification(item, current_user).deliver_later if item.assignee.present? && current_user.present? && can_send_email?
23
23
  end
24
24
 
25
25
  # Need to have a host set before email can be sent
@@ -54,7 +54,7 @@ class Comment < ActiveRecord::Base
54
54
  def notify_subscribers
55
55
  commentable.subscribed_users.reject { |user_id| user_id == user.id }.each do |subscriber_id|
56
56
  if subscriber = User.find_by_id(subscriber_id)
57
- SubscriptionMailer.comment_notification(subscriber, self).deliver_now
57
+ SubscriptionMailer.comment_notification(subscriber, self).deliver_later
58
58
  end
59
59
  end
60
60
  end
@@ -58,13 +58,11 @@ class Setting < ActiveRecord::Base
58
58
  return cache[name] if cache.key?(name)
59
59
 
60
60
  # Check database
61
- if database_and_table_exists?
62
- if setting = find_by_name(name.to_s)
63
- return cache[name] = setting.value unless setting.value.nil?
64
- end
61
+ if database_and_table_exists? && (setting = find_by_name(name.to_s))&.value.present?
62
+ return cache[name] = setting.value
65
63
  end
66
64
  # Check YAML settings
67
- return cache[name] = yaml_settings[name] if yaml_settings.key?(name)
65
+ cache[name] = yaml_settings[name] if yaml_settings.key?(name)
68
66
  end
69
67
 
70
68
  # Set setting value
@@ -73,6 +71,7 @@ class Setting < ActiveRecord::Base
73
71
  raise ArgumentError, "name cannot be blank" if name.blank?
74
72
 
75
73
  return nil unless database_and_table_exists?
74
+
76
75
  setting = find_by_name(name.to_s) || new(name: name.to_s)
77
76
  setting.value = value
78
77
  setting.save
@@ -61,7 +61,7 @@ class User < ActiveRecord::Base
61
61
  has_many :opportunities
62
62
  has_many :assigned_opportunities, class_name: 'Opportunity', foreign_key: 'assigned_to'
63
63
  has_many :permissions, dependent: :destroy
64
- has_many :preferences, dependent: :destroy
64
+ has_many :preferences, class_name: 'Preference', dependent: :destroy
65
65
  has_many :lists
66
66
  has_and_belongs_to_many :groups
67
67
 
data/bin/bundle CHANGED
@@ -1,5 +1,111 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
5
- load Gem.bin_path('bundler', 'bundle')
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+
28
+ bundler_version = nil
29
+ update_index = nil
30
+ ARGV.each_with_index do |a, i|
31
+ bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
32
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
33
+
34
+ bundler_version = Regexp.last_match(1)
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../Gemfile", __dir__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+
59
+ lockfile_contents = File.read(lockfile)
60
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
61
+
62
+ Regexp.last_match(1)
63
+ end
64
+
65
+ def bundler_requirement
66
+ @bundler_requirement ||=
67
+ env_var_version ||
68
+ cli_arg_version ||
69
+ bundler_requirement_for(lockfile_version)
70
+ end
71
+
72
+ def bundler_requirement_for(version)
73
+ return "#{Gem::Requirement.default}.a" unless version
74
+
75
+ bundler_gem_version = Gem::Version.new(version)
76
+
77
+ bundler_gem_version.approximate_recommendation
78
+ end
79
+
80
+ def load_bundler!
81
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
82
+
83
+ activate_bundler
84
+ end
85
+
86
+ def activate_bundler
87
+ gem_error = activation_error_handling do
88
+ gem "bundler", bundler_requirement
89
+ end
90
+ return if gem_error.nil?
91
+
92
+ require_error = activation_error_handling do
93
+ require "bundler/version"
94
+ end
95
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
96
+
97
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
98
+ exit 42
99
+ end
100
+
101
+ def activation_error_handling
102
+ yield
103
+ nil
104
+ rescue StandardError, LoadError => e
105
+ e
106
+ end
107
+ end
108
+
109
+ m.load_bundler!
110
+
111
+ load Gem.bin_path("bundler", "bundle") if m.invoked_as_script?
data/bin/rails CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- APP_PATH = File.expand_path('../config/application', __dir__)
5
- require_relative '../config/boot'
6
- require 'rails/commands'
4
+ APP_PATH = File.expand_path("../config/application", __dir__)
5
+ require_relative "../config/boot"
6
+ require "rails/commands"
data/bin/rake CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative '../config/boot'
5
- require 'rake'
4
+ require_relative "../config/boot"
5
+ require "rake"
6
6
  Rake.application.run
data/bin/setup CHANGED
@@ -1,38 +1,35 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'fileutils'
4
+ require "fileutils"
5
5
 
6
6
  # path to your application root.
7
- APP_ROOT = File.expand_path('..', __dir__)
7
+ APP_ROOT = File.expand_path("..", __dir__)
8
8
 
9
9
  def system!(*args)
10
10
  system(*args) || abort("\n== Command #{args} failed ==")
11
11
  end
12
12
 
13
13
  FileUtils.chdir APP_ROOT do
14
- # This script is a way to setup or update your development environment automatically.
15
- # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
14
+ # This script is a way to set up or update your development environment automatically.
15
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
16
16
  # Add necessary setup steps to this file.
17
17
 
18
- puts '== Installing dependencies =='
19
- system! 'gem install bundler --conservative'
20
- system('bundle check') || system!('bundle install')
21
-
22
- # Install JavaScript dependencies
23
- # system('bin/yarn')
18
+ puts "== Installing dependencies =="
19
+ system! "gem install bundler --conservative"
20
+ system("bundle check") || system!("bundle install")
24
21
 
25
22
  # puts "\n== Copying sample files =="
26
- # unless File.exist?('config/database.yml')
27
- # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
23
+ # unless File.exist?("config/database.yml")
24
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
28
25
  # end
29
26
 
30
27
  puts "\n== Preparing database =="
31
- system! 'bin/rails db:prepare'
28
+ system! "bin/rails db:prepare"
32
29
 
33
30
  puts "\n== Removing old logs and tempfiles =="
34
- system! 'bin/rails log:clear tmp:clear'
31
+ system! "bin/rails log:clear tmp:clear"
35
32
 
36
33
  puts "\n== Restarting application server =="
37
- system! 'bin/rails restart'
34
+ system! "bin/rails restart"
38
35
  end
@@ -30,11 +30,15 @@ require 'fat_free_crm/gem_ext/rails/engine'
30
30
  module FatFreeCRM
31
31
  class Application < Rails::Application
32
32
  # Initialize configuration defaults for originally generated Rails version.
33
- config.load_defaults 6.0
33
+ config.load_defaults 7.0
34
34
 
35
- # Settings in config/environments/* take precedence over those specified here.
36
- # Application configuration should go into files in config/initializers
37
- # -- all .rb files in that directory are automatically loaded.
35
+ # Configuration for the application, engines, and railties goes here.
36
+ #
37
+ # These settings can be overridden in specific environments using the files
38
+ # in config/environments, which are processed later.
39
+ #
40
+ # config.time_zone = "Central Time (US & Canada)"
41
+ # config.eager_load_paths << Rails.root.join("extras")
38
42
 
39
43
  # Models are organized in sub-directories
40
44
  config.autoload_paths += Dir[Rails.root.join("app/models/**")] +
@@ -78,6 +82,7 @@ module FatFreeCRM
78
82
  config.active_record.use_yaml_unsafe_load = false
79
83
  config.active_record.yaml_column_permitted_classes = [
80
84
  ::ActiveRecord::Type::Time::Value,
85
+ ::ActiveSupport::HashWithIndifferentAccess, # for Field#settings serialization see app/models/fields/field.rb
81
86
  ::ActiveSupport::TimeWithZone,
82
87
  ::ActiveSupport::TimeZone,
83
88
  ::BigDecimal,
data/config/boot.rb CHANGED
@@ -6,9 +6,7 @@
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
8
 
9
- # Set up gems listed in the Gemfile.
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
9
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
11
10
 
12
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
13
-
14
- require 'bootsnap/setup'
11
+ require "bundler/setup" # Set up gems listed in the Gemfile.
12
+ require "bootsnap/setup" # Speed up boot time by caching expensive operations.
data/config/cable.yml ADDED
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: fat_free_crm_production
@@ -0,0 +1,26 @@
1
+ ---
2
+ development: &development
3
+ adapter: postgresql
4
+ database: fat_free_crm_development
5
+ username: postgres
6
+ password:
7
+ host: localhost
8
+ port: 5432
9
+ schema_search_path: public
10
+ min_messages: warning
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ <<: *development
17
+ database: fat_free_crm_test
18
+
19
+ production:
20
+ <<: *development
21
+ database: fat_free_crm_production
22
+
23
+ staging:
24
+ <<: *development
25
+ database: fat_free_crm_staging
26
+
@@ -5,8 +5,9 @@
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
7
  #------------------------------------------------------------------------------
8
- # Load the rails application
9
- require_relative 'application'
10
8
 
11
- # Initialize the rails application
9
+ # Load the Rails application.
10
+ require_relative "application"
11
+
12
+ # Initialize the Rails application.
12
13
  Rails.application.initialize!