v8: Redirects confirm overlay (#4378)

This commit is contained in:
Bjarne Fyrstenborg
2019-02-14 15:10:28 +01:00
committed by Sebastiaan Janssen
parent 6943be9726
commit 0a486de6a2
14 changed files with 121 additions and 67 deletions
@@ -0,0 +1,11 @@
<div>
<div ng-if="model.redirect" class="umb-alert umb-alert--warning mb2">
<localize key="redirectUrls_redirectRemoveWarning">This will remove the redirect</localize><br><br>
<localize key="redirectUrls_originalUrl">Original URL</localize>: {{model.redirect.originalUrl}}<br>
<localize key="redirectUrls_redirectedTo">Redirected To</localize>: {{model.redirect.destinationUrl}}
</div>
<localize key="defaultdialogs_confirmdelete"></localize>?
</div>
@@ -0,0 +1,5 @@
<div>
<localize key="redirectUrls_confirmDisable">Are you sure you want to disable the URL tracker?</localize>
</div>
@@ -1,7 +1,7 @@
(function() {
"use strict";
function RedirectUrlsController($scope, redirectUrlsResource, notificationsService, localizationService, $q) {
function RedirectUrlsController($scope, $q, redirectUrlsResource, notificationsService, localizationService, eventsService, overlayService) {
// TODO: search by url or url part
// TODO: search by domain
// TODO: display domain in dashboard results?
@@ -76,68 +76,113 @@
});
}
function removeRedirect(redirectToDelete) {
localizationService.localize("redirectUrls_confirmRemove", [redirectToDelete.originalUrl, redirectToDelete.destinationUrl]).then(function (value) {
var toggleConfirm = confirm(value);
function disableUrlTracker(event) {
if (toggleConfirm) {
redirectUrlsResource.deleteRedirectUrl(redirectToDelete.redirectId).then(function () {
var index = vm.redirectUrls.indexOf(redirectToDelete);
vm.redirectUrls.splice(index, 1);
localizationService.localize("redirectUrls_redirectRemoved").then(function(value){
notificationsService.success(value);
});
// check if new redirects needs to be loaded
if (vm.redirectUrls.length === 0 && vm.pagination.totalPages > 1) {
// if we are not on the first page - get records from the previous
if (vm.pagination.pageIndex > 0) {
vm.pagination.pageIndex = vm.pagination.pageIndex - 1;
vm.pagination.pageNumber = vm.pagination.pageNumber - 1;
}
search();
}
}, function (error) {
localizationService.localize("redirectUrls_redirectRemoveError").then(function(value){
notificationsService.error(value);
});
});
const dialog = {
view: "views/dashboard/content/overlays/disable.html",
submitButtonLabel: "Disable",
submitButtonLabelKey: "actions_disable",
submit: function (model) {
performDisable();
overlayService.close();
},
close: function () {
overlayService.close();
}
};
localizationService.localize("redirectUrls_disableUrlTracker").then(value => {
dialog.title = value;
overlayService.open(dialog);
});
event.preventDefault()
event.stopPropagation();
}
function removeRedirect(redirect, event) {
const dialog = {
view: "views/dashboard/content/overlays/delete.html",
redirect: redirect,
submitButtonLabelKey: "contentTypeEditor_yesDelete",
submit: function (model) {
performDelete(model.redirect);
overlayService.close();
},
close: function () {
overlayService.close();
}
};
localizationService.localize("general_delete").then(value => {
dialog.title = value;
overlayService.open(dialog);
});
event.preventDefault()
event.stopPropagation();
}
function performDisable() {
redirectUrlsResource.toggleUrlTracker(true).then(function () {
activate();
localizationService.localize("redirectUrls_disabledConfirm").then(function (value) {
notificationsService.success(value);
});
}, function (error) {
localizationService.localize("redirectUrls_disableError").then(function (value) {
notificationsService.warning(value);
});
});
}
function disableUrlTracker() {
localizationService.localize("redirectUrls_confirmDisable").then(function(value) {
var toggleConfirm = confirm(value);
if (toggleConfirm) {
function performDelete(redirect) {
redirect.deleteButtonState = "busy";
redirectUrlsResource.toggleUrlTracker(true).then(function () {
activate();
localizationService.localize("redirectUrls_disabledConfirm").then(function(value){
notificationsService.success(value);
});
}, function (error) {
localizationService.localize("redirectUrls_disableError").then(function(value){
notificationsService.warning(value);
});
});
redirectUrlsResource.deleteRedirectUrl(redirect.redirectId).then(function () {
// emit event
var args = { redirect: redirect };
eventsService.emit("editors.redirects.redirectDeleted", args);
// remove from list
var index = vm.redirectUrls.indexOf(redirect);
vm.redirectUrls.splice(index, 1);
localizationService.localize("redirectUrls_redirectRemoved").then(function (value) {
notificationsService.success(value);
});
// check if new redirects needs to be loaded
if (vm.redirectUrls.length === 0 && vm.pagination.totalPages > 1) {
// if we are not on the first page - get records from the previous
if (vm.pagination.pageIndex > 0) {
vm.pagination.pageIndex = vm.pagination.pageIndex - 1;
vm.pagination.pageNumber = vm.pagination.pageNumber - 1;
}
search();
}
}, function (error) {
redirect.deleteButtonState = "error";
localizationService.localize("redirectUrls_redirectRemoveError").then(function (value) {
notificationsService.error(value);
});
});
}
function enableUrlTracker() {
redirectUrlsResource.toggleUrlTracker(false).then(function() {
redirectUrlsResource.toggleUrlTracker(false).then(function () {
activate();
localizationService.localize("redirectUrls_enabledConfirm").then(function(value){
localizationService.localize("redirectUrls_enabledConfirm").then(function (value) {
notificationsService.success(value);
});
}, function(error) {
localizationService.localize("redirectUrls_enableError").then(function(value){
}, function (error) {
localizationService.localize("redirectUrls_enableError").then(function (value) {
notificationsService.warning(value);
});
});
@@ -167,7 +212,6 @@
}
activate();
}
angular.module("umbraco").controller("Umbraco.Dashboard.RedirectUrlsController", RedirectUrlsController);
@@ -12,7 +12,7 @@
ng-if="vm.dashboard.urlTrackerDisabled === false"
type="button"
size="s"
action="vm.disableUrlTracker()"
action="vm.disableUrlTracker($event)"
label-key="redirectUrls_disableUrlTracker">
</umb-button>
@@ -63,13 +63,13 @@
<div class="umb-table-body">
<div class="umb-table-row -solid" ng-repeat="redirectUrl in vm.redirectUrls">
<div class="umb-table-row -solid" ng-repeat="redirect in vm.redirectUrls">
<div class="umb-table-cell not-fixed flx-s1 flx-g1 flx-b1">
{{redirectUrl.culture ||'*'}}
{{redirect.culture ||'*'}}
</div>
<div class="umb-table-cell flx-s1 flx-g1 flx-b4">
<a class="umb-table-body__link" href="{{redirectUrl.originalUrl}}" target="_blank" title="{{redirectUrl.originalUrl}}">{{redirectUrl.originalUrl}}</a>
<a class="umb-table-body__link" href="{{redirect.originalUrl}}" target="_blank" title="{{redirect.originalUrl}}">{{redirect.originalUrl}}</a>
</div>
<div class="umb-table-cell flx-s0 flx-g0" style="flex-basis: 20px;">
@@ -78,14 +78,15 @@
<div class="umb-table-cell flx-s1 flx-g1 flx-b5 items-center">
<div class="flx-s1 flx-g1 flx-b0" style="margin-right: 20px;">
<a class="umb-table-body__link" href="{{redirectUrl.destinationUrl}}" target="_blank" title="{{redirectUrl.destinationUrl}}">{{redirectUrl.destinationUrl}}</a>
<a class="umb-table-body__link" href="{{redirect.destinationUrl}}" target="_blank" title="{{redirect.destinationUrl}}">{{redirect.destinationUrl}}</a>
</div>
<umb-button
type="button"
button-style="danger"
size="xs"
action="vm.removeRedirect(redirectUrl)"
label-key="redirectUrls_removeButton">
state="redirect.deleteButtonState"
action="vm.removeRedirect(redirect, $event)"
label-key="general_remove">
</umb-button>
</div>
@@ -1496,10 +1496,10 @@ Mange hilsner fra Umbraco robotten
<key alias="redirectedTo">Viderestillet til</key>
<key alias="noRedirects">Der er ikke lavet nogen viderestillinger</key>
<key alias="noRedirectsDescription">Når en udgivet side bliver omdøbt eller flyttet, vil en viderestilling automatisk blive lavet til den nye side.</key>
<key alias="removeButton">Fjern</key>
<key alias="confirmRemove">Er du sikker på at du vil fjerne viderestillingen fra '%0%' til '%1%'?</key>
<key alias="redirectRemoved">Viderestillings URL fjernet.</key>
<key alias="redirectRemoveError">Fejl under fjernelse af viderestillings URL.</key>
<key alias="redirectRemoveWarning">Dette vil fjerne viderestillingen</key>
<key alias="confirmDisable">Er du sikker på at du vil slå URL trackeren fra?</key>
<key alias="disabledConfirm">URL tracker er nu slået fra.</key>
<key alias="disableError">Der opstod en fejl under forsøget på at slå URL trackeren fra, der findes mere information i logfilen.</key>
@@ -2008,10 +2008,10 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="panelInformation">The following URLs redirect to this content item:</key>
<key alias="noRedirects">No redirects have been made</key>
<key alias="noRedirectsDescription">When a published page gets renamed or moved a redirect will automatically be made to the new page.</key>
<key alias="removeButton">Remove</key>
<key alias="confirmRemove">Are you sure you want to remove the redirect from '%0%' to '%1%'?</key>
<key alias="redirectRemoved">Redirect URL removed.</key>
<key alias="redirectRemoveError">Error removing redirect URL.</key>
<key alias="redirectRemoveWarning">This will remove the redirect</key>
<key alias="confirmDisable">Are you sure you want to disable the URL tracker?</key>
<key alias="disabledConfirm">URL tracker has now been disabled.</key>
<key alias="disableError">Error disabling the URL tracker, more information can be found in your log file.</key>
@@ -2022,10 +2022,10 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="panelInformation">The following URLs redirect to this content item:</key>
<key alias="noRedirects">No redirects have been made</key>
<key alias="noRedirectsDescription">When a published page gets renamed or moved a redirect will automatically be made to the new page.</key>
<key alias="removeButton">Remove</key>
<key alias="confirmRemove">Are you sure you want to remove the redirect from '%0%' to '%1%'?</key>
<key alias="redirectRemoved">Redirect URL removed.</key>
<key alias="redirectRemoveError">Error removing redirect URL.</key>
<key alias="redirectRemoveWarning">This will remove the redirect</key>
<key alias="confirmDisable">Are you sure you want to disable the URL tracker?</key>
<key alias="disabledConfirm">URL tracker has now been disabled.</key>
<key alias="disableError">Error disabling the URL tracker, more information can be found in your log file.</key>
@@ -1643,10 +1643,9 @@
<key alias="redirectedTo">Redirigido a To</key>
<key alias="noRedirects">No se ha creado ninguna redirección</key>
<key alias="noRedirectsDescription">Cuando una página es renombrada o movida, una redirección a la nueva página es automáticamente creada.</key>
<key alias="removeButton">Eliminar</key>
<key alias="confirmRemove">¿Estás seguro que quieres eliminar la redirección de '%0%' a '%1%'?</key>
<key alias="redirectRemoved">Redirección URL eliminada.</key>
<key alias="redirectRemoveError">Error borrando la redirección URL.</key>
<key alias="redirectRemoveError">Error borrando la redirección URL.</key>
<key alias="confirmDisable">¿Seguro que quieres desactivar URL tracker?</key>
<key alias="disabledConfirm">URL tracker ha sido desactivado.</key>
<key alias="disableError">Error desactivando URL tracker, más información se puede encontrar en los logs.</key>
@@ -1850,7 +1850,6 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à
<key alias="redirectedTo">Redirigé Vers</key>
<key alias="noRedirects">Aucune redirection n'a été créée</key>
<key alias="noRedirectsDescription">Lorsqu'une page publiée est renommée ou déplacée, une redirection sera automatiquement créée vers la nouvelle page.</key>
<key alias="removeButton">Supprimer</key>
<key alias="confirmRemove">Etes-vous certain(e) de vouloir supprimer la redirection de '%0%' vers '%1%'?</key>
<key alias="redirectRemoved">Redirection d'URL supprimée.</key>
<key alias="redirectRemoveError">Erreur lors de la suppression de la redirection d'URL.</key>
@@ -1397,7 +1397,6 @@ Echter, Runway biedt een gemakkelijke basis om je snel op weg te helpen. Als je
<key alias="redirectedTo">Doorgestuurd naar</key>
<key alias="noRedirects">Er zijn geen redirects</key>
<key alias="noRedirectsDescription">Er wordt automatisch een redirect aangemaakt als een gepubliceerde pagina hernoemd of verplaatst wordt.</key>
<key alias="removeButton">Verwijder</key>
<key alias="confirmRemove">Weet je zeker dat je de redirect van '%0%' naar '%1%' wilt verwijderen?</key>
<key alias="redirectRemoved">Redirect URL verwijderd.</key>
<key alias="redirectRemoveError">Fout bij verwijderen redirect URL.</key>
@@ -1477,7 +1477,6 @@ Naciśnij przycisk <strong>instaluj</strong>, aby zainstalować bazę danych Umb
<key alias="redirectedTo">Przekierowane do</key>
<key alias="noRedirects">Nie stworzono żadnych przekierowań</key>
<key alias="noRedirectsDescription">Kiedy nazwa opublikowanej strony zostanie zmieniona lub zostanie ona przeniesiona, zostanie stworzone automatyczne przekierowanie na nową stronę.</key>
<key alias="removeButton">Usuń</key>
<key alias="confirmRemove">Czy jesteś pewien, że chcesz usunąć przekierowanie z '%0%' do '%1%'?</key>
<key alias="redirectRemoved">Przekierowanie URL zostało usunięte.</key>
<key alias="redirectRemoveError">Wystąpił błąd podczas usuwania przekierowania URL.</key>
@@ -1286,7 +1286,6 @@
<key alias="redirectedTo">Перенаправлен в</key>
<key alias="noRedirects">На данный момент нет ни одного перенаправления</key>
<key alias="noRedirectsDescription">Если опубликованный документ переименовывается или меняет свое расположение в дереве, а следовательно, меняется адрес (URL), автоматически создается перенаправление на новое местоположение этого документа.</key>
<key alias="removeButton">Удалить</key>
<key alias="confirmRemove">Вы уверены, что хотите удалить перенаправление с '%0%' на '%1%'?</key>
<key alias="redirectRemoved">Перенаправление удалено.</key>
<key alias="redirectRemoveError">Ошибка удаления перенаправления.</key>
@@ -1262,7 +1262,6 @@
<key alias="redirectedTo">已重定向至</key>
<key alias="noRedirects">未进行重定向</key>
<key alias="noRedirectsDescription">当已发布的页重命名或移动时, 将自动对新页进行重定向。</key>
<key alias="removeButton">删除</key>
<key alias="confirmRemove">确实要删除 "%0%" 到 "%1%" 的重定向吗?</key>
<key alias="redirectRemoved">重定向URL已删除。</key>
<key alias="redirectRemoveError">删除重定向 url 时出错.</key>
@@ -1241,7 +1241,6 @@
<key alias="redirectedTo">轉址成</key>
<key alias="noRedirects">沒有任何轉址</key>
<key alias="noRedirectsDescription">當發佈後的頁面改名或移動時,會自動轉址至新網頁。</key>
<key alias="removeButton">移除</key>
<key alias="confirmRemove">您確定要移除從 %0% 到 %1% 的轉址嗎?</key>
<key alias="redirectRemoved">轉址已移除。</key>
<key alias="redirectRemoveError">移除轉址錯誤。