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.
If an email is seen (Message-ID:) then convert newlines to <br> unless within <html> tags. Also place the contents inside an iframe so the CSS rules don't leech out.
Fixes#3032
Fixes#3571. Credit to @ayumihamsaki. Thanks to @petehalverson for his PR testing system, this is the first PR I'm merging after testing it with that system.
Add option to horizontally align the loader indicator in the center and option to change the size (only small size available for now) through the JavaScript API. These abilities were already available through CSS, this commit makes them available through JS as well.
Add `data-input-preset-remove-stop-words="false"` to an element being handled with the input preset JS to disable the removal of stop words from slug generation. Credit to @tim0991.
This fixes a small issue where the form is submitted an extra unnamed null field is present in the request due to a trailing & symbol in `requestData` when `data` is empty.
This logic could have been placed in the ValidationException class or the framework.js file. It seems more fitting for it to be in the framework.js file.
Current changes to the ``framework.js`` led to a breaking change due to the fact, that ``options.data`` was no longer populated with the request data. The ``options`` object is part of the ``context`` object, which is later beeing passed to ``ajaxBeforeSend``
The two relevant versions of the file show the change of behavior:
b6fedfb688/modules/system/assets/js/framework.js (L56) => https://github.com/octobercms/october/blob/develop/modules/system/assets/js/framework.js#L88
The change is required to remain consistent with the old behavior. This code is tested and appears to be working as it did formerly.
Adds the ability to specify an `ignoreTimezone: true` option on the config for a datepicker form widget or date column type. This will ignore both October's and the backend user's timezone settings to display the date exactly as it is stored.
Removed `minNumber` and `maxNumber` options, they are not enforceable on the client side without a lot more work. Added `number` filter type, added missing numberrange filter template, consolidated styles for filter-date and filter-number filters.
Use native scroll on mobile devices (much better UX)
Stack settings menu items 2 column medium, 3 column large
The settings search is now forcibly focused
This should make Windows PCs look a little nicer, albeit inconsistent with others (Sergoe UI is unique). If it's good enough for GitHub, then it's good enough for October.
All text shadows have been stripped, along with some box shading. They were barely noticeable and should speed up the UI.
This allows request elements external to the form to serialize a target form for use. An example might be a search form at the top of a page, list of results in the middle, then the pagination at the bottom. The pagination would need to target the search form with data-request-form to persist the search query value.
This should work with the JS API too, passed as an object, because $($()) is acceptable in jQuery
jQuery sends multiple values for the `X-REQUESTED-WITH` header if it has already been set, even when the value is the same. This means that same-origin requests would send `X-REQUESTED-WITH: XMLHttpRequest, XMLHttpRequest` which isn't detected as AJAX by Laravel/Symphony.
To fix this issue while retaining the crossDomain usage of framework.js, I've used `crossDomain: false` to trick jQuery into sending the header anyways on cross-origin requests. This is still changeable by the user in the `ajaxSetup` event.
Adds support for Cross-Origin requests made via framework.js by manually adding the `X-Requested-With: XMLHttpRequest` header required for server-side detection of AJAX requests that is sent on normal Same-Origin AJAX requests but stripped by default by jQuery when making Cross-Origin requests. Note: Request target server still needs to have `Access-Control` headers configured correctly to return a request.
Process JS API requests ($.request(handler, options)) through the document object instead of a non-existent form element. The form element was originally added because the framework only supported requests made from within a form
```
[22:08:12] spunky: The $triggerEl was implemented because previously it was just $form
[22:08:24] spunky: For data-requests without a form, these events were being ignored
[22:08:31] spunky: So as a workaround I implemented $triggerEl
```
As this is no longer the case, any JS API requests will now be made through the document element instead to support listening to events (such as ajaxSetup) even when there is no real attached element to trigger them on.
- Used for handling flash messages via JS API
Request options are now passed to ajaxBeforeSend & ajaxPromise events
Improved framework extras
- Fixes data-request-flash when used within a plain form, this code would fail because $triggerEl is set to a plain form:
`<form><button data-request="..." data-request-flash>...</button></form>`
Adds support for passing objects to be used as the loading indicator. Note: Objects must support `.show()` and `.hide()` methods.
Example:
```js
$.request('onHandler', {
loading: $.oc.stripeLoadIndicator
});
```