2019-11-04 15:00:46 +01:00
|
|
|
{{ define "content" }}
|
|
|
|
<div class="container">
|
|
|
|
|
2019-11-13 12:06:29 +01:00
|
|
|
{{$update := .Options.Get "update"}}
|
2019-11-04 15:00:46 +01:00
|
|
|
|
2019-11-13 12:06:29 +01:00
|
|
|
{{if $update}}
|
2019-11-04 15:00:46 +01:00
|
|
|
|
2019-11-13 13:57:41 +01:00
|
|
|
{{template "breadcrumb" toSlice "Domande" (all "Question") (.Data|string) (.Data.ID|show "Question") "Aggiorna" "current"}}
|
2019-11-13 12:06:29 +01:00
|
|
|
{{else}}
|
2019-11-13 13:57:41 +01:00
|
|
|
{{template "breadcrumb" toSlice "Domande" (all "Question") "Aggiungi" "current"}}
|
2019-11-13 12:06:29 +01:00
|
|
|
{{end}}
|
2019-11-04 15:00:46 +01:00
|
|
|
|
2019-11-13 15:54:17 +01:00
|
|
|
{{template "add_update_header" dict "update" $update "addTitle" "Crea nuova domanda" "updateTitle" (printf "Aggiorna domanda \"%s\"" (.Data|string|trim))}}
|
2019-11-13 12:06:29 +01:00
|
|
|
{{$form := "form_add_update"}}
|
|
|
|
<form
|
|
|
|
class="needs-validation"
|
|
|
|
action="{{if $update}}{{.Data.ID|update "Question"}}{{else}}{{create "Question"}}{{end}}"
|
|
|
|
method="POST"
|
|
|
|
role="form"
|
|
|
|
id={{$form}}>
|
2019-11-04 15:00:46 +01:00
|
|
|
|
2019-11-13 12:06:29 +01:00
|
|
|
{{$options := ` { name: "Text",id: "question_text",label: "Testo della domanda",placeholder: "Inserire il testo della domanda",type: "text",required: "true"} `}}
|
|
|
|
{{template "input" dict "options" ($options|yaml) "value" (.Data|field "Text") "update" $update}}
|
2019-11-04 15:00:46 +01:00
|
|
|
|
2019-11-13 13:57:41 +01:00
|
|
|
{{$options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Question"} `}}
|
|
|
|
{{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
|
|
|
|
|
2019-11-13 12:06:29 +01:00
|
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
2019-11-04 15:00:46 +01:00
|
|
|
{{ end }}
|