add suffix to assets entrypoints + replace link/script html tags by encore_entry twig tag

This commit is contained in:
Mathieu Jaumotte 2021-07-23 12:27:30 +02:00
parent e0dbe9cf9d
commit d20a3cf9d4
9 changed files with 45 additions and 55 deletions

View File

@ -6,11 +6,11 @@
{% block content %} {% block content %}
<div class="activity-new"> <div class="activity-new">
<div id="activity"></div> {# <=== vue component #} <div id="activity"></div> {# <=== vue component #}
{% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'accompanyingCourse'} %} {% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'accompanyingCourse'} %}
</div> </div>
{% endblock %} {% endblock %}
{% block js %} {% block js %}
@ -18,10 +18,10 @@
{{ encore_entry_script_tags('async_upload') }} {{ encore_entry_script_tags('async_upload') }}
<script type="text/javascript"> <script type="text/javascript">
window.addEventListener('DOMContentLoaded', function (e) { window.addEventListener('DOMContentLoaded', function (e) {
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]', chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}'); '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
}); });
window.activity = {{ activity_json|json_encode|raw }}; window.activity = {{ activity_json|json_encode|raw }};
</script> </script>
{{ encore_entry_script_tags('vue_activity') }} {{ encore_entry_script_tags('vue_activity') }}
{% endblock %} {% endblock %}

View File

@ -23,7 +23,7 @@
{{ 'Login to %installation_name%' | trans({ '%installation_name%' : installation.name } ) }} {{ 'Login to %installation_name%' | trans({ '%installation_name%' : installation.name } ) }}
</title> </title>
<link rel="shortcut icon" href="{{ asset('build/images/favicon.ico') }}" type="image/x-icon"> <link rel="shortcut icon" href="{{ asset('build/images/favicon.ico') }}" type="image/x-icon">
<link rel="stylesheet" href="{{ asset('build/login.css') }}"/> {{ encore_entry_link_tags('page_login') }}
</head> </head>
<body> <body>
<div id="content"> <div id="content">
@ -42,14 +42,13 @@
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" /> <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
<br/> <br/>
<button type="submit" name="login">{{ 'Login'|trans }}</button> <button type="submit" name="login">{{ 'Login'|trans }}</button>
</form> </form>
<p class="forgot-password-link"><a href="{{ path('password_request_recover') }}">{{ 'Forgot your password ?'|trans }}</a></p> <p class="forgot-password-link"><a href="{{ path('password_request_recover') }}">{{ 'Forgot your password ?'|trans }}</a></p>
{{ include('@ChillMain/Login/_footer.html.twig') }} {{ include('@ChillMain/Login/_footer.html.twig') }}
</div> </div>
<script type="text/javascript" src="{{ asset('build/runtime.js') }}"></script> {{ encore_entry_script_tags('page_login') }}
</body> </body>
</html> </html>

View File

@ -1,5 +1,5 @@
{# {#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop> <info@champs-libres.coop> / <http://www.champs-libres.coop>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -24,25 +24,20 @@
{{ 'Login to %installation_name%' | trans({ '%installation_name%' : installation.name } ) }} {{ 'Login to %installation_name%' | trans({ '%installation_name%' : installation.name } ) }}
</title> </title>
<link rel="shortcut icon" href="{{ asset('build/images/favicon.ico') }}" type="image/x-icon"> <link rel="shortcut icon" href="{{ asset('build/images/favicon.ico') }}" type="image/x-icon">
<link rel="stylesheet" href="{{ asset('build/chill.css') }}"/> {{ encore_entry_link_tags('chill') }}
</head> </head>
<body> <body>
<header class="navigation container-fluid"> <header class="navigation container-fluid">
<div class="col-4 d-md-none parent"> <div class="col-4 d-md-none parent">
<div class="col-10 col-md-12 offset-2 logo-container"> <div class="col-10 col-md-12 offset-2 logo-container">
<a href="{{ path('chill_main_homepage') }}"> <a href="{{ path('chill_main_homepage') }}">
<img class="logo" src="{{ asset('build/images/logo-chill-sans-slogan_white.png') }}"> <img class="logo" src="{{ asset('build/images/logo-chill-sans-slogan_white.png') }}">
</a> </a>
</div>
</div> </div>
</div>
</header> </header>
<div id="content">
<div id="content">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
</body> </body>

View File

@ -26,13 +26,13 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge"> <meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ installation.name }} - {% block title %}{% endblock %}</title> <title>{{ installation.name }} - {% block title %}{% endblock %}</title>
<link rel="shortcut icon" href="{{ asset('build/images/favicon.ico') }}" type="image/x-icon"> <link rel="shortcut icon" href="{{ asset('build/images/favicon.ico') }}" type="image/x-icon">
{{ encore_entry_link_tags('bootstrap') }} {{ encore_entry_link_tags('mod_bootstrap') }}
{{ encore_entry_link_tags('forkawesome') }} {{ encore_entry_link_tags('mod_forkawesome') }}
{{ encore_entry_link_tags('ckeditor5') }} {{ encore_entry_link_tags('mod_ckeditor5') }}
{{ encore_entry_link_tags('chill') }} {{ encore_entry_link_tags('chill') }}
{% block css%}<!-- nothing added to css -->{% endblock %} {% block css%}<!-- nothing added to css -->{% endblock %}
</head> </head>
@ -71,7 +71,7 @@
<span>{{ flashMessage|raw }}</span> <span>{{ flashMessage|raw }}</span>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
@ -100,11 +100,11 @@
{{ include('@ChillMain/Layout/_footer.html.twig') }} {{ include('@ChillMain/Layout/_footer.html.twig') }}
{{ encore_entry_script_tags('bootstrap') }} {{ encore_entry_script_tags('mod_bootstrap') }}
{{ encore_entry_script_tags('forkawesome') }} {{ encore_entry_script_tags('mod_forkawesome') }}
{{ encore_entry_script_tags('ckeditor5') }} {{ encore_entry_script_tags('mod_ckeditor5') }}
{{ encore_entry_script_tags('chill') }} {{ encore_entry_script_tags('chill') }}
<script type="text/javascript"> <script type="text/javascript">
window.addEventListener('DOMContentLoaded', function(e) { window.addEventListener('DOMContentLoaded', function(e) {
chill.checkOtherValueOnChange(); chill.checkOtherValueOnChange();
@ -115,7 +115,7 @@
chill.categoryLinkParentChildSelect(); chill.categoryLinkParentChildSelect();
}); });
</script> </script>
{% block js%}<!-- nothing added to js -->{% endblock %} {% block js%}<!-- nothing added to js -->{% endblock %}
</body> </body>
</html> </html>

View File

@ -45,23 +45,19 @@ module.exports = function(encore, entries)
// Aliases are used when webpack is trying to resolve modules path // Aliases are used when webpack is trying to resolve modules path
encore.addAliases({ encore.addAliases({
ChillMainAssets: __dirname + '/Resources/public', ChillMainAssets: __dirname + '/Resources/public',
//ChillMainSass: __dirname + '/Resources/public/modules/scratch',
ShowHide: __dirname + '/Resources/public/modules/show_hide' ShowHide: __dirname + '/Resources/public/modules/show_hide'
}); });
// Add separate entrypoints // Page entrypoints
encore.addEntry('login', __dirname + '/Resources/public/modules/login_page/index.js'); encore.addEntry('page_login', __dirname + '/Resources/public/modules/login_page/index.js');
//encore.addEntry('scratch', __dirname + '/Resources/public/modules/scratch/index.js');
// Chill2 new assets // Modules entrypoints
encore.addEntry('forkawesome', __dirname + '/Resources/public/modules/forkawesome/index.js'); encore.addEntry('mod_forkawesome', __dirname + '/Resources/public/modules/forkawesome/index.js');
encore.addEntry('bootstrap', __dirname + '/Resources/public/modules/bootstrap/index.js'); encore.addEntry('mod_bootstrap', __dirname + '/Resources/public/modules/bootstrap/index.js');
// CKEditor5
buildCKEditor(encore); buildCKEditor(encore);
encore.addEntry('ckeditor5', __dirname + '/Resources/public/modules/ckeditor5/index.js'); encore.addEntry('mod_ckeditor5', __dirname + '/Resources/public/modules/ckeditor5/index.js');
// Address // Vue entrypoints
encore.addEntry('vue_address', __dirname + '/Resources/public/vuejs/Address/index.js'); encore.addEntry('vue_address', __dirname + '/Resources/public/vuejs/Address/index.js');
}; };

View File

@ -19,7 +19,7 @@
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a <a
href="{{ chill_path_add_return_path('chill_person_household_members', { 'household_id': household.id }) }}" href="{{ chill_path_add_return_path('chill_person_household_members', { 'household_id': household.id }) }}"
class="btn btn-cancel" class="btn btn-cancel"
/> />
@ -38,5 +38,5 @@
{% endblock %} {% endblock %}
{% block js %} {% block js %}
{{ encore_entry_script_tags('household_edit_metadata') }} {{ encore_entry_script_tags('page_household_edit_metadata') }}
{% endblock %} {% endblock %}

View File

@ -214,5 +214,5 @@
{% endblock %} {% endblock %}
{% block js %} {% block js %}
{{ encore_entry_script_tags('household_edit_metadata') }} {{ encore_entry_script_tags('page_household_edit_metadata') }}
{% endblock %} {% endblock %}

View File

@ -22,7 +22,7 @@
{% block personcontent %} {% block personcontent %}
<div class="person-edit"> <div class="person-edit">
<h1>{{ 'Update details for %name%'|trans({ '%name%': person.firstName|capitalize ~ ' ' ~ person.lastName|capitalize } ) }}</h1> <h1>{{ 'Update details for %name%'|trans({ '%name%': person.firstName|capitalize ~ ' ' ~ person.lastName|capitalize } ) }}</h1>
{% form_theme form '@ChillMain/Form/fields.html.twig' %} {% form_theme form '@ChillMain/Form/fields.html.twig' %}
@ -142,5 +142,5 @@
{% endblock %} {% endblock %}
{% block js %} {% block js %}
{{ encore_entry_link_tags('person') }} {{ encore_entry_link_tags('page_person') }}
{% endblock %} {% endblock %}

View File

@ -13,8 +13,8 @@ module.exports = function(encore, entries)
encore.addEntry('vue_accourse', __dirname + '/Resources/public/vuejs/AccompanyingCourse/index.js'); encore.addEntry('vue_accourse', __dirname + '/Resources/public/vuejs/AccompanyingCourse/index.js');
encore.addEntry('vue_accourse_work_create', __dirname + '/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js'); encore.addEntry('vue_accourse_work_create', __dirname + '/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js');
encore.addEntry('vue_accourse_work_edit', __dirname + '/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js'); encore.addEntry('vue_accourse_work_edit', __dirname + '/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js');
encore.addEntry('vue_accourse_work_list', __dirname + '/Resources/public/modules/accompanying_course_work_list/index.js'); // why in modules ? encore.addEntry('vue_accourse_work_list', __dirname + '/Resources/public/modules/accompanying_course_work_list/index.js'); // why in modules ?
encore.addEntry('household_edit_metadata', __dirname + '/Resources/public/modules/household_edit_metadata/index.js');
encore.addEntry('person', __dirname + '/Resources/public/js/person.js'); encore.addEntry('page_household_edit_metadata', __dirname + '/Resources/public/modules/household_edit_metadata/index.js');
encore.addEntry('page_person', __dirname + '/Resources/public/js/person.js');
}; };