Skip to content

Commit

Permalink
Merge branch 'release/3.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
pbchase committed Jun 5, 2018
2 parents a554015 + febd901 commit d14c1b1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to the Form Render Skip Logic module will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [3.1.1] - 2018-06-04
### Changed
- Fixing control field's 2nd column visibility. (Tiago Bember Simeao)


## [3.1.0] - 2018-06-02
### Added
- Add support for data piping and smart variables in place of a control field. (Tiago Bember Simeao & Philip Chase)
Expand Down
41 changes: 26 additions & 15 deletions js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ $(document).ready(function() {

$modal.addClass('frsl');

var place2ndColumnField = function($row) {
if ($row.hasClass('frsl-moved') || !$row.is(':visible')) {
return;
}

var $element = $row.find('.external-modules-input-element');
var $target = $row.prev().find('.external-modules-input-element');

$element.css('width', ($target.parent().width() - $target.outerWidth(true) - 10) + 'px');
$element.position({
my: 'left+10 top',
at: 'right top',
of: $target[0],
collision: "none"
});

$row.addClass('frsl-moved');
}

var branchingLogicCheckboxes = function($checkbox) {
var prefix = $checkbox.attr('name').replace('_select', '');
$target = $modal.find('select[name^="' + prefix + '"]').parent().parent();
Expand Down Expand Up @@ -46,6 +65,8 @@ $(document).ready(function() {

$(selectorShow).parent().parent().show();
$(selectorHide).parent().parent().hide();

place2ndColumnField($('[name="control_field_key' + suffix + '"]').parent().parent());
};

var $checkboxes = $modal.find('tr[field="target_events_select"] .external-modules-input-element');
Expand All @@ -60,6 +81,9 @@ $(document).ready(function() {
$modal.find('tr[field="control_mode"]').each(function() {
var defaultValue = 'default';
$(this).find('.external-modules-input-element').each(function() {
// Not using ":checked" selector to get the selected radio
// due to a possible bug on EM that unchecks radios within
// repeatable elements.
if (typeof this.attributes.checked !== 'undefined') {
defaultValue = $(this).val();
return false;
Expand All @@ -79,21 +103,8 @@ $(document).ready(function() {
}
});

$modal.find('tr[field="control_field_key"], tr[field="condition_value"]').each(function() {
if (!$(this).is(':visible')) {
return;
}

var $element = $(this).find('.external-modules-input-element');
var $target = $(this).prev().find('.external-modules-input-element');

$element.css('width', ($target.parent().width() - $target.outerWidth(true) - 10) + 'px');
$element.position({
my: 'left+10 top',
at: 'right top',
of: $target[0],
collision: "none"
});
$modal.find('tr[field="condition_value"]').each(function() {
place2ndColumnField($(this));
});
};
});
Expand Down

0 comments on commit d14c1b1

Please sign in to comment.