github.com/wawandco/ox@v0.13.6-0.20230809142027-913b3d837f2a/plugins/tools/ox/resource/templates/index.html.tmpl (about)

     1  <div class="py-4 mb-2">
     2  	<h3 class="d-inline-block">{{ .Name.Group }}</h3>
     3  	<div class="float-right">
     4  		<%= linkTo(new{{ .Name.Resource }}Path(), {class: "btn btn-primary"}) { %>
     5  		Create New {{ .Name.Proper }}
     6  		<% } %>
     7  	</div>
     8  </div>
     9  
    10  <table class="table table-hover table-bordered">
    11  	<thead class="thead-light">
    12  		{{ range $p := .Model.Attrs -}}
    13  		{{ if ne $p.CommonType "text" -}}
    14  		<th>{{ $p.Name.Pascalize }}</th>
    15  		{{ end }}
    16  		{{- end -}}
    17  		<th>&nbsp;</th>
    18  	</thead>
    19  	<tbody>
    20  		<%= for ({{ .Name.VarCaseSingle }}) in {{ .Name.VarCasePlural }} { %>
    21  		<tr>
    22  			{{ range $mp := .Model.Attrs -}}
    23  			{{- if ne $mp.CommonType "text" -}}
    24  			<td class="align-middle"><%= {{ $.Name.VarCaseSingle }}.{{ $mp.Name.Pascalize }} %></td>
    25  			{{ end }}
    26  			{{- end -}}
    27  			<td>
    28  				<div class="float-right">
    29  					<%= linkTo({{ .Name.VarCaseSingle }}Path({ {{ .Name.ParamID }}: {{ .Name.VarCaseSingle }}.ID }), {class: "btn btn-info", body: "View"}) %>
    30  					<%= linkTo(edit{{ .Name.Proper }}Path({ {{ .Name.ParamID }}: {{ .Name.VarCaseSingle }}.ID }), {class: "btn btn-warning", body: "Edit"}) %>
    31  					<%= linkTo({{ .Name.VarCaseSingle }}Path({ {{ .Name.ParamID }}: {{ .Name.VarCaseSingle }}.ID }), {class: "btn btn-danger", "data-method": "DELETE", "data-confirm": "Are you sure?", body: "Destroy"}) %>
    32  				</div>
    33  			</td>
    34  		</tr>
    35  		<% } %>
    36  	</tbody>
    37  </table>
    38  
    39  <div class="text-center">
    40  	<%= paginator(pagination) %>
    41  </div>