Fix cancel action in school update form

This commit is contained in:
Andrea Fazzi 2020-02-03 11:54:53 +01:00
parent 4e9ffa5c89
commit f41caf7164
5 changed files with 12 additions and 5 deletions

View file

@ -94,8 +94,8 @@
</div>
</div>
<script
src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n"
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous">
</script>
<script

View file

@ -43,7 +43,7 @@
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

View file

@ -5,7 +5,7 @@
<a href="{{.id|show .options.model}}" class="btn btn-default">Annulla</a>
{{else}}
{{if .options.cancelTitle}}
<a href="{{all .options.model}}" class="btn btn-default">Annulla</a>
<a href="{{if .referer}}{{.referer|html}}{{else}}{{all .options.model}}{{end}}" class="btn btn-default">Annulla</a>
{{end}}
{{end}}
</div>

View file

@ -106,7 +106,11 @@
{{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
{{else}}
{{$options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "School" } `}}
{{if $isAdmin}}
{{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
{{else}}
{{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update "referer" (.Data.ID|show "School")}}
{{end}}
{{end}}
</form>

View file

@ -56,6 +56,9 @@
<dt class="col-sm-3">Password</dt>
<dd class="col-sm-9"><span class="text-monospace">{{.Data.User.Password}}</span></dd>
<dt class="col-sm-3">Referente di sede</dt><dd class="col-sm-9">{{.Data.SchoolContactPersonLastname}} {{.Data.SchoolContactPersonFirstname}}</dd>
<dt class="col-sm-3">Responsabile di gara</dt><dd class="col-sm-9">{{.Data.ContestDirectorLastname}} {{.Data.ContestDirectorFirstname}}</dd>
{{if $isAdmin}}
{{if $creatorUser:=.Data.CreatedBy}}
<dt class="col-sm-3">Creato da</dt>