Skip to content

Commit

Permalink
Updates and Improvements
Browse files Browse the repository at this point in the history
- Adding some spam protection for contact forms
- Improving translation performance for Involvements
- Resolving some of the issues with Involvement Images
- Improving build & automatic update processes
  • Loading branch information
jkrrv committed Oct 17, 2023
2 parents eea899a + 2b23c4b commit 75e2cd6
Show file tree
Hide file tree
Showing 27 changed files with 1,258 additions and 1,590 deletions.
5 changes: 4 additions & 1 deletion .idea/TouchPoint-WP.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/libraries/Generated_files.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 85 additions & 0 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 29 additions & 2 deletions assets/js/base-defer.js
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,13 @@ class TP_Involvement extends TP_Mappable {

tpvm._utils.ga('send', 'event', inv.invType, 'contact complete', inv.name);

let res = await tpvm.postData('inv/contact', {invId: inv.invId, fromPerson: fromPerson, message: message, invType: inv.invType});
let res = await tpvm.postData('inv/contact', {
invId: inv.invId,
fromPerson: fromPerson,
message: message,
invType: inv.invType,
fromEmail: tpvm.userEmail
});
if (res.success.length > 0) {
if (showConfirm) {
Swal.fire({
Expand Down Expand Up @@ -1122,6 +1128,7 @@ class TP_Involvement extends TP_Mappable {
lng: TP_DataGeo.loc.lng,
type: type,
limit: count,
locale: tpvm.locale
}).then(handleNearbyLoaded);
}

Expand All @@ -1146,6 +1153,7 @@ class TP_Involvement extends TP_Mappable {
} else {
tpvm._invNear.labelStr(__("Your Location", 'TouchPoint-WP'));
}
setTimeout(getNearbyInvolvements, 600000); // 10 minutes
}
}
}
Expand Down Expand Up @@ -1379,7 +1387,12 @@ class TP_Person {

tpvm._utils.ga('send', 'event', 'Person', 'contact complete', psn.peopleId);

let res = await tpvm.postData('person/contact', {toId: psn.peopleId, fromPerson: fromPerson, message: message});
let res = await tpvm.postData('person/contact', {
toId: psn.peopleId,
fromPerson: fromPerson,
message: message,
fromEmail: tpvm.userEmail
});
if (res.success.length > 0) {
if (showConfirm) {
Swal.fire({
Expand Down Expand Up @@ -1461,10 +1474,24 @@ class TP_Person {
if (name.length > 0) // removes entry generated by submit input
data[name] = inputs[ii].value;
}
tpvm.userEmail = data['email'] ?? null;

Swal.showLoading();

let result = await tpvm.postData('person/ident', data);

// Handle an error if it happened.
if (result.hasOwnProperty('error')) {
Swal.hideLoading();
Swal.update({
icon: 'error',
title: __("Something went wrong.", 'TouchPoint-WP'),
text: result.error,
timer: 3000
});
return false;
}

if (result.people.length > 0) {
return result;
} else {
Expand Down
3 changes: 2 additions & 1 deletion assets/js/base-inline.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script>
const tpvm = {
DEBUG: false,
userEmail: null,
involvements: [],
partners: [],
meetings: [],
people: {},
locale: '<?php echo str_replace('_', '-', get_locale()); ?>' ?? 'en-US',
locale: '<?php echo str_replace('_', '-', get_locale() ?? 'en-US'); ?>',
_actions: {}, // collection of actions that have been registered that can be linked via location.hash.
_utils: {},
_vmContext: {},
Expand Down
3 changes: 1 addition & 2 deletions assets/js/partner-defer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ class TP_Partner extends TP_Mappable {

static actions = [];

static _secureCount = 0;

constructor(obj) {
super(obj);

Expand Down Expand Up @@ -62,6 +60,7 @@ class TP_Partner extends TP_Mappable {
return this.post_id !== 0;
}

// noinspection JSUnusedGlobalSymbols Called by inline.
static initFilters() {
const filtOptions = document.querySelectorAll("[data-partner-filter]");
for (const ei in filtOptions) {
Expand Down
Binary file removed assets/touchpointIcon.png
Binary file not shown.
30 changes: 16 additions & 14 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,33 @@ mkdir build/assets/js

# install uglify and uglify the JS files.
echo $(npm install -g uglify-js)
uglifyjs -o build/assets/js/base-defer.min.js -- assets/js/base-defer.js
uglifyjs -o build/assets/js/meeting-defer.min.js -- assets/js/meeting-defer.js
uglifyjs -o build/assets/js/partner-defer.min.js -- assets/js/partner-defer.js
uglifyjs assets/js/base-defer.js -o build/assets/js/base-defer.min.js --source-map
uglifyjs assets/js/meeting-defer.js -o build/assets/js/meeting-defer.min.js --source-map
uglifyjs assets/js/partner-defer.js -o build/assets/js/partner-defer.min.js --source-map
cp -r assets build
cd ./build || exit
zip -r ../touchpoint-wp.zip assets
cd ..


# compile translations
wget -O wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
if [ ! -f wp-cli.phar ]; then
wget -O wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
fi

cp -r ./i18n ./build/i18n

php ./wp-cli.phar i18n make-json ./build/i18n
php ./wp-cli.phar i18n make-mo ./build/i18n
cd ./build || exit
zip -r ../touchpoint-wp.zip i18n
cd ..
cp ./wpml-config.xml ./build/wpml-config.xml
cp ./composer.json ./build/composer.json

zip -r touchpoint-wp.zip ./ext
zip -r touchpoint-wp.zip ./src
cp -r ./ext ./build/ext
cp -r ./src ./build/src

find . -maxdepth 1 -iname "*.php" -exec zip touchpoint-wp.zip {} \;
find . -maxdepth 1 -iname "*.md" -exec zip touchpoint-wp.zip {} \;
find . -maxdepth 1 -iname "*.json" -exec zip touchpoint-wp.zip {} \;
find . -maxdepth 1 -iname "*.php" -exec cp {} build/ \;
find . -maxdepth 1 -iname "*.md" -exec cp {} build/ \;
find . -maxdepth 1 -iname "*.json" -exec cp {} build/ \;

rm -r build
cd ./build || exit
find . -exec zip ../touchpoint-wp.zip {} \;
cd ..
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "A WordPress Plugin for integrating with TouchPoint Church Management Software.",
"license": "AGPL-3.0-or-later",
"type": "wordpress-plugin",
"version": "0.0.35",
"keywords": [
"wordpress",
"wp",
Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated from 5bff39 to 1543ab
2 changes: 1 addition & 1 deletion generateI18n_1forTranslation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ if (!(test-path $pharFile -newerThan $compareDt))
Invoke-WebRequest https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -OutFile $pharFile
}

php .\wp-cli.phar i18n make-pot . i18n/TouchPoint-WP.pot
php .\wp-cli.phar i18n make-pot . --exclude="build" i18n/TouchPoint-WP.pot
php .\wp-cli.phar i18n update-po i18n/TouchPoint-WP.pot
Loading

0 comments on commit 75e2cd6

Please sign in to comment.