Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #5798, closes #5018 - adds new `gh-fullscreen-modal` component - modals are now specified in-context so that they can have deeper interaction with their surrounding components/controller/route, i.e. a modal component can be a thin confirm/deny wrapper over the underlying controller action keeping all context-sensitive logic in one place - adds spin-buttons to all modals with async behaviour - adds/improves behaviour of inline-validation in modals - improves re-authenticate modal to properly handle validation and authentication errors
- Loading branch information
1 parent
d710bde
commit 1c6b208
Showing
88 changed files
with
1,262 additions
and
1,075 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import Ember from 'ember'; | ||
import LiquidTether from 'liquid-tether/components/liquid-tether'; | ||
|
||
const {RSVP, isBlank, on, run} = Ember; | ||
const emberA = Ember.A; | ||
|
||
const FullScreenModalComponent = LiquidTether.extend({ | ||
to: 'fullscreen-modal', | ||
target: 'document.body', | ||
targetModifier: 'visible', | ||
targetAttachment: 'top center', | ||
attachment: 'top center', | ||
tetherClass: 'fullscreen-modal', | ||
overlayClass: 'fullscreen-modal-background', | ||
modalPath: 'unknown', | ||
|
||
dropdown: Ember.inject.service(), | ||
|
||
init() { | ||
this._super(...arguments); | ||
this.modalPath = `modals/${this.get('modal')}`; | ||
}, | ||
|
||
setTetherClass: on('init', function () { | ||
let tetherClass = this.get('tetherClass'); | ||
let modifiers = (this.get('modifier') || '').split(' '); | ||
let tetherClasses = emberA([tetherClass]); | ||
|
||
modifiers.forEach((modifier) => { | ||
if (!isBlank(modifier)) { | ||
let className = `${tetherClass}-${modifier}`; | ||
tetherClasses.push(className); | ||
} | ||
}); | ||
|
||
this.set('tetherClass', tetherClasses.join(' ')); | ||
}), | ||
|
||
closeDropdowns: on('didInsertElement', function () { | ||
run.schedule('afterRender', this, function () { | ||
this.get('dropdown').closeDropdowns(); | ||
}); | ||
}), | ||
|
||
actions: { | ||
close() { | ||
if (this.attrs.close) { | ||
return this.attrs.close(); | ||
} | ||
|
||
return new RSVP.Promise((resolve) => { | ||
resolve(); | ||
}); | ||
}, | ||
|
||
confirm() { | ||
if (this.attrs.confirm) { | ||
return this.attrs.confirm(); | ||
} | ||
|
||
return new RSVP.Promise((resolve) => { | ||
resolve(); | ||
}); | ||
}, | ||
|
||
clickOverlay() { | ||
this.send('close'); | ||
} | ||
} | ||
}); | ||
|
||
FullScreenModalComponent.reopenClass({ | ||
positionalParams: ['modal'] | ||
}); | ||
|
||
export default FullScreenModalComponent; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* global key */ | ||
import Ember from 'ember'; | ||
|
||
const {Component, on, run} = Ember; | ||
|
||
export default Component.extend({ | ||
tagName: 'section', | ||
classNames: 'modal-content', | ||
|
||
_previousKeymasterScope: null, | ||
|
||
setupShortcuts: on('didInsertElement', function () { | ||
run(function () { | ||
document.activeElement.blur(); | ||
}); | ||
this._previousKeymasterScope = key.getScope(); | ||
|
||
key('enter', 'modal', () => { | ||
this.send('confirm'); | ||
}); | ||
|
||
key('escape', 'modal', () => { | ||
this.send('closeModal'); | ||
}); | ||
|
||
key.setScope('modal'); | ||
}), | ||
|
||
removeShortcuts: on('willDestroyElement', function () { | ||
key.unbind('enter', 'modal'); | ||
key.unbind('escape', 'modal'); | ||
|
||
key.setScope(this._previousKeymasterScope); | ||
}), | ||
|
||
actions: { | ||
confirm() { | ||
throw new Error('You must override the "confirm" action in your modal component'); | ||
}, | ||
|
||
closeModal() { | ||
this.attrs.closeModal(); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Ember from 'ember'; | ||
import ModalComponent from 'ghost/components/modals/base'; | ||
|
||
const {computed} = Ember; | ||
const {alias} = computed; | ||
|
||
export default ModalComponent.extend({ | ||
generatedHtml: alias('model') | ||
}); |
Oops, something went wrong.