Skip to content

Commit f41a62e

Browse files
committed
initial mock demo
1 parent 1db950b commit f41a62e

29 files changed

+93701
-0
lines changed

app/app.js

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
var DEMOS = [
2+
{
3+
module: 'sideMenusSimple',
4+
url: '/directive/ionSideMenus/simple',
5+
href: '#/directive/ionSideMenus/simple',
6+
templateUrl: 'demo/directive/ionSideMenus/simple/template.html'
7+
}
8+
];
9+
10+
var demoApp = angular.module('ionicDemo', ['ionic']
11+
.concat(DEMOS.map(function(demo) {
12+
return demo.module;
13+
}))
14+
);
15+
16+
demoApp.constant('Demos', DEMOS);
17+
18+
demoApp.config(function($stateProvider, $urlRouterProvider, Demos) {
19+
20+
$stateProvider.state('index', {
21+
url: '/',
22+
templateUrl: 'app/index.template.html'
23+
});
24+
25+
Demos.forEach(function(demo) {
26+
$stateProvider.state(demo.module, {
27+
url: demo.url,
28+
templateUrl: demo.templateUrl
29+
});
30+
});
31+
32+
$urlRouterProvider.otherwise('/');
33+
});
34+
35+
demoApp.controller('IonicDemoCtrl', function($scope, Demos) {
36+
$scope.demos = Demos;
37+
38+
});
39+
40+
//If a template has a header bar, hide our navbar and add our own back button
41+
demoApp.directive('ionView', function($ionicNavBarDelegate, $timeout, $rootScope, $ionicViewService) {
42+
var hasBackButton;
43+
$rootScope.$on('$viewHistory.historyChange', function(e, data) {
44+
hasBackButton = !!data.showBack;
45+
});
46+
return {
47+
restrict: 'E',
48+
link: function(scope, element, attr) {
49+
$timeout(init);
50+
function init() {
51+
var header = angular.element(element[0].querySelector('ion-header-bar'));
52+
if (header.length && hasBackButton) {
53+
var backButton = angular.element('<div class="button">← DEMOS</div>');
54+
backButton.on('click', function(e) {
55+
var backView = $ionicViewService.getBackView();
56+
backView && backView.go();
57+
});
58+
59+
var parent = header[0].querySelector('.buttons') || header[0];
60+
parent.insertBefore(backButton[0], parent.firstElementChild);
61+
}
62+
}
63+
}
64+
};
65+
});

app/index.template.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<ion-view>
2+
<ion-header-bar class="bar-positive" align-title="left">
3+
<h1 class="title">All Demos</h1>
4+
</ion-header-bar>
5+
<ion-content>
6+
<ion-list>
7+
<ion-item ng-repeat="demo in demos" ng-href="{{demo.href}}">
8+
{{demo.module}}
9+
</ion-item>
10+
</ion-list>
11+
</ion-content>
12+
</ion-view>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var app = angular.module('sideMenusSimple', ['ionic']);
2+
app.controller('SideMenusSimpleCtrl', function($scope, $ionicSideMenuDelegate) {
3+
4+
$scope.toggleLeft = function() {
5+
$ionicSideMenuDelegate.toggleLeft();
6+
};
7+
8+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.side-menus-simple-header {
2+
color: red;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<ion-view title="Side Menus Simple" ng-controller="SideMenusSimpleCtrl">
2+
<ion-side-menus>
3+
4+
<ion-side-menu-content>
5+
<ion-header-bar class="bar-positive">
6+
<div class="buttons">
7+
<div class="button button-clear" ng-click="toggleLeft()">
8+
<i class="icon ion-navicon"></i>
9+
</div>
10+
</div>
11+
</ion-header-bar>
12+
<ion-content>
13+
<h2 class="side-menus-simple-header">
14+
Hello!
15+
</h2>
16+
</ion-side-menu-content>
17+
</ion-side-menu-content>
18+
19+
<ion-side-menu side="left">
20+
<ion-header-bar class="bar-positive">
21+
</ion-header-bar>
22+
<ion-content>
23+
<a class="item" ng-click="toggleLeft()">
24+
Close Menu
25+
</a>
26+
</ion-content>
27+
</ion-side-menu>
28+
29+
</ion-side-menus>
30+
</ion-view>
31+

index.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!doctype html>
2+
<html ng-app="ionicDemo" ng-controller="IonicDemoCtrl">
3+
<head>
4+
<link rel="stylesheet" href="lib/ionic/css/ionic.min.css">
5+
6+
<!-- each demo stylesheet -->
7+
<link rel="stylesheet" href="demo/directive/ionSideMenus/simple/style.css">
8+
</head>
9+
<body>
10+
11+
<ion-nav-view animation="slide-left-right-ios7">
12+
</ion-nav-view>
13+
14+
<script src="lib/ionic/js/ionic.bundle.js"></script>
15+
<script src="app/app.js"></script>
16+
17+
<!-- each demo script -->
18+
<script src="demo/directive/ionSideMenus/simple/script.js"></script>
19+
</body>
20+
</html>

lib/ionic/css/ionic.css

+6,429
Large diffs are not rendered by default.

lib/ionic/css/ionic.min.css

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ionic/fonts/ionicons.eot

84.2 KB
Binary file not shown.

lib/ionic/fonts/ionicons.svg

+1,623
Loading

lib/ionic/fonts/ionicons.ttf

136 KB
Binary file not shown.

lib/ionic/fonts/ionicons.woff

47.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)