Add completion page
This commit is contained in:
parent
3e0003095b
commit
54e77f72f4
5 changed files with 327 additions and 12 deletions
|
|
@ -6,6 +6,14 @@ import (
|
|||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
)
|
||||
|
||||
type ContentCompliance struct {
|
||||
District *ContentDistrict
|
||||
HasCompleteResponse bool
|
||||
HasUsefulInfo bool
|
||||
ReferenceNumber string
|
||||
URL ContentURL
|
||||
}
|
||||
|
||||
func getDistrictCompliance(w http.ResponseWriter, r *http.Request) {
|
||||
district, err := districtBySlug(r)
|
||||
if err != nil {
|
||||
|
|
@ -15,7 +23,7 @@ func getDistrictCompliance(w http.ResponseWriter, r *http.Request) {
|
|||
html.RenderOrError(
|
||||
w,
|
||||
"rmo/district-compliance.html",
|
||||
ContentNuisance{
|
||||
ContentCompliance{
|
||||
District: newContentDistrict(district),
|
||||
URL: makeContentURL(nil),
|
||||
},
|
||||
|
|
@ -31,13 +39,37 @@ func getDistrictComplianceAddress(w http.ResponseWriter, r *http.Request) {
|
|||
html.RenderOrError(
|
||||
w,
|
||||
"rmo/district-compliance-address.html",
|
||||
ContentNuisance{
|
||||
ContentCompliance{
|
||||
District: newContentDistrict(district),
|
||||
URL: makeContentURL(nil),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func getDistrictComplianceComplete(w http.ResponseWriter, r *http.Request) {
|
||||
query := r.URL.Query()
|
||||
complete := query.Get("complete")
|
||||
is_complete := complete != ""
|
||||
useful := query.Get("useful")
|
||||
is_useful := useful != ""
|
||||
|
||||
district, err := districtBySlug(r)
|
||||
if err != nil {
|
||||
respondError(w, "Failed to lookup organization", err, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
html.RenderOrError(
|
||||
w,
|
||||
"rmo/district-compliance-complete.html",
|
||||
ContentCompliance{
|
||||
District: newContentDistrict(district),
|
||||
HasCompleteResponse: is_complete,
|
||||
HasUsefulInfo: is_useful,
|
||||
ReferenceNumber: "ABC-123",
|
||||
URL: makeContentURL(nil),
|
||||
},
|
||||
)
|
||||
}
|
||||
func getDistrictComplianceConcern(w http.ResponseWriter, r *http.Request) {
|
||||
district, err := districtBySlug(r)
|
||||
if err != nil {
|
||||
|
|
@ -47,7 +79,7 @@ func getDistrictComplianceConcern(w http.ResponseWriter, r *http.Request) {
|
|||
html.RenderOrError(
|
||||
w,
|
||||
"rmo/district-compliance-concern.html",
|
||||
ContentNuisance{
|
||||
ContentCompliance{
|
||||
District: newContentDistrict(district),
|
||||
URL: makeContentURL(nil),
|
||||
},
|
||||
|
|
@ -63,7 +95,7 @@ func getDistrictComplianceContact(w http.ResponseWriter, r *http.Request) {
|
|||
html.RenderOrError(
|
||||
w,
|
||||
"rmo/district-compliance-contact.html",
|
||||
ContentNuisance{
|
||||
ContentCompliance{
|
||||
District: newContentDistrict(district),
|
||||
URL: makeContentURL(nil),
|
||||
},
|
||||
|
|
@ -79,7 +111,7 @@ func getDistrictComplianceEvidence(w http.ResponseWriter, r *http.Request) {
|
|||
html.RenderOrError(
|
||||
w,
|
||||
"rmo/district-compliance-evidence.html",
|
||||
ContentNuisance{
|
||||
ContentCompliance{
|
||||
District: newContentDistrict(district),
|
||||
URL: makeContentURL(nil),
|
||||
},
|
||||
|
|
@ -95,7 +127,7 @@ func getDistrictCompliancePermission(w http.ResponseWriter, r *http.Request) {
|
|||
html.RenderOrError(
|
||||
w,
|
||||
"rmo/district-compliance-permission.html",
|
||||
ContentNuisance{
|
||||
ContentCompliance{
|
||||
District: newContentDistrict(district),
|
||||
URL: makeContentURL(nil),
|
||||
},
|
||||
|
|
@ -110,7 +142,7 @@ func getDistrictComplianceProcess(w http.ResponseWriter, r *http.Request) {
|
|||
html.RenderOrError(
|
||||
w,
|
||||
"rmo/district-compliance-process.html",
|
||||
ContentNuisance{
|
||||
ContentCompliance{
|
||||
District: newContentDistrict(district),
|
||||
URL: makeContentURL(nil),
|
||||
},
|
||||
|
|
@ -126,7 +158,7 @@ func getDistrictComplianceSubmit(w http.ResponseWriter, r *http.Request) {
|
|||
html.RenderOrError(
|
||||
w,
|
||||
"rmo/district-compliance-submit.html",
|
||||
ContentNuisance{
|
||||
ContentCompliance{
|
||||
District: newContentDistrict(district),
|
||||
URL: makeContentURL(nil),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ func Router(r *mux.Router) {
|
|||
r.HandleFunc("/district/{slug}", getRootDistrict).Methods("GET")
|
||||
r.HandleFunc("/district/{slug}/compliance", getDistrictCompliance).Methods("GET")
|
||||
r.HandleFunc("/district/{slug}/compliance/address", getDistrictComplianceAddress).Methods("GET")
|
||||
r.HandleFunc("/district/{slug}/compliance/complete", getDistrictComplianceComplete).Methods("GET")
|
||||
r.HandleFunc("/district/{slug}/compliance/concern", getDistrictComplianceConcern).Methods("GET")
|
||||
r.HandleFunc("/district/{slug}/compliance/contact", getDistrictComplianceContact).Methods("GET")
|
||||
r.HandleFunc("/district/{slug}/compliance/evidence", getDistrictComplianceEvidence).Methods("GET")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue