Created
September 30, 2015 21:20
-
-
Save barmatz/e8572ddc9a7eb1d13d93 to your computer and use it in GitHub Desktop.
Ember Bootstrap Modal
This file contains hidden or 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
| (function () { | |
| 'use strict'; | |
| App.XModalComponent = Ember.Component.extend({ | |
| title: null, | |
| backdrop: true, | |
| keyboard: true, | |
| propertiesDidChange: Ember.observer('backdrop', 'keyboard', function () { | |
| this.refresh(); | |
| }), | |
| refresh: function () { | |
| var self = this | |
| , backdrop = this.get('backdrop') | |
| , keyboard = this.get('keyboard'); | |
| this.$('.modal').modal({ | |
| backdrop: backdrop, | |
| keyboard: keyboard | |
| }) | |
| .on('show.bs.modal', function () { | |
| self.sendAction('showing'); | |
| }) | |
| .on('shown.bs.modal', function () { | |
| self.sendAction('showed'); | |
| }) | |
| .on('hide.bs.modal', function () { | |
| self.sendAction('hiding'); | |
| }) | |
| .on('hidden.bs.modal', function () { | |
| self.destroy(); | |
| }); | |
| }, | |
| toggle: function () { | |
| this.$('.modal').modal('toggle'); | |
| }, | |
| show: function () { | |
| this.$('.modal').modal('show'); | |
| }, | |
| hide: function () { | |
| this.$('.modal').modal('hide'); | |
| }, | |
| handleUpdate: function () { | |
| this.$('.modal').modal('handleUpdate'); | |
| }, | |
| didInsertElement: function () { | |
| this.refresh(); | |
| }, | |
| willDestroyElement: function () { | |
| this.sendAction('hidden'); | |
| } | |
| }); | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment