diff --git a/src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/freetext-input.js b/src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/freetext-input.js deleted file mode 100644 index 65b66dc13..000000000 --- a/src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/freetext-input.js +++ /dev/null @@ -1,25 +0,0 @@ -import {ShowHide} from 'ChillMainAssets/lib/show_hide/show_hide.js'; - -window.addEventListener('DOMContentLoaded', function() { - let - freetextContainer = document.querySelector('#freetext-entity'), - entitySelector = document.querySelector('#entity-selector') - ; - if (null === entitySelector) { - return; - } - - new ShowHide({ - debug: true, - load_event: null, - froms: [entitySelector], - container: [freetextContainer], - test: function(froms, event) { - for (let container of froms) { - return container.querySelector('input[value="freetext"]').checked; - } - console.log('we couldnt find the input'); - return false; - }, - }) -}); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/showhide-input.js b/src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/showhide-input.js index da5f812c6..d9da5eb79 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/showhide-input.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/showhide-input.js @@ -3,7 +3,9 @@ import {ShowHide} from 'ChillMainAssets/lib/show_hide/show_hide.js'; window.addEventListener('DOMContentLoaded', function() { let personContainer = document.querySelector('#person-entity'), - entitySelector = document.querySelector('#entity-selector') + entitySelector = document.querySelector('#entity-selector'), + freetextContainer = document.querySelector('#freetext-entity'), + thirdpartyContainer = document.querySelector('#thirdparty-entity') ; if (null === entitySelector) { return; @@ -22,4 +24,32 @@ window.addEventListener('DOMContentLoaded', function() { return false; }, }) + + new ShowHide({ + debug: true, + load_event: null, + froms: [entitySelector], + container: [thirdpartyContainer], + test: function(froms, event) { + for (let container of froms) { + return container.querySelector('input[value="thirdparty"]').checked; + } + console.log('we couldnt find the input'); + return false; + }, + }) + + new ShowHide({ + debug: true, + load_event: null, + froms: [entitySelector], + container: [freetextContainer], + test: function(froms, event) { + for (let container of froms) { + return container.querySelector('input[value="freetext"]').checked; + } + console.log('we couldnt find the input'); + return false; + }, + }) }); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/thirdparty-input.js b/src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/thirdparty-input.js deleted file mode 100644 index 876adc7c9..000000000 --- a/src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/thirdparty-input.js +++ /dev/null @@ -1,25 +0,0 @@ -import {ShowHide} from 'ChillMainAssets/lib/show_hide/show_hide.js'; - -window.addEventListener('DOMContentLoaded', function() { - let - thirdpartyContainer = document.querySelector('#thirdparty-entity'), - entitySelector = document.querySelector('#entity-selector') - ; - if (null === entitySelector) { - return; - } - - new ShowHide({ - debug: true, - load_event: null, - froms: [entitySelector], - container: [thirdpartyContainer], - test: function(froms, event) { - for (let container of froms) { - return container.querySelector('input[value="thirdparty"]').checked; - } - console.log('we couldnt find the input'); - return false; - }, - }) -}); diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig index b572d9d11..cb542b6a1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig @@ -5,16 +5,12 @@ {% block title %}{{ 'Person resources'|trans|capitalize ~ ' ' ~ person|chill_entity_render_string }}{% endblock %} {% block js %} - {{ encore_entry_script_tags('page_person_resource_person_input') }} - {{ encore_entry_script_tags('page_person_resource_thirdparty_input') }} - {{ encore_entry_script_tags('page_person_resource_freetext_input') }} + {{ encore_entry_script_tags('page_person_resource_showhide_input') }} {{ encore_entry_script_tags('mod_pickentity_type') }} {% endblock %} {% block css %} - {{ encore_entry_link_tags('page_person_resource_person_input') }} - {{ encore_entry_link_tags('page_person_resource_thirdparty_input') }} - {{ encore_entry_link_tags('page_person_resource_freetext_input') }} + {{ encore_entry_link_tags('page_person_resource_showhide_input') }} {{ encore_entry_link_tags('mod_pickentity_type') }} {% endblock %} @@ -63,17 +59,15 @@ -
-
- {% if resource.kind %} -
-
{{ resource.comment.comment }}
-
- {% else %} -

{{ 'no comment found'|trans|capitalize }}

- {% endif %} -
-
+ {% if resource.kind %} +
+
+
+
{{ resource.comment.comment }}
+
+
+
+ {% endif %}