Skip to content

Commit

Permalink
Display ADS or NOT
Browse files Browse the repository at this point in the history
  • Loading branch information
PrestaSafe committed Aug 30, 2024
1 parent 7f1e033 commit ed0f38f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
6 changes: 4 additions & 2 deletions _dev/src/components/LeftPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const toaster = createToaster({
position: "top",
});
const prettyblocks_env = ref(window.prettyblocks_env.PRETTYBLOCKS_REMOVE_ADS);
defineComponent({
SortableList,
MenuGroup,
Expand Down Expand Up @@ -216,7 +218,7 @@ prettyBlocksContext.on('iframeLoaded', () => {
<div>
<ZoneSelect v-model="state" />
</div>
<div class="pl-2 mt-[6px]" v-if="!showCopyZone">
<div class="pl-2 mt-[6px]">
<ButtonLight type="secondary" icon="TrashIcon" @click="deleteAllBlocks" size="6"/>
</div>
<div class="mt-[6px]">
Expand Down Expand Up @@ -284,7 +286,7 @@ prettyBlocksContext.on('iframeLoaded', () => {
<a class="text-indigo" href="https://www.prestasafe.com" target="_blank"
>PrestaSafe</a
><br />
<a href="https://prettyblocks.io/pro" class="text-red-500" target="_blank">{{ trans('get_pro') }}</a>
<a v-if="!prettyblocks_env" href="https://prettyblocks.io/pro" class="text-red-500" target="_blank">{{ trans('get_pro') }}</a>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions _dev/src/components/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const getBlocksAvailable = () => {
.catch(error => console.error(error));
}
const prettyblocks_env = ref(window.prettyblocks_env.PRETTYBLOCKS_REMOVE_ADS);
</script>

<template>
Expand All @@ -86,7 +86,7 @@ const getBlocksAvailable = () => {
</div>
<!-- Footer -->
<div class="flex items-center justify-between p-5 border-t border-solid border-slate-200">
<a href="https://prettyblocks.io/pro" class="text-red-500" target="_blank">{{ trans('get_pro') }}</a>
<a v-if="!prettyblocks_env" href="https://prettyblocks.io/pro" class="text-red-500" target="_blank">{{ trans('get_pro') }}</a>
<button
class="text-indigo bg-transparent border border-solid border-indigo hover:bg-indigo hover:text-white active:bg-indigo font-bold uppercase text-sm px-6 py-3 rounded outline-none focus:outline-none ease-linear transition-all duration-150"
type="button" v-on:click="toggleModal()">
Expand Down
8 changes: 7 additions & 1 deletion _dev/src/components/form/ZoneSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ function onInput(zone) {
class="relative w-full bg-white border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo focus:border-indigo sm:text-sm">
<span class="flex items-center break-all">
<!-- display the name of selected element -->
<span class="block line-clamp-1 truncate max-w-48"> {{ trans('current_zone') }}: {{ props.modelValue.alias !== '' ? props.modelValue.alias : props.modelValue.name }}</span>
<!-- {{ props.modelValue }} -->
<span class="block line-clamp-1 truncate max-w-48" v-if="typeof props.modelValue.alias === 'undefined'">
{{ trans('search_zone') }}
</span>
<span class="block line-clamp-1 truncate max-w-48" v-else>
{{ props.modelValue.alias || props.modelValue.name }}
</span>
</span>
<span class="ml-3 absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
<ChevronUpDownIcon class="h-5 w-5 text-gray-400" aria-hidden="true" />
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/AdminThemeManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ public function indexAction()
'vitedev' => filter_var(getenv('PRETTYBLOCKS_VITE_DEV'), FILTER_VALIDATE_BOOLEAN) ?? false,
'PRETTYBLOCKS_VITE_HOST' => getenv('PRETTYBLOCKS_VITE_HOST') ? getenv('PRETTYBLOCKS_VITE_HOST') : 'http://localhost:3002/',
'iframe_sandbox' => getenv('PRETTYBLOCKS_IFRAME_SANDBOX') ? getenv('PRETTYBLOCKS_IFRAME_SANDBOX') : 'allow-same-origin allow-scripts allow-forms allow-popups allow-presentation allow-top-navigation allow-pointer-lock allow-popups-to-escape-sandbox allow-modals allow-top-navigation-by-user-activation',
'PRETTYBLOCKS_REMOVE_ADS' => \filter_var(\Configuration::get('PRETTYBLOCKS_REMOVE_ADS'), FILTER_VALIDATE_BOOLEAN) ? true : \filter_var(getenv('PRETTYBLOCKS_REMOVE_ADS'), FILTER_VALIDATE_BOOLEAN) ?? false,
],

'ajax_urls' => [
Expand Down Expand Up @@ -302,6 +303,7 @@ public function indexAction()
'error_console' => $translator->trans('An error occurred while processing your request', [], 'Modules.Prettyblocks.Admin'),
'duplicate_state_error' => $translator->trans('An error occurred while duplicating the element', [], 'Modules.Prettyblocks.Admin'),
'get_pro' => $translator->trans('Get Pro Blocks', [], 'Modules.Prettyblocks.Admin'),
'search_zone' => $translator->trans('Search zone', [], 'Modules.Prettyblocks.Admin'),
],
'security_app' => [
'ajax_token' => \Configuration::getGlobalValue('_PRETTYBLOCKS_TOKEN_'),
Expand Down

0 comments on commit ed0f38f

Please sign in to comment.