Skip to content

Commit

Permalink
Merge branch 'develop' into release/0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NoelleDL committed Aug 16, 2022
2 parents d314e7d + 922bb30 commit d1ca52e
Show file tree
Hide file tree
Showing 18 changed files with 607 additions and 247 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/build
assets/data.go

# Mac
.DS_Store
#VSCode
Expand Down
30 changes: 26 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ BINPATH ?= build
BUILD_TIME=$(shell date +%s)
GIT_COMMIT=$(shell git rev-parse HEAD)
VERSION ?= $(shell git tag --points-at HEAD | grep ^v | head -n 1)
LOCAL_DP_RENDERER_IN_USE = $(shell grep -c "\"github.com/ONSdigital/dp-renderer\" =" go.mod)

LDFLAGS = -ldflags "-X main.BuildTime=$(BUILD_TIME) -X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)"

Expand All @@ -14,19 +15,40 @@ audit:
go list -m all | nancy sleuth

.PHONY: build
build:
build: generate-prod
go build -tags 'production' $(LDFLAGS) -o $(BINPATH)/dp-frontend-feedback-controller

.PHONY: debug
debug:
debug: generate-debug
go build -tags 'debug' $(LDFLAGS) -o $(BINPATH)/dp-frontend-feedback-controller
HUMAN_LOG=1 DEBUG=1 $(BINPATH)/dp-frontend-feedback-controller

.PHONY: test
test:
go test -race -cover ./...
test: generate-prod
go test -race -cover -tags 'production' ./...

.PHONY: convey
convey:
goconvey ./...

.PHONY: fetch-renderer-lib
fetch-renderer-lib:
ifeq ($(LOCAL_DP_RENDERER_IN_USE), 1)
$(eval CORE_ASSETS_PATH = $(shell grep -w "\"github.com/ONSdigital/dp-renderer\" =>" go.mod | awk -F '=> ' '{print $$2}' | tr -d '"'))
else
$(eval APP_RENDERER_VERSION=$(shell grep "github.com/ONSdigital/dp-renderer" go.mod | cut -d ' ' -f2 ))
$(eval CORE_ASSETS_PATH = $(shell go get github.com/ONSdigital/dp-renderer@$(APP_RENDERER_VERSION) && go list -f '{{.Dir}}' -m github.com/ONSdigital/dp-renderer))
endif

.PHONY: generate-debug
generate-debug: fetch-renderer-lib
cd assets; go run github.com/kevinburke/go-bindata/go-bindata -prefix $(CORE_ASSETS_PATH)/assets -debug -o data.go -pkg assets locales/... templates/... $(CORE_ASSETS_PATH)/assets/locales/... $(CORE_ASSETS_PATH)/assets/templates/...
{ echo "// +build debug\n"; cat assets/data.go; } > assets/debug.go.new
mv assets/debug.go.new assets/data.go

.PHONY: generate-prod
generate-prod: fetch-renderer-lib
cd assets; go run github.com/kevinburke/go-bindata/go-bindata -prefix $(CORE_ASSETS_PATH)/assets -o data.go -pkg assets locales/... templates/... $(CORE_ASSETS_PATH)/assets/locales/... $(CORE_ASSETS_PATH)/assets/templates/...
{ echo "// +build production\n"; cat assets/data.go; } > assets/data.go.new
mv assets/data.go.new assets/data.go

49 changes: 27 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
dp-frontend-feedback-controller
================
# dp-frontend-feedback-controller

To allow users to provide feedback about the ONS website

### Getting started
## Getting started

* Run `make debug`

### Dependencies
## Dependencies

* No further dependencies other than those defined in `go.mod`

### Configuration

| Environment variable | Default | Description
| ---------------------------- | --------- | -----------
| BIND_ADDR | localhost:25200 | The host and port to bind to
| GRACEFUL_SHUTDOWN_TIMEOUT | 5s | The graceful shutdown timeout in seconds (`time.Duration` format)
| HEALTHCHECK_INTERVAL | 30s | Time between self-healthchecks (`time.Duration` format)
| HEALTHCHECK_CRITICAL_TIMEOUT | 90s | Time to wait until an unhealthy dependent propagates its state to make this app unhealthy (`time.Duration` format)
| RENDERER_URL | http://localhost:20010 | The URL of [dp-frontend-renderer](https://www.github.com/ONSdigital/dp-frontend-renderer).
| MAIL_HOST | "" | The host for the mail server.
| MAIL_PORT | "" | The port for the mail server.
| MAIL_USER | "" | A user on the mail server.
| MAIL_PASSWORD | "" | The password for the mail server user.
| FEEDBACK_TO | "" | Receiver email address for feedback.
| FEEDBACK_FROM | "" | Sender email address for feedback.

### Contributing
## Configuration

| Environment variable | Default | Description
| ------------------------------ | --------- | -----------
| BIND_ADDR | localhost:25200 | The host and port to bind to
| GRACEFUL_SHUTDOWN_TIMEOUT | 5s | The graceful shutdown timeout in seconds (`time.Duration` format)
| HEALTHCHECK_INTERVAL | 30s | Time between self-healthchecks (`time.Duration` format)
| HEALTHCHECK_CRITICAL_TIMEOUT | 90s | Time to wait until an unhealthy dependent propagates its state to make this app unhealthy (`time.Duration` format)
| RENDERER_URL | http://localhost:20010 | The URL of [dp-frontend-renderer](https://www.github.com/ONSdigital/dp-frontend-renderer).
| MAIL_HOST | "" | The host for the mail server.
| MAIL_PORT | "" | The port for the mail server.
| MAIL_USER | "" | A user on the mail server.
| MAIL_PASSWORD | "" | The password for the mail server user.
| FEEDBACK_TO | "" | Receiver email address for feedback.
| FEEDBACK_FROM | "" | Sender email address for feedback.
| DEBUG | false | Enable debug mode
| API_ROUTER_URL | http://localhost:23200/v1 | The URL of the [dp-api-router](https://github.com/ONSdigital/dp-api-router)
| SITE_DOMAIN | localhost |
| PATTERN_LIBRARY_ASSETS_PATH | "" | Pattern library location
| SUPPORTED_LANGUAGES | [2]string{"en", "cy"} | Supported languages

## Contributing

See [CONTRIBUTING](CONTRIBUTING.md) for details.

### License
## License

Copyright © 2021, Office for National Statistics (https://www.ons.gov.uk)

Expand Down
3 changes: 3 additions & 0 deletions assets/assets.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// assets in locale and templates folders are converted into Go source code with go-bindata
// the data.go file in this package is auto generated through the generate-dev and generate-prod tasks in the Makefile
package assets
98 changes: 98 additions & 0 deletions assets/locales/service.cy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Notes
# - Documentation: https://github.com/nicksnyder/go-i18n/blob/master/README.md
# - Description should be the English version of the text, unless English version is a shorthand e.g. Home button is shorthand in English for Homepage
# - Arguments can be added via {{.argN}} where N is integer index starting at 0 e.g. {{.arg0}} {{.arg1}}
# - To inject HTML (Avoid where possible as it is messy) use "| safeHTML" e.g. {{ localise Foo .Language 1 | safeHTML }} where Foo might be "<strong>test</strong>"
# count - 0 = zero
# count - 1 = one
# count - 2 = two; useful for languages with mutations like welsh (radical) 'brother'=brawd, two (soft) 'brothers'=frawd, three or more (nasal) 'brothers'=brodyr
# count - 3 = few
# count - 6 = many
# count - 4 = other; 4,5 & >6
# Plural rules can be found here: http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------

[FeedbackTitle]
description = "{{.Metadata.Title}}"
one = "{{.arg0}}"

[FeedbackDesc]
descriptions = "You can use the form below to ask a question, report a problem or suggest an improvement we can make to ONS.GOV.UK"
one = "You can use the form below to ask a question, report a problem or suggest an improvement to the ONS.GOV.UK team."

[FeedbackTitleWhat]
description = "What's it to do with?"
one = "What's it to do with?"

[FeedbackWhatOptSpecificPage]
description = "This specific page"
one = "This specific page"

[FeedbackWhatEnterURL]
description = "Enter URL or name of the page"
one = "Enter URL or name of the page"

[FeedbackWhatOptHintSpecificPage]
description = "{{.ServiceDescription}}"
one = "({{.arg0}})"

[FeedbackWhatOptNewService]
description = "This new service"
one = "This new service"

[FeedbackWhatOptGeneral]
description = "The whole <abbr title=\"Office for National Statistics\">ONS</abbr> website or general feedback"
one = "The whole ONS website or general feedback"

[FeedbackTitleEntry]
description = "What are the details?"
one = "What are the details?"

[FeedbackHintEntry]
description = "For example, if you were searching for something, what did you type into the search box?"
one = "For example, if you were searching for something, what did you type into the search box?"

[FeedbackAlertEntry]
description = "Write some feedback"
one = "Write some feedback"

[FeedbackTitleReply]
description = "Do you want a reply?"
one = "Do you want a reply?"

[FeedbackDescReply]
description = "If you'd like us to get back to you, please add your name and email address below."
one = "If you'd like us to get back to you, please add your name and email address below."

[FeedbackTitleName]
description = "Name (optional)"
one = "Name (optional)"

[FeedbackTitleEmail]
description = "Email (optional)"
one = "Email (optional)"

[FeedbackReplyDisclaimer]
description = "We'll only use this to reply to your message"
one = "We'll only use this to reply to your message."

[FeedbackAlertEmail]
description = "This is not a valid email address, correct it or delete it"
one = "This is not a valid email address, correct it or delete it"

[FeedbackSubmit]
description = "Send feedback"
one = "Send feedback"

[FeedbackFinished]
description = "Your feedback will help us to improve the website. We are unable to respond to all enquiries. If your matter is urgent, please <a href=\"/aboutus/contactus\">contact us</a>.<br><br>Return to <a href=\"{{.Metadata.Description}}\">{{.Metadata.Description}}"
one = "Your feedback will help us to improve the website. We are unable to respond to all enquiries. If your matter is urgent, please <a href=\"/aboutus/contactus\">contact us</a>.<br><br>Return to <a href=\"{{.arg0}}\">{{.arg0}}"

[FeedbackWholeWebsite]
description = "The whole ONS website or general feedback"
one = "The whole ONS website or general feedback"

[FeedbackASpecificPage]
description = "A specific page"
one = "A specific page"
98 changes: 98 additions & 0 deletions assets/locales/service.en.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Notes
# - Documentation: https://github.com/nicksnyder/go-i18n/blob/master/README.md
# - Description should be the English version of the text, unless English version is a shorthand e.g. Home button is shorthand in English for Homepage
# - Arguments can be added via {{.argN}} where N is integer index starting at 0 e.g. {{.arg0}} {{.arg1}}
# - To inject HTML (Avoid where possible as it is messy) use "| safeHTML" e.g. {{ localise Foo .Language 1 | safeHTML }} where Foo might be "<strong>test</strong>"
# count - 0 = zero
# count - 1 = one
# count - 2 = two; useful for languages with mutations like welsh (radical) 'brother'=brawd, two (soft) 'brothers'=frawd, three or more (nasal) 'brothers'=brodyr
# count - 3 = few
# count - 6 = many
# count - 4 = other; 4,5 & >6
# Plural rules can be found here: http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------

[FeedbackTitle]
description = "{{.Metadata.Title}}"
one = "{{.arg0}}"

[FeedbackDesc]
descriptions = "You can use the form below to ask a question, report a problem or suggest an improvement we can make to ONS.GOV.UK"
one = "You can use the form below to ask a question, report a problem or suggest an improvement to the ONS.GOV.UK team."

[FeedbackTitleWhat]
description = "What's it to do with?"
one = "What's it to do with?"

[FeedbackWhatOptSpecificPage]
description = "This specific page"
one = "This specific page"

[FeedbackWhatEnterURL]
description = "Enter URL or name of the page"
one = "Enter URL or name of the page"

[FeedbackWhatOptHintSpecificPage]
description = "{{.ServiceDescription}}"
one = "({{.arg0}})"

[FeedbackWhatOptNewService]
description = "This new service"
one = "This new service"

[FeedbackWhatOptGeneral]
description = "The whole <abbr title=\"Office for National Statistics\">ONS</abbr> website or general feedback"
one = "The whole ONS website or general feedback"

[FeedbackTitleEntry]
description = "What are the details?"
one = "What are the details?"

[FeedbackHintEntry]
description = "For example, if you were searching for something, what did you type into the search box?"
one = "For example, if you were searching for something, what did you type into the search box?"

[FeedbackAlertEntry]
description = "Write some feedback"
one = "Write some feedback"

[FeedbackTitleReply]
description = "Do you want a reply?"
one = "Do you want a reply?"

[FeedbackDescReply]
description = "If you'd like us to get back to you, please add your name and email address below."
one = "If you'd like us to get back to you, please add your name and email address below."

[FeedbackTitleName]
description = "Name (optional)"
one = "Name (optional)"

[FeedbackTitleEmail]
description = "Email (optional)"
one = "Email (optional)"

[FeedbackReplyDisclaimer]
description = "We'll only use this to reply to your message"
one = "We'll only use this to reply to your message."

[FeedbackAlertEmail]
description = "This is not a valid email address, correct it or delete it"
one = "This is not a valid email address, correct it or delete it"

[FeedbackSubmit]
description = "Send feedback"
one = "Send feedback"

[FeedbackFinished]
description = "Your feedback will help us to improve the website. We are unable to respond to all enquiries. If your matter is urgent, please <a href=\"/aboutus/contactus\">contact us</a>.<br><br>Return to <a href=\"{{.Metadata.Description}}\">{{.Metadata.Description}}"
one = "Your feedback will help us to improve the website. We are unable to respond to all enquiries. If your matter is urgent, please <a href=\"/aboutus/contactus\">contact us</a>.<br><br>Return to <a href=\"{{.arg0}}\">{{.arg0}}"

[FeedbackWholeWebsite]
description = "The whole ONS website or general feedback"
one = "The whole ONS website or general feedback"

[FeedbackASpecificPage]
description = "A specific page"
one = "A specific page"
Loading

0 comments on commit d1ca52e

Please sign in to comment.