From 1f79d1db101b706649aed93ed36092477db7d357 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Fri, 31 Jan 2020 19:28:31 +0100 Subject: Move web files below /cms2 so they are easier to serve. Change-Id: Ib56ceaef4ecaaa5c12398d6e27c63404eb4b9cd6 --- .../META-INF/resources/admin/AdminElement.js | 50 ---------------------- .../resources/META-INF/resources/admin/index.html | 15 ------- src/main/resources/META-INF/resources/base.css | 15 ------- .../META-INF/resources/cms2/admin/AdminElement.js | 50 ++++++++++++++++++++++ .../META-INF/resources/cms2/admin/index.html | 15 +++++++ .../resources/META-INF/resources/cms2/base.css | 15 +++++++ .../META-INF/resources/cms2/components.js | 2 + .../resources/META-INF/resources/components.js | 2 - 8 files changed, 82 insertions(+), 82 deletions(-) delete mode 100644 src/main/resources/META-INF/resources/admin/AdminElement.js delete mode 100644 src/main/resources/META-INF/resources/admin/index.html delete mode 100644 src/main/resources/META-INF/resources/base.css create mode 100644 src/main/resources/META-INF/resources/cms2/admin/AdminElement.js create mode 100644 src/main/resources/META-INF/resources/cms2/admin/index.html create mode 100644 src/main/resources/META-INF/resources/cms2/base.css create mode 100644 src/main/resources/META-INF/resources/cms2/components.js delete mode 100644 src/main/resources/META-INF/resources/components.js (limited to 'src/main/resources/META-INF') diff --git a/src/main/resources/META-INF/resources/admin/AdminElement.js b/src/main/resources/META-INF/resources/admin/AdminElement.js deleted file mode 100644 index 1fdfbe7..0000000 --- a/src/main/resources/META-INF/resources/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` -

Hello ${greetee}!

- `; - - render(template, this.shadowRoot); - } -} - -customElements.define("mlk-admin", AdminElement); diff --git a/src/main/resources/META-INF/resources/admin/index.html b/src/main/resources/META-INF/resources/admin/index.html deleted file mode 100644 index 7e1aa0a..0000000 --- a/src/main/resources/META-INF/resources/admin/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - MulkCMS Admin - - - - - - - - - diff --git a/src/main/resources/META-INF/resources/base.css b/src/main/resources/META-INF/resources/base.css deleted file mode 100644 index 1f1a941..0000000 --- a/src/main/resources/META-INF/resources/base.css +++ /dev/null @@ -1,15 +0,0 @@ -/* Pure CSS */ -@import "web_modules/purecss/build/base.css"; -@import "web_modules/purecss/build/buttons.css"; -@import "web_modules/purecss/build/forms.css"; -@import "web_modules/purecss/build/menus.css"; -@import "web_modules/purecss/build/tables.css"; - -/* Normalize + OpenType */ -@import "web_modules/normalize-opentype.css/normalize-opentype.css"; - -/* Sanitize.css */ -@import "web_modules/sanitize.css/sanitize.css"; -@import "web_modules/sanitize.css/forms.css"; -@import "web_modules/sanitize.css/page.css"; -@import "web_modules/sanitize.css/typography.css"; diff --git a/src/main/resources/META-INF/resources/cms2/admin/AdminElement.js b/src/main/resources/META-INF/resources/cms2/admin/AdminElement.js new file mode 100644 index 0000000..36db08d --- /dev/null +++ b/src/main/resources/META-INF/resources/cms2/admin/AdminElement.js @@ -0,0 +1,50 @@ +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` +

Hello ${greetee}!

+ `; + + 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 new file mode 100644 index 0000000..9e49564 --- /dev/null +++ b/src/main/resources/META-INF/resources/cms2/admin/index.html @@ -0,0 +1,15 @@ + + + + + + MulkCMS Admin + + + + + + + + + diff --git a/src/main/resources/META-INF/resources/cms2/base.css b/src/main/resources/META-INF/resources/cms2/base.css new file mode 100644 index 0000000..e525a23 --- /dev/null +++ b/src/main/resources/META-INF/resources/cms2/base.css @@ -0,0 +1,15 @@ +/* Pure CSS */ +@import "../web_modules/purecss/build/base.css"; +@import "../web_modules/purecss/build/buttons.css"; +@import "../web_modules/purecss/build/forms.css"; +@import "../web_modules/purecss/build/menus.css"; +@import "../web_modules/purecss/build/tables.css"; + +/* Normalize + OpenType */ +@import "../web_modules/normalize-opentype.css/normalize-opentype.css"; + +/* Sanitize.css */ +@import "../web_modules/sanitize.css/sanitize.css"; +@import "../web_modules/sanitize.css/forms.css"; +@import "../web_modules/sanitize.css/page.css"; +@import "../web_modules/sanitize.css/typography.css"; diff --git a/src/main/resources/META-INF/resources/cms2/components.js b/src/main/resources/META-INF/resources/cms2/components.js new file mode 100644 index 0000000..61d4657 --- /dev/null +++ b/src/main/resources/META-INF/resources/cms2/components.js @@ -0,0 +1,2 @@ +import {AdminElement} from "./admin/AdminElement.js"; + diff --git a/src/main/resources/META-INF/resources/components.js b/src/main/resources/META-INF/resources/components.js deleted file mode 100644 index 61d4657..0000000 --- a/src/main/resources/META-INF/resources/components.js +++ /dev/null @@ -1,2 +0,0 @@ -import {AdminElement} from "./admin/AdminElement.js"; - -- cgit v1.2.3