Skip to content

How Privacy Notices were added to WebApp

Lydia Gray edited this page May 24, 2018 · 1 revision

ContentFactory/ContentTypeFactory

  • Add PrivacyNotice to _factories (see snapshot below)

Add PrivacyNotice to _factories

ContentFactory

  • Create PrivacyNoticeFactory in ContentFactory
  • Initialise global variable for MarkdownWrapper
  • Create constructor
  • Create virtual Build method of type ProcessedPrivacyNotice taking in a PrivacyNotice
  • Create variables for fields that require converting to markdown
  • Set each variable to _markdownWrapper.ConvertToHtml passing in the appropriate fields from the privacyNotice
  • Initialise processedPrivacyNotice to a new ProcessedPrivacyNotice passing in each field from the privacyNotice OR the html converted variable set in the previous step (see snapshot below)

Instantiate processedPrivacyNotice

  • Return processedPrivacyNotice

Controllers

  • Create PrivacyNoticeController in Controllers, and inherit from Controller
  • Initialise global variable for IProcessedContentRepository
  • Create constructor and inject its dependencies
  • Add [HttpGet] and route attributes
  • Create async Task method passing in a slug
  • Initialise result to await Get on the repository (passing in slug)
  • If result is not successful, return result
  • Initialise privacyNotice to the content of result as a ProcessedPrivacyNotice
  • Return View passing in privacyNotice

Models

  • Create PrivacyNotice in Models
  • Get/set for all properties
  • Create empty constructor
  • Create constructor with all properties

Processed Models

  • Create ProcessedPrivacyNotice in ProcessedModels
  • Get/set for all properties
  • Create empty constructor
  • Create constructor with all properties

Utils/UrlGenerator

  • Add “privacy-notices/” to UrlGenerator (see snapshot below)

Add to UrlGenerator

Views/stockportgov

  • Create folder PrivacyNotice in Views/stockportgov
  • Create file Detail in PrivacyNotice folder
  • Add view as required