oef/templates/questions_add_update.html.tpl
2019-11-13 15:54:17 +01:00

31 lines
1.2 KiB
Smarty

{{ define "content" }}
<div class="container">
{{$update := .Options.Get "update"}}
{{if $update}}
{{template "breadcrumb" toSlice "Domande" (all "Question") (.Data|string) (.Data.ID|show "Question") "Aggiorna" "current"}}
{{else}}
{{template "breadcrumb" toSlice "Domande" (all "Question") "Aggiungi" "current"}}
{{end}}
{{template "add_update_header" dict "update" $update "addTitle" "Crea nuova domanda" "updateTitle" (printf "Aggiorna domanda \"%s\"" (.Data|string|trim))}}
{{$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}}>
{{$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}}
{{$options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Question"} `}}
{{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
</form>
</div>
{{ end }}