View | Details | Raw Unified | Return to bug 27250
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt (-16 / +22 lines)
Lines 366-388 SMTP servers Link Here
366
                $("#delete_confirm_dialog").html(
366
                $("#delete_confirm_dialog").html(
367
                    _("You are about to delete the '%s' SMTP server.").format(smtp_server_name)
367
                    _("You are about to delete the '%s' SMTP server.").format(smtp_server_name)
368
                );
368
                );
369
                $("#delete_confirm_modal_button").data('smtp-server-id', smtp_server_id);
370
                $("#delete_confirm_modal_button").data('smtp-server-name', smtp_server_name);
371
            });
369
372
370
                $("#delete_confirm_modal_button").on( "click", function () {
373
            $("#delete_confirm_modal_button").on( "click", function () {
371
                    $.ajax({
374
372
                        method: "DELETE",
375
                var smtp_server_id   = $(this).data('smtp-server-id');
373
                        url: "/api/v1/config/smtp_servers/"+smtp_server_id
376
                var smtp_server_name = $(this).data('smtp-server-name');
374
                    }).success(function() {
377
375
                        $("#delete_confirm_modal").modal('hide');
378
                $.ajax({
376
                        window.smtp_servers.api().ajax.reload(function (data) {
379
                    method: "DELETE",
377
                            if (data.recordsTotal == 0) {
380
                    url: "/api/v1/config/smtp_servers/"+smtp_server_id
378
                                $("#smtp_servers_wrapper").hide();
381
                }).success(function() {
379
                            }
382
                    window.smtp_servers.api().ajax.reload(function (data) {
380
                            $("#smtp_action_result_dialog").hide();
383
                        if (data.recordsTotal == 0) {
381
                            $("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(smtp_server_name)).show();
384
                            $("#smtp_servers_wrapper").hide();
382
                        });
385
                        }
383
                    }).error(function () {
386
                        $("#smtp_action_result_dialog").hide();
384
                        $("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs.").format(smtp_server_name)).show();
387
                        $("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(smtp_server_name)).show();
385
                    });
388
                    });
389
                }).fail(function () {
390
                    $("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs.").format(smtp_server_name)).show();
391
                }).done(function () {
392
                    $("#delete_confirm_modal").modal('hide');
386
                });
393
                });
387
            });
394
            });
388
        });
395
        });
389
- 

Return to bug 27250