Skip to content

Commit

Permalink
setup build for new test app
Browse files Browse the repository at this point in the history
  • Loading branch information
rolorogan committed Nov 7, 2024
1 parent dd873f9 commit 62e0ec5
Show file tree
Hide file tree
Showing 6 changed files with 286 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.min.js"></script>

<!-- App code -->
<script src="../js/oneapp.app.min.js"></script>
<script src="../js/app.app.min.js"></script>
<script src="../js/services.min.js"></script>
<script src="../js/controller.min.js"></script>
<script src="../js/directives.min.js"></script>
<script src="../js/shared.min.js"></script>
<script src="../js/assets.min.js"></script>
<script src="../js/oneapp.partials.min.js"></script>
<script src="../js/oneapp.shared.partials.min.js"></script>
<script src="../js/app.partials.min.js"></script>
<script src="../js/app.shared.partials.min.js"></script>

<!--<script src="assets/angucomplete-alt.min.js"></script>-->
<script src="https://cloudcdn.wmca.org.uk/nwmAssets/apps/shared/sharedFilters.js"></script>
Expand Down
20 changes: 17 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand All @@ -29,18 +31,22 @@
"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/",
"swiftGo": "Swift ABT",
"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/",
Expand All @@ -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/",
Expand All @@ -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/",
Expand All @@ -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/",
Expand All @@ -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/",
Expand Down
94 changes: 94 additions & 0 deletions src/app/js/app/app.js
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]
}
});
});
}
})();
67 changes: 67 additions & 0 deletions src/app/js/app/ticket.templates.js
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'
};
}
})();
64 changes: 64 additions & 0 deletions src/app/js/app/tickets.templates.js
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);
});
});
}
};
}
})();
41 changes: 41 additions & 0 deletions src/app/tickets/views/app/index.html
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>

0 comments on commit 62e0ec5

Please sign in to comment.