diff --git a/res/app/components/stf/device/device-info-filter/index.js b/res/app/components/stf/device/device-info-filter/index.js index 8d76930f..1385c9b6 100644 --- a/res/app/components/stf/device/device-info-filter/index.js +++ b/res/app/components/stf/device/device-info-filter/index.js @@ -1,7 +1,7 @@ module.exports = angular.module('stf.device-status', []) - .filter('statusName', function (gettext) { + .filter('statusName', function (gettext, $filter) { return function (text) { - return { + return $filter('translate')({ 'absent': gettext('Disconnected'), 'present': gettext('Connected'), 'offline': gettext('Offline'), @@ -11,9 +11,10 @@ module.exports = angular.module('stf.device-status', []) 'using': gettext('Stop Using'), 'busy': gettext('Busy'), 'available': gettext('Use') - }[text] || gettext('Unknown') + }[text] || gettext('Unknown')) } }) + // TODO: translate here the rest .filter('batteryHealth', function (gettext) { return function (text) { return { diff --git a/res/app/components/stf/device/device-service.js b/res/app/components/stf/device/device-service.js index 49f2ee0e..0d92665a 100644 --- a/res/app/components/stf/device/device-service.js +++ b/res/app/components/stf/device/device-service.js @@ -99,6 +99,7 @@ module.exports = function DeviceServiceFactory($http, socket, $filter) { // TODO: i18n shortDate data.releasedAtFormatted = $filter('date')(data.releasedAt, 'yyyy/MM/dd - X') + $scope.$broadcast('device.synced', data) } // For convenience, add the sorting priority to each state diff --git a/res/app/device-list/device-list.jade b/res/app/device-list/device-list.jade index 3b0175a1..0788a6a4 100644 --- a/res/app/device-list/device-list.jade +++ b/res/app/device-list/device-list.jade @@ -26,36 +26,35 @@ div.stf-device-list ul.devices-icon-view li(ng-repeat='device in tracker.devices | filter:{usable:true} | filter:{name:deviceSearch} | orderBy:"name" track by device.serial', ng-click='device.usable && toggle(device)', - popover='{{ "Model: " | translate }}{{ device.model }}', popover-trigger='mouseenter', popover-popup-delay='0', - popover-title='{{ device.name || device.model }}', popover-placement='top', ng-hide='!device.model' + popover='{{ ::"Model: " | translate }}{{ ::device.model }}', popover-trigger='mouseenter', popover-popup-delay='0', + popover-title='{{ ::device.enhancedName }}', popover-placement='top', ng-hide='!device.model' ).cursor-select.pointer.thumbnail .device-photo-small - img(ng-src='/static/devices/icon/x120/{{ device.image || "_default.jpg" }}') - .device-name {{ device.name || device.model }} - button(ng-class='controlButtonClass(device.state)' - ).btn.btn-xs.device-status {{device.state|statusName|translate}} + img(ng-src='{{ ::device.enhancedImage120 }}') + .device-name(ng-bind='::device.enhancedName') + button(ng-class='device.enhancedButtonClass' + ).btn.btn-xs.device-status(ng-bind='device.enhancedState') .clear-fix .clear-fix .line + ul.devices-icon-view li(ng-repeat='device in tracker.devices | filter:{usable:false} | filter:{name:deviceSearch} | orderBy:"name" track by device.serial', ng-disabled='true', ng-hide='!device.model' ).cursor-select.pointer.thumbnail.device-is-busy .device-photo-small - img(ng-src='/static/devices/icon/x120/{{ device.image || "_default.jpg" }}') - .device-name(title='{{device.serial}} - {{device.model}}') {{ device.name || device.model }} - //raphael-status-icon.device-status-button(status='{{ deviceStatus(device) }}', title="{{ deviceStatusText(device) }}", tooltip='{{ deviceStatusText(device)|translate }}') - //button.btn.btn-default.btn-xs.device-status {{statusName(device)}} - button(ng-class='controlButtonClass(device.state)', + img(ng-src='{{ ::device.enhancedImage120 }}') + .device-name(ng-bind='::device.enhancedName') + button(ng-class='device.enhancedButtonClass', ng-dblclick='tryToKick(device)', - ).btn.btn-xs.device-status {{device.state|statusName|translate}} + ).btn.btn-xs.device-status(ng-bind='device.enhancedState') .clear-fix tab(active='activeTabs.details', ng-show='!$root.basicMode') tab-heading i.fa.fa-list span(translate) Details - div(ng-show='activeTabs.details', ng-controller='DeviceListDetailsCtrl').device-list-details-content + div(ng-if='activeTabs.details', ng-controller='DeviceListDetailsCtrl').device-list-details-content nothing-to-show(message='{{"No devices connected"|translate}}', icon='fa-sitemap', ng-show='!tracker.devices.length') .filtering-buttons @@ -94,38 +93,38 @@ div.stf-device-list td(data-title="'Status'|translate", sortable='"stateSorting"', filter="{ 'usable': 'select' }", filter-data="statusFilter($column)") - button(ng-class='controlButtonClass(device.state)', + button(ng-class='device.enhancedButtonClass', ng-dblclick='tryToKick(device)', ng-click='device.usable && toggle(device)').btn.btn-xs.device-status {{device.state|statusName|translate}} - td(data-title="'ModelX'|translate", sortable='"model"', filter='{"model": "text"}') + td(data-title="::'Model'|translate", sortable='"model"', filter='{"model": "text"}') span.device-small-image - img(ng-src='/static/devices/icon/x24/{{ device.image || "_default.jpg" }}') + img(ng-src='/static/devices/icon/x24/{{ ::device.image || "_default.jpg" }}') span(ng-if='device.state !== "using"') {{device.model}} a(ng-if='device.state === "using"', ng-href='/#!/control/{{ device.serial }}') {{device.model}} td(data-title="'Product'|translate", sortable='"name"', filter='{"name": "text"}').device-list-product - span {{device.name}} + span {{::device.name}} td(data-title="'Carrier'|translate", sortable='"operator"', filter='{"operator": "text"}').device-list-carrier - span {{device.operator}} + span {{::device.operator}} td(data-title="'Released'|translate", sortable='"releasedAtFormatted"', filter='{"releasedAtFormatted": "text"}') - span {{device.releasedAtFormatted}} + span {{::device.releasedAtFormatted}} td(data-title="'OS'|translate", sortable='"version"', filter='{"version": "text"}') - span {{device.version}} + span {{::device.version}} td(data-title="'Network'|translate", sortable='"phone.network"', filter='{"phone": "text"}') span {{device.phone.network}} td(ng-show='showAll', data-title="'Screen'|translate", sortable='"display.width"', filter='{"display": "text"}') span {{device.display.width}}x{{device.display.height}} td(ng-show='showAll', data-title="'Serial'|translate", sortable='"serial"', filter='{"serial": "text"}') - span {{device.serial}} + span {{::device.serial}} td(ng-show='showAll', data-title="'Manufacturer'|translate", sortable='"manufacturer"', filter='{"manufacturer": "text"}') - span {{device.manufacturer}} + span {{::device.manufacturer}} td(ng-show='showAll', data-title="'SDK'|translate", sortable='"sdk"', filter='{"sdk": "text"}') - span {{device.sdk}} + span {{::device.sdk}} td(ng-show='showAll', data-title="'ABI'|translate", sortable='"abi"', filter='{"abi": "text"}') - span {{device.abi}} + span {{::device.abi}} td(ng-show='showAll', data-title="'Phone'|translate", sortable='"phone.phoneNumber"') span {{device.phone.phoneNumber}} td(ng-show='showAll', data-title="'Phone IMEI'|translate", sortable='"phone.imei"') @@ -146,7 +145,7 @@ div.stf-device-list span {{device.battery.temp}}°C td(data-title="'Location'|translate", sortable='"provider.name"', filter='{"provider": "text"}') - span {{device.provider.name}} + span {{::device.provider.name}} td(data-title="'User'|translate", sortable='"owner.name"', filter='{"owner": "text"}') a(ng-if='device.owner', ng-href='{{userContactUrl(device.owner.email)}}', role='button', target='_href') {{device.owner.name || "No name"}} a(ng-if='!device.owner') -