Skip to content

Commit

Permalink
Merge pull request #1321 from mooror/enhance-batch-action-parameters
Browse files Browse the repository at this point in the history
Enhance batch action parameters
  • Loading branch information
GuySartorelli authored Jul 12, 2022
2 parents f58e4aa + 2217643 commit 7cf2435
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css

Large diffs are not rendered by default.

30 changes: 28 additions & 2 deletions client/src/legacy/LeftAndMain.BatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,39 @@ $.entwine('ss.tree', function($){
onchange: function(e) {
var form = $(e.target.form),
btn = form.find(':submit'),
selected = $(e.target).val();
selected = $(e.target).val(),
actionUrlParts = selected.split('/'),
actionName = actionUrlParts[actionUrlParts.length - 1];

// Refresh selected / enabled nodes
$('#Form_BatchActionsForm').refreshSelected();

// Process action parameter fields
var parameterFields = $('#BatchActionParameters_' + actionName);
if (parameterFields.length) {
// Reset fields to default values before displaying them
parameterFields.find(':input').each(function () {
var input = $(this)[0];
if (input.tagName === 'SELECT') {
input.selectedIndex = -1;
$(this).trigger('chosen:updated');
} else if (input.type === 'checkbox') {
input.checked = input.defaultChecked;
} else {
input.value = input.defaultValue;
}
});

// Hide / display action parameter fields
parameterFields.siblings().hide();
parameterFields.show();
$('#BatchActionParameters').slideDown();
} else {
$('#BatchActionParameters').slideUp();
}

// TODO Should work by triggering change() along, but doesn't - entwine event bubbling?
this.trigger("chosen:updated");
this.trigger('chosen:updated');

this._super(e);
}
Expand Down
19 changes: 19 additions & 0 deletions client/src/styles/legacy/_style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,25 @@ html, body {
border-bottom-left-radius: 0;
width: calc(#{$grid-gutter-width} + 1px); // gutters + 1px border
}

// Action parameter fields
.action-parameters {
.form__field-description {
margin-bottom: 0;
}

.field {
height: auto;
}

.field:last-child {
margin-bottom: 0;
}

.form__field-holder--no-label {
padding-right: 0;
}
}
}

/** --------------------------------------------
Expand Down

0 comments on commit 7cf2435

Please sign in to comment.