Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Don't allow creating empty file filters #7965

Merged
merged 1 commit into from
May 29, 2014
Merged
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
12 changes: 12 additions & 0 deletions src/search/FileFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,18 @@ define(function (require, exports, module) {
});
}

// Code to enable/disable the OK button at the bottom of dialog (whether filter is empty or not)
var $primaryBtn = dialog.getElement().find(".primary");

function updatePrimaryButton() {
var trimmedValue = $editField.val().trim();

$primaryBtn.prop("disabled", !trimmedValue.length);
}

$editField.on("input", updatePrimaryButton);
updatePrimaryButton();

if (_context) {
$editField.on("input", _.debounce(updateFileCount, 400));
updateFileCount();
Expand Down