|
@@ -2,89 +2,52 @@
|
|
|
|
|
|
<div class="container">
|
|
|
|
|
|
- <nav aria-label="breadcrumb">
|
|
|
- {{if .Options.Get "update"}}
|
|
|
- <ol class="breadcrumb">
|
|
|
- <li class="breadcrumb-item"><a href="/documents?{{query "tpl_layout" "base" "tpl_content" "documents"}}">Documento</a></li>
|
|
|
- <li class="breadcrumb-item active"><a href="#">Aggiorna documento</a></li>
|
|
|
- </ol>
|
|
|
- </nav>
|
|
|
-
|
|
|
- {{else}}
|
|
|
- <nav aria-label="breadcrumb">
|
|
|
- <ol class="breadcrumb">
|
|
|
- <li class="breadcrumb-item"><a href="/documents?{{query "tpl_layout" "base" "tpl_content" "documents"}}">Documento</a></li>
|
|
|
- <li class="breadcrumb-item active"><a href="#">Aggiungi</a></li>
|
|
|
- </ol>
|
|
|
- </nav>
|
|
|
- {{end}}
|
|
|
-
|
|
|
- {{if .Options.Get "update"}}
|
|
|
- <div class="karmen-info-header">
|
|
|
- <div class="row">
|
|
|
- <div class="col-md-8">
|
|
|
- <h1>Aggiorna documento</h1>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- {{else}}
|
|
|
- <h1 class="karmen-info-header">Crea nuovo documento</h1>
|
|
|
- {{end}}
|
|
|
+ {{$update := .Options.Get "update"}}
|
|
|
|
|
|
- {{if .Options.Get "update"}}
|
|
|
- <form id="form_documents_add_update" action="/documents/{{.Data.ID}}/update" method="POST" role="form" data-toggle="validator">
|
|
|
+ {{if $update}}
|
|
|
+ {{template "breadcrumb" toSlice "Documenti" (all "Document") (.Data|string) (.Data.ID|show "Document") "Aggiorna" "current"}}
|
|
|
{{else}}
|
|
|
- <form id="form_documents_add_update" action="/documents/add/" method="POST" role="form" data-toggle="validator">
|
|
|
+ {{template "breadcrumb" toSlice "Documenti" (all "Document") "Aggiungi" "current"}}
|
|
|
{{end}}
|
|
|
-
|
|
|
- <div class="form-group has-feedback">
|
|
|
- <label class="control-label" for="document_name">Nome</label>
|
|
|
- <input type="text" name="Name" class="form-control" id="document_name" placeholder="Nome" {{if .Options.Get "update"}} value="{{.Data.Name}}" {{end}} required>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group has-feedback">
|
|
|
- <label class="control-label" for="document_cloud_path">Cartella di lavoro remota (cloud)</label>
|
|
|
- <input type="text" name="CloudPath" class="form-control" id="document_cloud_path" placeholder="Documents/" {{if .Options.Get "update"}} value="{{.Data.CloudPath}}" {{end}} required>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-check">
|
|
|
- <input type="checkbox" name="KeepArtifacts" class="form-check-input" id="keep_artifacts" {{if .Options.Get "update"}}{{if .Data.KeepArtifacts}}checked{{end}}{{end}}>
|
|
|
- <label class="form-check-label" for="exampleCheck1">Mantieni gli artefatti</label>
|
|
|
- <small id="activity_group_hours_help_box" class="form-text text-muted">
|
|
|
- Se selezionato carica sulla cartella remota gli artefatti derivati dalla produzione del documento (es: file di Markdown).
|
|
|
- </small>
|
|
|
- </div>
|
|
|
-
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="generator_type_id">Tipo di generatore</label>
|
|
|
- <select name="GeneratorTypeID" class="form-control selectpicker" id="generator_type_id" placeholder="Tipo di generatore" data-live-search="true" form="form_documents_add_update" title="Seleziona il tipo di generatore" data-dropup-auto="false">
|
|
|
- <option value="0"></option>
|
|
|
- {{range $generatorType := .Data.AllGeneratorTypes}}
|
|
|
- {{if $.Options.Get "update"}}
|
|
|
- <option
|
|
|
- value="{{$generatorType.ID}}"
|
|
|
- {{index $.Data.SelectedGeneratorType $generatorType.ID}}>{{$generatorType.Name}}
|
|
|
- </option>
|
|
|
- {{else}}
|
|
|
- <option value="{{$generatorType.ID}}">{{$generatorType.Name}}</option>
|
|
|
- {{end}}
|
|
|
- {{end}}
|
|
|
- </select>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <button type="submit" class="btn btn-primary">Salva</button>
|
|
|
- {{if .Options.Get "update"}}
|
|
|
- <a href="/documents/{{.Data.ID}}?{{query "tpl_layout" "base" "tpl_content" "documents_show"}}" class="btn btn-default">Annulla</a>
|
|
|
- {{else}}
|
|
|
- <a href="/documents?{{query "tpl_layout" "base" "tpl_content" "documents"}}" class="btn btn-default">Annulla</a>
|
|
|
- {{end}}
|
|
|
- </div>
|
|
|
+
|
|
|
+ {{template "add_update_header" dict "update" $update "addTitle" "Crea nuovo documento" "updateTitle" (printf "Aggiorna documento %s" (.Data|string))}}
|
|
|
+
|
|
|
+ {{$form := "form_documents_add_update"}}
|
|
|
+ <form
|
|
|
+ class="needs-validation"
|
|
|
+ action="{{if $update}}{{.Data.ID|update "Document"}}{{else}}{{create "Document"}}{{end}}"
|
|
|
+ method="POST"
|
|
|
+ role="form"
|
|
|
+ id={{$form}}>
|
|
|
+
|
|
|
+ {{$options := ` { name: "Name",id: "document_name",label: "Nome",placeholder: "Nome",type: "text",required: "true"} `}}
|
|
|
+ {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Name") "update" $update}}
|
|
|
+
|
|
|
+ {{$options := ` { name: "CloudPath",id: "document_cloud_path",label: "Cartella di lavoro remota",placeholder: "Documents/",type: "text",required: "true"} `}}
|
|
|
+ {{template "input" dict "options" ($options|yaml) "value" (.Data|field "CloudPath") "update" $update}}
|
|
|
+
|
|
|
+ {{$options := `
|
|
|
+ name: "KeepArtifacts"
|
|
|
+ id: "document_keep_artifacts"
|
|
|
+ label: "Mantieni gli artefatti"
|
|
|
+ formClass: "form-group form-check"
|
|
|
+ help: "Se selezionato carica sulla cartella remota gli artefatti derivati dalla produzione del documento (es: markdown, odt, etc.). "
|
|
|
+ `}}
|
|
|
+ {{template "checkbox" dict "options" ($options|yaml) "value" (.Data|field "KeepArtifacts") "update" $update}}
|
|
|
+
|
|
|
+ {{$options := `
|
|
|
+ name: "generator_type_id"
|
|
|
+ id: "generator_type_id"
|
|
|
+ label: "Tipo di generatore"
|
|
|
+ title: "Seleziona il tipo di generatore"
|
|
|
+ `}}
|
|
|
+ {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllGeneratorTypes") "selected" (.Data|field "SelectedGeneratorType") "update" $update "form" $form}}
|
|
|
|
|
|
+ {{ $options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Document"} ` }}
|
|
|
+ {{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
|
|
|
+
|
|
|
</form>
|
|
|
-
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
{{ end }}
|