-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1496 from sapayth/enhance/form_builder_field_clou…
…dflare_turnstile enhance: form builder field Cloudflare Turnstile
- Loading branch information
Showing
24 changed files
with
614 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
admin/form-builder/assets/js/components/form-cloudflare_turnstile/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Field template: Cloudflare Turnstile | ||
*/ | ||
Vue.component('form-cloudflare_turnstile', { | ||
template: '#tmpl-wpuf-form-cloudflare_turnstile', | ||
|
||
mixins: [ | ||
wpuf_mixins.form_field_mixin | ||
], | ||
|
||
computed: { | ||
has_turnstile_api_keys: function () { | ||
return wpuf_form_builder.turnstile_site && wpuf_form_builder.turnstile_secret; | ||
}, | ||
|
||
no_api_keys_msg: function () { | ||
return wpuf_form_builder.field_settings.turnstile.validator.msg; | ||
}, | ||
|
||
turnstile_image: function () { | ||
var base_url = wpuf_form_builder.asset_url + '/images/cloudflare-placeholder-'; | ||
|
||
if (this.field.turnstile_theme === 'dark') { | ||
base_url += 'dark'; | ||
} else { | ||
base_url += 'light'; | ||
} | ||
|
||
if (this.field.turnstile_size === 'compact') { | ||
base_url += '-compact'; | ||
} | ||
|
||
return base_url + '.png'; | ||
} | ||
} | ||
}); |
12 changes: 12 additions & 0 deletions
12
admin/form-builder/assets/js/components/form-cloudflare_turnstile/template.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="wpuf-fields"> | ||
<template v-if="!has_turnstile_api_keys"> | ||
<p v-html="no_api_keys_msg"></p> | ||
</template> | ||
<template v-else> | ||
<img | ||
class="wpuf-turnstile-placeholder" | ||
:src="turnstile_image" | ||
alt=""> | ||
</template> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.