1
0
mirror of https://github.com/mbirth/tcl_update_db.git synced 2024-12-26 12:34:07 +00:00

Small improvements to OTA versions display in tooltip.

This commit is contained in:
Markus Birth 2018-02-16 23:50:42 +01:00
parent 74d733b98c
commit 423631cc7a
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A

View File

@ -51,15 +51,25 @@ document.addEventListener 'DOMContentLoaded', (event) ->
if vermeta['OTA'].length > 0 if vermeta['OTA'].length > 0
fromList = (v['fv'] for v in vermeta['OTA']) fromList = (v['fv'] for v in vermeta['OTA'])
fromList = fromList.join ', ' fromList = fromList.sort().reverse()
otaInfo = "✔️ (from #{fromList})" fromListText = fromList.join ', '
if fromList.length > 3
fromMore = fromList.length - 3
fromList = fromList[0..2]
fromListText = (fromList.join ', ') + " + #{fromMore} more"
otaInfo = "✔️ (from #{fromListText})"
else else
otaInfo = "" otaInfo = ""
if vermeta['OTA_FROM'].length > 0 if vermeta['OTA_FROM'].length > 0
toList = (v['tv'] for v in vermeta['OTA_FROM']) toList = (v['tv'] for v in vermeta['OTA_FROM'])
toList = toList.join ', ' toList = toList.sort().reverse()
updateInfo = "<strong>OTA possible to #{toList}</strong>" toListText = toList.join ', '
if toList.length > 3
toMore = toList.length - 3
toList = toList[0..2]
toListText = (toList.join ', ') + " + #{toMore} more"
updateInfo = "<strong>OTA possible to #{toListText}</strong>"
else else
updateInfo = "No OTA to future version." updateInfo = "No OTA to future version."