Skip to content

Commit f4cd59f

Browse files
committed
Use snackbar notifications in new interactions
1 parent a02d8a2 commit f4cd59f

File tree

11 files changed

+43
-52
lines changed

11 files changed

+43
-52
lines changed

ts/WoltLabSuite/Core/Component/Interaction/Bulk/FormBuilderDialog.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* @since 6.2
88
*/
99

10-
import { show as showNotification } from "WoltLabSuite/Core/Ui/Notification";
1110
import { dialogFactory } from "WoltLabSuite/Core/Component/Dialog";
11+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
1212

1313
async function handleFormBuilderDialogAction(
1414
container: HTMLElement,
@@ -34,8 +34,7 @@ async function handleFormBuilderDialogAction(
3434
);
3535
}
3636

37-
// TODO: This shows a generic success message and should be replaced with a more specific message.
38-
showNotification();
37+
showDefaultSuccessSnackbar();
3938

4039
container.dispatchEvent(new CustomEvent("interaction:reset-selection"));
4140
}

ts/WoltLabSuite/Core/Component/Interaction/FormBuilderDialog.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* @since 6.2
88
*/
99

10-
import { show as showNotification } from "WoltLabSuite/Core/Ui/Notification";
1110
import { dialogFactory } from "WoltLabSuite/Core/Component/Dialog";
11+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
1212

1313
async function handleFormBuilderDialogAction(element: HTMLElement, endpoint: string): Promise<void> {
1414
const { ok } = await dialogFactory().usingFormBuilder().fromEndpoint(endpoint);
@@ -23,8 +23,7 @@ async function handleFormBuilderDialogAction(element: HTMLElement, endpoint: str
2323
}),
2424
);
2525

26-
// TODO: This shows a generic success message and should be replaced with a more specific message.
27-
showNotification();
26+
showDefaultSuccessSnackbar();
2827
}
2928

3029
export function setup(identifier: string, container: HTMLElement): void {

ts/WoltLabSuite/Core/Component/Interaction/LegacyDboAction.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
*/
1010

1111
import { dboAction } from "WoltLabSuite/Core/Ajax";
12-
import { show as showNotification } from "WoltLabSuite/Core/Ui/Notification";
1312
import { ConfirmationType, handleConfirmation } from "./Confirmation";
13+
import { showDefaultSuccessSnackbar, showSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
14+
import { getPhrase } from "WoltLabSuite/Core/Language";
1415

1516
async function handleDboAction(
1617
element: HTMLElement,
@@ -31,23 +32,21 @@ async function handleDboAction(
3132
.dispatch();
3233

3334
if (confirmationType == ConfirmationType.Delete) {
34-
// TODO: This shows a generic success message and should be replaced with a more specific message.
35-
showNotification(undefined, () => {
36-
element.dispatchEvent(
37-
new CustomEvent("interaction:remove", {
38-
bubbles: true,
39-
}),
40-
);
41-
});
35+
element.dispatchEvent(
36+
new CustomEvent("interaction:remove", {
37+
bubbles: true,
38+
}),
39+
);
40+
41+
showSuccessSnackbar(getPhrase("wcf.global.success.delete"));
4242
} else {
4343
element.dispatchEvent(
4444
new CustomEvent("interaction:invalidate", {
4545
bubbles: true,
4646
}),
4747
);
4848

49-
// TODO: This shows a generic success message and should be replaced with a more specific message.
50-
showNotification();
49+
showDefaultSuccessSnackbar();
5150
}
5251
}
5352

ts/WoltLabSuite/Core/Component/Interaction/Rpc.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010
import { deleteObject } from "WoltLabSuite/Core/Api/DeleteObject";
1111
import { postObject } from "WoltLabSuite/Core/Api/PostObject";
12-
import { show as showNotification } from "WoltLabSuite/Core/Ui/Notification";
1312
import { ConfirmationType, handleConfirmation } from "./Confirmation";
13+
import { showDefaultSuccessSnackbar, showSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
14+
import { getPhrase } from "WoltLabSuite/Core/Language";
1415

1516
async function handleRpcInteraction(
1617
container: HTMLElement,
@@ -42,14 +43,13 @@ async function handleRpcInteraction(
4243
}
4344

4445
if (confirmationType === ConfirmationType.Delete) {
45-
// TODO: This shows a generic success message and should be replaced with a more specific message.
46-
showNotification(undefined, () => {
47-
element.dispatchEvent(
48-
new CustomEvent("interaction:remove", {
49-
bubbles: true,
50-
}),
51-
);
52-
});
46+
element.dispatchEvent(
47+
new CustomEvent("interaction:remove", {
48+
bubbles: true,
49+
}),
50+
);
51+
52+
showSuccessSnackbar(getPhrase("wcf.global.success.delete"));
5353
} else {
5454
if (invalidatesAllItems) {
5555
container.dispatchEvent(new CustomEvent("interaction:invalidate-all"));
@@ -61,8 +61,7 @@ async function handleRpcInteraction(
6161
);
6262
}
6363

64-
// TODO: This shows a generic success message and should be replaced with a more specific message.
65-
showNotification();
64+
showDefaultSuccessSnackbar();
6665
}
6766
}
6867

wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Bulk/FormBuilderDialog.js

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/FormBuilderDialog.js

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/LegacyDboAction.js

Lines changed: 6 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Rpc.js

Lines changed: 6 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wcfsetup/install/files/lib/system/event/listener/PreloadPhrasesCollectingListener.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public function __invoke(PreloadPhrasesCollecting $event): void
109109
$event->preload('wcf.global.select');
110110
$event->preload('wcf.global.success');
111111
$event->preload('wcf.global.success.add');
112+
$event->preload('wcf.global.success.delete');
112113
$event->preload('wcf.global.success.edit');
113114

114115
$event->preload('wcf.global.rss.accessToken.info');

wcfsetup/install/lang/de.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,6 +3993,7 @@ Dateianhänge:
39933993
<item name="wcf.global.success"><![CDATA[Die Aktion wurde erfolgreich ausgeführt.]]></item>
39943994
<item name="wcf.global.success.add"><![CDATA[Der Eintrag wurde gespeichert.]]></item>
39953995
<item name="wcf.global.success.add.editCreatedObject"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du kannst{else}Sie können{/if} jetzt einen weiteren erstellen oder den <a href="{$objectEditLink}">zuvor erstellten Eintrag bearbeiten</a>.]]></item>
3996+
<item name="wcf.global.success.delete"><![CDATA[Der Eintrag wurde erfolgreich gelöscht.]]></item>
39963997
<item name="wcf.global.success.edit"><![CDATA[Die Änderungen wurden gespeichert.]]></item>
39973998
<item name="wcf.global.language.noSelection"><![CDATA[Keine Auswahl]]></item>
39983999
<item name="wcf.global.loading"><![CDATA[Lädt …]]></item>

0 commit comments

Comments
 (0)