<div class="panel-title text-center">[% l('Item Search and Cataloging') %]</div>
</div>
<div class="panel-body">
+ <div class="row">
+ <div class="col-md-8">
+ <input focus-me="focus_search"
+ class="form-control" ng-model="cat_query" type="text"
+ ng-keypress="catalog_search($event)"
+ placeholder="[% l('Search catalog for...') %]"/>
+ </div>
+ <div class="col-md-4">
+ <button class='btn btn-default' ng-click="catalog_search()">
+ [% l('Search') %]
+ </button>
+ </div>
+ </div>
<div>
<img src="/xul/server/skin/media/images/portal/bucket.png"/>
<a target="_self" href="./cat/bucket/record/">[% l('Record Buckets') %]</a>
/**
* Splash page dynamic content.
*/
-.controller('SplashCtrl', ['$scope',
- function($scope) {
- console.log('SplashCtrl');
+.controller('SplashCtrl', ['$scope', '$window', function($scope, $window) {
+ console.log('SplashCtrl');
+ $scope.focus_search = true;
+
+ $scope.catalog_search = function($event) {
+ $scope.focus_search = true;
+ if (!$scope.cat_query) return;
+ if ($event && $event.keyCode != 13) return; // input ng-keypress
+ $window.location.href =
+ '/eg/staff/cat/catalog/results?query=' +
+ encodeURIComponent($scope.cat_query);
}
-]);
+}]);
resolve : resolver
});
+ // Jump directly to the results page. Any URL parameter
+ // supported by the embedded catalog is supported here.
+ $routeProvider.when('/cat/catalog/results', {
+ templateUrl: './cat/catalog/t_catalog',
+ controller: 'CatalogCtrl',
+ resolve : resolver
+ });
+
$routeProvider.when('/cat/catalog/retrieve_by_id', {
templateUrl: './cat/catalog/t_retrieve_by_id',
controller: 'CatalogRecordRetrieve',
url = url.replace(/advanced/, '/record/' + $scope.record_id);
}
+ // Jumping directly to the results page by passing a search
+ // query via the URL. Copy all URL params to the iframe url.
+ if ($location.path().match(/catalog\/results/)) {
+ url = url.replace(/advanced/, '/results?');
+ var first = true;
+ angular.forEach($location.search(), function(val, key) {
+ if (!first) url += '&';
+ first = false;
+ url += encodeURIComponent(key)
+ + '=' + encodeURIComponent(val);
+ });
+ }
+
$scope.catalog_url = url;
}