Changed script to accommodate for heavy restyling

pull/3/head
Davide Bongiovanni 6 years ago
parent 47c25847f0
commit af3d1f3200

@ -16,14 +16,19 @@ function init_edit(partID) {
$('table#details tr#datasheet td input').show(); $('table#details tr#datasheet td input').show();
$('#duplicate-button').closest('div').hide(); $('#duplicate-button').closest('div').hide();
$('#delete-button').closest('div').hide();
$('tr#datasheet').show(); $('tr#datasheet').show();
$('input[name=notes-input]').show(); $('input[name=notes-input]').show();
$('table#details tr#notes td p').hide(); $('table#details tr#notes td p').hide();
var newButton = '<div class="round-button-left"><a href="#" onclick="save(' + partID + ')"><i class="fa fa-check" aria-hidden="true"></i></a></div>'; // var newButton = '<div class="round-button-left"><a href="#" onclick="save(' + partID + ')"><i class="fa fa-check" aria-hidden="true"></i></a></div>';
$('.round-button-left').replaceWith(newButton); // $('.round-button-left').replaceWith(newButton);
$('#edit-button').html('<i class="fa fa-check" aria-hidden="true"></i>');
$('#edit-button').off('click').on('click', function(){
save(partID);
});
} }
function new_entry() { function new_entry() {
@ -61,9 +66,11 @@ function end_edit() {
$('table#details tr#notes td p').show(); $('table#details tr#notes td p').show();
$('#duplicate-button').closest('div').show(); $('#duplicate-button').closest('div').show();
$('#delete-button').closest('div').show();
var newButton = '<div class="round-button-left"><a href="#" id="edit-button"><i class="fa fa-pencil" aria-hidden="true"></i></a></div>'; $('#edit-button').html('<i class="fa fa-pencil" aria-hidden="true"></i>');
$('.round-button-left').replaceWith(newButton); // var newButton = '<div class="round-button-left"><a href="#" id="edit-button"><i class="fa fa-pencil" aria-hidden="true"></i></a></div>';
// $('.round-button-left').replaceWith(newButton);
} }
function save(partID) { function save(partID) {
@ -196,7 +203,7 @@ function show_part_info(partID) {
$('tr#datasheet-head td').text('DATASHEET: '); $('tr#datasheet-head td').text('DATASHEET: ');
$('input[name=datasheet-url-input]').val(''); $('input[name=datasheet-url-input]').val('');
} }
$('#edit-button').click(function() { $('#edit-button').off('click').on('click', function() {
init_edit(partID); init_edit(partID);
}); });
$('#delete-button').off('click').on('click', function() { $('#delete-button').off('click').on('click', function() {

Loading…
Cancel
Save