mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Fixes for tab demo
This commit is contained in:
5
dist/css/ionic-ios7.css
vendored
5
dist/css/ionic-ios7.css
vendored
@ -359,8 +359,11 @@ body, .ionic-body {
|
||||
.has-header {
|
||||
margin-top: 44px; }
|
||||
|
||||
.has-footer {
|
||||
margin-bottom: 44px; }
|
||||
|
||||
.has-tabs {
|
||||
bottom: 49px; }
|
||||
margin-bottom: 84px; }
|
||||
|
||||
.page, .full-section {
|
||||
position: fixed;
|
||||
|
||||
4
dist/css/ionic-scoped.css
vendored
4
dist/css/ionic-scoped.css
vendored
@ -1095,8 +1095,10 @@
|
||||
-webkit-overflow-scrolling: touch; }
|
||||
.ionic .has-header {
|
||||
margin-top: 44px; }
|
||||
.ionic .has-footer {
|
||||
margin-bottom: 44px; }
|
||||
.ionic .has-tabs {
|
||||
bottom: 49px; }
|
||||
margin-bottom: 84px; }
|
||||
.ionic .page, .ionic .full-section {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
|
||||
5
dist/css/ionic.css
vendored
5
dist/css/ionic.css
vendored
@ -1423,8 +1423,11 @@ body, .ionic-body {
|
||||
.has-header {
|
||||
margin-top: 44px; }
|
||||
|
||||
.has-footer {
|
||||
margin-bottom: 44px; }
|
||||
|
||||
.has-tabs {
|
||||
bottom: 49px; }
|
||||
margin-bottom: 84px; }
|
||||
|
||||
.page, .full-section {
|
||||
position: fixed;
|
||||
|
||||
25
dist/js/ionic-angular.js
vendored
25
dist/js/ionic-angular.js
vendored
@ -214,6 +214,9 @@ angular.module('ionic.ui.content', [])
|
||||
if(attr.hasHeader) {
|
||||
c.addClass('has-header');
|
||||
}
|
||||
if(attr.hasFooter) {
|
||||
c.addClass('has-footer');
|
||||
}
|
||||
if(attr.hasTabs) {
|
||||
c.addClass('has-tabs');
|
||||
}
|
||||
@ -285,7 +288,6 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
|
||||
$scope.$watch('isEditing', function(v) {
|
||||
_this.isEditing = true;
|
||||
console.log('Is Editing Changed', v);
|
||||
});
|
||||
},
|
||||
|
||||
@ -558,13 +560,21 @@ angular.module('ionic.ui.tabs', [])
|
||||
return {
|
||||
restrict: 'CA',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
template: '<div ng-show="isVisible" ng-transclude></div>',
|
||||
require: '^tabController',
|
||||
scope: true,
|
||||
link: function(scope, element, attrs, tabsCtrl) {
|
||||
scope.$watch('isVisible', function(value) {
|
||||
if(!value) {
|
||||
element[0].style.display = 'none';
|
||||
} else {
|
||||
element[0].style.display = 'block';
|
||||
}
|
||||
});
|
||||
|
||||
scope.title = attrs.title;
|
||||
scope.icon = attrs.icon;
|
||||
scope.iconOn = attrs.iconOn;
|
||||
scope.iconOff = attrs.iconOff;
|
||||
tabsCtrl.addController(scope);
|
||||
}
|
||||
}
|
||||
@ -579,7 +589,7 @@ angular.module('ionic.ui.tabs', [])
|
||||
replace: true,
|
||||
scope: true,
|
||||
template: '<div class="tabs tabs-primary">' +
|
||||
'<tab-item title="{{controller.title}}" icon="{{controller.icon}}" active="controller.isVisible" index="$index" ng-repeat="controller in controllers"></tab-item>' +
|
||||
'<tab-item title="{{controller.title}}" icon="{{controller.icon}}" icon-on="{{controller.iconOn}}" icon-off="{{controller.iconOff}}" active="controller.isVisible" index="$index" ng-repeat="controller in controllers"></tab-item>' +
|
||||
'</div>'
|
||||
}
|
||||
})
|
||||
@ -591,7 +601,8 @@ angular.module('ionic.ui.tabs', [])
|
||||
require: '^tabController',
|
||||
scope: {
|
||||
title: '@',
|
||||
icon: '@',
|
||||
iconOn: '@',
|
||||
iconOff: '@',
|
||||
active: '=',
|
||||
tabSelected: '@',
|
||||
index: '='
|
||||
@ -604,7 +615,9 @@ angular.module('ionic.ui.tabs', [])
|
||||
},
|
||||
template:
|
||||
'<a href="#" ng-class="{active:active}" ng-click="selectTab()" class="tab-item">' +
|
||||
'<i class="{{icon}}"></i> {{title}}' +
|
||||
'<i class="{{icon}}" ng-if="icon"></i>' +
|
||||
'<i class="{{iconOn}}" ng-if="active"></i>' +
|
||||
'<i class="{{iconOff}}" ng-if="!active"></i> {{title}}' +
|
||||
'</a>'
|
||||
}
|
||||
});
|
||||
|
||||
16
dist/js/ionic.js
vendored
16
dist/js/ionic.js
vendored
@ -1920,8 +1920,6 @@ window.ionic = {
|
||||
newX = Math.min(-buttonsWidth, -buttonsWidth + (((e.gesture.deltaX + buttonsWidth) * 0.4)));
|
||||
}
|
||||
|
||||
console.log(newX);
|
||||
|
||||
_this._currentDrag.content.style.webkitTransform = 'translate3d(' + newX + 'px, 0, 0)';
|
||||
}
|
||||
});
|
||||
@ -2024,7 +2022,6 @@ window.ionic = {
|
||||
|
||||
if(_this._isDragging) {
|
||||
var newY = _this._currentDrag.startOffsetTop + e.gesture.deltaY;
|
||||
console.log(newY);
|
||||
|
||||
_this.el.style.top = newY + 'px';
|
||||
|
||||
@ -2046,25 +2043,12 @@ window.ionic = {
|
||||
var index = siblings.indexOf(this._currentDrag.placeholder);
|
||||
var topSibling = siblings[Math.max(0, index - 1)];
|
||||
var bottomSibling = siblings[Math.min(siblings.length, index+1)];
|
||||
|
||||
/*
|
||||
console.log('Reordering from index', index);
|
||||
console.dir(this.el);
|
||||
console.dir(topSibling);
|
||||
console.dir(bottomSibling);
|
||||
*/
|
||||
|
||||
|
||||
var thisOffsetTop = this._currentDrag.currentY;// + this._currentDrag.startOffsetTop;
|
||||
|
||||
console.log('Comparing', thisOffsetTop, 'with', (topSibling && topSibling.offsetTop + topSibling.offsetHeight/2), (bottomSibling && bottomSibling.offsetTop + bottomSibling.offsetHeight/2));
|
||||
|
||||
if(topSibling && (thisOffsetTop < topSibling.offsetTop + topSibling.offsetHeight/2)) {
|
||||
console.log('Swapping up with index', index - 1);
|
||||
ionic.DomUtil.swapNodes(this._currentDrag.placeholder, topSibling);
|
||||
return index - 1;
|
||||
} else if(bottomSibling && thisOffsetTop > (bottomSibling.offsetTop + bottomSibling.offsetHeight/2)) {
|
||||
console.log('Swapping down with index', index + 1);
|
||||
ionic.DomUtil.swapNodes(bottomSibling, this._currentDrag.placeholder);
|
||||
return index + 1;
|
||||
}
|
||||
|
||||
0
example/demo.html
Normal file
0
example/demo.html
Normal file
3
js/ext/angular/src/directive/ionicContent.js
vendored
3
js/ext/angular/src/directive/ionicContent.js
vendored
@ -17,6 +17,9 @@ angular.module('ionic.ui.content', [])
|
||||
if(attr.hasHeader) {
|
||||
c.addClass('has-header');
|
||||
}
|
||||
if(attr.hasFooter) {
|
||||
c.addClass('has-footer');
|
||||
}
|
||||
if(attr.hasTabs) {
|
||||
c.addClass('has-tabs');
|
||||
}
|
||||
|
||||
1
js/ext/angular/src/directive/ionicList.js
vendored
1
js/ext/angular/src/directive/ionicList.js
vendored
@ -60,7 +60,6 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
|
||||
$scope.$watch('isEditing', function(v) {
|
||||
_this.isEditing = true;
|
||||
console.log('Is Editing Changed', v);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
21
js/ext/angular/src/directive/ionicTabBar.js
vendored
21
js/ext/angular/src/directive/ionicTabBar.js
vendored
@ -46,13 +46,21 @@ angular.module('ionic.ui.tabs', [])
|
||||
return {
|
||||
restrict: 'CA',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
template: '<div ng-show="isVisible" ng-transclude></div>',
|
||||
require: '^tabController',
|
||||
scope: true,
|
||||
link: function(scope, element, attrs, tabsCtrl) {
|
||||
scope.$watch('isVisible', function(value) {
|
||||
if(!value) {
|
||||
element[0].style.display = 'none';
|
||||
} else {
|
||||
element[0].style.display = 'block';
|
||||
}
|
||||
});
|
||||
|
||||
scope.title = attrs.title;
|
||||
scope.icon = attrs.icon;
|
||||
scope.iconOn = attrs.iconOn;
|
||||
scope.iconOff = attrs.iconOff;
|
||||
tabsCtrl.addController(scope);
|
||||
}
|
||||
}
|
||||
@ -67,7 +75,7 @@ angular.module('ionic.ui.tabs', [])
|
||||
replace: true,
|
||||
scope: true,
|
||||
template: '<div class="tabs tabs-primary">' +
|
||||
'<tab-item title="{{controller.title}}" icon="{{controller.icon}}" active="controller.isVisible" index="$index" ng-repeat="controller in controllers"></tab-item>' +
|
||||
'<tab-item title="{{controller.title}}" icon="{{controller.icon}}" icon-on="{{controller.iconOn}}" icon-off="{{controller.iconOff}}" active="controller.isVisible" index="$index" ng-repeat="controller in controllers"></tab-item>' +
|
||||
'</div>'
|
||||
}
|
||||
})
|
||||
@ -79,7 +87,8 @@ angular.module('ionic.ui.tabs', [])
|
||||
require: '^tabController',
|
||||
scope: {
|
||||
title: '@',
|
||||
icon: '@',
|
||||
iconOn: '@',
|
||||
iconOff: '@',
|
||||
active: '=',
|
||||
tabSelected: '@',
|
||||
index: '='
|
||||
@ -92,7 +101,9 @@ angular.module('ionic.ui.tabs', [])
|
||||
},
|
||||
template:
|
||||
'<a href="#" ng-class="{active:active}" ng-click="selectTab()" class="tab-item">' +
|
||||
'<i class="{{icon}}"></i> {{title}}' +
|
||||
'<i class="{{icon}}" ng-if="icon"></i>' +
|
||||
'<i class="{{iconOn}}" ng-if="active"></i>' +
|
||||
'<i class="{{iconOff}}" ng-if="!active"></i> {{title}}' +
|
||||
'</a>'
|
||||
}
|
||||
});
|
||||
|
||||
@ -4,43 +4,46 @@
|
||||
<title>Tab Bars</title>
|
||||
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="stylesheet" href="../../../../dist/ionic.css">
|
||||
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular-touch.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular-animate.js"></script>
|
||||
<style>
|
||||
.content {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<tab-controller>
|
||||
<div title="Home" icon="icon-home" class="tab-content">
|
||||
<header class="bar bar-header bar-dark">
|
||||
<h1 class="title">Tab Bars</h1>
|
||||
|
||||
<div title="Home" icon-on="icon-ios7-filing" icon-off="icon-ios7-filing-outline" class="tab-content" ng-controller="HomeCtrl">
|
||||
<header class="bar bar-header bar-secondary">
|
||||
<h1 class="title">Tasks</h1>
|
||||
<button class="button button-clear button-primary" ng-click="isEditingItems = !isEditingItems">Edit</button>
|
||||
</header>
|
||||
<content has-header="true" has-tabs="true">
|
||||
<h1>Home</h1>
|
||||
<ul class="list" ng-controller="HomeCtrl">
|
||||
<a href="#" class="list-item" ng-repeat="item in items">
|
||||
<list is-editing="isEditingItems" animation="my-repeat-animation" delete-icon="icon-minus-circled" reorder-icon="icon-navicon">
|
||||
<list-item ng-repeat="item in items"
|
||||
buttons="item.buttons"
|
||||
can-delete="true"
|
||||
can-reorder="true"
|
||||
can-swipe="true"
|
||||
on-delete="deleteProject(project)"
|
||||
on-select="selectProject(project)">
|
||||
{{item.title}}
|
||||
</a>
|
||||
</ul>
|
||||
<i class="{{item.icon}}"></i>
|
||||
</list-item>
|
||||
</list>
|
||||
</content>
|
||||
</div>
|
||||
|
||||
<div title="About" icon="icon-info" class="tab-content">
|
||||
<header class="bar bar-header bar-success">
|
||||
<h1 class="title">About</h1>
|
||||
<div title="About" icon-on="icon-ios7-clock" icon-off="icon-ios7-clock-outline" class="tab-content">
|
||||
<header class="bar bar-header bar-secondary">
|
||||
<h1 class="title">Deadlines</h1>
|
||||
</header>
|
||||
<content has-header="true" has-tabs="true">
|
||||
<h1>About Us</h1>
|
||||
<h1>Deadlines</h1>
|
||||
</content>
|
||||
</div>
|
||||
|
||||
<div title="Settings" icon="icon-gear" class="tab-content">
|
||||
<header class="bar bar-header bar-dark">
|
||||
<div title="Settings" icon-on="icon-ios7-gear" icon-off="icon-ios7-gear-outline" class="tab-content">
|
||||
<header class="bar bar-header bar-secondary">
|
||||
<h1 class="title">Settings</h1>
|
||||
</header>
|
||||
<content has-header="true" has-tabs="true">
|
||||
@ -49,17 +52,16 @@
|
||||
</div>
|
||||
</tab-controller>
|
||||
|
||||
<script src="../../../../dist/ionic.js"></script>
|
||||
<script src="../src/directive/ionicContent.js"></script>
|
||||
<script src="../src/directive/ionicTabBar.js"></script>
|
||||
<script src="../../../../dist/js/ionic.js"></script>
|
||||
<script src="../../../../dist/js/ionic-angular.js"></script>
|
||||
<script>
|
||||
angular.module('tabsTest', ['ionic.ui.tabs'])
|
||||
angular.module('tabsTest', ['ionic.ui'])
|
||||
|
||||
.controller('HomeCtrl', function($scope) {
|
||||
$scope.items = [];
|
||||
for(var i = 0; i < 100; i++) {
|
||||
for(var i = 0; i < 30; i++) {
|
||||
$scope.items.push({
|
||||
title: 'Item ' + i
|
||||
title: 'Task ' + (i + 1)
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
@ -79,8 +79,6 @@
|
||||
newX = Math.min(-buttonsWidth, -buttonsWidth + (((e.gesture.deltaX + buttonsWidth) * 0.4)));
|
||||
}
|
||||
|
||||
console.log(newX);
|
||||
|
||||
_this._currentDrag.content.style.webkitTransform = 'translate3d(' + newX + 'px, 0, 0)';
|
||||
}
|
||||
});
|
||||
@ -183,7 +181,6 @@
|
||||
|
||||
if(_this._isDragging) {
|
||||
var newY = _this._currentDrag.startOffsetTop + e.gesture.deltaY;
|
||||
console.log(newY);
|
||||
|
||||
_this.el.style.top = newY + 'px';
|
||||
|
||||
@ -205,25 +202,12 @@
|
||||
var index = siblings.indexOf(this._currentDrag.placeholder);
|
||||
var topSibling = siblings[Math.max(0, index - 1)];
|
||||
var bottomSibling = siblings[Math.min(siblings.length, index+1)];
|
||||
|
||||
/*
|
||||
console.log('Reordering from index', index);
|
||||
console.dir(this.el);
|
||||
console.dir(topSibling);
|
||||
console.dir(bottomSibling);
|
||||
*/
|
||||
|
||||
|
||||
var thisOffsetTop = this._currentDrag.currentY;// + this._currentDrag.startOffsetTop;
|
||||
|
||||
console.log('Comparing', thisOffsetTop, 'with', (topSibling && topSibling.offsetTop + topSibling.offsetHeight/2), (bottomSibling && bottomSibling.offsetTop + bottomSibling.offsetHeight/2));
|
||||
|
||||
if(topSibling && (thisOffsetTop < topSibling.offsetTop + topSibling.offsetHeight/2)) {
|
||||
console.log('Swapping up with index', index - 1);
|
||||
ionic.DomUtil.swapNodes(this._currentDrag.placeholder, topSibling);
|
||||
return index - 1;
|
||||
} else if(bottomSibling && thisOffsetTop > (bottomSibling.offsetTop + bottomSibling.offsetHeight/2)) {
|
||||
console.log('Swapping down with index', index + 1);
|
||||
ionic.DomUtil.swapNodes(bottomSibling, this._currentDrag.placeholder);
|
||||
return index + 1;
|
||||
}
|
||||
|
||||
@ -78,12 +78,12 @@ body, .ionic-body {
|
||||
|
||||
.has-footer {
|
||||
//bottom: $bar-height;
|
||||
//margin-bottom: $bar-height;
|
||||
margin-bottom: $bar-height;
|
||||
}
|
||||
|
||||
// Specify that a content area will have tabs
|
||||
.has-tabs {
|
||||
bottom: $tabs-height;
|
||||
margin-bottom: 84px;
|
||||
}
|
||||
|
||||
.page, .full-section {
|
||||
|
||||
Reference in New Issue
Block a user