set major and minor platform versions in body css

This commit is contained in:
Adam Bradley
2014-01-31 20:57:26 -06:00
parent f37b196ff8
commit 7352be9010
6 changed files with 30 additions and 9 deletions

View File

@@ -2762,6 +2762,10 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
updateHeaderData(data);
});
$rootScope.$on('viewState.titleUpdated', function(e, data) {
$scope.currentTitle = (data && data.title ? data.title : '');
});
// If a nav page changes the left or right buttons, update our scope vars
$scope.$parent.$on('viewState.leftButtonsChanged', function(e, data) {
$scope.leftButtons = data;
@@ -2823,10 +2827,16 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
$scope.$emit('viewState.rightButtonsChanged', $scope.rightButtons);
});
// watch for changes in the title
var deregTitle = $scope.$watch('title', function(val) {
$scope.$emit('viewState.titleUpdated', $scope);
});
$scope.$on('$destroy', function(){
// deregister on destroy
deregLeftButtons();
deregRightButtons();
deregTitle();
});
};

View File

File diff suppressed because one or more lines are too long

7
dist/js/ionic.js vendored
View File

@@ -1794,20 +1794,23 @@ window.ionic = {
_checkPlatforms: function(platforms) {
this.platforms = [];
var v = this.version().toString().replace('.', '_');
if(this.isCordova()) {
this.platforms.push('cordova');
}
if(this.isIOS()) {
this.platforms.push('ios');
this.platforms.push('ios' + parseInt(this.version(), 10));
this.platforms.push('ios' + v.split('_')[0]);
this.platforms.push('ios' + v);
}
if(this.isIPad()) {
this.platforms.push('ipad');
}
if(this.isAndroid()) {
this.platforms.push('android');
this.platforms.push('android' + parseInt(this.version(), 10));
this.platforms.push('android' + v.split('_')[0]);
this.platforms.push('android' + v);
}
},

View File

File diff suppressed because one or more lines are too long

View File

@@ -35,6 +35,9 @@ describe('Ionic Platform Service', function() {
ionic.Platform.setVersion(' ');
expect(ionic.Platform.version()).toEqual(0);
ionic.Platform.setVersion('me-not-number');
expect(ionic.Platform.version()).toEqual(0);
ionic.Platform.setVersion('');
expect(ionic.Platform.version()).toEqual(0);
@@ -89,18 +92,20 @@ describe('Ionic Platform Service', function() {
expect(ionic.Platform.platforms[0]).toEqual('cordova');
expect(ionic.Platform.platforms[1]).toEqual('ios');
expect(ionic.Platform.platforms[2]).toEqual('ios7');
expect(ionic.Platform.platforms[3]).toEqual('ios7_9');
});
it('sets android platforms', function() {
window.cordova = {};
ionic.Platform.setPlatform('android');
ionic.Platform.setVersion('4.4.4');
ionic.Platform.setVersion('4.2.3');
ionic.Platform._checkPlatforms()
expect(ionic.Platform.platforms[0]).toEqual('cordova');
expect(ionic.Platform.platforms[1]).toEqual('android');
expect(ionic.Platform.platforms[2]).toEqual('android4');
expect(ionic.Platform.platforms[3]).toEqual('android4_2');
});
it('is android', function() {

View File

@@ -38,20 +38,23 @@
_checkPlatforms: function(platforms) {
this.platforms = [];
var v = this.version().toString().replace('.', '_');
if(this.isCordova()) {
this.platforms.push('cordova');
}
if(this.isIOS()) {
this.platforms.push('ios');
this.platforms.push('ios' + parseInt(this.version(), 10));
this.platforms.push('ios' + v.split('_')[0]);
this.platforms.push('ios' + v);
}
if(this.isIPad()) {
this.platforms.push('ipad');
}
if(this.isAndroid()) {
this.platforms.push('android');
this.platforms.push('android' + parseInt(this.version(), 10));
this.platforms.push('android' + v.split('_')[0]);
this.platforms.push('android' + v);
}
},