diff --git a/html/search/glresults.html b/html/search/glresults.html index 75b471f9..e720b85c 100644 --- a/html/search/glresults.html +++ b/html/search/glresults.html @@ -1,4 +1,4 @@ -
diff --git a/js/controllers/SearchController.js b/js/controllers/SearchController.js new file mode 100644 index 00000000..fbe667b9 --- /dev/null +++ b/js/controllers/SearchController.js @@ -0,0 +1,14 @@ +(function(module) { + mifosX.controllers = _.extend(module, { + SearchController: function(scope, routeParams , resourceFactory) { + + scope.searchResults = []; + resourceFactory.globalSearch.search( {query: routeParams.query} , function(data){ + scope.searchResults = data; + }); + } + }); + mifosX.ng.application.controller('SearchController', ['$scope','$routeParams','ResourceFactory', mifosX.controllers.SearchController]).run(function($log) { + $log.info("SearchController initialized"); + }); +}(mifosX.controllers || {})); diff --git a/js/mifosXComponents.js b/js/mifosXComponents.js index 2fac67e2..fd85c6e1 100644 --- a/js/mifosXComponents.js +++ b/js/mifosXComponents.js @@ -19,7 +19,8 @@ define(['underscore', 'mifosX'], function() { 'ViewClientController', 'CreateClientController', 'TaskController', - 'CurrencyConfigController' + 'CurrencyConfigController', + 'SearchController' ], filters: [ 'StatusLookup' diff --git a/js/routes.js b/js/routes.js index 5259e0a8..aa2cdb86 100644 --- a/js/routes.js +++ b/js/routes.js @@ -51,6 +51,9 @@ }) .when('/viewcurrconfig', { templateUrl: 'html/organization/currencyconfig.html' + }) + .when('/search/:query', { + templateUrl: 'html/search/glresults.html' }); $locationProvider.html5Mode(false); diff --git a/js/services/ResourceFactoryProvider.js b/js/services/ResourceFactoryProvider.js index 551b305a..89f91470 100644 --- a/js/services/ResourceFactoryProvider.js +++ b/js/services/ResourceFactoryProvider.js @@ -43,6 +43,12 @@ }), currencyConfigResource: defineResource(apiVer + "/currencies", {}, { update: { method: 'PUT'} + }), + globalSearch: defineResource(apiVer + "/search", {query:'@query'}, { + search: { method: 'GET', + params: { query: '@query'} , + isArray:true + } }) }; }];