-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
286 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] | ||
} | ||
}); | ||
}); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
}; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
}); | ||
} | ||
}; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<div class="blocks cfx timetable-search-page"> | ||
<div class="block"> | ||
<div class="blocks"> | ||
<div class="block block--fullwidth"> | ||
<div class="boxin bdr-top--blue"> | ||
<h1>Ticket finder</h1> | ||
<hr> | ||
<search data-ng-cloak></search> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="block"> | ||
<div class="blocks"> | ||
<div class="block block--fullwidth"> | ||
<search-results data-ng-cloak></search-results> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<!-- pop-up modals --> | ||
<modal-dialog show="ticket.modalShownSwift" class="bdr-top--cyan hide" data-ng-cloak data-ng-if="tickets.loadingStatus == 'success'"> | ||
<div class="modalSwift" data-ng-if="ticket.loadingStatus == 'success'"> | ||
<div class="boxin"> | ||
<h2>Swift Card</h2> | ||
|
||
<span data-ng-if="ticket.all.isAdult || ticket.all.passengerType == 'Student18Plus' || ticket.all.passengerType == 'Concessionary'"><img src="$*imgUrl/season-swift-cardx2.png" alt="Adult season tickets" /></span> | ||
<span data-ng-if="ticket.all.isChild"><img src="$*imgUrl/child-swift-card.png" alt="Child season tickets" /></span> | ||
<span data-ng-if="ticket.all.id == '810'" data-ng-hide="ticket.all.id != '810'"><img src="$*imgUrl/payg-swift-cardx2.png" alt="Swift pay as you go" /></span> | ||
<!-- <span><img src="build/img/16-18-card.png" alt="16-18 photocard" /></span>--> | ||
|
||
<p>New to Swift? Please bear in mind it can take up to 5 working days for your new Swift card to arrive when bought online.</p> | ||
|
||
<p data-ng-if="ticket.all.requirePhotocard == true"><b>{{ticket.all.name}}</b> requires <span data-ng-if="ticket.all.passengerType == 'Child'">a Child</span><span data-ng-if="ticket.all.passengerType == 'Adult'">an Adult</span> Swift photocard</p> | ||
|
||
<a data-ng-if="ticket.all.buyTicketUrl" class="btn btn--arrow" data-ng-href="{{ticket.all.buyTicketUrl}}" target="_blank">Buy on Swift</a> | ||
</div> | ||
</div> | ||
</modal-dialog> |