hlfw.ca

webbing

Download patch

ref: 77c4b5fbc7c014d245ab2cd0ac2131fca0e5210f
parent: 350c01ad73bd4d71473a3f1b1b281e800127939c
author: Halfwit <halfwit@MacBook-Pro.hitronhub.home>
date: Thu Dec 12 10:50:34 PST 2019

Change templates to use nested plugin templates

--- /dev/null
+++ b/key.pem
@@ -1,0 +1,9 @@
+-----BEGIN EC PARAMETERS-----
+BgUrgQQAIg==
+-----END EC PARAMETERS-----
+-----BEGIN EC PRIVATE KEY-----
+MIGkAgEBBDAeTBdoYaAY5ETFPFuZgZ/YU8qd10mROvVfWkzWSGViAKCxKEEW9P6P
+GxxpgprfLuKgBwYFK4EEACKhZANiAAR+V8cvAr/T8r0OKhQKRWpVHD8dG3ZLvSK1
+6fPDVyVo2xA62x231L8jcIse4u9cCpGsYb1P1peXS9x0yJp/MtvUHVIkf0xFlW6b
+/K7fQ3tPS6ecfHQ7+V+cp3LoD78ARt4=
+-----END EC PRIVATE KEY-----
--- a/pages/doctor/application.go
+++ b/pages/doctor/application.go
@@ -25,7 +25,6 @@
 		"title":      p.Sprint("Olmax Medical | Application"),
 		"offer":      p.Sprint("Create A New Offer"),
 		"area":       p.Sprint("Location and specialties"),
-		"doccountry": p.Sprint("What country or countries do you practice medicine?"),
 		"docspecial": p.Sprint("What is your specialty, or specialties?"),
 		"gender":     p.Sprint("What is your biological gender?"),
 		"male":       p.Sprint("Male"),
--- a/plugins/countries.go
+++ b/plugins/countries.go
@@ -65,9 +65,11 @@
 	c.list[j] = tmp
 }
 
-func listCountries(_ *router.Request) map[string]interface{} {
+func listCountries(r *router.Request) map[string]interface{} {
+	p := r.Printer()
 	// TODO(halfwit): Use Request to get a localized country name
 	c := make(map[string]interface{})
+	c["label"] = p.Sprint("Select country/countries")
 	for _, item := range cache.list {
 		c[item.Name.Common] = item.Name.Common
 	}
--- a/plugins/services.go
+++ b/plugins/services.go
@@ -25,7 +25,7 @@
 	for _, entry := range s.PostFormValue("specialty") {
 		switch string(entry) {
 		case "acutepain":
-		case "anesthesiology":
+		case "anasthesiology":
 		case "bariatric":
 		case "cardiology":
 		case "chiropractic":
@@ -74,40 +74,41 @@
 func ListServices(r *router.Request) map[string]interface{} {
 	p := r.Printer()
 	return map[string]interface{}{
-		"acutepain":      p.Sprintf("Acute Pain Medicine"),
-		"anesthesiology": p.Sprintf("Anesthesiology"),
-		"bariatric":      p.Sprintf("Bariatric Surgery"),
-		"cardiology":     p.Sprintf("Cardiology"),
-		"chiropractic":   p.Sprintf("Chiropractics"),
-		"chronic":        p.Sprintf("Chronic Pain"),
-		"critcare":       p.Sprintf("Critical Care"),
-		"dermatology":    p.Sprintf("Dermatology"),
-		"emergency":      p.Sprintf("Emergency Medicine"),
-		"endocrinology":  p.Sprintf("Endocrinology"),
-		"otolaringology": p.Sprintf("Ear Nose and Throat"),
-		"familymedicine": p.Sprintf("Family Medicine"),
-		"gastro":         p.Sprintf("Gastrointestinology"),
-		"headneck":       p.Sprintf("Head and Neck"),
-		"hematology":     p.Sprintf("Hematology and Oncology"),
-		"hepatology":     p.Sprintf("Hepatology"),
-		"hyperbaric":     p.Sprintf("Hyperbaric"),
-		"immunology":     p.Sprintf("Immunology"),
-		"diseases":       p.Sprintf("Infectious Diseases"),
-		"internal":       p.Sprintf("Internal Medicine"),
-		"neonatal":       p.Sprintf("Neonatology"),
-		"nephrology":     p.Sprintf("Nephrology"),
-		"neurology":      p.Sprintf("Neurology"),
-		"neurosurgery":   p.Sprintf("Neurosurgery"),
-		"obstetrics":     p.Sprintf("Obstetrics and Gynecology"),
-		"occupational":   p.Sprintf("Occupational Medicine"),
-		"opthamology":    p.Sprintf("Opthamology"),
-		"orthopedics":    p.Sprintf("Orthopedic Surgery"),
-		"palliative":     p.Sprintf("Palliative Care"),
-		"pediatrics":     p.Sprintf("Pediatrics"),
-		"podiatry":       p.Sprintf("Podiatry"),
-		"pulmonology":    p.Sprintf("Pulmonology"),
-		"radiology":      p.Sprintf("Radiology"),
-		"radiation":      p.Sprintf("Radiaton Oncology"),
-		"transplants":    p.Sprintf("Transplant Surgery"),
+		"label":          p.Sprint("Select specialty/specialties"),
+		"acutepain":      p.Sprint("Acute Pain Medicine"),
+		"anesthesiology": p.Sprint("Anesthesiology"),
+		"bariatric":      p.Sprint("Bariatric Surgery"),
+		"cardiology":     p.Sprint("Cardiology"),
+		"chiropractic":   p.Sprint("Chiropractics"),
+		"chronic":        p.Sprint("Chronic Pain"),
+		"critcare":       p.Sprint("Critical Care"),
+		"dermatology":    p.Sprint("Dermatology"),
+		"emergency":      p.Sprint("Emergency Medicine"),
+		"endocrinology":  p.Sprint("Endocrinology"),
+		"otolaringology": p.Sprint("Ear Nose and Throat"),
+		"familymedicine": p.Sprint("Family Medicine"),
+		"gastro":         p.Sprint("Gastrointestinology"),
+		"headneck":       p.Sprint("Head and Neck"),
+		"hematology":     p.Sprint("Hematology and Oncology"),
+		"hepatology":     p.Sprint("Hepatology"),
+		"hyperbaric":     p.Sprint("Hyperbaric"),
+		"immunology":     p.Sprint("Immunology"),
+		"diseases":       p.Sprint("Infectious Diseases"),
+		"internal":       p.Sprint("Internal Medicine"),
+		"neonatal":       p.Sprint("Neonatology"),
+		"nephrology":     p.Sprint("Nephrology"),
+		"neurology":      p.Sprint("Neurology"),
+		"neurosurgery":   p.Sprint("Neurosurgery"),
+		"obstetrics":     p.Sprint("Obstetrics and Gynecology"),
+		"occupational":   p.Sprint("Occupational Medicine"),
+		"opthamology":    p.Sprint("Opthamology"),
+		"orthopedics":    p.Sprint("Orthopedic Surgery"),
+		"palliative":     p.Sprint("Palliative Care"),
+		"pediatrics":     p.Sprint("Pediatrics"),
+		"podiatry":       p.Sprint("Podiatry"),
+		"pulmonology":    p.Sprint("Pulmonology"),
+		"radiology":      p.Sprint("Radiology"),
+		"radiation":      p.Sprint("Radiaton Oncology"),
+		"transplants":    p.Sprint("Transplant Surgery"),
 	}
 }
--- a/router/pages.go
+++ b/router/pages.go
@@ -47,7 +47,7 @@
 	pagecache[p.Path+".html"] = p
 }
 
-// ValidatePages - Walk all our templates and finally return applicable errors as an array
+// ValidatePages - Walk all our templates, test them, and finally return applicable errors as an array
 func ValidatePages() []error {
 	var errs []error
 	hd := path.Join("templates", "header.tpl")
--- a/templates/doctor/application.tpl
+++ b/templates/doctor/application.tpl
@@ -5,19 +5,9 @@
 		<form id="application" method="post" enctype="multipart/form-data" boundary="VAL">
 			<h4>{{.area}}</h4>
 			<fieldset>
-				<label for="country">{{.doccountry}}</label>
-				<select name="country" id="country" multiple required>
-		    		{{range $id, $name := .countrylist}}
-					<option value="{{$id}}">{{$name}}</option>
-  	          		{{end}}
-				</select>
+				{{template "country" .country}}
 				<br><!-- clean up the formatting on some browsers -->
-				<label for="specialty">{{.docspecial}}</label>	   
-		 		<select name="specialty" id="specialty" multiple required>
-				{{range $id, $name := .specialties}}
-					<option value="{{$id}}">{{$name}}</option>
-				{{end}}
-				</select>
+				{{template "specialty" .specialties}}
 			</fieldset>
 			<h4>{{.gender}}</h4>
 			<fieldset>
--- a/templates/help/provider.tpl
+++ b/templates/help/provider.tpl
@@ -3,12 +3,7 @@
 	    <h2>{{.mainHeader}}</h2>
 	    <h3>{{.earn}}</h3>
 	    <form method="post">
-	        <p>{{.specialtyHeader}}</p>
-	        <select name="specialty">
-		    {{range $id, $name := .specialties}}
-		    <option value="{{$id}}">{{$name}}</option>
-		    {{end}}
-		</select>
+			{{template "specialty" .specialties}}
 	        <button>{{.getStartedHeader}}</button>
 	    </form>
 		<!--TODO change link from TODO.html-->
--- a/templates/login.tpl
+++ b/templates/login.tpl
@@ -11,6 +11,6 @@
 			<input type="password" name="pass" id="pass" minlength="8" required autocomplete="off"/><br>
 			<p class="forgot"><a href="resetpassword.html">{{.forgotPassword}}</a></p>
 			<button type="submit" class="button button-block"/>{{.login}}</button>
-          	    </form>
+          </form>
 	</main>
 {{end}}
\ No newline at end of file
--- a/templates/newpassword.tpl
+++ b/templates/newpassword.tpl
@@ -11,6 +11,6 @@
 			<laber for="reenter">{{.reenter}}*</label>
 			<input type="password" name="reenter" id="reenter" required autocomplete="off"/><br>
 			<button type="submit" class="button button-block"/>{{.update}}</button>
-          	    </form>
+          </form>
 	</main>
 {{end}}
\ No newline at end of file
--- /dev/null
+++ b/templates/plugins/countries.tpl
@@ -1,0 +1,8 @@
+{{define "country"}}
+<label for="country">{{.label}}</label>
+<select name="country" id="country" multiple required>
+    {{range $id, $name := .}}
+	<option value="{{$id}}">{{$name}}</option>
+    {{end}}
+</select>
+{{end}}
--- a/templates/plugins/specialties.tpl
+++ b/templates/plugins/specialties.tpl
@@ -1,8 +1,8 @@
 {{define "specialty"}}				
-<label for="Specialty">{{.specialty}}</label>
-	<select name="Specialty">
-        {{range $id, $name := .}}
-		<option value="{{$id}}">{{$name}}</option>
-	    {{end}}		
-    </select>
+<label for="Specialty">{{.label}}</label>
+<select name="Specialty" id="specialty" multiple required>
+    {{range $id, $name := .}}
+	<option value="{{$id}}">{{$name}}</option>
+	{{end}}		
+</select>
 {{end}}
\ No newline at end of file
--- a/templates/resetpassword.tpl
+++ b/templates/resetpassword.tpl
@@ -9,6 +9,6 @@
 			<label for="email">{{.email}}*</label>
 			<input type="email" name="email" id="email" required autocomplete="off"/><br>
 			<button type="submit" class="button button-block"/>{{.sendreset}}</button>
-          	    </form>
+          </form>
 	</main>
 {{end}}
\ No newline at end of file