mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Namespacing for controllers and views
This commit is contained in:
@ -20,7 +20,7 @@
|
||||
|
||||
<script src="../../js/events.js"></script>
|
||||
<script src="../../js/gestures.js"></script>
|
||||
<script src="../../js/controllers/sideMenuViewController.js"></script>
|
||||
<script src="../../js/controllers/sideMenuController.js"></script>
|
||||
|
||||
<script src="js/toderp.js"></script>
|
||||
<style>
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
(function(ionic) {
|
||||
NavController = function(opts) {
|
||||
|
||||
ionic.controllers = ionic.controllers || {};
|
||||
|
||||
ionic.controllers.NavController = function(opts) {
|
||||
var _this = this;
|
||||
|
||||
this.navBar = opts.navBar;
|
||||
@ -12,9 +15,9 @@
|
||||
this.navBar.shouldGoBack = function() {
|
||||
_this.pop();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
NavController.prototype = {
|
||||
ionic.controllers.NavController.prototype = {
|
||||
getControllers: function() {
|
||||
return this.controllers;
|
||||
},
|
||||
@ -101,5 +104,5 @@
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
};
|
||||
})(ionic = window.ionic || {});
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
(function(ionic) {
|
||||
|
||||
SideMenuController = function(options) {
|
||||
ionic.controllers = ionic.controllers || {};
|
||||
|
||||
ionic.controllers.SideMenuController = function(options) {
|
||||
var _this = this;
|
||||
|
||||
|
||||
@ -29,9 +31,9 @@
|
||||
_this._handleDrag(e);
|
||||
}, this.center);
|
||||
*/
|
||||
};
|
||||
};
|
||||
|
||||
SideMenuController.prototype = {
|
||||
ionic.controllers.SideMenuController.prototype = {
|
||||
toggleLeft: function() {
|
||||
var openAmount = this.getOpenAmount();
|
||||
if(openAmount > 0) {
|
||||
@ -186,6 +188,6 @@
|
||||
|
||||
this._lastX = e.gesture.touches[0].pageX;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
})(ionic = window.ionic || {});
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
(function(ionic) {
|
||||
|
||||
TabBarController = function(options) {
|
||||
ionic.controllers = ionic.controllers || {};
|
||||
|
||||
ionic.controllers.TabBarController = function(options) {
|
||||
this.tabBar = options.tabBar;
|
||||
|
||||
this._bindEvents();
|
||||
@ -20,7 +22,7 @@ TabBarController = function(options) {
|
||||
this.setSelectedController(0);
|
||||
};
|
||||
|
||||
TabBarController.prototype = {
|
||||
ionic.controllers.TabBarController.prototype = {
|
||||
// Start listening for events on our tab bar
|
||||
_bindEvents: function() {
|
||||
var _this = this;
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
(function(ionic) {
|
||||
|
||||
NavBar = function(opts) {
|
||||
ionic.ui.NavBar = function(opts) {
|
||||
this.el = opts.el;
|
||||
|
||||
this._titleEl = this.el.querySelector('.title');
|
||||
};
|
||||
};
|
||||
|
||||
NavBar.prototype = {
|
||||
ionic.ui.NavBar.prototype = {
|
||||
shouldGoBack: function() {},
|
||||
|
||||
setTitle: function(title) {
|
||||
@ -38,5 +37,5 @@
|
||||
this._currentBackButton.parentNode.removeChild(this._currentBackButton);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
})(ionic = window.ionic || {});
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
(function(ionic) {
|
||||
SideMenu = function(opts) {
|
||||
|
||||
ionic.ui = ionic.ui || {};
|
||||
|
||||
ionic.ui.SideMenu = function(opts) {
|
||||
this.el = opts.el;
|
||||
this.width = opts.width;
|
||||
this.isEnabled = opts.isEnabled || true;
|
||||
};
|
||||
};
|
||||
|
||||
SideMenu.prototype = {
|
||||
ionic.ui.SideMenu.prototype = {
|
||||
getFullWidth: function() {
|
||||
return this.width;
|
||||
},
|
||||
@ -18,5 +21,5 @@
|
||||
pushDown: function() {
|
||||
this.el.style.zIndex = -1;
|
||||
}
|
||||
};
|
||||
};
|
||||
})(ionic = window.ionic || {});
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
(function(ionic) {
|
||||
|
||||
TabBarItem = function(el) {
|
||||
ionic.ui = ionic.ui || {};
|
||||
|
||||
ionic.ui.TabBarItem = function(el) {
|
||||
this.el = el;
|
||||
|
||||
this._buildItem();
|
||||
};
|
||||
TabBarItem.prototype = {
|
||||
ionic.ui.TabBarItem.prototype = {
|
||||
// Factory for creating an item from a given javascript object
|
||||
create: function(itemData) {
|
||||
var item = document.createElement('a');
|
||||
@ -74,7 +76,7 @@ TabBarItem.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
TabBar = function(opts) {
|
||||
ionic.ui.TabBar = function(opts) {
|
||||
this.el = opts.el;
|
||||
|
||||
this.items = [];
|
||||
@ -82,7 +84,7 @@ TabBar = function(opts) {
|
||||
this._buildItems();
|
||||
};
|
||||
|
||||
TabBar.prototype = {
|
||||
ionic.ui.TabBar.prototype = {
|
||||
// get all the items for the TabBar
|
||||
getItems: function() {
|
||||
return this.items;
|
||||
|
||||
@ -134,14 +134,13 @@
|
||||
|
||||
</section>
|
||||
|
||||
<script src="../../js/ionic-events.js"></script>
|
||||
<script src="../../js/ionic-gestures.js"></script>
|
||||
<script src="../../js/controllers/ionic-tabcontroller.js"></script>
|
||||
<script src="../../js/events.js"></script>
|
||||
<script src="../../js/gestures.js"></script>
|
||||
<script src="../../js/controllers/tabBarController.js"></script>
|
||||
<script>
|
||||
|
||||
// Grab the sections
|
||||
var tab = document.getElementById('tab-bar');
|
||||
var controller = new ion.controllers.TabController({
|
||||
var controller = new ionic.controllers.TabController({
|
||||
tab: tab
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user