Changed filter.js to fire its internal AJAX requests on the control's element instead of the closest form element. Previous behavior would fire the requests on a non-existant form element (as filter widgets are typically not located within a form element) and it looks like that was copy-paste oversight from the inspector javascript that the filter was originally based on. Credit to @fansaien
There are no `form` elements in the preview context of a form, so this adds an alternative selector to use when no common `form` elements are found for the Input Trigger API to use. Credit to @fansaien
This is needed as it removes leftover control-popover backdrops in any plugin backend that utilizes ajax in a popup modal (which is any of them that has relations or nested relations), so we will need to take a look at the dashboard widgets again. Credit to @ayumihamsaki.
The setTimeout fires after the modal already hides so it ends up firing twice which causes an error because the element is no longer there:
```
Uncaught TypeError: Cannot read property 'get' of null
at Popup.triggerEvent (storm-min.js?v443:3732)
at Popup.hide (storm-min.js?v443:3741)
at storm-min.js?v443:3730
```
Credit to @Teranode for the fix.
Since popovers and modals currently share the same z-index (600) a popover that gets created for a filter inside a modal is invisible. It is hidden below the modal. This commit adds a check to see if a filter is created from within a modal window. If yes, the popover will be added to the modal container. Otherwise the default container value `false` is used. Credit to @tobias-kuendig
Adds action buttons ("Apply" & "Clear") to filter popups for UX improvement (past experience was click out of the popup to apply the selected filters and manually remove all applied filters). Credit to @Teranode. Fixes#3304.
This prevents an error from popping up after the popover is hidden/removed `this.$container.remove()` is no longer available after removal so we need to check for the presence of `this.$container`. Credit to @Teranode
Replaced the existing PNG flag icons with the flag-icon-css library that uses SVGs, has more flags, and is more active (i.e well maintained). Credit to @mariavilaro & @w20k. Thanks to @petehalverson for Octodock for easy testing of this.