diff --git a/submodules/users/users.js b/submodules/users/users.js index 434b36b9..97ed0fcb 100644 --- a/submodules/users/users.js +++ b/submodules/users/users.js @@ -391,34 +391,33 @@ define(function(require){ if(userId in mapUsers) { var isRegistered = _.find(data.deviceStatus, function(status){ return (status.device_id === device.id && status.registered === true); }) ? true : false; - if(mapUsers[userId].extra.devices.length == 2) { - if(mapUsers[userId].extra.additionalDevices) { - mapUsers[userId].extra.additionalDevices.count++; - mapUsers[userId].extra.additionalDevices.tooltip += '
' - + device.name + ' (' + device.device_type.replace('_', ' ') + ')'; - } else { + + if(mapUsers[userId].extra.devices.length >= 2) { + if(mapUsers[userId].extra.additionalDevices === 0) { mapUsers[userId].extra.additionalDevices = { - count: 1, - tooltip: '' - + device.name + ' (' + device.device_type.replace('_', ' ') + ')' + count: 0, + tooltip: '' }; } + + mapUsers[userId].extra.additionalDevices.count++; + mapUsers[userId].extra.additionalDevices.tooltip += '' + + device.name + ' (' + device.device_type.replace('_', ' ') + ')
'; } - else { - var deviceDataToTemplate = { - id: device.id, - name: device.name + ' (' + device.device_type.replace('_', ' ') + ')', - type: device.device_type, - registered: isRegistered, - icon: self.deviceIcons[device.device_type] - }; - if (device.device_type === 'mobile') { - deviceDataToTemplate.mobile = device.mobile; - } + var deviceDataToTemplate = { + id: device.id, + name: device.name + ' (' + device.device_type.replace('_', ' ') + ')', + type: device.device_type, + registered: isRegistered, + icon: self.deviceIcons[device.device_type] + }; - mapUsers[userId].extra.devices.push(deviceDataToTemplate); + if (device.device_type === 'mobile') { + deviceDataToTemplate.mobile = device.mobile; } + + mapUsers[userId].extra.devices.push(deviceDataToTemplate); } }); @@ -1005,7 +1004,6 @@ define(function(require){ }); }); - template.on('click', '.detail-devices .edit-device-link', function() { var row = $(this).parents('.item-row'), id = row.data('id') diff --git a/views/users-row.html b/views/users-row.html index 4dba9614..80d1829d 100644 --- a/views/users-row.html +++ b/views/users-row.html @@ -25,7 +25,9 @@
{{#each extra.devices}} - + {{#compare @index "<" 2}} + + {{/compare}} {{else}} {{ i18n.users.noUserDevices }} {{/each}}