1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

WIP content linker UX

This commit is contained in:
Harvey Kandola 2017-12-07 19:43:46 +00:00
parent 531e9c88d7
commit db1b3aef8c
11 changed files with 338 additions and 325 deletions

View file

@ -12,8 +12,16 @@
import Mixin from '@ember/object/mixin';
import { schedule } from '@ember/runloop';
// ID values expected format:
// modal: #document-template-modal
// element: #new-template-name
// See https://getbootstrap.com/docs/4.0/components/modal/#via-javascript
export default Mixin.create({
// e.g. #document-template-modal, #new-template-name
modalOpen(modalId, options) {
$(modalId).modal('dispose');
$(modalId).modal(options);
},
modalInputFocus(modalId, inputId) {
$(modalId).on('show.bs.modal', function(event) { // eslint-disable-line no-unused-vars
schedule('afterRender', () => {
@ -22,15 +30,55 @@ export default Mixin.create({
});
},
// e.g. #document-template-modal
// Destroys the elements modal.
modalDispose(modalId) {
$(modalId).modal('dispose');
},
// Manually hides a modal. Returns to the caller before the modal has actually
// been hidden (i.e. before the hidden.bs.modal event occurs).
modalHide(modalId) {
$(modalId).modal('hide');
},
// Manually hides a modal. Returns to the caller before the modal
// has actually been hidden (i.e. before the hidden.bs.modal event occurs).
// Then destroys the element's modal.
modalClose(modalId) {
$(modalId).modal('hide');
$(modalId).modal('dispose');
},
// e.g. #document-template-modal
modalOpen(modalId, options) {
$(modalId).modal('dispose');
$(modalId).modal(options);
// This event fires immediately when the show instance method is called.
// If caused by a click, the clicked element is available as the relatedTarget
// property of the event.
modalOnShow(modalId, callback) {
$(modalId).on('show.bs.modal', function(e) {
callback(e);
});
},
// This event is fired when the modal has been made visible to the user
// (will wait for CSS transitions to complete). If caused by a click,
// the clicked element is available as the relatedTarget property of the event.
modalOnShown(modalId, callback) {
$(modalId).on('shown.bs.modal', function(e) {
callback(e);
});
},
// This event is fired immediately when the hide instance method has been called.
modalOnHide(modalId, callback) {
$(modalId).on('hide.bs.modal', function(e) {
callback(e);
});
},
// This event is fired when the modal has finished being hidden from the user
// (will wait for CSS transitions to complete).
modalOnHidden(modalId, callback) {
$(modalId).on('hidden.bs.modal', function(e) {
callback(e);
});
}
});