This repository has been archived by the owner on Mar 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Добавить фильтр на страницу автосервиса
(#138)
- Loading branch information
1 parent
edbfe87
commit 0411821
Showing
12 changed files
with
189 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import Component from '@ember/component'; | ||
import {action, computed, get} from '@ember/object'; | ||
|
||
export default class extends Component { | ||
sortColumn; | ||
sortAsc = true; | ||
|
||
@action | ||
onHeadClick(column) { | ||
if (this.get('sortColumn') === column) { | ||
if (this.get('sortAsc')) { | ||
this.set('sortAsc', false); | ||
} else { | ||
this.set('sortColumn', null); | ||
} | ||
} else { | ||
this.set('sortColumn', column); | ||
this.set('sortAsc', true); | ||
} | ||
} | ||
|
||
@computed('data', 'sortColumn', 'sortAsc') | ||
get sortedData() { | ||
let data = this.get('data'); | ||
const sortColumn = this.get('sortColumn'); | ||
|
||
if (!sortColumn) { | ||
return data; | ||
} | ||
|
||
data = data.sortBy(`${get(sortColumn, 'path')}`); | ||
if (!this.get('sortAsc')) { | ||
data = data.reverse(); | ||
} | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Controller from '@ember/controller'; | ||
import {action} from '@ember/object'; | ||
|
||
export default class extends Controller { | ||
@action | ||
onCarClick() { | ||
this.transitionToRoute('account.subject', this.get('model.sensors.firstObject.controller.object.id')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.table { | ||
color: #333; | ||
font-size: 16px; | ||
line-height: 18px; | ||
} | ||
|
||
.table td, .table th { | ||
padding: .75rem; | ||
vertical-align: top; | ||
border-top: 1px solid #dee2e6; | ||
width: 300px; | ||
} | ||
|
||
.table thead th { | ||
vertical-align: bottom; | ||
border-bottom: 2px solid #dee2e6; | ||
cursor: pointer; | ||
} | ||
|
||
.arrow { | ||
position: relative; | ||
bottom: 1px; | ||
} | ||
|
||
tr.clickable:hover { | ||
background-color: #dee2e6; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
{{#each columns as |column|}} | ||
<th onclick={{action onHeadClick column}}> | ||
{{column.label}} | ||
{{#if (eq sortColumn column)}} | ||
{{#if sortAsc}} | ||
<span class="text-small text-muted arrow"> | ||
{{core/icon-component name="up-arrow"}} | ||
</span> | ||
{{else}} | ||
<span class="text-small text-muted arrow"> | ||
{{core/icon-component name="down-arrow"}} | ||
</span> | ||
{{/if}} | ||
{{/if}} | ||
</th> | ||
{{/each}} | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each sortedData as |row|}} | ||
<tr class="{{if attrs.onRowClick "clickable"}}" onclick={{attrs.onRowClick}}> | ||
{{#each columns as |column|}} | ||
<td>{{get row column.path}}</td> | ||
{{/each}} | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
</table> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.