ui/app/components/sortable-table/template.hbs

134 lines
4.3 KiB
Handlebars

<table class="fixed grid sortable-table basic-table {{if bulkActions 'has-actions'}} {{if groupByKey 'basic-table'}} {{if subRows 'has-sub-rows'}}">
<thead>
<tr class="fixed-header-placeholder">
{{#if bulkActions}}
<th width="{{checkWidth}}"></th>
{{/if}}
{{#each headers as |header idx|}}
<th width={{if header.width header.width}}></th>
{{/each}}
{{#if rowActions}}
<th width="{{actionsWidth}}"></th>
{{/if}}
</tr>
{{#if (or paging search bulkActions)}}
<div class="fixed-header-actions row">
<div class="col span-8">
{{#if bulkActions}}
<div class="bulk-actions">
{{#each availableActions as |action index|}}
{{#if action.enabled}}
<a class="btn btn-sm bg-primary" href="#" onclick={{action 'executeBulkAction' action.action}} tabindex={{index}}>
{{t action.label}}
<i class="{{action.icon}}"></i>
</a>
{{else}}
<a class="btn btn-sm bg-default btn-disabled" href="#" onclick="return false;" tabindex={{index}}>
{{t action.label}}
<i class="{{action.icon}}"></i>
</a>
{{/if}}
{{/each}}
{{#if selectedNodes.length}}
{{t pagingLabel pages=1 count=selectedNodes.length}}
{{/if}}
</div>
{{/if}}
</div>
<div class="col span-4 clearfix">
{{#if search}}
<div class="pull-right input-group">
{{input value=searchText type="search" class="input-sm pull-right" placeholder=(t 'generic.search')}}
{{#if searchText}}
<span class="input-group-btn">
<button class="btn bg-primary btn-sm" {{action 'clearSearch'}}><i class="icon icon-close"/></button>
</span>
{{/if}}
</div>
{{/if}}
</div>
</div>
{{/if}}
<tr class="fixed-header">
{{#if bulkActions}}
<th width="{{checkWidth}}" class="row-check">
{{check-box classNames="select-all-check" checked=isAll}}
</th>
{{/if}}
{{#each headers as |header|}}
{{sortable-thead
sortable=this
current=sortBy
descending=descending
action="changeSort"
header=header
}}
{{/each}}
{{#if rowActions}}
<th width="{{actionsWidth}}"></th>
{{/if}}
</tr>
</thead>
{{#if prefix}}
<tbody>
{{yield this 'prefix'}}
</tbody>
{{/if}}
{{#if groupByKey}}
{{! Note: Grouping requires fullRows}}
{{#each groupedContent as |group|}}
<tbody class="group">
{{yield this 'group' group}}
{{#each group.items as |row|}}
{{yield this 'row' row dt (array-includes childFilterNodes row.id)}}
{{/each}}
</tbody>
{{/each}}
{{else if fullRows}}
<tbody>
{{#each pagedContent as |row|}}
{{yield this 'row' row dt (array-includes childFilterNodes row.id)}}
{{else}}
{{yield this (if arranged.length 'nomatch' 'norows')}}
{{/each}}
</tbody>
{{else}}
<tbody>
{{#each pagedContent as |row|}}
<tr class="main-row">
{{#if bulkActions}}
<td data-title="{{generic.actions}}: " class="row-check">
{{check-box nodeId=row.id}}
</td>
{{/if}}
{{#if hasBlock}}
{{yield this 'row' row dt}}
{{else}}
{{#each headers as |header|}}
<td data-title={{header.displayName}} data-id={{row.id}}>{{select-property row header.name}}</td>
{{/each}}
{{/if}}
</tr>
{{#if hasBlock}}
{{yield this 'sub-row' row dt}}
{{/if}}
{{else}}
{{#if hasBlock}}
{{yield this (if arranged.length 'nomatch' 'norows')}}
{{/if}}
{{/each}}
</tbody>
{{/if}}
{{#if suffix}}
<tbody>
{{yield this 'suffix'}}
</tbody>
{{/if}}
</table>
{{#if (and paging filtered.length)}}
{{page-numbers content=pagedContent class="text-center mt-10 mb-10 no-select" indexTo=indexTo indexFrom=indexFrom totalCount=filtered.length textLabel=pagingLabel}}
{{/if}}