You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
934 B
38 lines
934 B
class DataProtectionConfirmationBannerComponent < ViewComponent::Base |
|
include Rails.application.routes.url_helpers |
|
|
|
attr_reader :user, :organisation |
|
|
|
def initialize(user:, organisation: nil) |
|
@user = user |
|
@organisation = organisation |
|
|
|
super |
|
end |
|
|
|
def display_banner? |
|
return false unless FeatureToggle.new_data_protection_confirmation? |
|
return false if user.support? && organisation.blank? |
|
|
|
!DataProtectionConfirmation.exists?( |
|
organisation: org_or_user_org, |
|
confirmed: true, |
|
) |
|
end |
|
|
|
def data_protection_officers_text |
|
if org_or_user_org.data_protection_officers.any? |
|
"You can ask: #{org_or_user_org.data_protection_officers.map(&:name).sort_by(&:downcase).join(', ')}" |
|
end |
|
end |
|
|
|
def data_sharing_agreement_href |
|
data_sharing_agreement_organisation_path(org_or_user_org) |
|
end |
|
|
|
private |
|
|
|
def org_or_user_org |
|
organisation.presence || user.organisation |
|
end |
|
end
|
|
|