Internal: Fix flash bag messages in symfony, now render in vue

pull/3513/head
Julio Montoya 5 years ago
parent 667c52a197
commit 82c1a505ed
  1. 2
      .travis.yml
  2. 14
      assets/vue/App.vue
  3. 1
      assets/vue/mixins/NotificationMixin.js
  4. 2
      src/CoreBundle/Resources/views/Index/vue.html.twig
  5. 56
      src/CoreBundle/Resources/views/Layout/base-layout.html.twig
  6. 39
      src/CoreBundle/Resources/views/Layout/layout_one_col.html.twig
  7. 2
      src/CoreBundle/Resources/views/Layout/login-layout.html.twig
  8. 2
      src/CoreBundle/Resources/views/Lti/launch.html.twig

@ -103,7 +103,7 @@ script:
- sed -i "s/APP_ENV='dev'/APP_ENV='test'/g" .env.local
- cd tests/behat
- ../../vendor/behat/behat/bin/behat features/adminFillUsers.feature -vvv
# - ../../vendor/behat/behat/bin/behat features/adminSettings.feature -v
- ../../vendor/behat/behat/bin/behat features/adminSettings.feature -vvv
# - ../../vendor/behat/behat/bin/behat features/career.feature -v
# - ../../vendor/behat/behat/bin/behat features/class.feature -v
# - ../../vendor/behat/behat/bin/behat features/companyReports.feature -v

@ -123,12 +123,14 @@ export default {
let payload = {isAuthenticated: isAuthenticated, user: user};
this.$store.dispatch("security/onRefresh", payload);
if (this.$parent.$el.attributes["data-messages"]) {
let messages = JSON.parse(this.$parent.$el.attributes["data-messages"].value);
if (messages) {
Array.from(messages).forEach(element =>
this.showMessage(element)
);
if (this.$parent.$el.attributes["data-flashes"]) {
let flashes = JSON.parse(this.$parent.$el.attributes["data-flashes"].value);
if (flashes) {
for (const key in flashes) {
for (const text in flashes[key]) {
this.showMessage(flashes[key][text], key);
}
}
}
}

@ -13,7 +13,6 @@ export default {
},
showError(error) {
console.log(error);
//this.showMessage(error, 'danger');
},

@ -3,7 +3,7 @@
{% block content %}
<div
id="app"
data-messages="{{ app.session.flashbag.get('warning')|json_encode }}"
data-flashes="{{ app.flashes()|json_encode }}"
data-is-authenticated="{{ is_authenticated }}"
data-user-json="{{ user_json }}">
</div>

@ -3,59 +3,35 @@
{% import "@ChamiloCore/Macros/buttons.html.twig" as macro_buttons %}
{% import "@ChamiloCore/Macros/image.html.twig" as macro_image %}
{% import '@ChamiloCore/Macros/headers.html.twig' as macro_headers %}
{# Chamilo theme #}
{% set theme = 'chamilo' %}
{% if not from_vue %}
<!doctype html>
<html lang="{{ app.request.locale }}" class="no-js h-100">
{# Chamilo theme #}
{% set theme = 'chamilo' %}
<!DOCTYPE html>
<html lang="{{ app.request.locale }}" class="no-js h-100">
{% block chamilo_head %}
<head>
{% include "@ChamiloCore/Layout/head.html.twig" %}
</head>
<head>
{% include "@ChamiloCore/Layout/head.html.twig" %}
</head>
{% endblock %}
<body class="{{ section_name }} h-100"
data-in-course="{{ course ? 'true' : 'false' }}"
data-course-code="{{ course ? course.code : '' }}"
data-session-id="{{ session ? session.id : '' }}"
<body
class="{{ section_name }} h-100"
data-in-course="{{ course ? 'true' : 'false' }}"
data-course-code="{{ course ? course.code : '' }}"
data-session-id="{{ session ? session.id : '' }}"
{% if legacy_breadcrumb is defined %}
data-breadcrumb="{{ legacy_breadcrumb | json_encode() }}"
{% endif %}
>
<noscript> {{ "Your browser does not support Javascript" | trans }} </noscript>
{% block chamilo_wrap %}
{% block page_header %}
{# {% include '@ChamiloCore/Layout/header.html.twig' %} #}
{% endblock %}
{# <div class="app-body"> #}
{% block page_sidebar %}
{# {% include '@ChamiloCore/Layout/sidebar.html.twig' %} #}
{% endblock %}
{# <main id="app-main" class="main"> #}
{% block chamilo_breadcrumb %}
<!-- BREADCRUMB -->
{# {% include '@ChamiloCore/Layout/breadcrumb.html.twig' %}#}
<!-- END BREADCRUMB -->
{% endblock %}
{% block page_content %}
{% endblock %}
{# </main> #}
{# </div> #}
{% block page_content %}
{% endblock %}
{% endblock %}
{% block chamilo_footer %}
<!-- FOOTER -->
{# {% include '@ChamiloCore/Layout/footer.html.twig' %} #}
<!-- END FOOTER -->
{% endblock %}
<script src="{{ url('home') ~ 'build/vue.js' }}"></script>
</body>
</html>
</body>
</html>
{% else %}
{{ block('page_content') }}
{% endif %}

@ -28,15 +28,16 @@
{% endif %}
{% autoescape %}
<div id="app"
data-is-authenticated="{{ is_authenticated }}"
data-user-json="{{ user_json }}"
<div
id="app"
data-is-authenticated="{{ is_authenticated }}"
data-user-json="{{ user_json }}"
data-flashes="{{ app.flashes()|json_encode }}"
{% if legacy_breadcrumb is defined %}
data-breadcrumb="{{ legacy_breadcrumb | json_encode() }}"
data-breadcrumb="{{ legacy_breadcrumb | json_encode() }}"
{% endif %}
>
</div>
{% endautoescape %}
{% set hideContent = 'display: none' %}
@ -45,25 +46,19 @@
{% endif %}
<section id="sectionMainContent" class="section-content" style="{{ hideContent }}">
{% autoescape false %}
{% block chamilo_messages %}
{% include '@ChamiloCore/FlashMessage/render.html.twig' %}
{% endblock %}
{% autoescape false %}
{% if introduction is defined %}
{{ introduction }}
{% endif %}
{# <section class="container-fluid">#}
{% if introduction is defined %}
{{ introduction }}
{% endif %}
{% if actions != '' %}
{{ actions }}
{% endif %}
{% if actions != '' %}
{{ actions }}
{% endif %}
{# Content #}
{% block content %}
{{ content }}
{% endblock %}
{# </section>#}
{% endautoescape %}
{% block content %}
{{ content }}
{% endblock %}
{% endautoescape %}
</section>
{% if plugin_content_bottom %}

@ -1,6 +1,6 @@
{% import '@ChamiloCore/Macros/box.html.twig' as macro %}
<!doctype html>
<!DOCTYPE html>
<!--[if lt IE 7 ]><html lang="{{ app.request.getLocale() }}" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]><html lang="{{ app.request.getLocale() }}" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]><html lang="{{ app.request.getLocale() }}" class="no-js ie8"> <![endif]-->

@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

Loading…
Cancel
Save