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
)
])
+18
View File
@@ -0,0 +1,18 @@
directive = () ->
directive =
templateUrl: "/partials/directives/key.html"
replace: true,
transclude: false,
restrict: 'E',
scope:
value: "="
controller:["$scope", ($scope) ->
$scope.hasIndexDown = false
$scope.hasIndexUp = false
$scope.hasIndex = false
$scope.has2DIndexUp = false
]
return directive
directives.directive( "vulKey", [directive])
+18
View File
@@ -0,0 +1,18 @@
directive = () ->
directive =
templateUrl: "/partials/directives/value.html"
replace: true,
transclude: false,
restrict: 'E',
scope:
value: "="
controller:["$scope", ($scope) ->
$scope.isString = _.isString($scope.value)
$scope.isNumber = _.isNumber($scope.value)
$scope.isObject = _.isObject($scope.value)
$scope.isArray = _.isArray($scope.value)
]
return directive
directives.directive( "vulValue", [directive])
+13
View File
@@ -0,0 +1,13 @@
root = this;
root.filters.filter 'escape', () ->
return window.escape;
root.filters.filter 'replaceAllCommasBySpaces', () ->
return (text) ->
return text.replace(new RegExp(",","g"), " ")
root.filters.filter 'niceJSON', () ->
return (obj) ->
return JSON.stringify(obj, null, 4);
+25
View File
@@ -0,0 +1,25 @@
root = this;
angular.module('vulture', [
'ngRoute'
'vulture.filters'
'vulture.services'
'vulture.directives'
'vulture.controllers'
]).
config(['$routeProvider', ($routeProvider) ->
$routeProvider.when('/servers', {templateUrl: 'partials/servers.html', controller: 'serversCtrl'})
$routeProvider.when('/about', {templateUrl: 'partials/about.html', controller: 'aboutCtrl'})
$routeProvider.when('/:server/databases', {templateUrl: 'partials/databases.html', controller: 'databasesCtrl'})
$routeProvider.when('/:server/:database/collections', {templateUrl: 'partials/collections.html', controller: 'collectionsCtrl'})
$routeProvider.when('/:server/:database/:collection/idx/:idx', {templateUrl: 'partials/document.html', controller: 'documentCtrl'})
$routeProvider.otherwise({redirectTo: '/servers'})
])
root.filters = angular.module('vulture.filters', [])
root.services = angular.module('vulture.services', [])
root.directives = angular.module('vulture.directives', [])
root.controllers = angular.module('vulture.controllers', [])