Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance batch action parameters #1321

Merged
merged 9 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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