diff --git a/res/app/components/stf/common-ui/index.js b/res/app/components/stf/common-ui/index.js index 2d1f769e..d8f5c4bc 100644 --- a/res/app/components/stf/common-ui/index.js +++ b/res/app/components/stf/common-ui/index.js @@ -1,5 +1,6 @@ module.exports = angular.module('stf/common-ui', [ require('./clear-button').name, require('./filter-button').name, - require('./nothing-to-show').name + require('./nothing-to-show').name, + require('./table').name ]) \ No newline at end of file diff --git a/res/app/components/stf/common-ui/table/index.js b/res/app/components/stf/common-ui/table/index.js new file mode 100644 index 00000000..1ccad6d3 --- /dev/null +++ b/res/app/components/stf/common-ui/table/index.js @@ -0,0 +1,7 @@ +require('./table.css') +require('script!ng-table/ng-table') +//require('ng-table/ng-table.css') + +module.exports = angular.module('stf/common-ui/table', [ + 'ngTable' +]) diff --git a/res/app/components/stf/common-ui/table/table.css b/res/app/components/stf/common-ui/table/table.css new file mode 100644 index 00000000..4822ad47 --- /dev/null +++ b/res/app/components/stf/common-ui/table/table.css @@ -0,0 +1,157 @@ +.ng-table th { + /*text-align: center;*/ + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.ng-table th.sortable { + cursor: pointer; +} + +.ng-table th.sortable div { + padding-right: 18px; + position: relative; +} + +.ng-table th.sortable div:after, +.ng-table th.sortable div:before { + content: ""; + border-width: 0 4px 4px; + border-style: solid; + border-color: #000 transparent; + visibility: visible; + right: 8px; + top: 50%; + position: absolute; + opacity: .3; + margin-top: -4px; +} + +.ng-table th.sortable div:before { + margin-top: 2px; + border-bottom: none; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid #000; +} + +.ng-table th.sortable div:hover:after, +.ng-table th.sortable div:hover:before { + opacity: 1; + visibility: visible; +} + +.ng-table th.sortable.sort-desc, +.ng-table th.sortable.sort-asc { + background-color: rgba(183, 194, 219, 0.25); + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); +} + +.ng-table th.sortable.sort-desc div:after, +.ng-table th.sortable.sort-asc div:after { + margin-top: -2px; +} + +.ng-table th.sortable.sort-desc div:before, +.ng-table th.sortable.sort-asc div:before { + visibility: hidden; +} + +.ng-table th.sortable.sort-asc div:after, +.ng-table th.sortable.sort-asc div:hover:after { + visibility: visible; + filter: alpha(opacity=60); + -khtml-opacity: 0.6; + -moz-opacity: 0.6; + opacity: 0.6; +} + +.ng-table th.sortable.sort-desc div:after { + border-bottom: none; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid #000; + visibility: visible; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + filter: alpha(opacity=60); + -khtml-opacity: 0.6; + -moz-opacity: 0.6; + opacity: 0.6; +} + +.ng-table th.filter .input-filter { + margin: 0; + display: block; + width: 100%; + min-height: 30px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.ng-table + .pagination { + margin-top: 0; +} + +@media only screen and (max-width: 800px) { + .ng-table-responsive { + border-bottom: 1px solid #999999; + } + + .ng-table-responsive tr { + border-top: 1px solid #999999; + border-left: 1px solid #999999; + border-right: 1px solid #999999; + } + + .ng-table-responsive td:before { + position: absolute; + padding: 8px; + left: 0; + top: 0; + width: 50%; + white-space: nowrap; + text-align: left; + font-weight: bold; + } + + .ng-table-responsive thead tr th { + text-align: left; + } + + .ng-table-responsive thead tr.ng-table-filters th { + padding: 0; + } + + .ng-table-responsive thead tr.ng-table-filters th form > div { + padding: 8px; + } + + .ng-table-responsive td { + border: none; + border-bottom: 1px solid #eeeeee; + position: relative; + padding-left: 50%; + white-space: normal; + text-align: left; + } + + .ng-table-responsive td:before { + content: attr(data-title-text); + } + + .ng-table-responsive, + .ng-table-responsive thead, + .ng-table-responsive tbody, + .ng-table-responsive th, + .ng-table-responsive td, + .ng-table-responsive tr { + display: block; + } +} diff --git a/res/app/components/stf/device/device-service.js b/res/app/components/stf/device/device-service.js index 550226f4..b78fc231 100644 --- a/res/app/components/stf/device/device-service.js +++ b/res/app/components/stf/device/device-service.js @@ -11,6 +11,8 @@ module.exports = function DeviceServiceFactory($rootScope, $http, socket) { , scopedSocket = socket.scoped($scope) function notify() { + $scope.$broadcast('devices.update', true) + // Not great. Consider something else if (!$scope.$$phase) { $scope.$digest() diff --git a/res/app/device-list/device-list.jade b/res/app/device-list/device-list.jade index 52882bff..a41156c5 100644 --- a/res/app/device-list/device-list.jade +++ b/res/app/device-list/device-list.jade @@ -44,7 +44,7 @@ div.stf-device-list filter-button(ng-model='filterEnabled') - table.table.table-hover(ng-table='tableParams', + table.table.table-hover.dataTable(ng-table='tableParams', show-filter='filterEnabled', ng-show='tracker.devices.length') //.cursor.selectable //thead diff --git a/res/app/device-list/index.js b/res/app/device-list/index.js index a778825a..87d949dd 100644 --- a/res/app/device-list/index.js +++ b/res/app/device-list/index.js @@ -1,13 +1,9 @@ require('./device-list.css') -require('script!ng-table/ng-table') -require('ng-table/ng-table.css') - module.exports = angular.module('device-list', [ require('stf/device').name, require('stf/user/group').name, - require('stf/common-ui').name, - 'ngTable' + require('stf/common-ui').name ]) .config(['$routeProvider', function ($routeProvider) { $routeProvider.when('/devices', {