Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/allowed_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@
'views/templates/hook/prettyblocks/prettyblock_link_list.tpl',
'views/templates/hook/prettyblocks/prettyblock_login.tpl',
'views/templates/hook/prettyblocks/prettyblock_lookbook.tpl',
'views/templates/hook/prettyblocks/prettyblock_llm_links.tpl',
'views/templates/hook/prettyblocks/prettyblock_masonry_gallery.tpl',
'views/templates/hook/prettyblocks/prettyblock_modal.tpl',
'views/templates/hook/prettyblocks/prettyblock_mystery_boxes.tpl',
Expand Down
64 changes: 64 additions & 0 deletions src/Service/EverblockPrettyBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public static function getEverPrettyBlocks($context)
$ctaTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_cta.tpl';
$googleReviewsTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_google_reviews.tpl';
$sharerTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_sharer.tpl';
$llmLinksTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_llm_links.tpl';
$linkListTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_link_list.tpl';
$downloadsTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_downloads.tpl';
$socialLinksTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_social_links.tpl';
Expand Down Expand Up @@ -2643,6 +2644,69 @@ public static function getEverPrettyBlocks($context)
], $module),
],
];
$blocks[] = [
'name' => $module->l('LLM links'),
'description' => $module->l('Display a banner of links to AI assistants'),
'code' => 'everblock_llm_links',
'tab' => 'general',
'icon_path' => $defaultLogo,
'need_reload' => true,
'templates' => [
'default' => $llmLinksTemplate,
],
'config' => [
'fields' => static::appendSpacingFields([
'heading_text' => [
'type' => 'text',
'label' => $module->l('Heading text'),
'default' => $module->l('Résumer cet article avec :'),
],
'link_hover_effect' => [
'type' => 'checkbox',
'label' => $module->l('Enable hover effect on links'),
'default' => '1',
],
], $module),
],
'repeater' => [
'name' => 'LLM link',
'nameFrom' => 'label',
'groups' => static::appendSpacingFields([
'label' => [
'type' => 'text',
'label' => $module->l('Label'),
'default' => $module->l('ChatGPT'),
],
'base_url' => [
'type' => 'text',
'label' => $module->l('Base URL (ends with the prompt parameter, e.g. https://chat.openai.com/?prompt=)'),
'default' => 'https://chat.openai.com/?prompt=',
],
'prompt_template' => [
'type' => 'textarea',
'label' => $module->l('Prompt template (use {{title}} and {{url}} placeholders)'),
'default' => $module->l('Résume cet article de manière concise, en listant les points clés à retenir. Titre : {{title}} — URL : {{url}}'),
],
'icon' => [
'type' => 'fileupload',
'label' => $module->l('Icon image'),
'default' => [
'url' => '',
],
],
'icon_alt' => [
'type' => 'text',
'label' => $module->l('Icon alt text'),
'default' => $module->l('Open in assistant'),
],
'open_in_new_tab' => [
'type' => 'checkbox',
'label' => $module->l('Open in a new tab'),
'default' => '1',
],
], $module),
],
];
$blocks[] = [
'name' => $module->l('Social links'),
'description' => $module->l('Display custom links to social networks'),
Expand Down
46 changes: 46 additions & 0 deletions views/css/everblock.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,52 @@
transform: scale(1.04);
}

/* Prettyblock LLM links */
.prettyblock-llm-links__inner {
display: flex;
flex-direction: column;
gap: 1rem;
}

.prettyblock-llm-links__heading strong {
font-weight: 600;
font-size: 1rem;
}

.prettyblock-llm-links__list {
margin-right: -0.75rem;
margin-left: -0.75rem;
}

.prettyblock-llm-links__list > [class*="col-"] {
padding: 0.75rem;
}

.prettyblock-llm-links__item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 1rem;
height: 100%;
border: 1px solid rgba(0, 0, 0, 0.08);
border-radius: 0.75rem;
background-color: #fff;
text-decoration: none;
color: inherit;
}

.prettyblock-llm-links__icon {
max-width: 92px;
max-height: 92px;
object-fit: contain;
}

.prettyblock-llm-links__label {
font-weight: 600;
}

/* Lookbook product markers */

.lookbook-marker {
Expand Down
24 changes: 24 additions & 0 deletions views/js/everblock.js
Original file line number Diff line number Diff line change
Expand Up @@ -3529,6 +3529,7 @@ $(document).ready(function(){

initPrettyblockCategoryTabs();
initPrettyblockToc();
initPrettyblockLlmLinks();

function initPrettyblockCategoryTabs() {
var $blocks = $('.prettyblock-category-tabs');
Expand Down Expand Up @@ -3685,6 +3686,29 @@ $(document).ready(function(){
});
}

function initPrettyblockLlmLinks() {
$('.prettyblock-llm-links').each(function () {
var $block = $(this);
var pageTitle = $block.data('page-title') || document.title || '';
var pageUrl = $block.data('page-url') || window.location.href || '';

$block.find('.prettyblock-llm-links__item').each(function () {
var $link = $(this);
var baseUrl = $link.data('base-url') || '';
var promptTemplate = $link.data('prompt-template') || '';

if (!baseUrl || !promptTemplate) {
return;
}

var promptText = promptTemplate
.replace(/{{\s*title\s*}}/g, pageTitle)
.replace(/{{\s*url\s*}}/g, pageUrl);
$link.attr('href', baseUrl + encodeURIComponent(promptText));
});
});
}

var $everblockImageModal = $('#everblockImageModal');
if ($everblockImageModal.length) {
$(document).on('click', '.everblock-page__content img', function (event) {
Expand Down
75 changes: 75 additions & 0 deletions views/templates/hook/prettyblocks/prettyblock_llm_links.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{*
* 2019-2025 Team Ever
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author Team Ever <https://www.team-ever.com/>
* @copyright 2019-2025 Team Ever
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*}
{include file='module:everblock/views/templates/hook/prettyblocks/_partials/visibility_class.tpl'}
{include file='module:everblock/views/templates/hook/prettyblocks/_partials/spacing_style.tpl' spacing=$block.settings assign='prettyblock_spacing_style'}

{assign var='page_url' value=$urls.current_url|default:''}
{assign var='page_title' value=$page.meta.title|default:$page.meta.page_title|default:$page.page_title|default:$page_title|default:''}

<div id="block-{$block.id_prettyblocks}" class="{if $block.settings.default.force_full_width}container-fluid px-0 mx-0{elseif $block.settings.default.container}container{/if}{$prettyblock_visibility_class}">
{if $block.settings.default.force_full_width}
<div class="row gx-0 no-gutters">
{elseif $block.settings.default.container}
<div class="row">
{/if}
<!-- Module Ever Block -->
<div class="{if $block.settings.default.container}container{/if} prettyblock-llm-links" style="{$prettyblock_spacing_style}{if isset($block.settings.default.bg_color) && $block.settings.default.bg_color}background-color:{$block.settings.default.bg_color|escape:'htmlall':'UTF-8'};{/if}">
{if $block.settings.default.container}
<div class="row">
{/if}
<div class="prettyblock-llm-links__inner {$block.settings.css_class|escape:'htmlall':'UTF-8'}" data-page-title="{$page_title|escape:'htmlall':'UTF-8'}" data-page-url="{$page_url|escape:'htmlall':'UTF-8'}">
{if $block.settings.heading_text}
<div class="prettyblock-llm-links__heading">
<strong>{$block.settings.heading_text|escape:'htmlall':'UTF-8'}</strong>
</div>
{/if}
{if isset($block.states) && $block.states}
<div class="prettyblock-llm-links__list row">
{foreach from=$block.states item=state key=key}
{include file='module:everblock/views/templates/hook/prettyblocks/_partials/spacing_style.tpl' spacing=$state assign='prettyblock_state_spacing_style'}
{assign var='prompt_text' value=$state.prompt_template|default:''}
{assign var='prompt_text' value=$prompt_text|replace:'{{title}}':$page_title}
{assign var='prompt_text' value=$prompt_text|replace:'{{url}}':$page_url}
{assign var='base_url' value=$state.base_url|default:''}
{assign var='link_target' value='_self'}
{if isset($state.open_in_new_tab) && $state.open_in_new_tab}
{assign var='link_target' value='_blank'}
{/if}
<div class="col-6 col-md-4 col-lg-3" style="{$prettyblock_state_spacing_style}">
<a class="prettyblock-llm-links__item {if isset($block.settings.link_hover_effect) && $block.settings.link_hover_effect}everblock-link-hover--block{/if}" href="{$base_url}{$prompt_text|escape:'url'}" data-base-url="{$base_url|escape:'htmlall':'UTF-8'}" data-prompt-template="{$state.prompt_template|escape:'htmlall':'UTF-8'}" target="{$link_target}"{if $link_target === '_blank'} rel="noopener noreferrer"{/if}>
{if isset($state.icon.url) && $state.icon.url}
<img class="prettyblock-llm-links__icon" src="{$state.icon.url|escape:'htmlall':'UTF-8'}" alt="{$state.icon_alt|default:$state.label|default:''|escape:'htmlall':'UTF-8'}" loading="lazy" width="92" height="92">
{/if}
{if $state.label}
<span class="prettyblock-llm-links__label">{$state.label|escape:'htmlall':'UTF-8'}</span>
{/if}
</a>
</div>
{/foreach}
</div>
{/if}
</div>
{if $block.settings.default.container}
</div>
{/if}
</div>
<!-- /Module Ever Block -->
{if $block.settings.default.force_full_width || $block.settings.default.container}
</div>
{/if}
</div>
Loading