Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(tables): 1771 improve sort ux
Browse files Browse the repository at this point in the history
Closes #1771
  • Loading branch information
alex-wilmer committed May 24, 2016
1 parent 189dfd4 commit ce53127
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
4 changes: 3 additions & 1 deletion app/scripts/components/tables/tables.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ module ngApp.components.tables.controllers {
this.LocalStorageService.setItem(this.$scope.title + '-col', save);
}

updateSorting(): void {
updateSorting(event): void {
if (event) event.stopPropagation();

this.saveToLocalStorage();

if (this.$scope.update) {
Expand Down
45 changes: 33 additions & 12 deletions app/scripts/components/tables/templates/sort-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,42 @@
data-uib-dropdown-menu
role="menu">
<li data-ng-repeat="item in sortColumns">
<div class="sort-item">
<i class="fa fa-{{item.sort ? 'check-square-o' : 'square-o'}} fa-stack" ng-click="tsc.toggleSorting(item)"></i>
<span>{{ item.name | translate }}</span>
<span class="pull-right text-right" data-ng-if="item.sort">
<div
style="display: flex;"
class="sort-item"
ng-click="tsc.toggleSorting(item)"
>
<span>
<i class="fa fa-{{item.sort ? 'check-square-o' : 'square-o'}} fa-stack"></i>
<span>{{ item.name | translate }}</span>
</span>

<span
style="
margin: 0 -10px 0 auto;
padding: 3px 10px;
background-color: white;
cursor: default;
"
class="text-right sorting-radio-buttons-container"
>

<i class="fa fa-sort-alpha-asc"></i>
<input type="radio" aria-label="Sort Data Ascending" value="asc"
title="Sort Data Ascending"
data-ng-model="item.order" data-ng-change="tsc.updateSorting()"
data-ng-checked="!item.order || item.order === 'asc'"
name="{{ item.id }}-sort-order">
<input
type="radio" aria-label="Sort Data Ascending" value="asc"
style="cursor:pointer;"
title="Sort Data Ascending"
data-ng-model="item.order" data-ng-click="tsc.updateSorting($event)"
data-ng-checked="!item.order || item.order === 'asc'"
name="{{ item.id }}-sort-order"
>
<i class="fa fa-sort-alpha-desc"></i>
<input type="radio" aria-label="Sort Data Descending" value="desc"
data-ng-model="item.order" data-ng-change="tsc.updateSorting()"
name="{{ item.id }}-sort-order">
<input
type="radio" aria-label="Sort Data Descending" value="desc"
style="cursor:pointer;"
data-ng-model="item.order" data-ng-click="tsc.updateSorting($event)"
name="{{ item.id }}-sort-order"
>
</span>
</div>
</li>
Expand Down
7 changes: 7 additions & 0 deletions app/styles/tables.less
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,10 @@ th.truncated-cell {
line-height: 28px;;
}
}

.Columns-dropdown-headings > li {
outline: none;
}
.Columns-dropdown-headings > li:hover .sorting-radio-buttons-container {
border-left: 2px solid rgb(28, 126, 198);
}

0 comments on commit ce53127

Please sign in to comment.