From: Bill Erickson Date: Mon, 28 Oct 2013 18:11:39 +0000 (-0400) Subject: ff ui : orientation as url component X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2d7946b0d0d82a8b61b8cfa62c4b6f5e1aa155af;p=evergreen%2Fequinox.git ff ui : orientation as url component maintain our lender vs borrower filter orientation within the url so that browser-back returns the user to the correct list of items. it also helps simplify the code. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/fulfillment/t_actions.tt2 b/Open-ILS/src/templates/staff/fulfillment/t_actions.tt2 index c1743ffb4e..64674a05ba 100644 --- a/Open-ILS/src/templates/staff/fulfillment/t_actions.tt2 +++ b/Open-ILS/src/templates/staff/fulfillment/t_actions.tt2 @@ -12,23 +12,23 @@ diff --git a/Open-ILS/src/templates/staff/fulfillment/t_circulating.tt2 b/Open-ILS/src/templates/staff/fulfillment/t_circulating.tt2 index 9728e8ffb2..f82e6491e8 100644 --- a/Open-ILS/src/templates/staff/fulfillment/t_circulating.tt2 +++ b/Open-ILS/src/templates/staff/fulfillment/t_circulating.tt2 @@ -3,11 +3,11 @@
diff --git a/Open-ILS/src/templates/staff/fulfillment/t_ill.tt2 b/Open-ILS/src/templates/staff/fulfillment/t_ill.tt2 index bd60714c3f..854756ce79 100644 --- a/Open-ILS/src/templates/staff/fulfillment/t_ill.tt2 +++ b/Open-ILS/src/templates/staff/fulfillment/t_ill.tt2 @@ -1,12 +1,13 @@ diff --git a/Open-ILS/src/templates/staff/fulfillment/t_inbound.tt2 b/Open-ILS/src/templates/staff/fulfillment/t_inbound.tt2 index 5f597931ee..6d5e780004 100644 --- a/Open-ILS/src/templates/staff/fulfillment/t_inbound.tt2 +++ b/Open-ILS/src/templates/staff/fulfillment/t_inbound.tt2 @@ -4,11 +4,11 @@
diff --git a/Open-ILS/src/templates/staff/fulfillment/t_outbound.tt2 b/Open-ILS/src/templates/staff/fulfillment/t_outbound.tt2 index d9f6547739..7e6116107e 100644 --- a/Open-ILS/src/templates/staff/fulfillment/t_outbound.tt2 +++ b/Open-ILS/src/templates/staff/fulfillment/t_outbound.tt2 @@ -3,11 +3,11 @@
diff --git a/Open-ILS/src/templates/staff/fulfillment/t_pending.tt2 b/Open-ILS/src/templates/staff/fulfillment/t_pending.tt2 index f07932252a..25e9ba38fd 100644 --- a/Open-ILS/src/templates/staff/fulfillment/t_pending.tt2 +++ b/Open-ILS/src/templates/staff/fulfillment/t_pending.tt2 @@ -5,11 +5,11 @@
diff --git a/Open-ILS/web/js/ui/default/staff/fulfillment/app.js b/Open-ILS/web/js/ui/default/staff/fulfillment/app.js index 78db9fb9ea..0a5dde842d 100644 --- a/Open-ILS/web/js/ui/default/staff/fulfillment/app.js +++ b/Open-ILS/web/js/ui/default/staff/fulfillment/app.js @@ -22,22 +22,30 @@ angular.module('ffMain', ['ngRoute', 'egCoreMod', 'egUiMod', 'egUserMod']) controller: 'RecordsCtrl', resolve : resolver }); - - // Default to ILL management tabs + $routeProvider.when('/fulfillment/status/:barcode', { templateUrl: './fulfillment/t_ill', controller: 'ILLCtrl', resolve : resolver }); + $routeProvider.when('/fulfillment/status', { + templateUrl: './fulfillment/t_ill', + controller: 'ILLCtrl', + resolve : resolver + }); - // Default to ILL management tabs - $routeProvider.otherwise({ + $routeProvider.when('/fulfillment/:orientation/:tab', { templateUrl: './fulfillment/t_ill', controller: 'ILLCtrl', resolve : resolver }); + // Default to ILL management tabs + $routeProvider.otherwise({ + redirectTo : '/fulfillment/borrower/pending' + }); + $locationProvider.html5Mode(true); }) @@ -125,9 +133,16 @@ function ($scope, $route, egStartup, ffService, egAuth, egUser) { function ($scope, $q, $compile, $timeout, $rootScope, $location, $route, $routeParams, egNet, egAuth, ffService, egOrg) { - // tabs - var mytab = $location.path().match(/\/fulfillment\/([^\/]+)/)[1]; - $scope['tab_' + mytab] = true; + $scope.tabname = $routeParams.tab; + $scope.orientation = $routeParams.orientation; + + // URL format for /status needs a wee bit of manual handling + if (!$scope.tabname) $scope.tabname = 'status'; + + // bools useful for templates + $scope['tab_' + $scope.tabname] = true; + $scope['orientation_' + $scope.orientation] = true; + // so our child controllers can access our route info $scope.illRouteParams = $routeParams; @@ -139,13 +154,6 @@ function ($scope, $q, $compile, $timeout, $rootScope, $location, selected : {}, limit : 10, // TODO UI offset : 0, // TODO UI - filter_borrwer : true, - filterLender : false, - - toggleFilters : function(lender) { - $scope.itemList.filterBorrower = !lender; - $scope.itemList.filterLender = lender; - }, // select all rows in the list. if any are // already selected, de-select all. @@ -506,17 +514,16 @@ function ($scope, $q, $compile, $timeout, $rootScope, $location, ['$scope', '$q', 'egPCRUD', 'ffService', function ($scope, $q, egPCRUD, ffService) { - $scope.drawTable = function(filterLender) { + $scope.drawTable = function() { var deferred = $q.defer(); $scope.itemList.items = []; - $scope.itemList.toggleFilters(filterLender); var fullPath = ffService.relatedOrgs(); var dest = fullPath; // inbound transits var circ_lib = fullPath; // our copies - if ($scope.itemList.filterBorrower) { + if ($scope.orientation_borrower) { // borrower always means not-our-copies circ_lib = {'not in' : fullPath}; } @@ -563,17 +570,16 @@ function ($scope, $q, egPCRUD, ffService) { ['$scope', '$q', 'egPCRUD', 'ffService', function ($scope, $q, egPCRUD, ffService) { - $scope.drawTable = function(filterLender) { + $scope.drawTable = function() { var deferred = $q.defer(); $scope.itemList.items = []; - $scope.itemList.toggleFilters(filterLender); var fullPath = ffService.relatedOrgs(); var copy_lib = fullPath; // our copies var circ_lib = fullPath; // circulating here - if ($scope.itemList.filterLender) { + if ($scope.orientation_lender) { // borrower always means not-our-copies circ_lib = {'not in' : fullPath}; } else { @@ -691,7 +697,7 @@ function ($scope, $q, $route, egNet, egAuth, egPCRUD, egOrg, ffService) { if (hold_blob.volume) { display.call_number = hold_blob.volume.label(); } - if ($scope.itemList.filterLender) + if ($scope.orientation_lender) display.next_action = 'ill-home-capture'; }; @@ -725,10 +731,8 @@ function ($scope, $q, $route, egNet, egAuth, egPCRUD, egOrg, ffService) { ); */ - $scope.drawTable = function(filterLender) { + $scope.drawTable = function() { $scope.itemList.items = []; - $scope.itemList.toggleFilters(filterLender); - var fullPath = ffService.relatedOrgs(); var query = { @@ -737,7 +741,7 @@ function ($scope, $q, $route, egNet, egAuth, egPCRUD, egOrg, ffService) { frozen : 'f' }; - if ($scope.itemList.filterBorrower) { + if ($scope.orientation_borrower) { // holds for my patrons originate "here" // current_copy is not relevant query.request_lib = fullPath; @@ -791,17 +795,17 @@ function ($scope, $q, $route, egNet, egAuth, egPCRUD, egOrg, ffService) { $scope.firstPage = function() { $scope.itemList.offset = 0; - $scope.drawTable($scope.itemList.filterLender == true); + $scope.drawTable(); }; $scope.nextPage = function() { $scope.itemList.offset += $scope.itemList.limit; - $scope.drawTable($scope.itemList.filterLender == true); + $scope.drawTable(); }; $scope.prevPage = function() { $scope.itemList.offset -= $scope.itemList.limit; - $scope.drawTable($scope.itemList.filterLender == true); + $scope.drawTable(); }; $scope.drawTable();