Skip to content

Commit

Permalink
Display: Fix duplicated app container + remove unnecessary from_vue v…
Browse files Browse the repository at this point in the history
…alue #5680
  • Loading branch information
AngelFQC committed Jul 26, 2024
1 parent 40e0e23 commit 043165e
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 51 deletions.
1 change: 0 additions & 1 deletion public/main/inc/lib/template.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ public static function setVueParams(&$params)
$encoded = json_encode($user);
}
$params['user'] = $encoded;*/
$params['from_vue'] = isset($_REQUEST['from_vue']) ? 1 : 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/CoreBundle/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class IndexController extends BaseController
#[Route('/p/{slug}', name: 'public_page')]
public function index(): Response
{
return $this->render('@ChamiloCore/Index/vue.html.twig');
return $this->render('@ChamiloCore/Layout/no_layout.html.twig', ['content' => '']);
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/CoreBundle/EventListener/ExceptionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public function __invoke(ExceptionEvent $event): void
$message = $this->twig->render(
'@ChamiloCore/Exception/error.html.twig',
[
'from_vue' => false,
'exception' => $exception,
]
);
Expand Down
1 change: 0 additions & 1 deletion src/CoreBundle/EventListener/TwigListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function __invoke(ControllerEvent $event): void
$languages = $this->languageRepository->getAllAvailable()->getQuery()->getArrayResult();

// $this->twig->addGlobal('text_direction', api_get_text_direction());
$this->twig->addGlobal('from_vue', $request->request->get('from_vue') ? 1 : 0);
$this->twig->addGlobal('is_authenticated', json_encode($isAuth));
$this->twig->addGlobal('user_json', $data ?? json_encode([]));
$this->twig->addGlobal('access_url_id', $request->getSession()->get('access_url_id'));
Expand Down
6 changes: 0 additions & 6 deletions src/CoreBundle/Resources/views/Index/vue.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
{% extends "@ChamiloCore/Layout/no_layout.html.twig" %}

{%- block content %}
{% include '@ChamiloCore/Layout/vue_setup.html.twig' %}
{# {{ encore_entry_script_tags('vue') }}#}
{% endblock %}
40 changes: 18 additions & 22 deletions src/CoreBundle/Resources/views/Layout/base-layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,24 @@
{% import "@ChamiloCore/Macros/image.html.twig" as macro_image %}
{% import '@ChamiloCore/Macros/headers.html.twig' as macro_headers %}
{% import '@ChamiloCore/Macros/modals.html.twig' as macro_modals %}

{% set modals_block = macro_modals.global_modal('') %}
{% if not from_vue %}
<!DOCTYPE html>
<html lang="{{ app.request.locale }}" class="no-js h-100">
{% block chamilo_head %}
{%- include "@ChamiloCore/Layout/head.html.twig" %}
<!DOCTYPE html>
<html lang="{{ app.request.locale }}" class="no-js h-100">
{% block chamilo_head %}
{%- include "@ChamiloCore/Layout/head.html.twig" %}
{% endblock %}
<body class="font-sans antialiased {{ section_name }}">
<noscript>{{ "Your browser does not support Javascript"|trans }}</noscript>
{%- block chamilo_wrap -%}
{%- block page_content %}
{% endblock %}
<body class="font-sans antialiased {{ section_name }}">
<noscript>{{ "Your browser does not support Javascript"|trans }}</noscript>
{%- block chamilo_wrap -%}
{%- block page_content %}
{% endblock %}
{% endblock -%}
{%- block chamilo_footer -%}
{% endblock -%}
{{ modals_block }}
{% endblock -%}

{%- block chamilo_footer -%}
{% endblock -%}

{{ modals_block }}

{% include "@ChamiloCore/Layout/foot.html.twig" %}
</body>
</html>
{% else %}
{{ block('page_content') }}
{{ modals_block }}
{% endif %}
{% include "@ChamiloCore/Layout/foot.html.twig" %}
</body>
</html>
17 changes: 1 addition & 16 deletions src/CoreBundle/Resources/views/Layout/layout_one_col.html.twig
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{% extends '@ChamiloCore/Layout/base-layout.html.twig' %}
{%- block page_content %}
{% if from_vue %}
{# Loading legacy js using the $htmlHeadXtra array #}
{% autoescape false %}
{% for js in legacy_javascript %}
{{~ js }}
{% endfor %}
{% endautoescape %}
{% endif %}

{%- autoescape false %}
{% if js is defined %}
{%- for item in js %}
Expand Down Expand Up @@ -36,17 +27,11 @@
{% endautoescape -%}

{%- autoescape %}
{% if not from_vue %}
{%- include '@ChamiloCore/Layout/vue_setup.html.twig' %}
{% endif %}
{% endautoescape -%}

{% set hideContent = 'display: none' %}
{% if from_vue %}
{% set hideContent = '' %}
{% endif %}
{%- autoescape false %}
<section id="sectionMainContent" class="section-content" style="{{ hideContent }}">
<section id="sectionMainContent" class="section-content" style="display: none;">
{% if introduction is defined %}
{{ introduction }}
{% endif %}
Expand Down
4 changes: 1 addition & 3 deletions src/CoreBundle/Resources/views/Layout/no_layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
{# overrides everything inside body no-footer no-header #}
{% block chamilo_wrap %}
{%- autoescape %}
{% if not from_vue %}
<div id="app" data-flashes="{{ app.flashes()|json_encode }}"></div>
{% endif %}
{%- include '@ChamiloCore/Layout/vue_setup.html.twig' %}
{% endautoescape -%}
{% autoescape false %}
<section id="sectionMainContent" class="section-content">
Expand Down

0 comments on commit 043165e

Please sign in to comment.