|
| 1 | +/** |
| 2 | + * Vvveb |
| 3 | + * |
| 4 | + * Copyright (C) 2021 Ziadin Givan |
| 5 | + * |
| 6 | + * This program is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU Affero General Public License as |
| 8 | + * published by the Free Software Foundation, either version 3 of the |
| 9 | + * License, or (at your option) any later version. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU Affero General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU Affero General Public License |
| 17 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 18 | + * |
| 19 | + */ |
| 20 | + |
| 21 | +import {ServerComponent} from '../server-component.js'; |
| 22 | + |
| 23 | +let template = |
| 24 | +`<div data-v-component-post="post" data-v-post_id="1"> |
| 25 | + <h2 data-v-post-name>Post name</h2> |
| 26 | + <img class="img-fluid" src="media/posts/6.jpg" alt=""> |
| 27 | + <div data-v-post-content>Post content</div> |
| 28 | +</div> |
| 29 | +`; |
| 30 | + |
| 31 | +class PostComponent extends ServerComponent{ |
| 32 | + constructor () { |
| 33 | + super(); |
| 34 | + |
| 35 | + this.name = "Post"; |
| 36 | + this.attributes = ["data-v-component-post"], |
| 37 | + |
| 38 | + this.image ="icons/post.svg"; |
| 39 | + this.html = template; |
| 40 | + |
| 41 | + this.properties = [{ |
| 42 | + name: "Post name <span class='text-muted'>(autocomplete)</span>", |
| 43 | + key: "post", |
| 44 | + group:"autocomplete", |
| 45 | + htmlAttr:"data-v-post_id", |
| 46 | + inline:false, |
| 47 | + col:12, |
| 48 | + inputtype: AutocompleteInput, |
| 49 | + data: { |
| 50 | + url: "/admin/?module=editor/autocomplete&action=posts&type=", |
| 51 | + }, |
| 52 | + |
| 53 | + }]; |
| 54 | + } |
| 55 | + |
| 56 | + init(node) { |
| 57 | + } |
| 58 | +} |
| 59 | + |
| 60 | +let postComponent = new PostComponent; |
| 61 | + |
| 62 | +export { |
| 63 | + postComponent |
| 64 | +}; |
0 commit comments