diff --git a/app/assets/javascripts/expand-endpoint.js b/app/assets/javascripts/expand-endpoint.js index 287c65db..477bd19e 100644 --- a/app/assets/javascripts/expand-endpoint.js +++ b/app/assets/javascripts/expand-endpoint.js @@ -5,7 +5,6 @@ var lastPart = url.split("#").pop(); var endpoint = document.getElementById(lastPart + "-details"); if (endpoint != null) { - var endpoint = document.getElementById(lastPart + "-details"); var att = document.createAttribute("open"); att.value = ""; endpoint.setAttributeNode(att); @@ -37,10 +36,8 @@ var clickedEndpoint = e.target.id var parentEndpoint = document.getElementById(clickedEndpoint + "-details"); if (parentEndpoint.hasAttribute("open")) { - var parentEndpoint = document.getElementById(clickedEndpoint + "-details"); parentEndpoint.removeAttribute("open"); } else { - var parentEndpoint = document.getElementById(clickedEndpoint + "-details"); var att = document.createAttribute("open"); att.value = ""; parentEndpoint.setAttributeNode(att); @@ -70,14 +67,17 @@ window.addEventListener('load', function () { expandEnpoint() - var allLinks = document.querySelector("#endpoints").querySelectorAll('a[href^="#"]'); - for (var i = 0; i < allLinks.length; i++) { - allLinks[i].addEventListener('click', function (e) { - e.preventDefault(); - document.querySelector(this.getAttribute('href')).scrollIntoView({ - behavior: 'smooth' + var endpoints = document.querySelector("#endpoints") + if (endpoints) { + var allLinks = endpoints.querySelectorAll('a[href^="#"]'); + for (var i = 0; i < allLinks.length; i++) { + allLinks[i].addEventListener('click', function (e) { + e.preventDefault(); + document.querySelector(this.getAttribute('href')).scrollIntoView({ + behavior: 'smooth' + }); }); - }); + } } }); })(); diff --git a/app/uk/gov/hmrc/apidocumentation/views/AuthorisationAppRestrictedEndpointsView.scala.html b/app/uk/gov/hmrc/apidocumentation/views/AuthorisationAppRestrictedEndpointsView.scala.html index 6c88ae20..5f2face5 100644 --- a/app/uk/gov/hmrc/apidocumentation/views/AuthorisationAppRestrictedEndpointsView.scala.html +++ b/app/uk/gov/hmrc/apidocumentation/views/AuthorisationAppRestrictedEndpointsView.scala.html @@ -53,7 +53,7 @@
- If the endpoint requires a scope, + If the endpoint requires a scope, your application must include this scope when creating the access token.
Read the API documentation for authorisation rules for specific API endpoints.
@@ -117,7 +117,7 @@scope
You can now call an API using the access_token
we issued. Do this with an
Authorization header containing this access_token
as an OAuth 2.0 Bearer
- Token with the correct API scope.
+ Token with the correct API scope.
curl -X GET @{applicationConfig.sandboxApiBaseUrl}/hello/application \ diff --git a/app/uk/gov/hmrc/apidocumentation/views/AuthorisationUserRestrictedEndpointsView.scala.html b/app/uk/gov/hmrc/apidocumentation/views/AuthorisationUserRestrictedEndpointsView.scala.html index aba9529f..aeadd944 100644 --- a/app/uk/gov/hmrc/apidocumentation/views/AuthorisationUserRestrictedEndpointsView.scala.html +++ b/app/uk/gov/hmrc/apidocumentation/views/AuthorisationUserRestrictedEndpointsView.scala.html @@ -54,7 +54,7 @@User-restricted endpoints
HMRC on their behalf, without sharing their access credentials. -The end user authenticates directly with us using their Government Gateway account, and grants authority for specific scopes.
+The end user authenticates directly with us using their Government Gateway account, and grants authority for specific scopes.
We then issue an OAuth 2.0 access token that’s specific to the end user. Your application passes the access token in subsequent API requests to user-restricted endpoints.
@@ -91,7 +91,7 @@1. Request authorisation
The following diagram illustrates the process:
diff --git a/app/uk/gov/hmrc/apidocumentation/views/OpenApiPreviewRedoc.scala.html b/app/uk/gov/hmrc/apidocumentation/views/OpenApiPreviewRedoc.scala.html index f191ba39..d99914bf 100644 --- a/app/uk/gov/hmrc/apidocumentation/views/OpenApiPreviewRedoc.scala.html +++ b/app/uk/gov/hmrc/apidocumentation/views/OpenApiPreviewRedoc.scala.html @@ -14,21 +14,23 @@ * limitations under the License. *@ +@import views.html.helper.CSPNonce + @this() -@(uri: String) +@(uri: String)(implicit requestHeader: RequestHeader) - - + + @* To fix this issue: https://github.com/Redocly/redoc/issues/1108#issuecomment-585990742 *@ - - + + @* To fix this issue: https://github.com/Redocly/redoc/issues/1108#issuecomment-585990742 *@ - + diff --git a/app/uk/gov/hmrc/apidocumentation/views/include/main.scala.html b/app/uk/gov/hmrc/apidocumentation/views/include/main.scala.html index d8be9e8d..e918deff 100644 --- a/app/uk/gov/hmrc/apidocumentation/views/include/main.scala.html +++ b/app/uk/gov/hmrc/apidocumentation/views/include/main.scala.html @@ -26,6 +26,7 @@ @import uk.gov.hmrc.apidocumentation.views.templates.FooterLinks @import play.twirl.api.HtmlFormat +@import views.html.helper.CSPNonce @this( govukTemplate: GovukTemplate, @@ -45,7 +46,7 @@ additionalTopContent: Option[Html] = None, fullWidthContent: Boolean = false, bodyEndBlock: Option[Html] = None - )(mainContent: Html = HtmlFormat.empty)(implicit applicationConfig: ApplicationConfig, messages: Messages, request: play.api.mvc.Request[Any]) + )(mainContent: Html = HtmlFormat.empty)(implicit applicationConfig: ApplicationConfig, messages: Messages, request: play.api.mvc.Request[Any], requestHeader: RequestHeader) @head = { @@ -53,8 +54,8 @@ } @scripts = { - - + + } @@ -65,7 +66,7 @@ } @scriptElem = { - + } @footerBlock = { diff --git a/app/uk/gov/hmrc/apidocumentation/views/openapispec/ParentPageView.scala.html b/app/uk/gov/hmrc/apidocumentation/views/openapispec/ParentPageView.scala.html index e0e8eaad..6380a938 100644 --- a/app/uk/gov/hmrc/apidocumentation/views/openapispec/ParentPageView.scala.html +++ b/app/uk/gov/hmrc/apidocumentation/views/openapispec/ParentPageView.scala.html @@ -22,10 +22,12 @@ @import uk.gov.hmrc.apidocumentation.services._ @import uk.gov.hmrc.apidocumentation.config.ApplicationConfig @import uk.gov.hmrc.apidocumentation.models.apispecification.DocumentationItem +@import views.html.helper.CSPNonce @this(applicationConfig: ApplicationConfig) -@(markdownBlocks: List[DocumentationItem], title: String, maybeVersion: Option[ExtendedAPIVersion], maybeApi: Option[ExtendedAPIDefinition], loggedIn: Boolean = false) +@(markdownBlocks: List[DocumentationItem], title: String, maybeVersion: Option[ExtendedAPIVersion], maybeApi: Option[ExtendedAPIDefinition], loggedIn: Boolean = false +)(implicit requestHeader: RequestHeader) @renderGetApiVersionForm = { @for(api <- maybeApi) { @@ -138,4 +140,4 @@