diff --git a/app/index.html b/app/index.html index c1eab18..550ed7d 100644 --- a/app/index.html +++ b/app/index.html @@ -130,14 +130,14 @@ - + - - + + diff --git a/package.json b/package.json index 5b0e582..02eb933 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,8 @@ "swiftHost": "www.wmnetwork.co.uk/swift/tickets/", "baseUrlOneapp": "https://www.wmnetwork.co.uk/oneapp/tickets/", "oneappHost": "www.wmnetwork.co.uk/oneapp/tickets/", + "baseUrlApp": "https://www.wmnetwork.co.uk/app/tickets/", + "appHost": "", "cdn": "https://cloudcdn.wmca.org.uk/wmnassets/apps/ticketing/2.15.99", "imgUrl": "https://cloudcdn.wmca.org.uk/wmnassets/apps/ticketing/2.15.99/img", "api": "https://api.wmnetwork.co.uk/ticketing/v2/", @@ -29,6 +31,8 @@ "swiftHost": "stagenwm.cenapps.org.uk/swift-ticket-search", "baseUrlOneapp": "https://stagenwm.cenapps.org.uk/oneapp-ticket-search", "oneappHost": "stagenwm.cenapps.org.uk/oneapp-ticket-search", + "baseUrlApp": "stagenwm.cenapps.org.uk/app-ticket-search", + "appHost": "stagenwm.cenapps.org.uk/app-ticket-search", "cdn": "https://cloudcdn.wmca.org.uk/wmnassets/apps/ticketing/2.15.99", "imgUrl": "https://cloudcdn.wmca.org.uk/wmnassets/apps/ticketing/2.15.99/img", "api": "https://ticketingv2mzr3ie67n5b62.azurewebsites.net/", @@ -36,11 +40,13 @@ "paygLink": "https://natex-ssp.unicard-uk.com/ssp/swift/dnr_importBasket.jsp" }, "ghpages": { - "baseUrl": "https://wmcadigital.github.io/tfwm-ticketing-legacy", - "baseUrlSwift": "https://wmcadigital.github.io/tfwm-ticketing-legacy/swift", + "baseUrl": "https://wmcadigital.github.io/tfwm-ticketing-legacy/", + "baseUrlSwift": "https://wmcadigital.github.io/tfwm-ticketing-legacy/swift/", "swiftHost": "wmcadigital.github.io/tfwm-ticketing-legacy", - "baseUrlOneapp": "https://wmcadigital.github.io/tfwm-ticketing-legacy/oneapp", + "baseUrlOneapp": "https://wmcadigital.github.io/tfwm-ticketing-legacy/oneapp/", "oneappHost": "wmcadigital.github.io/tfwm-ticketing-legacy/oneapp", + "baseUrlApp": "https://wmcadigital.github.io/tfwm-ticketing-legacy/app/", + "appHost": "wmcadigital.github.io/tfwm-ticketing-legacy/app", "cdn": "https://cloudcdn.wmca.org.uk/wmnassets/apps/ticketing/2.15.99", "imgUrl": "https://cloudcdn.wmca.org.uk/wmnassets/apps/ticketing/2.15.99/img", "api": "https://ticketingv2mzr3ie67n5b62.azurewebsites.net/", @@ -53,6 +59,8 @@ "swiftHost": "", "baseUrlOneapp": "", "oneappHost": "", + "baseUrlApp": "", + "appHost": "", "cdn": "https://cloudcdn.wmca.org.uk/wmnassets/apps/ticketing/2.15.99", "imgUrl": "https://cloudcdn.wmca.org.uk/wmnassets/apps/ticketing/2.15.99/img", "api": "https://ticketingv2mzr3ie67n5b62.azurewebsites.net/", @@ -65,6 +73,8 @@ "swiftHost": "", "baseUrlOneapp": "", "oneappHost": "", + "baseUrlApp": "", + "appHost": "", "cdn": "/build", "imgUrl": "https://cloudcdn.wmca.org.uk/wmnassets/apps/ticketing/2.15.99/img", "api": "https://wmca-api-portal-staging.azure-api.net/ticketing/v2/", @@ -76,6 +86,8 @@ "swiftHost": "", "baseUrlOneapp": "", "oneappHost": "", + "baseUrlApp": "", + "appHost": "", "cdn": "/build", "imgUrl": "https://cloudcdn.wmca.org.uk/wmnassets/apps/ticketing/2.15.99/img", "api": "https://api.wmnetwork.co.uk/ticketing/v2/", @@ -87,6 +99,8 @@ "swiftHost": "localhostSwift", "baseUrlOneapp": "//localhost:8080", "oneappHost": "localhostOneapp", + "baseUrlApp": "//localhost:8080", + "appHost": "", "cdn": "/build/", "imgUrl": "/build/img", "api": "https://tickets.api.stageapp.net/", diff --git a/src/app/js/app/app.js b/src/app/js/app/app.js new file mode 100644 index 0000000..afd886f --- /dev/null +++ b/src/app/js/app/app.js @@ -0,0 +1,94 @@ +/* eslint-disable angular/di */ +(function() { + 'use strict'; + + angular + .module('ticketingApp', [ + 'ngSanitize', + 'ngRoute', + 'angucomplete-alt', + 'angularGrid', + 'ng.deviceDetector' + ]) + .config(trustedURLs) + .config(routeProvider) + .run(analytics) + .constant('ngAuthSettings', { + // this is used for what build you require before uploading to the relevant dir on CDN, just un-comment the one you require below + baseURL: '$*baseUrlApp', + apiServiceBaseUri: '$*api', + + // LOCAL + local: true, // Changes logic in services.js based on if this is available + + buildNo: 'NWM Ticketing v2.0.0' + }); + trustedURLs.$inject = ['$sceDelegateProvider']; + function trustedURLs($sceDelegateProvider) { + $sceDelegateProvider.resourceUrlWhitelist([ + // Allow same origin resource loads. + 'self', + 'http://censlwebdev01/**', + // Allow loading from our assets domain. Notice the difference between * and **. + 'https:https://cloudcdn.wmca.org.uk/**', + 'http:https://cloudcdn.wmca.org.uk/**', + '$*baseUrlApp**' + ]); + } + routeProvider.$inject = ['$routeProvider', 'ngAuthSettings']; + function routeProvider($routeProvider) { + // console.log(ngAuthSettings.buildNo + ngAuthSettings.apiServiceBaseUri); // Log the build to the console + $routeProvider + .when('/', { + title: 'tickets', + controller: 'TicketingSearchCtrl', + templateUrl: 'tickets/views/app/index.html', + controllerAs: 'tickets', + reloadOnSearch: false + }) + + .when('/ticket/:ticket', { + title: 'ticket', + controller: 'TicketDetailCtrl', + controllerAs: 'ticket', + templateUrl: 'ticket/views/shared/index.html', + resolve: { + // Before page loads.. + getUnique: [ + 'savedFilter', + function(savedFilter) { + // Get the search page history url from cache + return savedFilter.get('stateless'); + } + ], + getURL: [ + 'savedFilter', + function(savedFilter) { + // get saved url from cache + return savedFilter.get('url'); + } + ] + }, + reloadOnSearch: false + }) + .otherwise({ + title: 'tickets', + redirectTo: '/' + }); + } + + // Safely instantiate dataLayer - This is so Google Analytics tracks properly via Tag Manager + analytics.$inject = ['$rootScope', '$location', '$window']; + function analytics($rootScope, $location, $window) { + const dataLayer = $window.dataLayer || []; + + $rootScope.$on('$routeChangeSuccess', function() { + dataLayer.push({ + event: 'ngRouteChange', + attributes: { + route: $location.absUrl().split('https://www.tfwm.org.uk')[1] + } + }); + }); + } +})(); diff --git a/src/app/js/app/ticket.templates.js b/src/app/js/app/ticket.templates.js new file mode 100644 index 0000000..9c45fdb --- /dev/null +++ b/src/app/js/app/ticket.templates.js @@ -0,0 +1,67 @@ +(function() { + 'use strict'; + + angular + .module('ticketingApp') + .directive('detailDetails', detailDetails) + .directive('detailSidebar', detailSidebar) + .directive('detailAlternative', detailAlternative) + .directive('detailRelated', detailRelated) + .directive('detailWhere', detailWhere) + .directive('operators', operators); + + // DIRECTIVES + + function detailDetails() { + return { + templateUrl: 'ticket/views/shared/details.html', + restrict: 'E' + }; + } + + function detailSidebar() { + return { + templateUrl: 'ticket/views/shared/sidebar.html', + restrict: 'E' + }; + } + + function detailAlternative() { + return { + templateUrl: 'ticket/views/shared/alternative.html', + restrict: 'E' + }; + } + + detailRelated.$inject = ['$timeout', 'angularGridInstance']; + function detailRelated($timeout, angularGridInstance) { + return { + templateUrl: 'ticket/views/shared/related-product.html', + restrict: 'E', + // this fixes a bug where the cards weren't loading on initial load in slow loading browsers + link: function(scope) { + scope.$$postDigest(function() { + angular.element(document).ready(function() { + $timeout(function() { + angularGridInstance.alternativeResults.refresh(); + }, 0); + }); + }); + } + }; + } + + function detailWhere() { + return { + templateUrl: 'ticket/views/shared/where-can-i-use.html', + restrict: 'E' + }; + } + + function operators() { + return { + templateUrl: 'ticket/views/shared/operator.html', + restrict: 'E' + }; + } +})(); diff --git a/src/app/js/app/tickets.templates.js b/src/app/js/app/tickets.templates.js new file mode 100644 index 0000000..a982a18 --- /dev/null +++ b/src/app/js/app/tickets.templates.js @@ -0,0 +1,64 @@ +(function() { + 'use strict'; + + angular + .module('ticketingApp') + .directive('searchResults', searchResults) + .directive('filters', filters) + .directive('filtersMobile', filtersMobile) + .directive('ticketItem', ticketItem); + + // DIRECTIVES + + searchResults.$inject = []; + function searchResults() { + return { + templateUrl: 'tickets/views/shared/search-results.html', + restrict: 'E' + }; + } + + filters.$inject = []; + function filters() { + return { + templateUrl: 'tickets/views/shared/filters.html', + restrict: 'E' + }; + } + + filtersMobile.$inject = []; + function filtersMobile() { + return { + templateUrl: 'tickets/views/shared/filters-mobile.html', + restrict: 'E' + }; + } + + ticketItem.$inject = ['$timeout', 'angularGridInstance']; + function ticketItem($timeout, angularGridInstance) { + return { + restrict: 'A', + // This fixes a bug where the cards weren't loading on initial load in slow loading browsers + link: function(scope) { + // start by waiting for digests to finish + scope.$$postDigest(function() { + // next we wait for the dom to be ready + angular.element(document).ready(function() { + // finally we apply a timeout with a value + // of 0 ms to allow any lingering js threads + // to catch up + $timeout(function() { + // your dom is ready and rendered + // if you have an ng-show wrapper + // hiding your view from the ugly + // render cycle, we can go ahead + // and unveil that now: + angularGridInstance.ticketResults.refresh(); + angularGridInstance.origTicketResults.refresh(); + }, 0); + }); + }); + } + }; + } +})(); diff --git a/src/app/tickets/views/app/index.html b/src/app/tickets/views/app/index.html new file mode 100644 index 0000000..5924783 --- /dev/null +++ b/src/app/tickets/views/app/index.html @@ -0,0 +1,41 @@ +
+ + + \ No newline at end of file