Commit 333a141e by dileep bhimineni Committed by Vishal Kadam

changes for search results and paginations

parent a10b34d1
......@@ -119,4 +119,8 @@ footer.navbar-bottom img {
height: auto;
min-height: 0;
padding: 5px 5px 5px 0;
}
.pagination {
float: right;
}
\ No newline at end of file
......@@ -25,6 +25,16 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
$scope.results = [];
$scope.resultCount=0;
$scope.isCollapsed = true;
$scope.currentPage = 1;
$scope.numPerPage = 10;
$scope.itemsPerPage = 2;
$scope.maxSize = 5;
$scope.$watch("currentPage + numPerPage", function() {
var begin = (($scope.currentPage - 1) * $scope.numPerPage);
var end = begin + $scope.numPerPage;
$scope.filteredResults = $scope.results.slice(begin, end);
});
$scope.search = function(query) {
$scope.results = [];
NotificationService.reset();
......@@ -47,12 +57,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
return $scope.types.indexOf(this.results.dataType.typeName && this.results.dataType.typeName.toLowerCase()) > -1;
};
/* $scope.$watch("currentPage + numPerPage", function() {
var begin = (($scope.currentPage - 1) * $scope.numPerPage);
var end = begin + $scope.numPerPage;
$scope.filteredResults = $scope.rows.slice(begin, end);
});*/
$scope.doToggle = function($event,el) {
this.isCollapsed = !el;
var currElem = $event.currentTarget;
};
$scope.filterSearchResults = function(items) {
var res = {};
angular.forEach(items, function(value, key) {
......
......@@ -21,7 +21,7 @@
<form name="form" novalidate class="container">
<div class="col-lg-7 col-lg-offset-3">
<div class="row input-group">
<input type="text" class="form-control" placeholder="Search" data-ng-model="query" data-typeahead="type for type in types" required/>
<input type="text" class="form-control" placeholder="Search" data-ng-model="query" required/>
<span class="input-group-btn">
<button class="btn btn-success" type="submit" data-ng-disabled="form.$invalid" data-ng-click="search(query)">
<i class="glyphicon glyphicon-search white "></i>
......
......@@ -16,7 +16,9 @@
~ limitations under the License.
-->
<h4>{{resultCount}} results matching your search query "{{query}}" were found</h4>
<h4 ng-show='resultCount > 0'>{{resultCount}} results matching your search query "{{query}}" were found</h4>
<h4 ng-show='resultCount == "0"'>searching .....</h4>
<ul class="list-unstyled">
<li ng-repeat="result in results.rows" class="searchresults">
<div data-ng-if="typeAvailable()">
......@@ -30,13 +32,15 @@
<span ng-show="$index > 4"><b>{{key}}: </b>{{value}}{{$last ? '' : ', '}}</span>
</span></span>
</div>
<a href="javascript: void(0);" class="show-more" ng-click="isCollapsed = !isCollapsed">..show more</a>
<!-- <a href="javascript: void(0);" bn-slide-show class="show-more" ng-click="doToggle(!isCollapsed)">..show more</a>-->
<a href="javascript: void(0);" ng-show="isCollapsed" ng-click="doToggle($event,isCollapsed)">..show more</a>
<a href="javascript: void(0);" ng-show="!isCollapsed" ng-click="doToggle($event,isCollapsed)">..show less</a>
<h5>Tags : <a ng-repeat="(key, value) in result['$traits$']" data-ui-sref="search.results({query: key})">{{key}}</a> </h5>
<h5>Tags : <a ng-repeat="(key, value) in result['$traits$']" data-ui-sref="search.results({query: key})">{{key}}</a> </h5>
</div>
<div data-ng-if="!typeAvailable()" data-ng-include="'/modules/search/views/types/guid.html'"></div>
</li>
</ul>
<div ng-show='resultCount > 0'><pagination total-items="totalItems" ng-model="currentPage" ng-change="pageChanged()"></pagination></div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment