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

user_input_filter - don't send Cancel on Apply #5875

Merged
merged 1 commit into from Jul 29, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions app/assets/javascripts/miq_application.js
Expand Up @@ -984,6 +984,7 @@ function miqQsEnterEscape(e) {
if (keycode === 13) {
if ($('#apply_button').is(':visible')) {
miqAjaxButton('quick_search?button=apply');
$('#quicksearchbox').modal('hide');
}
}

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/application_controller/filter.rb
Expand Up @@ -342,6 +342,8 @@ def quick_search_apply_click
exp_remove_tokens(@edit[:adv_search_applied][:qs_exp])
session[:adv_search] ||= {}
session[:adv_search][@edit[@expkey][:exp_model]] = copy_hash(@edit) # Save by model name in settings

# FIXME: this should really do $('#quicksearchbox').modal('hide'); ; for now, Apply closes the modal JS side
if @edit[:in_explorer]
replace_right_cell
else
Expand Down
9 changes: 7 additions & 2 deletions app/views/layouts/_user_input_filter.html.haml
Expand Up @@ -103,10 +103,10 @@
:button => "apply"},
:class => "btn btn-primary",
:alt => t = _("Apply the current filter (Enter)"),
"data-dismiss" => "modal",
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
:remote => true,
"data-dismiss" => "modal",
"data-method" => :post,
:id => "apply_button",
:title => t)
Expand All @@ -125,7 +125,12 @@
if (miqDomElementExists('value_1')) $('#value_1').focus();
})
$('#quicksearchbox').off("click");
$('#quicksearchbox').on('click', '[data-dismiss="modal"]', function() {
$('#quicksearchbox').on('click', '[data-dismiss="modal"]', function(event) {
if (event && event.target && event.target.id == 'apply_button') {
// don't cancel on Apply, but still close the modal
return true;
}

miqJqueryRequest("quick_search?button=cancel", {beforeSend: true});
return true;
});
Expand Down