Skip to content

Commit

Permalink
Post component
Browse files Browse the repository at this point in the history
  • Loading branch information
givanz committed Oct 18, 2024
1 parent 9c5bb0b commit b7d19ff
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
3 changes: 3 additions & 0 deletions public/js/vvvebjs/components/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

import {postsComponent} from './posts.js';
import {postComponent} from './post.js';
import {categoriesComponent} from './categories.js';
import {archivesComponent} from './archives.js';
import {recentPostsComponent} from './recentPosts.js';
Expand All @@ -32,6 +33,7 @@ import {currencyComponent} from './currency.js';


Vvveb.Components.add("content/posts", postsComponent);
Vvveb.Components.add("content/post", postComponent);
Vvveb.Components.add("content/categories", categoriesComponent);
Vvveb.Components.add("content/archives", archivesComponent);
//Vvveb.Components.add("content/recentPosts", recentPostsComponent);
Expand All @@ -46,6 +48,7 @@ Vvveb.Components.add("content/currency", currencyComponent);

Vvveb.ComponentsGroup['Content'] = [
"content/posts",
"content/post",
"content/categories",
"content/archives",
// "content/recentPosts",
Expand Down
64 changes: 64 additions & 0 deletions public/js/vvvebjs/components/content/post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Vvveb
*
* Copyright (C) 2021 Ziadin Givan
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/

import {ServerComponent} from '../server-component.js';

let template =
`<div data-v-component-post="post" data-v-post_id="1">
<h2 data-v-post-name>Post name</h2>
<img class="img-fluid" src="media/posts/6.jpg" alt="">
<div data-v-post-content>Post content</div>
</div>
`;

class PostComponent extends ServerComponent{
constructor () {
super();

this.name = "Post";
this.attributes = ["data-v-component-post"],

this.image ="icons/post.svg";
this.html = template;

this.properties = [{
name: "Post name <span class='text-muted'>(autocomplete)</span>",
key: "post",
group:"autocomplete",
htmlAttr:"data-v-post_id",
inline:false,
col:12,
inputtype: AutocompleteInput,
data: {
url: "/admin/?module=editor/autocomplete&action=posts&type=",
},

}];
}

init(node) {
}
}

let postComponent = new PostComponent;

export {
postComponent
};

0 comments on commit b7d19ff

Please sign in to comment.