work with, working on...

This commit is contained in:
didier.amyot committed 2014-05-09 12:54:28 -04:00
1 parent 741ec3f40c
commit a72347d1e3
7 files changed
+28 -10

No files matched your search

@@ -10,8 +10,11 @@ root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$http'
lng: -72.6169 lng: -72.6169
zoom: 7 zoom: 7
url = "/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }"
$http.get("/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }/idx/#{$routeParams.idx - 1}").then((res) -> 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] $scope.geojson = res.data.document[$routeParams.key]
if not $scope.geojson.properties if not $scope.geojson.properties
$scope.geojson.properties = {} $scope.geojson.properties = {}
@@ -24,10 +27,16 @@ root.controllers.controller('geojsonmapCtrl', ['$scope', '$routeParams', '$http'
) )
$scope.previousDocumentUrl = () -> $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 = () -> $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.hasPreviousDocument = () ->
$scope.idx > 1 $scope.idx > 1
+6 -2
View File
@@ -1,13 +1,17 @@
root = this; root = this;
joinArray = (a, b)->
a.push.apply(a, b)
return a
root.controllers.controller('topBarCtrl', ['$scope', '$location', ($scope, $location) -> root.controllers.controller('topBarCtrl', ['$scope', '$location', ($scope, $location) ->
$scope.$on('$routeChangeSuccess', (next, current) -> $scope.$on('$routeChangeSuccess', (next, current) ->
$scope.path = _.filter($location.path().split("/"), (s) -> s) $scope.path = _.filter($location.path().split("/"), (s) -> s)
if $scope.path[5] == "query" 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) -> $scope.getHistoryUrl = (idx) ->
ret = "#/" + ($scope.path[i] for i in [0...idx]).join("/") 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 "" return ""
if idx == 0 if idx == 0
ret += "servers" ret += "servers"
+5 -1
View File
@@ -32,7 +32,11 @@ directive = () ->
$scope.hasIndex = $scope.hasIndexDown or $scope.hasIndexUp or $scope.has2DIndex $scope.hasIndex = $scope.hasIndexDown or $scope.hasIndexUp or $scope.has2DIndex
$scope.getGeoJsonUrl = () -> $scope.getGeoJsonUrl = () ->
r = $routeParams 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 return directive
+1
View File
@@ -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', {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/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/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'}) $routeProvider.otherwise({redirectTo: '/servers'})
]) ])
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
<div class="row"> <div class="row">
<div class="large-9 columns"> <div class="large-9 columns">
<input type="text" ng-model="newQuery" style="font-family: monospace;font-size: 1.3em;"> <input type="text" ng-model="newQuery" style="font-family: monospace;font-size: 1.2em;">
</div> </div>
<div class="large-3 columns right"> <div class="large-3 columns right">
<ul class="button-group"> <ul class="button-group">
+2 -2
View File
@@ -1,8 +1,8 @@
<div class="row"> <div class="row">
<div class="large-12 columns" style="text-align: center;"> <div class="large-12 columns" style="text-align: center;">
<a class="fa fa-angle-left" ng-href="{{ previousDocumentUrl() }}" ng-show="{{ hasPreviousDocument() }}"></a> <a class="fa fa-chevron-left" ng-href="{{ previousDocumentUrl() }}" ng-show="{{ hasPreviousDocument() }}"></a>
<kbd>{{idx}} / {{ meta.count}}</kbd> <kbd>{{idx}} / {{ meta.count}}</kbd>
<a class="fa fa-angle-right" ng-href="{{ nextDocumentUrl() }}"></a> <a class="fa fa-chevron-right" ng-href="{{ nextDocumentUrl() }}"></a>
</div> </div>
</div> </div>