Commit fbb7582c by dileep bhimineni

fixed homepage routing issues

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