first commit. Way too late.

This commit is contained in:
didier.amyot committed 2014-05-07 21:47:51 -04:00
commit da7cacb57e
35 files changed
+1355

No files matched your search

@@ -0,0 +1,5 @@
root = this;
root.controllers.controller('aboutCtrl', ['$scope', ($scope) ->
])
@@ -0,0 +1,12 @@
root = this;
root.controllers.controller('collectionsCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
$scope.server = $routeParams.server
$scope.database = $routeParams.database
$scope.collections = []
$http.get("/api/#{ $routeParams.server }/#{ $routeParams.database }/collections").then((res) ->
$scope.collections = res.data
)
])
@@ -0,0 +1,11 @@
root = this;
root.controllers.controller('databasesCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
$scope.server = $routeParams.server
$scope.databases = []
$http.get("/api/#{ $routeParams.server }/databases").then((res) ->
$scope.databases = res.data
)
])
@@ -0,0 +1,24 @@
root = this;
root.controllers.controller('documentCtrl', ['$scope', '$routeParams', '$http', ($scope, $routeParams, $http) ->
$scope.idx = $routeParams.idx
$scope.doc = {}
$scope.idx = Number($routeParams.idx)
$scope.meta = {}
$http.get("/api/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }/idx/#{$routeParams.idx - 1}").then((res) ->
$scope.doc = res.data.document
$scope.meta = res.data.meta
)
$scope.previousDocumentUrl = () ->
"#/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }/idx/#{$scope.idx - 1}"
$scope.nextDocumentUrl = () ->
"#/#{ $routeParams.server }/#{ $routeParams.database }/#{ $routeParams.collection }/idx/#{$scope.idx + 1}"
$scope.hasPreviousDocument = () ->
$scope.idx > 1
])
@@ -0,0 +1,7 @@
root = this;
root.controllers.controller('homeCtrl', ['$scope', ($scope) ->
])
@@ -0,0 +1,10 @@
root = this;
root.controllers.controller('serversCtrl', ['$scope', '$http', ($scope, $http) ->
$scope.servers = []
$http.get("/api/servers").then((res) ->
$scope.servers = res.data
)
])
@@ -0,0 +1,18 @@
root = this;
root.controllers.controller('topBarCtrl', ['$scope', '$location', ($scope, $location) ->
$scope.$on('$routeChangeSuccess', (next, current) ->
$scope.path = _.filter($location.path().split("/"), (s) -> s)
$scope.getHistoryUrl = (idx) ->
ret = "#/" + ($scope.path[i] for i in [0...idx]).join("/")
if $scope.path[idx] == "idx"
return ""
if idx == 0
ret += "servers"
else if idx == 1
ret += "/databases"
else if idx == 2
ret += "/collections"
return ret
)
])