feat(modal): On larger displays modals will be inset and centered, not full width/height, closes #783

This commit is contained in:
Adam Bradley
2014-03-13 22:14:28 -05:00
parent c912832b0b
commit ba2a40c845
3 changed files with 66 additions and 21 deletions

View File

@@ -82,6 +82,8 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
var self = this;
var modalEl = angular.element(self.modalEl);
self.el.classList.remove('hide');
$document[0].body.classList.add('modal-open');
self._isShown = true;
@@ -97,13 +99,14 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
$timeout(function(){
modalEl.addClass('ng-enter-active');
self.scope.$parent && self.scope.$parent.$broadcast('modal.shown');
self.el.classList.add('active');
}, 20);
self._deregisterBackButton = $ionicPlatform.registerBackButtonAction(function(){
self.hide();
}, 200);
ionic.views.Modal.prototype.show.call(this);
ionic.views.Modal.prototype.show.call(self);
},
@@ -113,9 +116,11 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
* @description Hide this modal instance.
*/
hide: function() {
this._isShown = false;
var modalEl = angular.element(this.modalEl);
var self = this;
self._isShown = false;
var modalEl = angular.element(self.modalEl);
self.el.classList.remove('active');
modalEl.addClass('ng-leave');
$timeout(function(){
@@ -125,13 +130,14 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
$timeout(function(){
$document[0].body.classList.remove('modal-open');
self.el.classList.add('hide');
}, 350);
ionic.views.Modal.prototype.hide.call(this);
ionic.views.Modal.prototype.hide.call(self);
this.scope.$parent && this.scope.$parent.$broadcast('modal.hidden');
self.scope.$parent && self.scope.$parent.$broadcast('modal.hidden');
this._deregisterBackButton && this._deregisterBackButton();
self._deregisterBackButton && self._deregisterBackButton();
},
/**