Elements can be deleted, add overlay during AJAX operations
This commit is contained in:
parent
8682bd236e
commit
5cdd216cdb
@ -56,16 +56,14 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="table-body">
|
<tbody id="table-body">
|
||||||
<tr id="loader">
|
|
||||||
<td colspan="6">
|
|
||||||
<i class="fa fa-spinner fa-spin"></i> Loading Custom Nav Elements…
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="overlay" id="overlay">
|
||||||
|
<i class="fa fa-spinner fa-spin"></i>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.black {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
.red,
|
.red,
|
||||||
.important,
|
.important,
|
||||||
.critical-priority {
|
.critical-priority {
|
||||||
|
@ -4,6 +4,7 @@ $(document).ready(function() {
|
|||||||
loadTable();
|
loadTable();
|
||||||
bindEditModal();
|
bindEditModal();
|
||||||
bindCreateModal();
|
bindCreateModal();
|
||||||
|
bindDeleteButton();
|
||||||
|
|
||||||
$('[data-toggle="nav-iconpicker"]').iconpicker({
|
$('[data-toggle="nav-iconpicker"]').iconpicker({
|
||||||
iconset: ['fontawesome', 'octicon'],
|
iconset: ['fontawesome', 'octicon'],
|
||||||
@ -143,7 +144,6 @@ function loadTable(modalToClose) {
|
|||||||
}
|
}
|
||||||
$template.find('ul[data-property="subtext"]').html(subtext);
|
$template.find('ul[data-property="subtext"]').html(subtext);
|
||||||
|
|
||||||
console.log($template);
|
|
||||||
$('#table-body').append($template);
|
$('#table-body').append($template);
|
||||||
|
|
||||||
elements[this.id] = this;
|
elements[this.id] = this;
|
||||||
@ -157,7 +157,7 @@ function loadTable(modalToClose) {
|
|||||||
console.error(data);
|
console.error(data);
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
$('#loader').hide();
|
$('#overlay').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -241,3 +241,25 @@ function bindCreateModal() {
|
|||||||
$modal.modal('show');
|
$modal.modal('show');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bindDeleteButton() {
|
||||||
|
$(document).on('click', '[data-action="delete"]', function() {
|
||||||
|
$('#overlay').show();
|
||||||
|
|
||||||
|
var heskUrl = $('#heskUrl').text();
|
||||||
|
var element = elements[$(this).parent().parent().find('[data-property="id"]').text()];
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'DELETE',
|
||||||
|
url: heskUrl + '/api/v1-internal/custom-navigation/' + element.id,
|
||||||
|
headers: { 'X-Internal-Call': true },
|
||||||
|
success: function() {
|
||||||
|
console.log('DELETED!');
|
||||||
|
loadTable();
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
console.error(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user