Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Use current url for admin path for fetch call

givanz283a5f6d5d19
diff --git a/public/js/admin/controller/backup.js b/public/js/admin/controller/backup.js
index 6c59fb2..9fc1bad 100755
--- a/public/js/admin/controller/backup.js
+++ b/public/js/admin/controller/backup.js
@@ -118,7 +118,7 @@ class BackupController {
}
make(url, btn = false) {
- url = url ?? '/admin/?module=tools/backup&action=save';
+ url = url ?? (window.location.pathname + '?module=tools/backup&action=save');
return this.action(url, btn);
}
diff --git a/public/js/admin/controller/update.js b/public/js/admin/controller/update.js
index 429d3ec..9024e99 100755
--- a/public/js/admin/controller/update.js
+++ b/public/js/admin/controller/update.js
@@ -90,7 +90,7 @@ class UpdateController {
let message = error?.statusText ?? "Error updating!";
displayToast("bg-danger", "Error", message);
- if (err.hasOwnProperty('text')) err.text().then( errorMessage => {
+ if (error.hasOwnProperty('text')) error.text().then( errorMessage => {
let message = errorMessage.substr(0, 200);
displayToast("bg-danger", "Error", message);
});
@@ -116,7 +116,7 @@ class UpdateController {
}
core(url, btn = false) {
- url = url ?? '/admin/?module=tools/update&action=update&type=core';
+ url = url ?? (window.location.pathname + '?module=tools/update&action=update&type=core');
return this.action(url, btn);
}
diff --git a/public/js/vvvebjs/components-server.js b/public/js/vvvebjs/components-server.js
index d61d764..b7dd818 100755
--- a/public/js/vvvebjs/components-server.js
+++ b/public/js/vvvebjs/components-server.js
@@ -1,20 +1,23 @@
-/*
-Copyright 2017 Ziadin Givan
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-https://github.com/givanz/VvvebJs
-*/
+/**
+ * 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/>.
+ *
+ * https://github.com/givanz/Vvveb
+ */
Vvveb.ComponentsGroup['Server Components'] = ["components/products", "components/product", "components/categories", "components/manufacturers", "components/search", "components/user", "components/product_gallery", "components/cart", "components/checkout", "components/filters", "components/slider"];
@@ -83,7 +86,7 @@ Vvveb.Components.add("components/products", {
if (node.dataset.type != undefined) {
$('.mb-3[data-group="'+ node.dataset.type + '"]').show();
} else {
- $('.mb-3[data-group]:first').show();
+ $('.mb-3[data-group]').show();
}
},
properties: [{
@@ -124,7 +127,7 @@ Vvveb.Components.add("components/products", {
htmlAttr:"data-products",
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=products",
+ url: window.location.pathname + "?module=editor/autocomplete&action=products",
},
},{
name: "Number of products",
@@ -190,7 +193,7 @@ Vvveb.Components.add("components/products", {
htmlAttr:"data-category",
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=products",
+ url: window.location.pathname + "?module=editor/autocomplete&action=products",
},
},{
@@ -200,7 +203,7 @@ Vvveb.Components.add("components/products", {
htmlAttr:"data-manufacturer",
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=products",
+ url: window.location.pathname + "?module=editor/autocomplete&action=products",
}
},{
name: "Manufacturer 2",
@@ -209,7 +212,7 @@ Vvveb.Components.add("components/products", {
htmlAttr:"data-manufacturer2",
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=products",
+ url: window.location.pathname + "?module=editor/autocomplete&action=products",
},
}]
});
@@ -517,7 +520,7 @@ Vvveb.Components.add("components/slider", {
col:12,
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=products",
+ url: window.location.pathname + "?module=editor/autocomplete&action=products",
},
},{
name: "Number of products",
@@ -585,7 +588,7 @@ Vvveb.Components.add("components/slider", {
col:12,
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=products",
+ url: window.location.pathname + "?module=editor/autocomplete&action=products",
},
},{
@@ -597,7 +600,7 @@ Vvveb.Components.add("components/slider", {
col:12,
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=products",
+ url: window.location.pathname + "?module=editor/autocomplete&action=products",
}
},{
name: "Manufacturer 2",
@@ -608,7 +611,7 @@ Vvveb.Components.add("components/slider", {
col:12,
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=products",
+ url: window.location.pathname + "?module=editor/autocomplete&action=products",
},
}]
});
diff --git a/public/js/vvvebjs/components-widgets.js b/public/js/vvvebjs/components-widgets.js
index 5feb68c..131a0f4 100755
--- a/public/js/vvvebjs/components-widgets.js
+++ b/public/js/vvvebjs/components-widgets.js
@@ -1,20 +1,23 @@
-/*
-Copyright 2017 Ziadin Givan
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-https://github.com/givanz/VvvebJs
-*/
+/**
+ * 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/>.
+ *
+ * https://github.com/givanz/Vvveb
+ */
Vvveb.ComponentsGroup['Widgets'] = ["widgets/googlemaps", "widgets/embed-video", "widgets/chartjs", "widgets/lottie",/* "widgets/facebookpage", */"widgets/paypal", /*"widgets/instagram",*/ "widgets/twitter", "widgets/openstreetmap"/*, "widgets/facebookcomments"*/];
diff --git a/public/js/vvvebjs/components/content/comments.js b/public/js/vvvebjs/components/content/comments.js
index d50a1ca..ff2ee9e 100755
--- a/public/js/vvvebjs/components/content/comments.js
+++ b/public/js/vvvebjs/components/content/comments.js
@@ -165,7 +165,7 @@ class CommentsComponent extends ServerComponent{
col:12,
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=comments",
+ url: window.location.pathname + "?module=editor/autocomplete&action=comments",
},
}];
}
diff --git a/public/js/vvvebjs/components/content/post.js b/public/js/vvvebjs/components/content/post.js
index 93980aa..870b5d9 100644
--- a/public/js/vvvebjs/components/content/post.js
+++ b/public/js/vvvebjs/components/content/post.js
@@ -47,7 +47,7 @@ class PostComponent extends ServerComponent{
col:12,
inputtype: AutocompleteInput,
data: {
- url: "/admin/?module=editor/autocomplete&action=posts&type=",
+ url: window.location.pathname + "?module=editor/autocomplete&action=posts&type=",
},
}];
diff --git a/public/js/vvvebjs/components/content/posts.js b/public/js/vvvebjs/components/content/posts.js
index cf6a100..63b6a87 100755
--- a/public/js/vvvebjs/components/content/posts.js
+++ b/public/js/vvvebjs/components/content/posts.js
@@ -18,8 +18,6 @@
*
*/
-
-
import {ServerComponent} from '../server-component.js';
@@ -28,7 +26,7 @@ let template =
<div class="container" data-v-component-posts="popular" data-v-limit="4">
<div class="row">
- <div class="col mb-2" data-v-post="" data-v-id="6" data-v-type="post">
+ <div class="col-sm-12 col-md-6 col-lg mb-2" data-v-post="" data-v-id="6" data-v-type="post">
<article class="card">
<div class="card-img-top">
@@ -51,7 +49,9 @@ let template =
</article>
- </div><div class="col mb-2" data-v-post="" data-v-id="5" data-v-type="post">
+ </div>
+
+ <div class="col-sm-12 col-md-6 col-lg mb-2" data-v-post="" data-v-id="5" data-v-type="post">
<article class="card">
<div class="card-img-top">
@@ -74,7 +74,9 @@ let template =
</article>
- </div><div class="col mb-2" data-v-post="" data-v-id="4" data-v-type="post">
+ </div>
+
+ <div class="col-sm-12 col-md-6 col-lg mb-2" data-v-post="" data-v-id="4" data-v-type="post">
<article class="card">
<div class="card-img-top">
@@ -99,7 +101,9 @@ let template =
</article>
- </div><div class="col mb-2" data-v-post="" data-v-id="3" data-v-type="post">
+ </div>
+
+ <div class="col-sm-12 col-md-6 col-lg mb-2" data-v-post="" data-v-id="3" data-v-type="post">
<article class="card">
<div class="card-img-top">
@@ -177,7 +181,7 @@ class PostsComponent extends ServerComponent{
init: function (node) {
//this.setGroup(node.dataset.vType);
//return 'autocomplete';
- return node.dataset.vSource;
+ return node.dataset.vSource ?? "automatic";
},
},{
name: "Start from page",
@@ -202,7 +206,7 @@ class PostsComponent extends ServerComponent{
htmlAttr:"data-v-limit",
inputtype: NumberInput,
data: {
- value: "8",//default
+ value: "4",//default
min: "1",
max: "1024",
step: "1"
@@ -247,6 +251,23 @@ class PostsComponent extends ServerComponent{
text: "Descending"
}]
}
+ },{
+ name: "Post type",
+ group:"automatic",
+ key: "order",
+ col:6,
+ inline:false,
+ htmlAttr:"data-v-type",
+ inputtype: SelectInput,
+ data: {
+ options: [{
+ value: "",//post - default
+ text: "Post"
+ },{
+ value: "page",
+ text: "Page"
+ }]
+ }
},{
name: "Limit to categories",
group:"automatic",
@@ -256,7 +277,7 @@ class PostsComponent extends ServerComponent{
col:12,
inputtype: TagsInput,
data: {
- url: "/admin/?module=editor/autocomplete&action=categories",
+ url: window.location.pathname + "?module=editor/autocomplete&action=categories",
},
},{
@@ -268,7 +289,7 @@ class PostsComponent extends ServerComponent{
col:12,
inputtype: TagsInput,
data: {
- url: "/admin/?module=editor/autocomplete&action=manufacturers",
+ url: window.location.pathname + "?module=editor/autocomplete&action=manufacturers",
}
},{
name: "Posts",
@@ -279,7 +300,7 @@ class PostsComponent extends ServerComponent{
col:12,
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=posts",
+ url: window.location.pathname + "?module=editor/autocomplete&action=posts",
},
}];
diff --git a/public/js/vvvebjs/components/ecommerce/product.js b/public/js/vvvebjs/components/ecommerce/product.js
index 6af90c1..0da7e96 100755
--- a/public/js/vvvebjs/components/ecommerce/product.js
+++ b/public/js/vvvebjs/components/ecommerce/product.js
@@ -309,7 +309,7 @@ class ProductComponent extends ServerComponent{
col:12,
inputtype: AutocompleteInput,
data: {
- url: "/admin/?module=editor/autocomplete&action=products&type=",
+ url: window.location.pathname + "?module=editor/autocomplete&action=products&type=",
},
}];
diff --git a/public/js/vvvebjs/components/ecommerce/products.js b/public/js/vvvebjs/components/ecommerce/products.js
index 77e25b8..f4c7c7f 100755
--- a/public/js/vvvebjs/components/ecommerce/products.js
+++ b/public/js/vvvebjs/components/ecommerce/products.js
@@ -23,9 +23,9 @@ import {ServerComponent} from '../server-component.js';
let template =
`
-<div class="container" data-v-component-products="popular" data-v-limit="1">
+<div class="container" data-v-component-products="popular" data-v-limit="1">
<div class="row">
- <div class="col" data-v-product>
+ <div class="col-sm-12 col-md-6 col-lg mb-2" data-v-product>
<article class="single-product-wrapper">
<!-- Product Image -->
<a href="product/product.html" data-v-product-url> </a>
@@ -137,7 +137,7 @@ class ProductsComponent extends ServerComponent{
col:12,
inputtype: AutocompleteList,
data: {
- url: "/admin/?module=editor/autocomplete&action=products",
+ url: window.location.pathname + "?module=editor/autocomplete&action=products",
},
},{
name: "Nr. of products",
@@ -148,7 +148,7 @@ class ProductsComponent extends ServerComponent{
htmlAttr:"data-v-limit",
inputtype: NumberInput,
data: {
- value: "8",//default
+ value: "4",//default
min: "1",
max: "1024",
step: "1"
@@ -194,6 +194,20 @@ class ProductsComponent extends ServerComponent{
}*/]
}
},{
+ name: "Product type",
+ group:"automatic",
+ key: "order",
+ col:6,
+ inline:false,
+ htmlAttr:"data-v-type",
+ inputtype: SelectInput,
+ data: {
+ options: [{
+ value: "",//product - default
+ text: "Product"
+ }]
+ }
+ },{
name: "Order direction",
group:"automatic",
key: "order",
@@ -219,7 +233,7 @@ class ProductsComponent extends ServerComponent{
col:12,
inputtype: TagsInput,
data: {
- url: "/admin/?module=editor/autocomplete&action=categories",
+ url: window.location.pathname + "?module=editor/autocomplete&action=categories",
},
},{
@@ -231,7 +245,7 @@ class ProductsComponent extends ServerComponent{
col:12,
inputtype: TagsInput,
data: {
- url: "/admin/?module=editor/autocomplete&action=manufacturers",
+ url: window.location.pathname + "?module=editor/autocomplete&action=manufacturers",
},
}];
}