Make admin fields read-only

This commit is contained in:
Brandon Dyck 2020-09-29 20:25:02 -06:00
parent 62a717c806
commit 0da89f0e6c

View File

@ -371,11 +371,15 @@ func (h *handler) handleAdmin(w http.ResponseWriter, r *http.Request) {
e.Input( e.Input(
a.Name(fieldNameEventName), a.Name(fieldNameEventName),
a.Value(metadata.Name), a.Value(metadata.Name),
a.Disabled(true),
), ),
e.Br(), e.Br(),
e.Label(a.For(fieldNameDescription))(hm.Text("Description")), e.Label(a.For(fieldNameDescription))(hm.Text("Description")),
e.Textarea(a.Name(fieldNameDescription))(hm.Text(metadata.Description)), e.Textarea(
a.Name(fieldNameDescription),
a.Disabled(true),
)(hm.Text(metadata.Description)),
e.Br(), e.Br(),
e.Label(a.For(fieldNameEarliest))(hm.Text("Earliest date")), e.Label(a.For(fieldNameEarliest))(hm.Text("Earliest date")),
@ -383,6 +387,7 @@ func (h *handler) handleAdmin(w http.ResponseWriter, r *http.Request) {
a.Name(fieldNameEarliest), a.Name(fieldNameEarliest),
a.Type("date"), a.Type("date"),
a.Value(metadata.Earliest.Format(formDateLayout)), a.Value(metadata.Earliest.Format(formDateLayout)),
a.Disabled(true),
), ),
e.Br(), e.Br(),
@ -391,10 +396,8 @@ func (h *handler) handleAdmin(w http.ResponseWriter, r *http.Request) {
a.Name(fieldNameLatest), a.Name(fieldNameLatest),
a.Type("date"), a.Type("date"),
a.Value(metadata.Latest.Format(formDateLayout)), a.Value(metadata.Latest.Format(formDateLayout)),
a.Disabled(true),
), ),
e.Br(),
e.Input(a.Type("submit")),
), ),
e.H3()(hm.Text("Responses")), e.H3()(hm.Text("Responses")),
e.P()(hm.Text(strconv.Itoa(responses.TotalResponses))), e.P()(hm.Text(strconv.Itoa(responses.TotalResponses))),