From d3b7d176b8b9f320b9eb5c34e6137359d1525a52 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 19 Oct 2020 14:55:01 +0200 Subject: [PATCH] extract SettingsView into own file also fix some copyright attributions --- src/ui/web/session/RoomGridView.js | 2 +- src/ui/web/session/SessionView.js | 34 ++------------------- src/ui/web/session/SettingsView.js | 49 ++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 33 deletions(-) create mode 100644 src/ui/web/session/SettingsView.js diff --git a/src/ui/web/session/RoomGridView.js b/src/ui/web/session/RoomGridView.js index 63b80fa7..f2a73068 100644 --- a/src/ui/web/session/RoomGridView.js +++ b/src/ui/web/session/RoomGridView.js @@ -1,5 +1,5 @@ /* -Copyright 2020 Bruno Windels +Copyright 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/ui/web/session/SessionView.js b/src/ui/web/session/SessionView.js index 1d397d30..6d3d7906 100644 --- a/src/ui/web/session/SessionView.js +++ b/src/ui/web/session/SessionView.js @@ -1,5 +1,6 @@ /* Copyright 2020 Bruno Windels +Copyright 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,6 +21,7 @@ import {TemplateView} from "../general/TemplateView.js"; import {StaticView} from "../general/StaticView.js"; import {SessionStatusView} from "./SessionStatusView.js"; import {RoomGridView} from "./RoomGridView.js"; +import {SettingsView} from "./SettingsView.js"; export class SessionView extends TemplateView { render(t, vm) { @@ -48,35 +50,3 @@ export class SessionView extends TemplateView { ]); } } - -class SettingsView extends TemplateView { - render(t, vm) { - let version = vm.version; - if (vm.showUpdateButton) { - version = t.span([ - vm.version, - t.button({onClick: () => vm.checkForUpdate()}, vm.i18n`Check for updates`) - ]); - } - - const row = (label, content, extraClass = "") => { - return t.div({className: `row ${extraClass}`}, [ - t.div({className: "label"}, label), - t.div({className: "content"}, content), - ]); - }; - - return t.main({className: "Settings middle"}, [ - t.div({className: "middle-header"}, [ - t.a({className: "button-utility close-middle", href: vm.closeUrl, title: vm.i18n`Close settings`}), - t.h2("Settings") - ]), - t.div({className: "SettingsBody"}, [ - row(vm.i18n`User ID`, vm.userId), - row(vm.i18n`Session ID`, vm.deviceId, "code"), - row(vm.i18n`Session key`, vm.fingerprintKey, "code"), - row(vm.i18n`Version`, version), - ]) - ]); - } -} diff --git a/src/ui/web/session/SettingsView.js b/src/ui/web/session/SettingsView.js new file mode 100644 index 00000000..73498530 --- /dev/null +++ b/src/ui/web/session/SettingsView.js @@ -0,0 +1,49 @@ +/* +Copyright 2020 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import {TemplateView} from "../general/TemplateView.js"; + +export class SettingsView extends TemplateView { + render(t, vm) { + let version = vm.version; + if (vm.showUpdateButton) { + version = t.span([ + vm.version, + t.button({onClick: () => vm.checkForUpdate()}, vm.i18n`Check for updates`) + ]); + } + + const row = (label, content, extraClass = "") => { + return t.div({className: `row ${extraClass}`}, [ + t.div({className: "label"}, label), + t.div({className: "content"}, content), + ]); + }; + + return t.main({className: "Settings middle"}, [ + t.div({className: "middle-header"}, [ + t.a({className: "button-utility close-middle", href: vm.closeUrl, title: vm.i18n`Close settings`}), + t.h2("Settings") + ]), + t.div({className: "SettingsBody"}, [ + row(vm.i18n`User ID`, vm.userId), + row(vm.i18n`Session ID`, vm.deviceId, "code"), + row(vm.i18n`Session key`, vm.fingerprintKey, "code"), + row(vm.i18n`Version`, version), + ]) + ]); + } +}