Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added controller hooks to make it easier to hook plugins into the FFCRM bootup sequence #1181

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,6 @@ def find_class(asset)
raise "Unknown resource"
end
end

ActiveSupport.run_load_hooks(:fat_free_crm_application_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,6 @@ def comment_params
def extract_commentable_name(params)
params.keys.detect { |x| x =~ /_id$/ }.try(:sub, /_id$/, '')
end

ActiveSupport.run_load_hooks(:fat_free_crm_comments_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/emails_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
@email.destroy
respond_with(@email)
end

Check notice

Code scanning / Rubocop

Avoid trailing whitespace. Note

Layout/TrailingWhitespace: Trailing whitespace detected.
ActiveSupport.run_load_hooks(:fat_free_crm_emails_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/entities/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,6 @@ def get_data_for_sidebar
@account_category_total[:all] = Account.my(current_user).count
@account_category_total[:other] = @account_category_total[:all] - categorized
end

ActiveSupport.run_load_hooks(:fat_free_crm_accounts_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/entities/campaigns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,6 @@ def get_data_for_sidebar
end
@campaign_status_total[:other] += @campaign_status_total[:all]
end

ActiveSupport.run_load_hooks(:fat_free_crm_campaigns_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/entities/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,6 @@
redirect_to contacts_path
end
end

Check notice

Code scanning / Rubocop

Avoid trailing whitespace. Note

Layout/TrailingWhitespace: Trailing whitespace detected.
ActiveSupport.run_load_hooks(:fat_free_crm_contacts_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/entities/leads_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,6 @@ def update_sidebar
get_data_for_sidebar(:campaign)
end
end

ActiveSupport.run_load_hooks(:fat_free_crm_leads_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/entities/opportunities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,6 @@ def set_params
current_user.pref[:opportunities_sort_by] = Opportunity.sort_by_map[params[:sort_by]] if params[:sort_by]
session[:opportunities_filter] = params[:stage] if params[:stage]
end

ActiveSupport.run_load_hooks(:fat_free_crm_opportunities_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/entities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,6 @@ def guess_related_account(id, url, user)
Account.new(user: user)
end
end

ActiveSupport.run_load_hooks(:fat_free_crm_entities_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,6 @@ def activity_duration
%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)
end
end

ActiveSupport.run_load_hooks(:fat_free_crm_home_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/lists_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ def list_params
:user_id
)
end

ActiveSupport.run_load_hooks(:fat_free_crm_lists_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,6 @@ def view
views = Task::ALLOWED_VIEWS
views.include?(view) ? view : views.first
end

ActiveSupport.run_load_hooks(:fat_free_crm_tasks_controller, self)
end
2 changes: 2 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,6 @@ def avatar_params
.permit(:image)
.merge(entity: @user, user_id: @user.id)
end

ActiveSupport.run_load_hooks(:fat_free_crm_users_controller, self)
end
Loading