Skip to content

Commit

Permalink
Added fathom site id configurable (#28)
Browse files Browse the repository at this point in the history
* AtlasOfLivingAustralia/biocollect#1534
- added capability to substitute Fathom site id
  • Loading branch information
temi authored Jun 19, 2023
1 parent 4bd3082 commit 96bc96f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}
}

version "4.1.0"
version "4.2.0-SNAPSHOT"
group "org.grails.plugins"

apply plugin:"eclipse"
Expand Down
3 changes: 3 additions & 0 deletions grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ info:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'

fathom:
site-id: 'TZHQTOVF'
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class TagLinkService {
String headerAndFooterVersion = "2"
@Value('${security.oidc.enabled:false}')
Boolean isOidc = false
@Value('${fathom.site-id}')
String fathomSiteId

@Autowired
LinkGenerator grailsLinkGenerator
Expand Down Expand Up @@ -315,6 +317,7 @@ class TagLinkService {
content = content.replace('::myProfileURL::', encodeOutput(buildMyProfileLink(request, attrs)))
content = content.replace('::editAccountLink::', encodeOutput(buildEditAccountLink(request, attrs)))
content = content.replace('::loginStatus::', signedInOutClass)
content = content.replace('::fathomID::', attrs?.fathomSiteId ?: fathomSiteId)

return content
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ class HeaderFooterTagLibSpec extends Specification implements TagLibUnitTest<Hea
result.startsWith(expected) || result.startsWith(' ' + expected)
}

void "test fathomId substitution" () {
given:
tagLib.tagLinkService.hfCache['footer'].content = "::fathomID::"
tagLib.tagLinkService.hfCache['footer'].timestamp = new Date().time

when:
def result = tagLib.footer()

then:
result == grailsApplication.config.getProperty('fathom.site-id')
}

void "test head"() {
given:
def expected = '<!-- head -->'
Expand Down

0 comments on commit 96bc96f

Please sign in to comment.