{event name='beforeManageButtons'}
{if $view->canEditCoverPhoto()}
- <div class="dropdown">
- <button type="button" class="button small dropdownToggle">{icon name='camera'} {lang}wcf.user.coverPhoto.edit{/lang}</button>
- <ul class="dropdownMenu">
- {if $view->canAddCoverPhoto()}
- <li><button type="button" class="jsButtonUploadCoverPhoto jsStaticDialog" data-dialog-id="userProfileCoverPhotoUpload">{lang}wcf.user.coverPhoto.upload{/lang}</button></li>
- {/if}
- <li{if !$view->user->coverPhotoHash} style="display:none;"{/if}><button type="button" class="jsButtonDeleteCoverPhoto">{lang}wcf.user.coverPhoto.delete{/lang}</button></li>
- </ul>
- </div>
+ <ul class="userProfileManageCoverPhoto buttonGroup buttonList smallButtons">
+ <li>
+ <button type="button" data-edit-cover-photo="{link controller="UserCoverPhoto" id=$user->userID}{/link}" data-default-cover-photo="{$__wcf->styleHandler->getStyle()->getCoverPhotoUrl()}" class="button small">
+ {icon name='camera'} {lang}wcf.user.coverPhoto.management{/lang}
+ </button>
+ </li>
+ </ul>
{/if}
{if $view->canEditUser()}
const dialog = dialogFactory().fromHtml(json.dialog).withoutControls();
const coverPhotoElement = getCoverPhotoElement();
const coverPhotoNotice = document.getElementById("coverPhotoNotice");
- const oldCoverPhoto = coverPhotoElement?.style.backgroundImage;
+ const oldCoverPhoto = getCoverPhotoUrl(coverPhotoElement);
dialog.addEventListener("afterClose", () => {
const file = dialog.querySelector<WoltlabCoreFile>("woltlab-core-file");
return;
}
- if (coverPhotoElement && coverPhotoUrl) {
- coverPhotoElement.style.backgroundImage = coverPhotoStyle;
+ if (coverPhotoElement instanceof HTMLImageElement && coverPhotoUrl) {
+ coverPhotoElement.src = coverPhotoUrl;
} else {
// ACP cover photo management
if (!coverPhotoElement && coverPhotoUrl) {
dialog.show(json.title);
}
+function getCoverPhotoUrl(coverPhotoElement: HTMLElement | null): string | undefined {
+ if (coverPhotoElement instanceof HTMLImageElement) {
+ return coverPhotoElement.src;
+ } else {
+ return coverPhotoElement?.style.backgroundImage;
+ }
+}
+
function getCoverPhotoElement(): HTMLElement | null {
- return document.querySelector<HTMLElement>(".userProfileCoverPhoto") ?? document.getElementById("coverPhotoPreview");
+ return (
+ document.querySelector<HTMLElement>(".userProfileHeader__coverPhotoImage") ??
+ document.getElementById("coverPhotoPreview")
+ );
}
export function setup(): void {
void new Promise((resolve_13, reject_13) => { require(["./Component/Option/Enable"], resolve_13, reject_13); }).then(tslib_1.__importStar).then(({ setup }) => setup());
});
(0, LazyLoader_1.whenFirstSeen)("[data-edit-cover-photo]", () => {
- void new Promise((resolve_13, reject_13) => { require(["./Component/User/CoverPhoto"], resolve_13, reject_13); }).then(tslib_1.__importStar).then(({ setup }) => setup());
+ void new Promise((resolve_14, reject_14) => { require(["./Component/User/CoverPhoto"], resolve_14, reject_14); }).then(tslib_1.__importStar).then(({ setup }) => setup());
});
// Move the reCAPTCHA widget overlay to the `pageOverlayContainer`
// when widget form elements are placed in a dialog.
const dialog = (0, Dialog_1.dialogFactory)().fromHtml(json.dialog).withoutControls();
const coverPhotoElement = getCoverPhotoElement();
const coverPhotoNotice = document.getElementById("coverPhotoNotice");
- const oldCoverPhoto = coverPhotoElement?.style.backgroundImage;
+ const oldCoverPhoto = getCoverPhotoUrl(coverPhotoElement);
dialog.addEventListener("afterClose", () => {
const file = dialog.querySelector("woltlab-core-file");
const coverPhotoUrl = file?.link ?? defaultCoverPhoto ?? "";
// nothing changed
return;
}
- if (coverPhotoElement && coverPhotoUrl) {
- coverPhotoElement.style.backgroundImage = coverPhotoStyle;
+ if (coverPhotoElement instanceof HTMLImageElement && coverPhotoUrl) {
+ coverPhotoElement.src = coverPhotoUrl;
}
else {
// ACP cover photo management
});
dialog.show(json.title);
}
+ function getCoverPhotoUrl(coverPhotoElement) {
+ if (coverPhotoElement instanceof HTMLImageElement) {
+ return coverPhotoElement.src;
+ }
+ else {
+ return coverPhotoElement?.style.backgroundImage;
+ }
+ }
function getCoverPhotoElement() {
- return document.querySelector(".userProfileCoverPhoto") ?? document.getElementById("coverPhotoPreview");
+ return (document.querySelector(".userProfileHeader__coverPhotoImage") ??
+ document.getElementById("coverPhotoPreview"));
}
function setup() {
(0, Selector_1.wheneverFirstSeen)("[data-edit-cover-photo]", (button) => {