diff --git a/ereuse_devicehub/static/js/main_inventory.js b/ereuse_devicehub/static/js/main_inventory.js index d790af81..333bf049 100644 --- a/ereuse_devicehub/static/js/main_inventory.js +++ b/ereuse_devicehub/static/js/main_inventory.js @@ -62,15 +62,26 @@ function deviceSelect() { function removeTag() { var devices = $(".deviceSelect").filter(':checked'); var devices_id = $.map(devices, function(x) { return $(x).attr('data')}); - if (devices_id.length > 0) { + if (devices_id.length == 1) { var url = "/inventory/tag/devices/"+devices_id[0]+"/del/"; window.location.href = url; + } else { + $("#unlinkTagAlertModal").click(); } } function addTag() { - deviceSelect(); - $("#addingTagModal").click(); + var devices = $(".deviceSelect").filter(':checked'); + var devices_id = $.map(devices, function(x) { return $(x).attr('data')}); + if (devices_id.length == 1) { + $("#addingTagModal .pol").hide(); + $("#addingTagModal .btn-primary").show(); + } else { + $("#addingTagModal .pol").show(); + $("#addingTagModal .btn-primary").hide(); + } + + $("#addTagAlertModal").click(); } function newTrade(action) { diff --git a/ereuse_devicehub/templates/inventory/addDevicestag.html b/ereuse_devicehub/templates/inventory/addDevicestag.html index cb929d37..5170b454 100644 --- a/ereuse_devicehub/templates/inventory/addDevicestag.html +++ b/ereuse_devicehub/templates/inventory/addDevicestag.html @@ -18,7 +18,7 @@

- You need select first some device for adding this in a tag + You need select first one device and only one for add this in a tag

diff --git a/ereuse_devicehub/templates/inventory/alert_unlink_tag_error.html b/ereuse_devicehub/templates/inventory/alert_unlink_tag_error.html new file mode 100644 index 00000000..b05fb40f --- /dev/null +++ b/ereuse_devicehub/templates/inventory/alert_unlink_tag_error.html @@ -0,0 +1,21 @@ + diff --git a/ereuse_devicehub/templates/inventory/device_list.html b/ereuse_devicehub/templates/inventory/device_list.html index 7f31a60a..3cf54939 100644 --- a/ereuse_devicehub/templates/inventory/device_list.html +++ b/ereuse_devicehub/templates/inventory/device_list.html @@ -231,17 +231,19 @@ Tags + + @@ -384,6 +386,7 @@ {% include "inventory/data_wipe.html" %} {% include "inventory/trade.html" %} {% include "inventory/alert_export_error.html" %} +{% include "inventory/alert_unlink_tag_error.html" %}