oef/templates/questions_add_update.html.tpl
2019-11-14 12:55:22 +01:00

33 lines
1.4 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 := ` { name: "contest_id", id: "contest_id", label: "Gara relativa a questa domanda", title: "Seleziona la gara"}`}}
{{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllContests") "selected" (.Data|field "SelectedContest") "update" $update "form" $form}}
{{$options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Question"} `}}
{{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
</form>
</div>
{{ end }}