class ApplicationController
Public Instance Methods
Source
# File app/controllers/application_controller.rb, line 122 def careplus_reports_tab_visible? return false unless current_user&.cis2_info return false unless current_team current_team.eligible_for_automated_careplus_reports? end
Source
# File app/controllers/application_controller.rb, line 41 def current_organisation = current_user&.selected_organisation def current_team = current_user&.selected_team helper_method :current_organisation, :current_team private def ensure_team_is_selected redirect_to new_users_teams_path if current_user && cis2_info.team.nil? end def set_header_path @header_path = dashboard_path end def set_assets_name @assets_name = "application" end def set_theme_colour @theme_colour = HostingEnvironment.theme_colour end def set_service_name @service_name = "Manage vaccinations in schools" @service_name_with_abbreviation = "Manage vaccinations in schools (Mavis)" @sub_service_name = ("National reporting" if current_team&.has_national_reporting_access?) end def set_service_url @service_url = "https://www.manage-vaccinations-in-schools.nhs.uk" end def set_disable_cache_headers response.headers["Cache-Control"] = "no-store" response.headers["Pragma"] = "no-cache" response.headers["Expires"] = "0" end def handle_unprocessable_entity render "errors/unprocessable_entity", status: :unprocessable_content end def user_not_authorized flash[:alert] = "You are not authorized to perform this action." redirect_back_or_to dashboard_path, allow_other_host: false end def set_service_guide_url base_url = "https://guide.manage-vaccinations-in-schools.nhs.uk" @service_guide_url = if current_team&.has_national_reporting_access? "#{base_url}/national-reporting/" else base_url end end def set_privacy_policy_url @privacy_policy_url = nil end def set_sentry_user Sentry.set_user(id: current_user&.id) end def set_reporting_app_context_cookie return unless current_user cookies[:mavis_reporting_context] = { navigation_items: reporting_app_navigation_items, careplus_reports_tab_visible: careplus_reports_tab_visible? }.to_json end def reporting_app_navigation_items @navigation_items || [] end def careplus_reports_tab_visible? return false unless current_user&.cis2_info return false unless current_team current_team.eligible_for_automated_careplus_reports? end
Source
# File app/controllers/application_controller.rb, line 43 def current_team = current_user&.selected_team helper_method :current_organisation, :current_team private def ensure_team_is_selected redirect_to new_users_teams_path if current_user && cis2_info.team.nil? end def set_header_path @header_path = dashboard_path end def set_assets_name @assets_name = "application" end def set_theme_colour @theme_colour = HostingEnvironment.theme_colour end def set_service_name @service_name = "Manage vaccinations in schools" @service_name_with_abbreviation = "Manage vaccinations in schools (Mavis)" @sub_service_name = ("National reporting" if current_team&.has_national_reporting_access?) end def set_service_url @service_url = "https://www.manage-vaccinations-in-schools.nhs.uk" end def set_disable_cache_headers response.headers["Cache-Control"] = "no-store" response.headers["Pragma"] = "no-cache" response.headers["Expires"] = "0" end def handle_unprocessable_entity render "errors/unprocessable_entity", status: :unprocessable_content end def user_not_authorized flash[:alert] = "You are not authorized to perform this action." redirect_back_or_to dashboard_path, allow_other_host: false end def set_service_guide_url base_url = "https://guide.manage-vaccinations-in-schools.nhs.uk" @service_guide_url = if current_team&.has_national_reporting_access? "#{base_url}/national-reporting/" else base_url end end def set_privacy_policy_url @privacy_policy_url = nil end def set_sentry_user Sentry.set_user(id: current_user&.id) end def set_reporting_app_context_cookie return unless current_user cookies[:mavis_reporting_context] = { navigation_items: reporting_app_navigation_items, careplus_reports_tab_visible: careplus_reports_tab_visible? }.to_json end def reporting_app_navigation_items @navigation_items || [] end def careplus_reports_tab_visible? return false unless current_user&.cis2_info return false unless current_team current_team.eligible_for_automated_careplus_reports? end end
Source
# File app/controllers/application_controller.rb, line 49 def ensure_team_is_selected redirect_to new_users_teams_path if current_user && cis2_info.team.nil? end
Source
# File app/controllers/application_controller.rb, line 82 def handle_unprocessable_entity render "errors/unprocessable_entity", status: :unprocessable_content end
Source
# File app/controllers/application_controller.rb, line 57 def set_assets_name @assets_name = "application" end
Source
# File app/controllers/application_controller.rb, line 76 def set_disable_cache_headers response.headers["Cache-Control"] = "no-store" response.headers["Pragma"] = "no-cache" response.headers["Expires"] = "0" end
Source
# File app/controllers/application_controller.rb, line 53 def set_header_path @header_path = dashboard_path end
Source
# File app/controllers/application_controller.rb, line 101 def set_privacy_policy_url @privacy_policy_url = nil end
Source
# File app/controllers/application_controller.rb, line 105 def set_sentry_user Sentry.set_user(id: current_user&.id) end
Source
# File app/controllers/application_controller.rb, line 91 def set_service_guide_url base_url = "https://guide.manage-vaccinations-in-schools.nhs.uk" @service_guide_url = if current_team&.has_national_reporting_access? "#{base_url}/national-reporting/" else base_url end end
Source
# File app/controllers/application_controller.rb, line 65 def set_service_name @service_name = "Manage vaccinations in schools" @service_name_with_abbreviation = "Manage vaccinations in schools (Mavis)" @sub_service_name = ("National reporting" if current_team&.has_national_reporting_access?) end
Source
# File app/controllers/application_controller.rb, line 72 def set_service_url @service_url = "https://www.manage-vaccinations-in-schools.nhs.uk" end
Source
# File app/controllers/application_controller.rb, line 61 def set_theme_colour @theme_colour = HostingEnvironment.theme_colour end