Commit fbb7582c by dileep bhimineni

fixed homepage routing issues

parent 365f6e26
......@@ -127,3 +127,7 @@ footer.navbar-bottom img {
.pagination {
float: right;
}
.resultsPagination {
height:140px;
}
\ No newline at end of file
......@@ -23,6 +23,6 @@ angular.module('dgc').config(['$locationProvider', '$urlRouterProvider',
function($locationProvider, $urlRouterProvider) {
$locationProvider.hashPrefix('!');
// For unmatched routes:
$urlRouterProvider.otherwise('/search');
$urlRouterProvider.otherwise('/');
}
]);
......@@ -24,9 +24,8 @@ angular.module('dgc.home.routes', []).config(['$stateProvider',
// states for my app
$stateProvider.state('home', {
url: '/search',
templateUrl: '/modules/search/views/search.html',
controller: 'SearchController'
url: '/',
templateUrl: '/modules/home/views/home.html'
});
}
]);
......@@ -31,6 +31,16 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
$scope.filteredResults = [];
$scope.resultRows = [];
$scope.$on('$stateChangeStart', function(event, toState) {
if (toState.resolve) {
$scope.loading = true;
}
});
$scope.$on('$stateChangeSuccess', function(event, toState) {
if (toState.resolve) {
$scope.loading = false;
}
});
$scope.setPage = function(pageNo) {
$scope.currentPage = pageNo;
};
......@@ -38,6 +48,8 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
$scope.results = [];
NotificationService.reset();
$scope.limit = 4;
$scope.searchMessage = 'searching...';
$scope.$parent.query = query;
SearchResource.search({
query: query
}, function searchSuccess(response) {
......@@ -102,7 +114,6 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
$scope.searchQuery = $location.search();
$scope.query = ($location.search()).query;
if ($scope.query) {
$scope.searchMessage = 'searching...';
$scope.search($scope.query);
}
}
......
......@@ -23,7 +23,7 @@
<div class="row input-group">
<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)">
<button class="btn btn-success" type="submit" data-ng-disabled="form.$invalid" ui-sref="search.results({ query: query })">
<i class="glyphicon glyphicon-search white "></i>
</button>
</span>
......@@ -39,7 +39,7 @@
<div data-ng-include="'/modules/navigation/views/navigation.html'"></div>
<div class="col-lg-9" data-ui-view="" style="min-height: 1350px;"></div>
<div class="col-lg-9" data-ui-view="" ></div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -41,7 +41,7 @@
<div data-ng-if="!searchTypesAvailable" data-ng-include="'/modules/search/views/types/guid.html'"></div>
</li>
</ul>
<div ng-show='filteredResults.length > 0'>
<div class="resultsPagination" ng-show='filteredResults.length > 0'>
<pagination total-items="totalItems" items-per-page="itemsPerPage" ng-model="currentPage" ng-change="pageChanged()"></pagination>
<p>
</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