small updates
This commit is contained in:
parent
439f819989
commit
59c6ce9da6
|
@ -231,7 +231,7 @@ func (h *ApplicationHandler) AgendaSubscribeEvent(w http.ResponseWriter, r *http
|
||||||
"subscribed_by": map[string]any{
|
"subscribed_by": map[string]any{
|
||||||
"user": map[string]any{
|
"user": map[string]any{
|
||||||
"id": current_user_token.Subject,
|
"id": current_user_token.Subject,
|
||||||
"display_name": current_user_claims["display_name"],
|
"display_name": fmt.Sprintf("%s %s", current_user_claims["first_name"], current_user_claims["last_name"]),
|
||||||
},
|
},
|
||||||
"group": map[string]any{
|
"group": map[string]any{
|
||||||
"id": current_group.ID,
|
"id": current_group.ID,
|
||||||
|
|
|
@ -269,7 +269,7 @@ func (h *ApplicationHandler) BeneficiaryDocuments(w http.ResponseWriter, r *http
|
||||||
beneficiaryID := vars["beneficiaryid"]
|
beneficiaryID := vars["beneficiaryid"]
|
||||||
|
|
||||||
//r.ParseForm()
|
//r.ParseForm()
|
||||||
r.ParseMultipartForm(10 * 1024 * 1024)
|
r.ParseMultipartForm(100 * 1024 * 1024)
|
||||||
|
|
||||||
document_type := r.FormValue("type")
|
document_type := r.FormValue("type")
|
||||||
document_name := r.FormValue("name")
|
document_name := r.FormValue("name")
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package renderer
|
package renderer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitlab.scity.coop/maas/navitia-golang/types"
|
"gitlab.scity.coop/maas/navitia-golang/types"
|
||||||
|
@ -67,6 +69,22 @@ func JSON(v any) template.JS {
|
||||||
return template.JS(result)
|
return template.JS(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RawJSON(v any) string {
|
||||||
|
buf := new(bytes.Buffer)
|
||||||
|
enc := json.NewEncoder(buf)
|
||||||
|
enc.SetEscapeHTML(false)
|
||||||
|
err := enc.Encode(&v)
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return strings.TrimSuffix(buf.String(), "\n")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func UnescapeHTML(s string) template.HTML {
|
||||||
|
return template.HTML(s)
|
||||||
|
}
|
||||||
|
|
||||||
func Dict(v ...interface{}) map[string]interface{} {
|
func Dict(v ...interface{}) map[string]interface{} {
|
||||||
dict := map[string]interface{}{}
|
dict := map[string]interface{}{}
|
||||||
lenv := len(v)
|
lenv := len(v)
|
||||||
|
|
|
@ -55,6 +55,8 @@ func (renderer *Renderer) Render(name string, w http.ResponseWriter, r *http.Req
|
||||||
"genderISO5218": GenderISO5218,
|
"genderISO5218": GenderISO5218,
|
||||||
"dict": Dict,
|
"dict": Dict,
|
||||||
"json": JSON,
|
"json": JSON,
|
||||||
|
"rawjson": RawJSON,
|
||||||
|
"unescapeHTML": UnescapeHTML,
|
||||||
"walkingLength": WalkingLength,
|
"walkingLength": WalkingLength,
|
||||||
"divideFloat64": Divide[float64],
|
"divideFloat64": Divide[float64],
|
||||||
"divideInt": Divide[int],
|
"divideInt": Divide[int],
|
||||||
|
@ -83,6 +85,8 @@ func (renderer *Renderer) RenderNoLayout(name string, w http.ResponseWriter, r *
|
||||||
"genderISO5218": GenderISO5218,
|
"genderISO5218": GenderISO5218,
|
||||||
"dict": Dict,
|
"dict": Dict,
|
||||||
"json": JSON,
|
"json": JSON,
|
||||||
|
"rawjson": RawJSON,
|
||||||
|
"unsescapeHTML": UnescapeHTML,
|
||||||
"divideFloat64": Divide[float64],
|
"divideFloat64": Divide[float64],
|
||||||
"divideInt": Divide[int],
|
"divideInt": Divide[int],
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue