فهرست منبع

Removing unused templates for browse, login, search, session, updating templates and routing

David Leonard 10 سال پیش
والد
کامیت
a1fa08d636
4فایلهای تغییر یافته به همراه81 افزوده شده و 43 حذف شده
  1. 36 0
      ionic/www/index.html
  2. 2 33
      ionic/www/js/app.js
  3. 42 0
      ionic/www/js/controllers.js
  4. 1 10
      ionic/www/templates/menu.html

+ 36 - 0
ionic/www/index.html

@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
+    <title></title>
+
+    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
+    <link href="css/style.css" rel="stylesheet">
+
+    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
+    <link href="css/ionic.app.css" rel="stylesheet">
+    -->
+
+    <!-- Ionic / Angularjs js -->
+    <script src="lib/ionic/js/ionic.bundle.js"></script>
+    <script src="lib/ionic/js/angular/angular-resource.min.js"></script>
+
+    <!-- Cordova script (this will be a 404 during development) -->
+    <script src="cordova.js"></script>
+
+    <!-- Main application file -->
+    <script src="js/app.js"></script>
+
+    <!-- Controllers -->
+    <script src="js/controllers.js"></script>
+
+    <!-- Services -->
+    <script src="js/services.js"></script>
+    
+  </head>
+
+  <body ng-app="starter">
+    <ion-nav-view></ion-nav-view>
+  </body>
+</html>

+ 2 - 33
ionic/www/js/app.js

@@ -1,8 +1,3 @@
-// Ionic Starter App
-
-// angular.module is a global place for creating, registering and retrieving Angular modules
-// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
-// the 2nd parameter is an array of 'requires'
 // 'starter.controllers' is found in controllers.js
 // 'starter.controllers' is found in controllers.js
 angular.module('starter', ['ionic', 'starter.controllers'])
 angular.module('starter', ['ionic', 'starter.controllers'])
 
 
@@ -30,24 +25,8 @@ angular.module('starter', ['ionic', 'starter.controllers'])
     controller: 'AppCtrl'
     controller: 'AppCtrl'
   })
   })
 
 
-  .state('app.search', {
-    url: "/search",
-    views: {
-      'menuContent': {
-        templateUrl: "templates/search.html"
-      }
-    }
-  })
-
-  .state('app.browse', {
-    url: "/browse",
-    views: {
-      'menuContent': {
-        templateUrl: "templates/browse.html"
-      }
-    }
-  })
-    .state('app.sessions', {
+  
+  .state('app.sessions', {
     url: "/sessions",
     url: "/sessions",
     views: {
     views: {
         'menuContent': {
         'menuContent': {
@@ -57,16 +36,6 @@ angular.module('starter', ['ionic', 'starter.controllers'])
     }
     }
   })
   })
 
 
-  .state('app.session', {
-    url: "/sessions/:sessionId",
-    views: {
-        'menuContent': {
-          templateUrl: "templates/session.html",
-          controller: 'SessionCtrl'
-      }
-    }
-  });
-
   // if none of the above states are matched, use this as the fallback
   // if none of the above states are matched, use this as the fallback
   $urlRouterProvider.otherwise('/app/sessions');
   $urlRouterProvider.otherwise('/app/sessions');
 });
 });

+ 42 - 0
ionic/www/js/controllers.js

@@ -0,0 +1,42 @@
+angular.module('starter.controllers', ['starter.services'])
+
+.controller('AppCtrl', function($scope, $ionicModal, $timeout) {
+  // Form data for the login modal
+  $scope.loginData = {};
+
+  // Create the login modal that we will use later
+  $ionicModal.fromTemplateUrl('templates/login.html', {
+    scope: $scope
+  }).then(function(modal) {
+    $scope.modal = modal;
+  });
+
+  // Triggered in the login modal to close it
+  $scope.closeLogin = function() {
+    $scope.modal.hide();
+  };
+
+  // Open the login modal
+  $scope.login = function() {
+    $scope.modal.show();
+  };
+
+  // Perform the login action when the user submits the login form
+  $scope.doLogin = function() {
+    console.log('Doing login', $scope.loginData);
+
+    // Simulate a login delay. Remove this and replace with your login
+    // code if using a login system
+    $timeout(function() {
+      $scope.closeLogin();
+    }, 1000);
+  };
+})
+
+.controller('SessionsCtrl', function($scope, Session) {
+    $scope.sessions = Session.query();
+})
+
+.controller('SessionCtrl', function($scope, $stateParams, Session) {
+    $scope.session = Session.get({sessionId: $stateParams.sessionId});
+});

+ 1 - 10
ionic/www/templates/menu.html

@@ -14,19 +14,10 @@
 
 
   <ion-side-menu side="left">
   <ion-side-menu side="left">
     <ion-header-bar class="bar-stable">
     <ion-header-bar class="bar-stable">
-      <h1 class="title">Left</h1>
+      <h1 class="title">Applications</h1>
     </ion-header-bar>
     </ion-header-bar>
     <ion-content>
     <ion-content>
       <ion-list>
       <ion-list>
-        <ion-item nav-clear menu-close ng-click="login()">
-          Login
-        </ion-item>
-        <ion-item nav-clear menu-close href="#/app/search">
-          Search
-        </ion-item>
-        <ion-item nav-clear menu-close href="#/app/browse">
-          Browse
-        </ion-item>
         <ion-item nav-clear menu-close href="#/app/sessions">
         <ion-item nav-clear menu-close href="#/app/sessions">
             Sessions
             Sessions
         </ion-item>
         </ion-item>