ui/lib/shared/addon/components/sortable-table/template.hbs

140 lines
4.5 KiB
Handlebars

<table class="fixed grid sortable-table {{if internalBulkActions "has-actions"}} {{if groupByKey "bordered"}} {{if subRows "has-sub-rows bordered"}} {{tableClassNames}}">
<thead>
<tr class="fixed-header-placeholder">
{{#if internalBulkActions}}
<th width="{{checkWidth}}"></th>
{{/if}}
{{#each headers as |header idx|}}
<th width={{if header.width header.width}} class="{{header.classNames}}"></th>
{{/each}}
{{#if rowActions}}
<th width="{{actionsWidth}}"></th>
{{/if}}
</tr>
{{#if showHeader}}
<div class="fixed-header-actions row clearfix">
{{#if internalBulkActions}}
<div class="bulk-actions pull-left">
{{#each availableActions as |resourceAction index|}}
{{#if resourceAction.enabled}}
<a class="btn btn-sm bg-primary" href="#" onclick={{action "executeBulkAction" resourceAction.action}} tabindex={{index}}>
{{t resourceAction.label}}
<i class="{{resourceAction.icon}}"></i>
</a>
{{else}}
<a class="btn btn-sm bg-default btn-disabled" href="#" onclick="return false;" tabindex={{index}}>
{{t resourceAction.label}}
<i class="{{resourceAction.icon}}"></i>
</a>
{{/if}}
{{/each}}
{{#if selectedNodes}}
<div class="inline-block text-small">{{t pagingLabel pages=1 count=selectedNodes.length}}</div>
{{/if}}
</div>
{{/if}}
<div class="pull-left">
{{#if leftActions}}
<div class="vertical-middle pr-20">
{{yield this "left-actions"}}
</div>
{{/if}}
</div>
<div class="pull-right">
{{#if search}}
<div class="vertical-middle">
{{#ember-wormhole to=searchToWormhole renderInPlace=(not searchToWormhole)}}
<div class="{{unless searchToWormhole "pull-right"}} search-group input-group">
{{input value=searchText aria-title=(t "generic.search") type="search" class="input-sm pull-right" placeholder=(t "generic.search")}}
{{#if searchText}}
<span class="input-group-btn">
<button class="btn bg-transparent text-info pl-10 pr-10" {{action "clearSearch"}}><i class="icon icon-close"/></button>
</span>
{{/if}}
</div>
{{/ember-wormhole}}
</div>
{{/if}}
{{#if rightActions}}
<div class="vertical-middle pl-20">
{{yield this "right-actions"}}
</div>
{{/if}}
</div>
</div>
{{/if}}
<tr class="fixed-header">
{{#if internalBulkActions}}
<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=(action "changeSort")
header=header
}}
{{/each}}
{{#if rowActions}}
<th width="{{actionsWidth}}"></th>
{{/if}}
</tr>
</thead>
{{#if prefix}}
<tbody>
{{yield this "prefix"}}
</tbody>
{{/if}}
{{#if groupByKey}}
{{#if extraGroups.length}}
{{#each extraGroups as |group|}}
<tbody class="group">
{{yield this "group" group}}
{{yield this "norows"}}
</tbody>
{{/each}}
{{/if}}
{{#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>
{{else}}
{{yield this (if arranged.length "nomatch" "norows")}}
{{/each}}
{{else}}
<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>
{{/if}}
{{#if suffix}}
{{yield this "suffix"}}
{{/if}}
</table>
{{#if (and paging showPaging)}}
{{page-numbers
content=pagedContent
class="text-center mt-10 mb-10 no-select"
indexTo=indexTo
indexFrom=indexFrom
totalCount=filtered.length
textLabel=pagingLabel
}}
{{/if}}