Skip to content

Commit

Permalink
added audio recording id filter, fixed library filter form problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark committed May 7, 2014
1 parent 17b96d9 commit 914e0e7
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 19 deletions.
23 changes: 18 additions & 5 deletions src/app/annotationLibrary/annotationItem.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ <h3>Annotation {{model.audioEventId}}</h3>
</div>
<audio id="annoSingleAudio{{$index}}" controls
data-ng-style="{width:annotation.converters.conversions.enforcedImageWidth}">
<source data-ng-repeat="resource in annotation.media.availableAudioFormats" data-ng-src="{{resource.url}}" src=""
type="{{resource.mimeType}}">
<source data-ng-repeat="resource in annotation.media.availableAudioFormats"
data-ng-src="{{resource.url}}" src=""
type="{{resource.mimeType}}">
Your browser does not support the audio element.
</audio>

Expand Down Expand Up @@ -45,14 +46,20 @@ <h3 class="panel-title pull-left">Details</h3>
<div class="panel-body">
<div class="list-group">
<a data-ng-repeat="tag in annotation.tags"
data-ng-href="{{annotation.urls.tagSearch}}"
data-ng-href="{{$parent.createFilterUrl({'tagsPartial': tag.text})}}"
class="list-group-item" title="Tag.">
<span class="glyphicon glyphicon-tags"></span>&nbsp;
<span class="badge">{{tag.typeOfTag.replace('_',' ')}}</span>
<span class="badge" data-ng-show="tag.retired">retired</span>
<span class="badge" data-ng-show="tag.isTaxanomic">taxonomic</span>
{{tag.text}} (ID {{tag.id}})
</a>
<a data-ng-show="annotation.isReference"
data-ng-href="{{$parent.createFilterUrl({'reference': annotation.isReference})}}"
class="list-group-item" title="Reference tag.">
<span class="glyphicon glyphicon-book"></span>&nbsp;
Reference Tag
</a>
<a data-ng-href="{{annotation.urls.listen}}" class="list-group-item" title="Start date.">
<span class="glyphicon glyphicon-record"></span>&nbsp;
Created {{annotation.audioEventStartDate | date: 'medium'}}
Expand All @@ -61,9 +68,14 @@ <h3 class="panel-title pull-left">Details</h3>
<span class="glyphicon glyphicon-time"></span>&nbsp;
{{annotation.annotationDurationRounded}} seconds duration
</a>
<a data-ng-repeat="project in annotation.projects"
data-ng-href="{{$parent.createProjectUrl(project.id)}}" class="list-group-item" title="Project name.">
<span class="glyphicon glyphicon-home"></span>&nbsp;
Project: {{project.name}}
</a>
<a data-ng-href="{{annotation.urls.site}}" class="list-group-item" title="Site name.">
<span class="glyphicon glyphicon-map-marker"></span>&nbsp;
{{annotation.siteName}}
Site: {{annotation.siteName}}
</a>
<a data-ng-href="{{annotation.urls.user}}" class="list-group-item" title="User.">
<span class="glyphicon glyphicon-user"></span>&nbsp;
Expand All @@ -81,7 +93,8 @@ <h3 class="panel-title pull-left">Details</h3>
<div class="col-md-6">
<div class="library-single-info panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left"><span class="glyphicon glyphicon-comment"></span>&nbsp;Comments</h3>
<h3 class="panel-title pull-left"><span class="glyphicon glyphicon-comment"></span>&nbsp;Comments
</h3>
</div>
<div class="panel-body">
<em>Coming soon...</em>
Expand Down
21 changes: 15 additions & 6 deletions src/app/annotationLibrary/annotationLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ baw.annotationLibrary.addCalculatedProperties = function addCalculatedProperties
audioEvent.calcOffsetStart = Math.floor(audioEvent.startTimeSeconds / 30) * 30;
audioEvent.calcOffsetEnd = (Math.floor(audioEvent.startTimeSeconds / 30) * 30) + 30;

//console.log(audioEvent);

audioEvent.urls = {
site: '/projects/' + audioEvent.projects[0].id +
'/sites/' + audioEvent.siteId,
user: '/user_accounts/' + audioEvent.ownerId,
tagSearch: '/library?' + $url.toKeyValue({tagsPartial: audioEvent.priorityTag.text}),
tagSearch: '/library?' + $url.toKeyValue({tagsPartial: audioEvent.priorityTag.text}, true),
similar: '/library?' + $url.toKeyValue(
{
annotationDuration: Math.round10(audioEvent.annotationDuration, -3),
freqMin: Math.round(audioEvent.lowFrequencyHertz),
freqMax: Math.round(audioEvent.highFrequencyHertz)
}),
},true),
singleItem: '/library/' + audioEvent.audioRecordingId +
'/audio_events/' + audioEvent.audioEventId,
listen: '/listen/' + audioEvent.audioRecordingId +
Expand Down Expand Up @@ -117,7 +119,7 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])
loadFilter();

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

$scope.clearFilter = function clearFilter() {
Expand All @@ -132,14 +134,15 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])


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

function getEmptyFilterSettings() {
return {
tagsPartial: null,
reference: 'true', // set to empty string to match value of radio button
userId: null,
audioRecordingId: null,
annotationDuration: null,
freqMin: null,
freqMax: null,
Expand All @@ -157,7 +160,9 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])
'freqMin',
'freqMax',
'page',
'items'
'items',
'userId',
'audioRecordingId'
].forEach(
function (currentvalue, index, array) {
var stringValue = $scope.filterSettings[currentvalue];
Expand Down Expand Up @@ -299,7 +304,11 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])
});

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

$scope.createProjectUrl = function createProjectUrl(projectId){
return '/projects/' + projectId;
};

}]);
24 changes: 16 additions & 8 deletions src/app/annotationLibrary/annotationLibrary.tpl.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="content" data-ng-controller="AnnotationLibraryCtrl">
<div id="content">
<h3>Annotation Library</h3>

<div class="panel panel-default">
Expand All @@ -12,29 +12,37 @@ <h3>Annotation Library</h3>
data-ng-model="filterSettings.tagsPartial">
</div>

<p class="help-block text-muted col-sm-6">Use comma (,) to separate tags.</p>
<p class="help-block text-muted col-sm-3">Use comma (,) to separate tags.</p>

<label for="refLibraryAudioRecordingId" class="col-sm-1 control-label">Recording Id</label>

<div class="col-sm-2">
<input type="number" class="form-control" id="refLibraryAudioRecordingId"
placeholder="Audio Recording Id" step="1" min="1"
data-ng-model="filterSettings.audioRecordingId">
</div>

</div>
<div class="form-group">
<label for="refLibraryDuration" class="col-sm-1 control-label">Duration</label>

<div class="col-sm-3">
<input type="number" class="form-control" id="refLibraryDuration"
placeholder="Duration (in seconds)"
placeholder="Duration (in seconds)" step="any"
data-ng-model="filterSettings.annotationDuration">
</div>

<label for="refLibraryFreqMin" class="col-sm-2 control-label">Min Frequency</label>

<div class="col-sm-2">
<input type="number" class="form-control" id="refLibraryFreqMin"
<input type="number" class="form-control" id="refLibraryFreqMin" step="any"
placeholder="Minimum Frequency" data-ng-model="filterSettings.freqMin">
</div>

<label for="refLibraryFreqMax" class="col-sm-2 control-label">Max Frequency</label>

<div class="col-sm-2">
<input type="number" class="form-control" id="refLibraryFreqMax"
<input type="number" class="form-control" id="refLibraryFreqMax" step="any"
placeholder="Maximum Frequency" data-ng-model="filterSettings.freqMax">
</div>
</div>
Expand Down Expand Up @@ -62,21 +70,21 @@ <h3>Annotation Library</h3>

<div class="col-sm-1">
<input type="number" class="form-control" id="refLibraryPage" placeholder="Page"
data-ng-model="filterSettings.page">
data-ng-model="filterSettings.page" step="1" min="1">
</div>

<label for="refLibraryItems" class="col-sm-1 control-label">Items</label>

<div class="col-sm-1">
<input type="number" class="form-control" id="refLibraryItems" placeholder="Items"
data-ng-model="filterSettings.items">
data-ng-model="filterSettings.items" step="1" min="1">
</div>

<label for="refLibraryUserId" class="col-sm-1 control-label">User Id</label>

<div class="col-sm-1">
<input type="number" class="form-control" id="refLibraryUserId" placeholder="User Id"
data-ng-model="filterSettings.userId">
data-ng-model="filterSettings.userId" step="1" min="1">
</div>
</div>
<div class="form-group">
Expand Down
7 changes: 7 additions & 0 deletions src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ var app = angular.module('baw',
{templateUrl: '/assets/experiment_base.html', controller: 'ExperimentsCtrl'}).

when('/library', {templateUrl: paths.site.files.library.list, controller: 'AnnotationLibraryCtrl', title: 'Annotation Library' }).
when('/library/:recordingId', {
redirectTo: function (routeParams, path, search) { return "/library?audioRecordingId="+routeParams.recordingId;},
templateUrl: paths.site.files.library.list,
title: ":recordingId" }).
when('/library/:recordingId/audio_events', {
redirectTo: function (routeParams, path, search) { return "/library?audioRecordingId="+routeParams.recordingId;},
title: 'Audio Events' }).
when('/library/:recordingId/audio_events/:audioEventId', {templateUrl: paths.site.files.library.item, controller: 'AnnotationItemCtrl', title: 'Annotation :audioEventId'}).

// missing route page
Expand Down

0 comments on commit 914e0e7

Please sign in to comment.