templates: adjust evaluation stars templates to work in blocks (#74793) #387
|
@ -19,7 +19,7 @@
|
|||
|
||||
<script>
|
||||
$(function() {
|
||||
var $widget = $('#form_label_{{widget.name}}').parents('div.widget');
|
||||
var $widget = $('[name="{{widget.name}}"]').parents('div.widget');
|
||||
$widget.find('.star-choice input').on('change', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$(this).parent().nextAll().find('.star').removeClass('selected');
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
$('#form_{{widget.name}}').parent().find('.star-choice span').on('click', function() {
|
||||
var $widget = $('[name="{{widget.name}}"]');
|
||||
$widget.parent().find('.star-choice span').on('click', function() {
|
||||
if ($(this).hasClass('selected')) {
|
||||
$(this).nextAll().removeClass('selected');
|
||||
} else {
|
||||
|
@ -24,9 +25,9 @@
|
|||
$(this).addClass('selected');
|
||||
$(this).nextAll().removeClass('selected');
|
||||
}
|
||||
$('#form_{{widget.name}} option[data-index=' + $(this).data('index') + ']').prop('selected', true);
|
||||
$widget.find('option[data-index=' + $(this).data('index') + ']').prop('selected', true);
|
||||
});
|
||||
$('#form_{{widget.name}}').parent().find('.star-choice [data-index=' + $('#form_{{widget.name}} option:selected').data('index') + ']').trigger('click');
|
||||
$widget.parent().find('.star-choice [data-index=' + $widget.find('option:selected').data('index') + ']').trigger('click');
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue