Skip to content

Commit

Permalink
fixed uses of url service; changed urls
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark committed Apr 30, 2014
1 parent 937aec3 commit ece7bfd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/app/annotationLibrary/annotationItem.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h3 class="panel-title pull-left">Details</h3>
<div class="panel-body">
<div class="list-group">
<a data-ng-repeat="tag in model.tags"
data-ng-href="{{$parent.createFilterUrl({tagsPartial: tag.text})}}"
data-ng-href="{{model.tagSearchUrl}}"
class="list-group-item" title="Tag.">
<span class="glyphicon glyphicon-tags"></span>&nbsp;
<span class="badge">{{tag.typeOfTag.replace('_',' ')}}</span>
Expand Down
14 changes: 7 additions & 7 deletions src/app/annotationLibrary/annotationLibrary.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])
.controller('AnnotationLibraryCtrl', ['$scope', '$location', '$resource', '$routeParams', 'conf.paths', 'AudioEvent', 'Media',
function ($scope, $location, $resource, $routeParams, paths, AudioEvent, Media) {
.controller('AnnotationLibraryCtrl', ['$scope', '$location', '$resource', '$routeParams', '$url', 'conf.paths', 'AudioEvent', 'Media',
function ($scope, $location, $resource, $routeParams, $url, paths, AudioEvent, Media) {

$scope.status = 'idle';

Expand All @@ -17,7 +17,7 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])
loadFilter();

$scope.setFilter = function setFilter() {
$location.path('/library').search(baw.angularCopies.toKeyValue($scope.filterSettings));
$location.path('/library').search($url.toKeyValue($scope.filterSettings));
};

$scope.clearFilter = function clearFilter() {
Expand All @@ -42,7 +42,7 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])


$scope.createFilterUrl = function createFilterUrl(paramObj) {
return '/library/?' + baw.angularCopies.toKeyValue(paramObj);
return '/library/?' + $url.toKeyValue(paramObj);
};

function loadFilter() {
Expand Down Expand Up @@ -137,8 +137,8 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])
return paging;
}
}])
.controller('AnnotationItemCtrl', ['$scope', '$location', '$resource', '$routeParams', 'conf.paths', 'AudioEvent', 'Media',
function ($scope, $location, $resource, $routeParams, paths, AudioEvent, Media) {
.controller('AnnotationItemCtrl', ['$scope', '$location', '$resource', '$routeParams', '$url', 'conf.paths', 'AudioEvent', 'Media',
function ($scope, $location, $resource, $routeParams, $url, paths, AudioEvent, Media) {

var parameters = {
audioEventId: $routeParams.audioEventId,
Expand Down Expand Up @@ -170,7 +170,7 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])
});

$scope.createFilterUrl = function createFilterUrl(paramObj) {
return '/library/?' + baw.angularCopies.toKeyValue(paramObj);
return '/library/?' + $url.toKeyValue(paramObj);
};

}]);
25 changes: 16 additions & 9 deletions src/components/services/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@
return resource;
}]);

bawss.factory('Media', [ '$resource', 'conf.paths', 'conf.constants', 'bawApp.unitConverter', 'AudioEvent', 'Tag',
function ($resource, paths, constants, unitConverter, AudioEvent, Tag) {
bawss.factory('Media', [ '$resource', '$url', 'conf.paths', 'conf.constants', 'bawApp.unitConverter', 'AudioEvent', 'Tag',
function ($resource, $url, paths, constants, unitConverter, AudioEvent, Tag) {
var mediaResource = $resource(uriConvert(paths.api.routes.media.showAbsolute),
{
recordingId: '@recordingId',
Expand Down Expand Up @@ -312,21 +312,28 @@
value.annotationDuration = value.endTimeSeconds - value.startTimeSeconds;

// urls
var offsetparams = {
start: calcOffsetStartValue,
end: calcOffsetEndValue
};
value.listenUrl = '/listen/' + audioRecordingIdValue +
'?start=' + calcOffsetStartValue +
'&end=' + calcOffsetEndValue;
'?' + $url.toKeyValue(offsetparams);
value.siteUrl = '/projects/' + value.projects[0].id +
'/sites/' + value.siteId;
value.userUrl = '/user_accounts/' + value.ownerId;

// updateFilter({tagsPartial:item.priorityTag.text})
value.tagSearchUrl = '/library?tagsPartial=' +
baw.angularCopies.fixedEncodeURI(value.priorityTag.text);
var similarParams = {
annotationDuration: Math.round10(value.annotationDuration, -3),
freqMin: Math.round(value.lowFrequencyHertz),
freqMax: Math.round(value.highFrequencyHertz)
};
value.tagSearchUrl = '/library?' +
$url.toKeyValue(angular.extend({}, similarParams, {tagsPartial: value.priorityTag.text }));

// updateFilter({annotationDuration:Math.round10(value.annotationDuration, -3), ...})
value.similarUrl = '/library?annotationDuration=' + Math.round10(value.annotationDuration, -3) +
'&freqMin=' + Math.round(value.lowFrequencyHertz) +
'&freqMax=' + Math.round(value.highFrequencyHertz);
value.similarUrl = '/library?' +
$url.toKeyValue(similarParams);

value.singleItemUrl = '/library/' +
value.audioRecordingId + '/audio_events/' +
Expand Down

0 comments on commit ece7bfd

Please sign in to comment.