diff --git a/client/coffee/controllers/geojsonmapCtrl.coffee b/client/coffee/controllers/geojsonmapCtrl.coffee index 227f82c..7701d65 100644 --- a/client/coffee/controllers/geojsonmapCtrl.coffee +++ b/client/coffee/controllers/geojsonmapCtrl.coffee @@ -10,8 +10,11 @@ root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$http' lng: -72.6169 zoom: 7 - - $http.get("/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }/idx/#{$routeParams.idx - 1}").then((res) -> + url = "/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }" + if $routeParams.query + url = "#{url}/query/#{$routeParams.query}" + url = "#{ url }/idx/#{$routeParams.idx - 1}" + $http.get(url).then((res) -> $scope.geojson = res.data.document[$routeParams.key] if not $scope.geojson.properties $scope.geojson.properties = {} @@ -24,10 +27,16 @@ root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$http' ) $scope.previousDocumentUrl = () -> - "#/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }/idx/#{$scope.idx - 1}/geojson/#{$routeParams.key}" + url = "#/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }/idx/#{$scope.idx - 1}" + if $routeParams.query + url = "#{url}/query/#{$routeParams.query}" + "#{url}/geojson/#{$routeParams.key}" $scope.nextDocumentUrl = () -> - "#/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }/idx/#{$scope.idx + 1}/geojson/#{$routeParams.key}" + url = "#/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }/idx/#{$scope.idx + 1}" + if $routeParams.query + url = "#{url}/query/#{$routeParams.query}" + "#{url}/geojson/#{$routeParams.key}" $scope.hasPreviousDocument = () -> $scope.idx > 1 diff --git a/client/coffee/controllers/topBarCtrl.coffee b/client/coffee/controllers/topBarCtrl.coffee index a3d2dd3..e3fd069 100644 --- a/client/coffee/controllers/topBarCtrl.coffee +++ b/client/coffee/controllers/topBarCtrl.coffee @@ -1,13 +1,17 @@ root = this; +joinArray = (a, b)-> + a.push.apply(a, b) + return a + root.controllers.controller('topBarCtrl', ['$scope', '$location', ($scope, $location) -> $scope.$on('$routeChangeSuccess', (next, current) -> $scope.path = _.filter($location.path().split("/"), (s) -> s) if $scope.path[5] == "query" - $scope.path = $scope.path[0...-1] + $scope.path = joinArray($scope.path[0...6], $scope.path[7...-1]) $scope.getHistoryUrl = (idx) -> ret = "#/" + ($scope.path[i] for i in [0...idx]).join("/") - if _.indexOf(["idx", "geojson"], $scope.path[idx]) != -1 + if _.indexOf(["idx", "geojson", "query"], $scope.path[idx]) != -1 return "" if idx == 0 ret += "servers" diff --git a/client/coffee/directives/key.coffee b/client/coffee/directives/key.coffee index 1db5877..98d6066 100644 --- a/client/coffee/directives/key.coffee +++ b/client/coffee/directives/key.coffee @@ -32,7 +32,11 @@ directive = () -> $scope.hasIndex = $scope.hasIndexDown or $scope.hasIndexUp or $scope.has2DIndex $scope.getGeoJsonUrl = () -> r = $routeParams - return "#" + "/#{r.server}/#{r.database}/#{r.collection}/idx/#{r.idx}/geojson/#{$scope.keyName}" + e = window.encodeURIComponent + url = "#/#{r.server}/#{r.database}/#{r.collection}/idx/#{r.idx}" + if r.query + url = "#{url}/query/#{e(r.query)}" + return "#{url}/geojson/#{$scope.keyName}" ] return directive diff --git a/client/coffee/vultureApp.coffee b/client/coffee/vultureApp.coffee index 6f4ae21..529537f 100644 --- a/client/coffee/vultureApp.coffee +++ b/client/coffee/vultureApp.coffee @@ -17,6 +17,7 @@ config(['$routeProvider', ($routeProvider) -> $routeProvider.when('/:server/:database/:collection/idx/:idx', {templateUrl: 'partials/document.html', controller: 'documentCtrl'}) $routeProvider.when('/:server/:database/:collection/idx/:idx/query/:query', {templateUrl: 'partials/document.html', controller: 'documentCtrl'}) $routeProvider.when('/:server/:database/:collection/idx/:idx/geojson/:key', {templateUrl: 'partials/geojsonmap.html', controller: 'geojsonmapCtrl'}) + $routeProvider.when('/:server/:database/:collection/idx/:idx/query/:query/geojson/:key', {templateUrl: 'partials/geojsonmap.html', controller: 'geojsonmapCtrl'}) $routeProvider.otherwise({redirectTo: '/servers'}) ]) diff --git a/client/favicon.ico b/client/favicon.ico new file mode 100644 index 0000000..5978f55 Binary files /dev/null and b/client/favicon.ico differ diff --git a/client/partials/document.html b/client/partials/document.html index dfa6356..018bdd4 100644 --- a/client/partials/document.html +++ b/client/partials/document.html @@ -1,6 +1,6 @@
- +