busy-web/components

View on GitHub
addon/templates/components/bc-sortable-list.hbs

Summary

Maintainability
Test Coverage

<table class="bc-sortable-list">
    <thead class="bc-sortable-list-header">
        {{#each __meta as |header|}}
            <th class="{{if header.sortable 'sortable'}} {{if header.sortable header.sortDir}}" cellspacing="0" onclick={{if header.sortable (action "sortAction" header)}}>
                {{header.headerName}}

                {{#if header.desc}}
                    <i class="material-icons">arrow_drop_down</i>
                {{else if header.asc}}
                    <i class="material-icons">arrow_drop_up</i>
                {{else}}
                    <i class="material-icons"></i>
                {{/if}}
            </th>
        {{/each}}
    </thead>

    <tbody class="bc-sortable-list-body">
        {{#each __data as |container|}}
            <tr {{action 'rowClickAction' container}} class="{{if rowAction 'clickable'}}">
                {{#if container.children}}
                    <td>expand</td>
                {{/if}}

                {{#each container.modelProps as |property|}}
                    {{#if property.isImage}}
                        <td class="image-cell"><div style={{bg-image property}} class="img"></div></td>
                    {{else if property.formatTime}}
                        <td>{{format-hours property longFormat=true}}</td>
                    {{else if property.formatCurrency}}
                        <td>{{format-currency property}}</td>
                    {{else}}
                        <td>{{property}}</td>
                    {{/if}}
                {{/each}}
            </tr>
        {{/each}}
    </tbody>
</table>