From f09329daee119dbc3f1503e33817d3dfd2f3b8f0 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 8 Oct 2021 22:21:40 +0200 Subject: [PATCH] blur logic implemented on view.html.twig of Person by means of example --- .../Resources/public/module/blur/index.js | 22 +++++++---- .../Resources/views/layout.html.twig | 17 ++++++++- .../ChillMainBundle/chill.webpack.config.js | 1 + .../Resources/views/Person/view.html.twig | 38 +++++++++++++------ 4 files changed, 57 insertions(+), 21 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js index 70a12736b..691059f36 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js @@ -1,13 +1,19 @@ -var infos = document.querySelectorAll("confidential"); -var toggles = document.querySelectorAll("confidential-toggle"); +var toggleBlur = function(e){ + + var btn = e.target; + + btn.previousElementSibling.classList.toggle("blur"); + btn.classList.toggle("fa-eye"); + btn.classList.toggle("fa-eye-slash"); -var toggleBlur = function(){ - var isBlurred = true; - if(isBlurred === true){ - - } } +var infos = document.getElementsByClassName("confidential"); +for(var i=0; i < infos.length; i++){ + infos[i].insertAdjacentHTML('beforeend', ''); +} + +var toggles = document.getElementsByClassName("toggle"); for(var i=0; i < toggles.length; i++){ - toggles[i].addEventListener("click", toggleBlur) + toggles[i].addEventListener("click", toggleBlur); } \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig index 8bee2983e..154a625f6 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig @@ -12,7 +12,22 @@ {{ encore_entry_link_tags('mod_forkawesome') }} {{ encore_entry_link_tags('mod_ckeditor5') }} {{ encore_entry_link_tags('chill') }} - {% block css%}{% endblock %} + {% block css%} + + {% endblock %} diff --git a/src/Bundle/ChillMainBundle/chill.webpack.config.js b/src/Bundle/ChillMainBundle/chill.webpack.config.js index 733899c19..a2a0c8f8d 100644 --- a/src/Bundle/ChillMainBundle/chill.webpack.config.js +++ b/src/Bundle/ChillMainBundle/chill.webpack.config.js @@ -59,6 +59,7 @@ module.exports = function(encore, entries) encore.addEntry('mod_bootstrap', __dirname + '/Resources/public/module/bootstrap/index.js'); encore.addEntry('mod_ckeditor5', __dirname + '/Resources/public/module/ckeditor5/index.js'); encore.addEntry('mod_disablebuttons', __dirname + '/Resources/public/module/disable-buttons/index.js'); + encore.addEntry('mod_blur', __dirname + '/Resources/public/module/blur/index.js'); encore.addEntry('mod_input_address', __dirname + '/Resources/public/vuejs/Address/mod_input_address_index.js'); // Vue entrypoints diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig index a67723f27..d0fc80e81 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig @@ -93,14 +93,18 @@ This view should receive those arguments: {%- endif -%} {%- if chill_person.fields.country_of_birth == 'visible' -%} -
{{ 'Country of birth'|trans }} :
-
{% apply spaceless %} - {% if person.countryOfBirth is not null %} - {{ person.countryOfBirth.name|localize_translatable_string }} - {% else %} - {{ 'Unknown country of birth'|trans }} - {% endif %} - {% endapply %}
+
+
+
{{ 'Country of birth'|trans }} :
+
{% apply spaceless %} + {% if person.countryOfBirth is not null %} + {{ person.countryOfBirth.name|localize_translatable_string }} + {% else %} + {{ 'Unknown country of birth'|trans }} + {% endif %} + {% endapply %}
+
+
{%- endif -%} @@ -198,10 +202,14 @@ This view should receive those arguments: {%- endif -%} {%- if chill_person.fields.phonenumber == 'visible' -%} -
-
{{ 'Phonenumber'|trans }} :
-
{% if person.phonenumber is not empty %}
{{ person.phonenumber|chill_format_phonenumber }}
{% else %}{{ 'No data given'|trans }}{% endif %}
-
+
+
+
+
{{ 'Phonenumber'|trans }} :
+
{% if person.phonenumber is not empty %}
{{ person.phonenumber|chill_format_phonenumber }}
{% else %}{{ 'No data given'|trans }}{% endif %}
+
+
+
{% endif %} {%- if chill_person.fields.mobilenumber == 'visible' -%} @@ -262,3 +270,9 @@ This view should receive those arguments: {% endblock %} + +{% block js %} + + {{ encore_entry_script_tags('mod_blur') }} + +{% endblock js %} \ No newline at end of file