diff --git a/src/app/annotationLibrary/annotationLibrary.js b/src/app/annotationLibrary/annotationLibrary.js index 35b2cf01..2341a2b0 100644 --- a/src/app/annotationLibrary/annotationLibrary.js +++ b/src/app/annotationLibrary/annotationLibrary.js @@ -4,26 +4,40 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration']) function ($scope, $location, $resource, $routeParams, AudioEvent) { $scope.filterSettings = { - tagsPartial: $routeParams.tagsPartial, - reference: $routeParams.reference, - duration: $routeParams.duration, - freqMin: $routeParams.freqMin, - freqMax: $routeParams.freqMax, - page: $routeParams.page, - items: $routeParams.items + tagsPartial: null, + reference: null, + annotationDuration: null, + freqMin: null, + freqMax: null, + page: null, + items: null }; $scope.setFilter = function setFilter() { - // update the url from the filter settings - var newUrl = '/library?' + baw.angularCopies.toKeyValue($scope.filterSettings); - if ($scope.filterSettings.tagsPartial !== undefined) { - newUrl = newUrl + '&tags_partial=' + $scope.filterSettings.tagsPartial; - } - console.log(newUrl); - //$location.path(newUrl); - // get the results from the server + $location.path('/library').search($scope.createQuery($scope.filterSettings)); + }; + $scope.loadFilter = function loadFilter() { + $scope.filterSettings = $scope.createQuery($routeParams); $scope.library = AudioEvent.library($scope.filterSettings); }; - - $scope.setFilter(); + $scope.createQuery = function createQuery(params) { + var hash = {}; + for (var key in params) { + if (params.hasOwnProperty(key)) { + var value = params[key]; + if (value !== undefined && value !== null && (typeof(value) === "string" ? value.length > 0 : true)) { + hash[key] = value; + } + } + } + console.log(hash); + return hash; + }; + $scope.calcOffsetStart = function calcOffsetStart(startOffset) { + return Math.floor(startOffset / 30) * 30; + }; + $scope.calcOffsetEnd = function calcOffsetEnd(startOffset) { + return (Math.floor(startOffset / 30) * 30) + 30; + }; + $scope.loadFilter(); }]); \ No newline at end of file diff --git a/src/app/annotationLibrary/annotationLibrary.tpl.html b/src/app/annotationLibrary/annotationLibrary.tpl.html index 45c3fac9..bf85fd78 100644 --- a/src/app/annotationLibrary/annotationLibrary.tpl.html +++ b/src/app/annotationLibrary/annotationLibrary.tpl.html @@ -17,7 +17,7 @@

Annotation Library

+ ng-model="filterSettings.annotationDuration">
@@ -79,7 +79,8 @@

Annotation Library

-
- {{item}} -
+ + {{tag.text}}  
+
\ No newline at end of file diff --git a/src/components/services/services.js b/src/components/services/services.js index c1a678f9..da932e5c 100644 --- a/src/components/services/services.js +++ b/src/components/services/services.js @@ -75,6 +75,8 @@ } var baseLibraryUri = paths.api.routes.audioEvent.libraryAbsolute; + //'http://localhost:3000'+paths.api.routes.audioEvent.library; + //paths.api.routes.audioEvent.libraryAbsolute; var resource = resourcePut($resource, uriConvert(paths.api.routes.audioEvent.showAbsolute), {