diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-02-15 14:29:41 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-02-15 14:29:41 +0100 |
commit | 6bfb3fb2a531c47d9e6cf8ba39fe62714cbe3ffd (patch) | |
tree | 8e26cda61f161d2bc67d3e4ecc43d3b523cdad40 | |
parent | 22747a00099d8624d862707c8140f9514388c5a5 (diff) |
Web: Remove AdminElement and components.js.
Change-Id: Ib829e99069229866a18e2a5356330bcf952b08d4
4 files changed, 0 insertions, 55 deletions
diff --git a/src/main/resources/META-INF/resources/cms2/admin/AdminElement.js b/src/main/resources/META-INF/resources/cms2/admin/AdminElement.js deleted file mode 100644 index 36db08d..0000000 --- a/src/main/resources/META-INF/resources/cms2/admin/AdminElement.js +++ /dev/null @@ -1,50 +0,0 @@ -import {html, render} from "../../web_modules/lit-html.js"; -import {createStore} from "../../web_modules/redux.js"; - -export class AdminElement extends HTMLElement { - constructor() { - super(); - this.attachShadow({mode: "open"}); - this.store = createStore(this.update.bind(this), {switched: false}); - this.store.subscribe(this.render.bind(this)); - } - - static get observedAttributes() { - return ["greetee"]; - } - - connectedCallback () { - this.render(); - } - - attributeChangedCallback(name, oldValue, newValue) { - this.render(); - } - - onSwitchClicked(event) { - this.store.dispatch({ type: "SWITCH" }); - } - - update(state, action) { - console.log(`Processing action: ${JSON.stringify(action)}`); - switch (action.type) { - case "SWITCH": - state.switched = !state.switched; - break; - } - return state; - } - - render() { - let state = this.store.getState(); - let greetee = state.switched ? "Andreas" : this.getAttribute("greetee"); - - const template = html` - <p>Hello ${greetee}! <button @click=${this.onSwitchClicked.bind(this)}>Switch</button></p> - `; - - render(template, this.shadowRoot); - } -} - -customElements.define("mlk-admin", AdminElement); diff --git a/src/main/resources/META-INF/resources/cms2/admin/index.html b/src/main/resources/META-INF/resources/cms2/admin/index.html index 9e49564..b0da45d 100644 --- a/src/main/resources/META-INF/resources/cms2/admin/index.html +++ b/src/main/resources/META-INF/resources/cms2/admin/index.html @@ -4,8 +4,6 @@ <head> <meta charset="UTF-8"> <title>MulkCMS Admin</title> - - <script type="module" src="/cms2/components.js"></script> </head> <body> diff --git a/src/main/resources/META-INF/resources/cms2/components.js b/src/main/resources/META-INF/resources/cms2/components.js deleted file mode 100644 index 61d4657..0000000 --- a/src/main/resources/META-INF/resources/cms2/components.js +++ /dev/null @@ -1,2 +0,0 @@ -import {AdminElement} from "./admin/AdminElement.js"; - diff --git a/src/main/resources/templates/base.html b/src/main/resources/templates/base.html index a6e0900..36f22a0 100644 --- a/src/main/resources/templates/base.html +++ b/src/main/resources/templates/base.html @@ -8,7 +8,6 @@ <link rel="stylesheet" type="text/css" href="/cms2/base.css" /> <script type="importmap" src="/web_modules/import-map.json"></script> - <script type="module" src="/cms2/components.js"></script> {#insert head}{/} </head> |