fix status rename bug

This commit is contained in:
Mats van Reenen 2020-12-31 19:11:58 +01:00
parent b20c9d1bd8
commit c5288b19a5
2 changed files with 18 additions and 18 deletions

View File

@ -54,6 +54,7 @@
<ul>
<li>
<input type="text" id="new_status" placeholder="Column name" autofocus>
<input type="hidden" id="new_status_id">
</li>
<li>
<input type="submit" name="change_status" value="Change column name">

View File

@ -75,26 +75,25 @@ var App = function() {
$('#change-status-modal').removeClass('hide');
$('#new_status').val($(this).text());
$('#new_status_id').val(statusToChange);
});
$('#change-status-modal').find('form').on('submit', function(e){
e.preventDefault();
var newStatus = $('#new_status').val();
var newStatusId = $('#new_status_id').val();
var currentStatus = JSON.parse(LocalStorage.get('status'));
currentStatus.map(function(obj){
if(obj.key == newStatusId)
{
obj.value = newStatus;
}
});
$('#change-status-modal').find('form').on('submit', function(e){
e.preventDefault();
var newStatus = $('#new_status').val();
var currentStatus = JSON.parse(LocalStorage.get('status'));
currentStatus.map(function(obj){
if(obj.key == statusToChange)
{
obj.value = newStatus;
}
});
$('header ul li[data-id=' + newStatusId + ']').html(newStatus);
$('header ul li[data-id=' + statusToChange + ']').html(newStatus);
LocalStorage.set('status', JSON.stringify(currentStatus));
LocalStorage.set('status', JSON.stringify(currentStatus));
$('.close-modal').trigger('click');
});
$('.close-modal').trigger('click');
});
}