This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/auth-token-dropdown.es6
2019-05-27 10:15:39 +02:00

41 lines
844 B
JavaScript

import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
export default DropdownSelectBoxComponent.extend({
classNames: ["auth-token-dropdown"],
headerIcon: "wrench",
allowInitialValueMutation: false,
showFullTitle: false,
computeContent() {
const content = [
{
id: "notYou",
icon: "user-times",
name: I18n.t("user.auth_tokens.not_you"),
description: ""
},
{
id: "logOut",
icon: "sign-out-alt",
name: I18n.t("user.log_out"),
description: ""
}
];
return content;
},
actions: {
onSelect(id) {
switch (id) {
case "notYou":
this.showToken(this.token);
break;
case "logOut":
this.revokeAuthToken(this.token);
break;
}
}
}
});