});
this.list = document.getElementById(this.prefix + "aclAccessList") as HTMLUListElement;
- this.list.addEventListener("click", this.removeItem.bind(this));
const excludedSearchValues: string[] = [];
this.list.querySelectorAll(".aclLabel").forEach((label) => {
const objectId = listItem.dataset.objectId!;
const iconName = type === "group" ? "users" : "user";
- const html = `<span class="icon icon16 fa-${iconName}"></span>
+ const html = `<fa-icon size="16" name="${iconName}" solid></fa-icon>
<span class="aclLabel">${StringUtil.escapeHTML(label)}</span>
- <span class="icon icon16 fa-times pointer jsTooltip" title="${Language.get("wcf.global.button.delete")}"></span>
+ <button class="aclItemDeleteButton jsTooltip" title="${Language.get("wcf.global.button.delete")}">
+ <fa-icon size="16" name="xmark" solid></fa-icon>
+ </button>
<input type="hidden" name="${this.inputName}[${type}][]" value="${objectId}">`;
const item = document.createElement("li");
this.searchInput.addExcludedSearchValues(label);
+ const deleteButton = item.querySelector(".aclItemDeleteButton") as HTMLButtonElement;
+ deleteButton.addEventListener("click", (event) => this.removeItem(event));
+
DomChangeListener.trigger();
return false;
}
private removeItem(event: MouseEvent): void {
- const target = event.target as HTMLElement;
- if (target.classList.contains("fa-times")) {
- const parent = target.parentElement!;
- const label = parent.querySelector(".aclLabel")!;
- this.searchInput.removeExcludedSearchValues(label.textContent!);
+ const target = event.currentTarget as HTMLButtonElement;
+ const parent = target.parentElement!;
+ const label = parent.querySelector(".aclLabel")!;
+ this.searchInput.removeExcludedSearchValues(label.textContent!);
- parent.remove();
+ parent.remove();
- if (this.list.childElementCount === 0) {
- DomUtil.hide(this.aclListContainer);
- }
+ if (this.list.childElementCount === 0) {
+ DomUtil.hide(this.aclListContainer);
}
}
this._clearButton.href = "#";
this._clearButton.className = "button inputSuffix disabled jsTooltip";
this._clearButton.title = Language.get("wcf.global.filter.button.clear");
- this._clearButton.innerHTML = '<fa-icon size="16" name="times" solid></fa-icon>';
+ this._clearButton.innerHTML = '<fa-icon size="16" name="xmark" solid></fa-icon>';
this._clearButton.addEventListener("click", (event) => {
event.preventDefault();
button.classList.add("active");
}
- const icon = button.querySelector(".icon") as HTMLElement;
+ const icon = button.querySelector("fa-icon")!;
if (type === "showAll") {
- icon.classList.add("fa-eye");
- icon.classList.remove("fa-eye-slash");
+ icon.setIcon("eye", false);
} else {
- icon.classList.remove("fa-eye");
- icon.classList.add("fa-eye-slash");
+ icon.setIcon("eye-slash", false);
}
}
}
* @return jQuery
*/
_createListItem: function (objectID, label, type) {
- var $listItem = $('<li><span class="icon icon16 fa-user' + (type === 'group' ? 's' : '') + '" /> <span class="aclLabel">' + label + '</span></li>').appendTo(this._containerElements.aclList);
+ var $listItem = $('<li><fa-icon size="16" name="' + (type === 'group' ? 'users' : 'user') + '" solid></fa-icon> <span class="aclLabel">' + label + '</span></li>').appendTo(this._containerElements.aclList);
$listItem.data('objectID', objectID).data('type', type).data('label', label).click($.proxy(this._click, this));
- $('<span class="icon icon16 fa-times jsTooltip pointer" title="' + WCF.Language.get('wcf.global.button.delete') + '" />').click($.proxy(this._removeItem, this)).appendTo($listItem);
+ $('<button title="' + WCF.Language.get('wcf.global.button.delete') + '"><fa-icon size="16" name="xmark" solid></fa-icon></button>').click($.proxy(this._removeItem, this)).appendTo($listItem);
return $listItem;
},
}
});
this.list = document.getElementById(this.prefix + "aclAccessList");
- this.list.addEventListener("click", this.removeItem.bind(this));
const excludedSearchValues = [];
this.list.querySelectorAll(".aclLabel").forEach((label) => {
excludedSearchValues.push(label.textContent);
const label = listItem.dataset.label;
const objectId = listItem.dataset.objectId;
const iconName = type === "group" ? "users" : "user";
- const html = `<span class="icon icon16 fa-${iconName}"></span>
+ const html = `<fa-icon size="16" name="${iconName}" solid></fa-icon>
<span class="aclLabel">${StringUtil.escapeHTML(label)}</span>
- <span class="icon icon16 fa-times pointer jsTooltip" title="${Language.get("wcf.global.button.delete")}"></span>
+ <button class="aclItemDeleteButton jsTooltip" title="${Language.get("wcf.global.button.delete")}">
+ <fa-icon size="16" name="xmark" solid></fa-icon>
+ </button>
<input type="hidden" name="${this.inputName}[${type}][]" value="${objectId}">`;
const item = document.createElement("li");
item.innerHTML = html;
}
Util_1.default.show(this.aclListContainer);
this.searchInput.addExcludedSearchValues(label);
+ const deleteButton = item.querySelector(".aclItemDeleteButton");
+ deleteButton.addEventListener("click", (event) => this.removeItem(event));
Listener_1.default.trigger();
return false;
}
removeItem(event) {
- const target = event.target;
- if (target.classList.contains("fa-times")) {
- const parent = target.parentElement;
- const label = parent.querySelector(".aclLabel");
- this.searchInput.removeExcludedSearchValues(label.textContent);
- parent.remove();
- if (this.list.childElementCount === 0) {
- Util_1.default.hide(this.aclListContainer);
- }
+ const target = event.currentTarget;
+ const parent = target.parentElement;
+ const label = parent.querySelector(".aclLabel");
+ this.searchInput.removeExcludedSearchValues(label.textContent);
+ parent.remove();
+ if (this.list.childElementCount === 0) {
+ Util_1.default.hide(this.aclListContainer);
}
}
invertPermissions(invert) {
this._clearButton.href = "#";
this._clearButton.className = "button inputSuffix disabled jsTooltip";
this._clearButton.title = Language.get("wcf.global.filter.button.clear");
- this._clearButton.innerHTML = '<fa-icon size="16" name="times" solid></fa-icon>';
+ this._clearButton.innerHTML = '<fa-icon size="16" name="xmark" solid></fa-icon>';
this._clearButton.addEventListener("click", (event) => {
event.preventDefault();
this.reset();
else {
button.classList.add("active");
}
- const icon = button.querySelector(".icon");
+ const icon = button.querySelector("fa-icon");
if (type === "showAll") {
- icon.classList.add("fa-eye");
- icon.classList.remove("fa-eye-slash");
+ icon.setIcon("eye", false);
}
else {
- icon.classList.remove("fa-eye");
- icon.classList.add("fa-eye-slash");
+ icon.setIcon("eye-slash", false);
}
}
}