mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
show hide functional
This commit is contained in:
parent
ecae7dab44
commit
416b62fc60
@ -0,0 +1,25 @@
|
||||
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;
|
||||
},
|
||||
})
|
||||
});
|
@ -2,26 +2,24 @@ import {ShowHide} from 'ChillMainAssets/lib/show_hide/show_hide.js';
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function() {
|
||||
let
|
||||
linkedEntityContainer = document.querySelector('#linked-entity'),
|
||||
personContainer = document.querySelector('#person-entity'),
|
||||
thirdpartyContainer = document.querySelector('#thirdparty-entity'),
|
||||
freetextContainer = document.querySelector('#freetext-entity')
|
||||
entitySelector = document.querySelector('#entity-selector')
|
||||
;
|
||||
if (null === linkedEntityContainer) {
|
||||
if (null === entitySelector) {
|
||||
return;
|
||||
}
|
||||
|
||||
new ShowHide({
|
||||
debug: true,
|
||||
load_event: null,
|
||||
froms: [linkedEntityContainer],
|
||||
container: [personContainer, thirdpartyContainer, freetextContainer],
|
||||
froms: [entitySelector],
|
||||
container: [personContainer],
|
||||
test: function(froms, event) {
|
||||
if (event) {
|
||||
console.log(event);
|
||||
for (let container of froms) {
|
||||
return container.querySelector('input[value="person"]').checked;
|
||||
}
|
||||
|
||||
return true;
|
||||
console.log('we couldnt find the input');
|
||||
return false;
|
||||
},
|
||||
})
|
||||
});
|
||||
|
@ -0,0 +1,25 @@
|
||||
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;
|
||||
},
|
||||
})
|
||||
});
|
@ -9,7 +9,7 @@
|
||||
<div class="row">
|
||||
<legend class="col-sm-4 col-form-label">Associer un</legend>
|
||||
<div class="col-sm-8">
|
||||
<div id="chill_personbundle_person_resource_linkedEntity">
|
||||
<div id="entity-selector">
|
||||
<div class="form-check">
|
||||
<input type="radio" id="chill_personbundle_person_resource_linkedEntity_0" name="linked-entity" class="form-check-input" value="person" />
|
||||
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_0">Usager</label>
|
||||
@ -19,7 +19,7 @@
|
||||
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_1">Tiers</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input type="radio" id="chill_personbundle_person_resource_linkedEntity_2" name="linked-entity" class="form-check-input" value="freeText" />
|
||||
<input type="radio" id="chill_personbundle_person_resource_linkedEntity_2" name="linked-entity" class="form-check-input" value="freetext" />
|
||||
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_2">Description libre</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -93,5 +93,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
{{ encore_entry_script_tags('page_person_resource') }}
|
||||
{{ 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') }}
|
||||
{% endblock %}
|
@ -18,6 +18,9 @@ module.exports = function(encore, entries)
|
||||
encore.addEntry('page_person', __dirname + '/Resources/public/page/person/index.js');
|
||||
encore.addEntry('page_accompanying_course_index_person_locate', __dirname + '/Resources/public/page/accompanying_course_index/person_locate.js');
|
||||
encore.addEntry('page_accompanying_course_index_masonry', __dirname + '/Resources/public/page/accompanying_course_index/masonry.js');
|
||||
encore.addEntry('page_person_resource_person_input', __dirname + '/Resources/public/page/person_resource/person-input.js');
|
||||
encore.addEntry('page_person_resource_thirdparty_input', __dirname + '/Resources/public/page/person_resource/thirdparty-input.js');
|
||||
encore.addEntry('page_person_resource_freetext_input', __dirname + '/Resources/public/page/person_resource/freetext-input.js');
|
||||
encore.addEntry('page_suggest_names', __dirname + '/Resources/public/page/person/suggest-names.js');
|
||||
encore.addEntry('page_person_resource', __dirname + '/Resources/public/page/person_resource/index.js');
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user