Calculate path when button is clicked

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-06-04 13:21:49 +05:30
parent 37e052c061
commit b2448e1207
2 changed files with 9 additions and 6 deletions

View File

@ -44,7 +44,8 @@ export class RoomInfoViewModel extends ViewModel {
return this.name;
}
get closeLink() {
return this.urlCreator.urlUntilSegment("room");
closePanel() {
const path = this.navigation.path.until("room");
this.navigation.applyPath(path);
}
}

View File

@ -8,7 +8,7 @@ export class RoomInfoView extends TemplateView {
const encryptionString = vm.isEncrypted ? vm.i18n`On` : vm.i18n`Off`;
return t.div({ className: "RoomInfo" }, [
this._createButton(vm),
this._createButton(t, vm),
t.div({ className: "RoomAvatar" },
[t.view(new AvatarView(vm, 52)), this._createEncryptionIcon(vm.isEncrypted)]),
t.div({ className: "RoomName" }, [t.h2(vm.name)]),
@ -40,8 +40,10 @@ export class RoomInfoView extends TemplateView {
[tag.div({ className: isEncrypted ? "encrypted" : "unencrypted" })])
}
_createButton(vm) {
return tag.div({ className: "buttons" },
[tag.a({ className: "close button-utility", href: vm.closeLink })]);
_createButton(t, vm) {
return t.div({ className: "buttons" },
[
t.button({ className: "close button-utility", onClick: () => vm.closePanel() })
]);
}
}