From 20db75a8d733776a4bf4ec503300fff8171a409b Mon Sep 17 00:00:00 2001 From: Davide Bongiovanni Date: Sun, 11 Nov 2018 17:15:22 +0100 Subject: [PATCH] Populating paragraphs on end edit. Can't add a bunch of stuff now. --- parts/static/script.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/parts/static/script.js b/parts/static/script.js index 0a1c71a..23a5f42 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -29,12 +29,16 @@ function new_entry() { } function end_edit() { + + $('table#details tr#location td p').text($('table#details tr#location td select option:checked').val()); $('table#details tr#location td p').show(); $('table#details tr#location td select').hide(); + $('table#details tr#partno td p').text($('table#details tr#partno td input').val()); $('table#details tr#partno td p').show(); $('table#details tr#partno td input').hide(); + $('table#details tr#description td p').text($('table#details tr#description td input').val()); $('table#details tr#description td p').show(); $('table#details tr#description td input').hide(); @@ -118,7 +122,10 @@ function save(partID) { processData: false, success: function(data) { var datasheet_par = '

'; - $('#datasheet-info').replaceWith(datasheet_par); + $('#datasheet-info').replaceWith(datasheet_par); // Fix addressing + $('#edit-button').click(function() { + init_edit(JSON.parse(data).part_id); + }); }, error: function() { alert("Couldn't update the part information. Please retry."); @@ -127,9 +134,6 @@ function save(partID) { }); end_edit(); - $('#edit-button').click(function() { - init_edit(partID); - }); } function text_filter(string) {