From 9d4df89f1034d7a06a0a2ffd9cefc075616c8601 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Tue, 27 Mar 2018 18:58:01 +0200 Subject: [usb-lock-off] edit-rule button for switching from dropdown to input text is now working in both directions. --- .../usblockoff/templates/usb-edit-rule.html | 66 +++++++++++++++++++--- 1 file changed, 59 insertions(+), 7 deletions(-) (limited to 'modules-available') diff --git a/modules-available/usblockoff/templates/usb-edit-rule.html b/modules-available/usblockoff/templates/usb-edit-rule.html index 8f31fdd9..e2854f50 100644 --- a/modules-available/usblockoff/templates/usb-edit-rule.html +++ b/modules-available/usblockoff/templates/usb-edit-rule.html @@ -35,10 +35,42 @@ $('a.btn[title]').tooltip({placement: "auto", html: true}); $('.switch-input').click(function() { - var $op = $(this).parent().find('select'); + //var $op = $(this).parent().find('select'); + var $op = $(this).parent().find(':input').not('button'); var val = $op.val(); - $op.replaceWith($('').attr('name', $op.attr('name')).val(val)); + console.log(val); + if ($op[0].localName == 'select') { + $op.replaceWith($('').attr('name', $op.attr('name')).attr('id', $op.attr('id')).val(val)); + + if ($op.attr('id') === 'prop-vid') { + remakeChangeEvent(val); + } + + $(this).parent().find('button span').removeClass('glyphicon-pencil').addClass('glyphicon glyphicon-list-alt'); + + } else if ($op[0].localName == 'input') { + $op.replaceWith($('