* Simple default navbar style adjustements to apply the Evergreen color.
* TODO: style other components to match EG color scheme
*/
-.navbar-default {
+#top-navbar.navbar-default {
background: -webkit-linear-gradient(#00593d, #007a54);
background-color: #007a54;
color: #fff;
}
-
-.navbar-default .navbar-nav>li>a {
+#top-navbar.navbar-default .navbar-nav>li>a {
color: #fff;
}
-
-.navbar-default .navbar-nav>li>a:hover {
+#top-navbar.navbar-default .navbar-nav>li>a:hover {
color: #ddd;
}
-
-.navbar-default .navbar-nav>.dropdown>a .caret {
+#top-navbar.navbar-default .navbar-nav>.dropdown>a .caret {
border-top-color: #fff;
border-bottom-color: #fff;
}
-.navbar-default .navbar-nav>.dropdown>a:hover .caret {
+#top-navbar.navbar-default .navbar-nav>.dropdown>a:hover .caret {
border-top-color: #ddd;
border-bottom-color: #ddd;
}
+/* status bar along the bottom of the page ------------------------ */
+/* decrease padding to decrease overall height */
+#status-bar {
+ min-height:1.8em !important;
+}
+#status-bar > ul {
+ margin-right:6px;
+}
+#status-bar li {
+ padding-left: 10px;
+}
+#status-bar > li > a {
+ padding-top:5px !important;
+ padding-bottom:5px !important;
+}
+.status-bar-connected {
+ color: rgb(92, 184, 92); /* success */
+}
+
/* --------------------------------------------------------------------------
* Structural modifications
*/
--- /dev/null
+<!-- Status bar along the bottom of the page -->
+
+<div id="status-bar"
+ class="navbar navbar-default navbar-fixed-bottom"
+ role="navigation">
+
+ <!--
+ Define the status bar as a directive so it may be used globally.
+ The template is defined inline (below) to leverage i18n and
+ so one less network fetch is required.
+ -->
+ <eg-status-bar></eg-status-bar>
+ <script type="text/ng-template" id="eg-status-bar-template">
+ <ul class="nav navbar-nav navbar-right">
+ <li>{{messages[0]}}</li>
+ <li>
+ <span
+ title="[% l('Print/Store Connection Status') %]"
+ class="glyphicon glyphicon-transfer"
+ ng-class="{'status-bar-connected' : hatchConnected()}">
+ </span>
+ </li>
+ <li>
+ <span
+ title="[% l('Network Connection Status') %]"
+ class="glyphicon glyphicon-signal"
+ ng-class="{'status-bar-connected' : netConnected()}">
+ </span>
+ </li>
+ </ul>
+ </script>
+</div>
[% INCLUDE "staff/t_navbar.tt2" %]
<div id="top-content-container" class="container">[% content %]</div>
[%
+ # status bar along bottom of page
+ INCLUDE "staff/parts/statusbar.tt2";
+
+ # script imports
INCLUDE "staff/t_base_js.tt2";
# App-specific JS load commands go into an APP_JS block.
<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/startup.js"></script>
<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/printstore.js"></script>
<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/ui.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/statusbar.js"></script>
<!-- navbar driver -->
<script src="[% ctx.media_prefix %]/js/ui/default/staff/navbar.js"></script>
);
return deferred.promise;
}
- } else {
- patronSvc.lastSearch = fullSearch;
}
+ patronSvc.lastSearch = fullSearch;
+
if (fullSearch.search.id) {
// search by user id performs a direct ID lookup
var userId = fullSearch.search.id.value;
egStartup.go().then(
function() {
+
// login page will not have a cached user
if (!egAuth.user()) return;
}
// minify-safe dependency injection
-NavCtrl.$inject = ['$scope', '$window',
+NavCtrl.$inject = ['$scope', '$window',
'$location', 'egStartup', 'egAuth', 'egEnv'];
+
provider.query,
{ sort : provider.sort,
limit : count,
- offset : index
+ offset : offset
}
);
}
service.socket.onopen = function() {
console.debug('connected to Hatch');
service.hatchAvailable = true;
+ if (service.onHatchOpen)
+ service.onHatchOpen();
angular.forEach(service.pending, function(msg) {
service.socket.send(JSON.stringify(msg));
});
console.debug("disconnected from Hatch");
service.socket = null;
service.hatchAvailable = null; // reset
+ if (service.onHatchClose)
+ service.onHatchClose();
}
service.socket.onerror = function() {
console.debug(
"unable to connect to Hatch server at " + service.hatchURL);
service.redirectPendingMessages();
+ if (service.onHatchClose)
+ service.onHatchClose();
}
service.socket.onmessage = function(evt) {
return {
restrict : 'AE',
template : '<div>{{printContent}}</div>',
- controller : ['$scope', '$window', 'egPrintStore',
- function($scope, $window, egPrintStore) {
+ controller : ['$scope','$window','$timeout','egPrintStore',
+ function($scope, $window, $timeout, egPrintStore) {
egPrintStore.onBrowserPrint = function(mime, data) {
- console.log('printing ' + data.length + ' of ' + mime);
+ console.log('printing ' + data.length + ' chars of ' + mime);
switch(mime) {
case 'text/csv':
case 'text/plain':
}
// force the template to absorb the data before printing
- $scope.$apply();
- $window.print();
- $scope.printContent = '';
+ // if an apply/digest loop is not already in progress
+ //if (!$scope.$$phase) $scope.$apply();
+
+ $timeout(
+ function() {
+ $scope.$apply();
+ $window.print();
+ }
+ );
}
}
]
--- /dev/null
+/**
+ * egStatusBar
+ *
+ * Displays key information and messages to the user.
+ *
+ * Currently displays network connection status, egPrintStore connection
+ * status, and messages delivered via
+ * $scope.$emit('egStatusBarMessage', msg)
+ */
+
+angular.module('egCoreMod')
+
+.directive('egStatusBar', function() {
+ return {
+ restrict : 'AE',
+ replace : true,
+ templateUrl : 'eg-status-bar-template',
+ controller : [
+ '$scope', '$rootScope', 'egPrintStore',
+ function($scope, $rootScope, egPrintStore) {
+ $scope.messages = []; // keep a log of recent messages
+
+ $scope.netConnected = function() {
+ // TODO: should should be abstracted through egNet
+ return OpenSRF.websocketConnected();
+ }
+
+ // update the UI whenever we lose connection
+ OpenSRF.onWebSocketClosed = function() {
+ $scope.$apply();
+ }
+
+ $scope.hatchConnected = function() {
+ return egPrintStore.hatchAvailable;
+ }
+
+ // update the UI whenever we lose connection
+ egPrintStore.onHatchClose = function() {
+ $scope.$apply();
+ }
+
+ // update the UI whenever we lose connection
+ egPrintStore.onHatchOpen = function() {
+ $scope.$apply();
+ }
+
+ $rootScope.$on('egStatusBarMessage', function(evt, args) {
+ $scope.messages.unshift(args.message);
+
+ // ensure the list does not exceed 10 messages
+ // TODO: configurable?
+ $scope.messages.splice(10, 1);
+ });
+ }]
+ }
+});