Implement export for 3rd Party sites

This commit is contained in:
Colin McLeod
2015-07-15 16:13:17 -07:00
parent 82a87cb653
commit ab1ea53ce3
11 changed files with 325 additions and 68 deletions

View File

@@ -1,4 +1,4 @@
angular.module('app').directive('shipyardHeader', ['lodash', '$rootScope', 'Persist', 'ShipsDB', function(_, $rootScope, Persist, ships) {
angular.module('app').directive('shipyardHeader', ['lodash', '$rootScope', '$state', 'Persist', 'Serializer', 'ShipsDB', function(_, $rootScope, $state, Persist, Serializer, ships) {
return {
restrict: 'E',
@@ -18,17 +18,6 @@ angular.module('app').directive('shipyardHeader', ['lodash', '$rootScope', 'Pers
$rootScope.discounts.ship = savedDiscounts[0];
$rootScope.discounts.components = savedDiscounts[1];
// Close menus if a navigation change event occurs
$rootScope.$on('$stateChangeStart', function() {
scope.openedMenu = null;
});
// Listen to close event to close opened menus or modals
$rootScope.$on('close', function() {
scope.openedMenu = null;
$rootScope.showAbout = false;
});
/**
* Save selected insurance option
*/
@@ -44,6 +33,13 @@ angular.module('app').directive('shipyardHeader', ['lodash', '$rootScope', 'Pers
$rootScope.$broadcast('discountChange');
};
scope.detailedExport = function(e) {
e.preventDefault();
e.stopPropagation();
scope.openedMenu = null;
$state.go('modal.export', { data: Serializer.toDetailedExport(scope.allBuilds) });
};
scope.openMenu = function(e, menu) {
e.stopPropagation();
if (menu == scope.openedMenu) {
@@ -58,16 +54,15 @@ angular.module('app').directive('shipyardHeader', ['lodash', '$rootScope', 'Pers
scope.openedMenu = menu;
};
scope.about = function(e) {
e.preventDefault();
e.stopPropagation();
// Close menus if a navigation change event occurs
$rootScope.$on('$stateChangeStart', function() {
scope.openedMenu = null;
$rootScope.showAbout = true;
};
});
$rootScope.hideAbout = function() {
$rootScope.showAbout = false;
};
// Listen to close event to close opened menus or modals
$rootScope.$on('close', function() {
scope.openedMenu = null;
});
scope.$watchCollection('allBuilds', function() {
scope.buildsList = Object.keys(scope.allBuilds).sort();