From 631658937ae124f5b1ab297f66ebf7898b49c418 Mon Sep 17 00:00:00 2001 From: Robinyo Date: Fri, 24 Jul 2015 15:01:52 +1000 Subject: [PATCH] Fixed the 'href' and related issues --- .gitignore | 34 ++++++++++ index.html | 10 +-- js/app.js | 134 ++++++++++++++++++++++----------------- js/controllers.js | 118 +++++++++++++++++++--------------- templates/browse.html | 2 + templates/menu.html | 33 +++++++--- templates/playlist.html | 2 + templates/playlists.html | 7 +- templates/search.html | 2 + 9 files changed, 218 insertions(+), 124 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b4b14f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +b-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules +out +bower_components +.bowerrc +.idea/* +*.iml +*.sublime-* +projectFilesBackup + +.DS_Store + +.build +.dist +.tmp + +# Test generated files + +# Built asset files + +# Coverage reports diff --git a/index.html b/index.html index a5825b9..b86f1f5 100644 --- a/index.html +++ b/index.html @@ -1,19 +1,20 @@ + - - + + - - + + @@ -26,4 +27,5 @@ + diff --git a/js/app.js b/js/app.js index 7219dc1..3289e9c 100644 --- a/js/app.js +++ b/js/app.js @@ -1,73 +1,89 @@ -// Ionic Starter App +/*! + * Ionic - Side menu Starter App + * MIT Licensed + */ -// 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 attribute in index.html) -// the 2nd parameter is an array of 'requires' -// 'starter.controllers' is found in controllers.js -angular.module('starter', ['ionic', 'starter.controllers']) +'use strict'; -.run(function($ionicPlatform) { - $ionicPlatform.ready(function() { - // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard - // for form inputs) - if (window.cordova && window.cordova.plugins.Keyboard) { - cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); - cordova.plugins.Keyboard.disableScroll(true); +angular.module('starter', [ + 'ionic' // inject the Ionic framework + // 'starter.controllers' +]) - } - if (window.StatusBar) { - // org.apache.cordova.statusbar required - StatusBar.styleDefault(); - } - }); -}) + .config(function($ionicConfigProvider, $stateProvider, $urlRouterProvider) { -.config(function($stateProvider, $urlRouterProvider) { - $stateProvider + $ionicConfigProvider.views.maxCache(10); // the default is 10 + $ionicConfigProvider.views.transition('platform'); + $ionicConfigProvider.views.forwardCache(false); // the default is false + $ionicConfigProvider.backButton.icon('ion-ios-arrow-back'); + $ionicConfigProvider.backButton.text(''); // default is 'Back' + $ionicConfigProvider.backButton.previousTitleText(false); // hides the 'Back' text + $ionicConfigProvider.templates.maxPrefetch(20); - .state('app', { - url: '/app', - abstract: true, - templateUrl: 'templates/menu.html', - controller: 'AppCtrl' - }) + $stateProvider + .state('app', { + url: '/app', + templateUrl: 'templates/menu.html', + controller: 'AppCtrl', + abstract: true + }) - .state('app.search', { - url: '/search', - views: { - 'menuContent': { - templateUrl: 'templates/search.html' - } - } - }) + .state('app.search', { + url: '/search', + views: { + 'menuContent': { + templateUrl: 'templates/search.html' + } + } + }) - .state('app.browse', { - url: '/browse', - views: { - 'menuContent': { - templateUrl: 'templates/browse.html' + .state('app.browse', { + url: '/browse', + views: { + 'menuContent': { + templateUrl: 'templates/browse.html' + } } - } - }) - .state('app.playlists', { - url: '/playlists', - views: { + }) + + .state('app.playlists', { + url: '/playlists', + views: { + 'menuContent': { + templateUrl: 'templates/playlists.html', + controller: 'PlaylistsCtrl' + } + } + }) + + .state('app.single', { + url: '/playlists/{playlistId}', // {} supports regex + views: { 'menuContent': { - templateUrl: 'templates/playlists.html', - controller: 'PlaylistsCtrl' + templateUrl: 'templates/playlist.html', + controller: 'PlaylistCtrl' + } } + }); + + // if none of the above states are matched, use this as the fallback + $urlRouterProvider.otherwise('/app/playlists'); + }) + + .run(function($ionicPlatform) { + $ionicPlatform.ready(function() { + + // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard + // for form inputs) + if (window.cordova && window.cordova.plugins.Keyboard) { + cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); + cordova.plugins.Keyboard.disableScroll(true); } - }) - .state('app.single', { - url: '/playlists/:playlistId', - views: { - 'menuContent': { - templateUrl: 'templates/playlist.html', - controller: 'PlaylistCtrl' + if (window.StatusBar) { + // org.apache.cordova.statusbar required + StatusBar.styleDefault(); } - } + + }); }); - // if none of the above states are matched, use this as the fallback - $urlRouterProvider.otherwise('/app/playlists'); -}); diff --git a/js/controllers.js b/js/controllers.js index 95c5b6c..d0b152d 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -1,56 +1,74 @@ -angular.module('starter.controllers', []) +/*! + * Ionic - Side menu Starter App + * MIT Licensed + */ -.controller('AppCtrl', function($scope, $ionicModal, $timeout) { +'use strict'; - // With the new view caching in Ionic, Controllers are only called - // when they are recreated or on app start, instead of every page change. - // To listen for when this page is active (for example, to refresh data), - // listen for the $ionicView.enter event: - //$scope.$on('$ionicView.enter', function(e) { - //}); +angular.module('starter') + .controller('AppCtrl', function( + $log, // inject the $log service + $scope, // inject the $scope service + $ionicModal, // inject the $ionicModal service + $timeout // inject the $timeout service + ) { - // Form data for the login modal - $scope.loginData = {}; + $log.info('AppCtrl'); - // Create the login modal that we will use later - $ionicModal.fromTemplateUrl('templates/login.html', { - scope: $scope - }).then(function(modal) { - $scope.modal = modal; + $scope.$on('$ionicView.beforeEnter', function() { + // The view has fully entered and is now the active view. + // This event will fire, whether it was the first load or a cached view. + $log.info('AppCtrl - $ionicView.beforeEnter'); + }); + + // 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('PlaylistsCtrl', function($scope) { + $scope.playlists = [ + { title: 'Reggae', id: 1 }, + { title: 'Chill', id: 2 }, + { title: 'Dubstep', id: 3 }, + { title: 'Indie', id: 4 }, + { title: 'Rap', id: 5 }, + { title: 'Cowbell', id: 6 } + ]; + }) + + .controller('PlaylistCtrl', function($log) { + $log.info('PlaylistCtrl'); }); - // 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('PlaylistsCtrl', function($scope) { - $scope.playlists = [ - { title: 'Reggae', id: 1 }, - { title: 'Chill', id: 2 }, - { title: 'Dubstep', id: 3 }, - { title: 'Indie', id: 4 }, - { title: 'Rap', id: 5 }, - { title: 'Cowbell', id: 6 } - ]; -}) - -.controller('PlaylistCtrl', function($scope, $stateParams) { -}); + + + + diff --git a/templates/browse.html b/templates/browse.html index 28a2d56..4549199 100644 --- a/templates/browse.html +++ b/templates/browse.html @@ -1,5 +1,7 @@ +

Browse

+
diff --git a/templates/menu.html b/templates/menu.html index 2abb7b1..1b6aeb2 100644 --- a/templates/menu.html +++ b/templates/menu.html @@ -1,36 +1,49 @@ + - + + + - - + - + + + - -

Left

+ +

Left Menu

- + + Login - + Search - + Browse - + Playlists
+
diff --git a/templates/playlist.html b/templates/playlist.html index 8a62cfc..e518cf3 100644 --- a/templates/playlist.html +++ b/templates/playlist.html @@ -1,5 +1,7 @@ +

Playlist

+
diff --git a/templates/playlists.html b/templates/playlists.html index eb77388..2ad2739 100644 --- a/templates/playlists.html +++ b/templates/playlists.html @@ -1,9 +1,14 @@ + + - + {{playlist.title}} + + diff --git a/templates/search.html b/templates/search.html index 7482416..022def9 100644 --- a/templates/search.html +++ b/templates/search.html @@ -1,5 +1,7 @@ +

Search

+