Skip to content

Commit

Permalink
Update 22/11/21
Browse files Browse the repository at this point in the history
  • Loading branch information
FalkoJoseph committed Nov 22, 2021
1 parent 01a4df2 commit 56a37dc
Show file tree
Hide file tree
Showing 163 changed files with 55,102 additions and 112,066 deletions.
2 changes: 1 addition & 1 deletion admin/css/form.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ input[type="file"] {
@apply border-0 rounded-full h-6 w-6 m-0 min-w-0 shadow-sm !important;
}

input[type=checkbox]:checked::before {
.toggle-checkbox:checked::before {
@apply hidden;
}

Expand Down
78 changes: 62 additions & 16 deletions admin/pages/class-wp-sweepbright-contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function verify_recaptcha()
$this->submit_estate_form();
$this->submit_general_form();
$this->submit_valuation_form();
$this->submit_contact_form();
} else {
$this->emit_event('wp_contact_estate_error', $recaptcha);
$_POST['wp_contact_estate_sent'] = false;
Expand Down Expand Up @@ -117,16 +118,49 @@ public function emit_event($event, $message = false)

public function parse_template($template, $form)
{
$output = str_replace('[title]', $form['title'], $template);
$output = str_replace('[address]', $form['address'], $output);
$output = str_replace('[url]', $form['url'], $output);
$output = str_replace('[first_name]', $form['first_name'], $output);
$output = str_replace('[last_name]', $form['last_name'], $output);
$output = str_replace('[email]', $form['email'], $output);
$output = str_replace('[phone]', $form['phone'], $output);
$output = str_replace('[message]', $form['message'], $output);
$output = str_replace('[street]', $form['street'], $output);
$output = str_replace('[city]', $form['city'], $output);
$output = $template;
if (isset($form['title'])) {
$output = str_replace('[title]', $form['title'], $template);
}
if (isset($form['address'])) {
$output = str_replace('[address]', $form['address'], $output);
}
if (isset($form['url'])) {
$output = str_replace('[url]', $form['url'], $output);
}
if (isset($form['first_name'])) {
$output = str_replace('[first_name]', $form['first_name'], $output);
}
if (isset($form['last_name'])) {
$output = str_replace('[last_name]', $form['last_name'], $output);
}
if (isset($form['reference'])) {
$output = str_replace('[reference]', $form['reference'], $output);
}
if (isset($form['address'])) {
$output = str_replace('[address]', $form['address'], $output);
}
if (isset($form['postal_code'])) {
$output = str_replace('[postal_code]', $form['postal_code'], $output);
}
if (isset($form['subject'])) {
$output = str_replace('[subject]', $form['subject'], $output);
}
if (isset($form['email'])) {
$output = str_replace('[email]', $form['email'], $output);
}
if (isset($form['phone'])) {
$output = str_replace('[phone]', $form['phone'], $output);
}
if (isset($form['message'])) {
$output = str_replace('[message]', $form['message'], $output);
}
if (isset($form['street'])) {
$output = str_replace('[street]', $form['street'], $output);
}
if (isset($form['city'])) {
$output = str_replace('[city]', $form['city'], $output);
}
return $output;
}

Expand Down Expand Up @@ -225,12 +259,6 @@ public function submit_valuation_form()
'message' => $this->validate_input($_POST['message']),
'street' => $this->validate_input($_POST['street']),
'city' => $this->validate_input($_POST['city']),

'contact_to' => $this->validate_input($_POST['contact_to']),
'contact_subject' => $this->validate_input($_POST['contact_subject']),
'contact_body' => $this->validate_input($_POST['contact_body']),
'autoreply_subject' => $this->validate_input($_POST['autoreply_subject']),
'autoreply_body' => $this->validate_input($_POST['autoreply_body']),
];

$this->mail_form($form);
Expand All @@ -240,6 +268,24 @@ public function submit_valuation_form()
}
}

public function submit_contact_form()
{
if (isset($_POST['submit-contact-form']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
$form = [];

foreach ($_POST as $key => $value) {
if (strpos($key, 'form_') === 0) {
$form[str_replace('form_', '', $key)] = $value;
}
}

$this->mail_form($form);
$this->emit_event('wp_contact_estate_sent', 'success');
$_POST['wp_contact_estate_sent'] = true;
$_POST['wp_contact_estate_error'] = false;
}
}

public function submit_general_form()
{
if (isset($_POST['submit-contact-general']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
Expand Down
1 change: 1 addition & 0 deletions admin/vue-components/Pages/Components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ export default {
items_align: "items-start",
mobile_direction: "flex-col",
margin_bottom: "mb-20",
columns_per_row: "",
},
columns: [],
});
Expand Down
13 changes: 11 additions & 2 deletions admin/vue-components/Pages/Components/Editor/Fields/FieldPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"
>
<option
v-for="(page, index) in pages"
v-for="(page, index) in $pages"
:key="index"
:value="page.post_name"
>
Expand All @@ -51,7 +51,16 @@ import bus from "../../../../../js/pages/bus.js";
export default {
props: ["pages", "col", "pageSelect", "field"],
components: {},
computed: {},
computed: {
$pages() {
return this.pages.filter(
(page) =>
!["Home - Nederlands", "Home - English", "Home - Français"].includes(
page.post_title
)
);
},
},
data() {
return {
defaultFields: this.pageSelect,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<template>
<div>
<div class="relative mb-2" v-if="inputData(field, col)">
<div class="aspect-ratio-16/9"></div>
<video
:key="inputData(field, col)"
class="absolute top-0 left-0 object-contain object-center w-full h-full bg-gray-200 border-none rounded "
controls
autoplay
muted
loop
>
<source :src="inputData(field, col)" type="video/mp4" />
</video>
</div>
<div class="flex mt-2 space-x-2">
<button class="w-1/2 btn btn-primary" @click="openLibrary">
Select video
</button>
<button class="w-1/2 btn btn-default" @click="removeImage">Remove</button>
</div>
</div>
</template>

<script>
export default {
props: ["field", "col", "lang"],
components: {},
computed: {},
data() {
return {
frame: false,
};
},
methods: {
inputData(field, activeCol) {
let data = this.col.data["default"][field.id];
if (!data) {
data = field.default;
activeCol.data["default"][field.id] = data;
}
return data;
},
removeImage() {
this.col.data["default"][this.field.id] = "";
},
mediaLibrary() {
this.frame = wp.media({
title: "Media Library",
button: {
text: "Use this video",
},
library: {
type: ["video"],
},
multiple: false,
});
const self = this;
this.frame.on("select", function () {
self.frame
.state()
.get("selection")
.map(function (attachment) {
if (attachment.attributes.type === "video") {
if (attachment.toJSON().url) {
const path = attachment
.toJSON()
.url.replace(/^(?:\/\/|[^/]+)*\//, "");
self.col.data["default"][self.field.id] = `/${path}`;
self.$forceUpdate();
}
} else {
self.$dialog
.confirm(
"Video filetype is not supported, please select a valid video."
)
.then((dialog) => {
self.frame.open();
});
}
})
.join();
});
},
openLibrary() {
this.frame.open();
},
},
mounted() {
this.mediaLibrary();
},
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default {
"italic",
"underline",
"blockquote",
"link",
{ list: "bullet" },
{ align: [] },
],
Expand Down
11 changes: 11 additions & 0 deletions admin/vue-components/Pages/Components/Editor/Fields/Renderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
v-if="
!field.sync &&
field.type !== 'upload_single' &&
field.type !== 'upload_video' &&
field.type !== 'upload_multiple' &&
field.type !== 'page_select' &&
field.type !== 'page_select_multiple' &&
Expand Down Expand Up @@ -77,6 +78,14 @@
></FieldUploadSingle>
</template>

<template v-else-if="field.type === 'upload_video'">
<FieldUploadVideo
:field="field"
:col="col"
:lang="lang"
></FieldUploadVideo>
</template>

<template v-else-if="field.type === 'upload_multiple'">
<FieldUploadMultiple
:field="field"
Expand Down Expand Up @@ -120,6 +129,7 @@ import FieldSelect from "./FieldSelect";
import FieldPage from "./FieldPage";
import FieldPageMultiple from "./FieldPageMultiple";
import FieldUploadSingle from "./FieldUploadSingle";
import FieldUploadVideo from "./FieldUploadVideo";
import FieldUploadMultiple from "./FieldUploadMultiple";
export default {
Expand All @@ -142,6 +152,7 @@ export default {
FieldPage,
FieldPageMultiple,
FieldUploadSingle,
FieldUploadVideo,
FieldUploadMultiple,
},
methods: {
Expand Down
9 changes: 8 additions & 1 deletion admin/vue-components/Pages/Components/Editor/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
placeholder="Title"
v-model="page.title[lang]"
class="w-full h-full font-medium input-heading"
:disabled="user_roles.includes('administrator') ? false : true"
:disabled="
user_roles.includes('administrator') && isEditable() ? false : true
"
/>
<input
v-else
Expand Down Expand Up @@ -98,6 +100,11 @@ export default {
};
},
methods: {
isEditable() {
return !(
this.page.title[this.lang] === "Home" && this.page.slug === "home"
);
},
preview() {
bus.$emit("preview");
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ export default {
obj.type !== this.page.settings.template
) {
condition = false;
} else if (
obj.category === category["value"] &&
obj.type === "blog" &&
obj.type !== this.page.settings.template
) {
condition = false;
}
return condition;
});
Expand Down
11 changes: 10 additions & 1 deletion admin/vue-components/Pages/Components/Editor/Sidebar/Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@
<template v-if="pageDefault.settings.template === 'default'"
>Default</template
>
<template v-if="pageDefault.settings.template === 'blog'"
>Blog</template
>
<template v-if="pageDefault.settings.template === 'base'"
>Base</template
>
<template v-if="pageDefault.settings.template === '404'">404</template>
</p>
</div>
<template v-if="pageDefault.settings.template === 'default'">
<template v-if="user_roles.includes('administrator')">
<template v-if="user_roles.includes('administrator') && isEditable()">
<div class="p-5 py-3 font-medium bg-gray-200 border-b border-gray-400">
Information
</div>
Expand Down Expand Up @@ -98,6 +101,12 @@ export default {
};
},
methods: {
isEditable() {
return !(
this.pageDefault.title[this.lang] === "Home" &&
this.pageDefault.slug === "home"
);
},
setSlug() {
bus.$emit("setSlug", this.pageDefault.slug);
},
Expand Down
Loading

0 comments on commit 56a37dc

Please sign in to comment.