Skip to content

Commit b7d19ff

Browse files
committed
Post component
1 parent 9c5bb0b commit b7d19ff

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

public/js/vvvebjs/components/content/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121
import {postsComponent} from './posts.js';
22+
import {postComponent} from './post.js';
2223
import {categoriesComponent} from './categories.js';
2324
import {archivesComponent} from './archives.js';
2425
import {recentPostsComponent} from './recentPosts.js';
@@ -32,6 +33,7 @@ import {currencyComponent} from './currency.js';
3233

3334

3435
Vvveb.Components.add("content/posts", postsComponent);
36+
Vvveb.Components.add("content/post", postComponent);
3537
Vvveb.Components.add("content/categories", categoriesComponent);
3638
Vvveb.Components.add("content/archives", archivesComponent);
3739
//Vvveb.Components.add("content/recentPosts", recentPostsComponent);
@@ -46,6 +48,7 @@ Vvveb.Components.add("content/currency", currencyComponent);
4648

4749
Vvveb.ComponentsGroup['Content'] = [
4850
"content/posts",
51+
"content/post",
4952
"content/categories",
5053
"content/archives",
5154
// "content/recentPosts",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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

Comments
 (0)