Add an event that can be fired when an mform is about to be submitted via ajax.
This allows custom field types to perform an action when the form is submitted.
The atto text editor will reset any autosaves when the form is submitted.
it is quite often when we need to have an autocomplete element that searches courses that
have completion enabled. This commit adds an option for the 'course' form element, and also
changes two places where we search for courses with completion. This should fix MDL-58989
The cache invalidation check was previously occuring every time either
the `set` or `get` function was called on the cache. However, the cache
invalidation check is based on the jsrev which is static for the
lifetime of the page.
This change moved the invalidation to happen during the setup of the AMD
module such that it only happens one time per storage type (Local +
Session).
We only use the jsrevPrefix to determine if the cache should be
invalidated, but the prefix that we were using is based on the new
jsrev.
For example, the jsrevPrefix will be:
hash(wwwroot + '/ + config.jsrev) + '/jsrev'
Where config.jsrev is the _current_ (new) jsrev.
As a result when searching for the jsrev used to store the data which is
currently in the storage cache, no key is returned, and we instead set
an 'initial' value and the cache is not cleared
This patch changes the jsrevPrefix to be:
hash(wwwroot) + '/jsrev'
Since the wwwroot does not change, the key remains static for the
current site. As a result, when the jsrev is bumped via a Moodle cache
purge, we are able to correctly fetch the old jsrev from the cache,
determine that the jsrev has changed, and purge the cache.
This includes a minor restructure of the autocomplete JS to make use of
promises and improve tracking of pending JS.
In particular it improves the way in which throttled text input is
handled to ensure that the behat does not continue until:
- typing is fully complete; and
- all possible ajax requests have been sent; and
- all possible ajax requests complete; and
- the suggestions are updated.
A number of conditions existed where behat would move on to the next
step too early in a race condition effect between Behat and Autocomplete.
Changed the template loading to buffer the requests for templates
so that they can be sent in batches to the server to save large
volumes of network requests.
Changed the getTemplate function in templates.js to use the
core_output_load_template_with_dependencies function to load the
requested template and all of the dependencies required to render it.
The dependencies are added to the relevant caches so that when the
template is rendered they aren't re-requested from the server.
* providers for paging preferences
* Moved the user pref persistence to the factory
* Added client defined namespace in config
* Define custom client events in the client instead of passing to the
factory
This was created by the Open University a couple of years ago, and is
very helpful for making dragging work reliably on a range of browsers
and with both mouse and touch-screens.
Sadly, HTML5 drag-drop is not yet ready for prime-time.
A template can include itself - e.g. by looping over the context children and rendering a tree.
Ensure this promise still resolves.
Example: admin/tool/lp/templates/competencies_tree.mustache.
For iOS we need to register non passive events not only for touchstart but also for touchmove
and touchend. Also iOS could open two move dialogue windows instead of one