Skip to content

Commit

Permalink
Tagging attempt.
Browse files Browse the repository at this point in the history
- Gruntfile modified to chuck more errors when required files are not found
- added new tagging library and deps in
- disabled select2, pending removal
- cleaned up the listen.tpl.html layout a bit
- removed old unecessary code that caused error in tags.js
  • Loading branch information
atruskie committed Nov 26, 2013
1 parent 905a305 commit da26e48
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 89 deletions.
15 changes: 9 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ module.exports = function (grunt) {
var templateCopy = _.clone(template);
if (kind === "string") {
templateCopy.src = value;
result.push(_.extend(template, base));
result.push(templateCopy);
}
else {
// here we assume it is a special specification func
var transformedTemplate = value.call(null, templateCopy);

if (!transformedTemplate) {
throw "Copy:build_vendor_assets:transformTemplate: expected object, got " + transformedTemplate + " instead";
if (!transformedTemplate || !transformedTemplate.src) {
throw "Copy:build_vendor_assets:transformTemplate: expected object with src set, got " + transformedTemplate + " instead";
}

result.push(transformedTemplate);
Expand Down Expand Up @@ -235,7 +235,8 @@ module.exports = function (grunt) {
src: [ '<%= app_files.js %>' ],
dest: '<%= build_dir %>/',
cwd: '.',
expand: true
expand: true,
nonull: true
}
]
},
Expand All @@ -245,7 +246,8 @@ module.exports = function (grunt) {
src: [ '<%= vendor_files.js %>' ],
dest: '<%= build_dir %>/',
cwd: '.',
expand: true
expand: true,
nonull: true
}
]
},
Expand All @@ -255,7 +257,8 @@ module.exports = function (grunt) {
src: [ '**' ],
dest: '<%= compile_dir %>/assets',
cwd: '<%= build_dir %>/assets',
expand: true
expand: true,
nonull: true
}
]
}
Expand Down
8 changes: 6 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
"objectdiff": "https://github.com/NV/objectDiff.js.git",
"lodash": "~2.3.0",
"select2": "~3.4.5",
"angular-ui-select2": "~0.0.2"
"angular-ui-select2": "~0.0.2",
"angular-tags": "~0.2.10"
},
"dependencies": {}
"dependencies": {},
"resolutions": {
"angular": "1.2.0"
}
}
22 changes: 15 additions & 7 deletions build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,37 @@ module.exports = {
'vendor/jquery/jquery.js',
// TODO: THIS IS TERRIBLE! REMOVE UI ASAP... OR AT LEAST ONLY INCLUDE RELEVANT COMPONENTS
'vendor/jquery-ui/ui/jquery-ui.js',
// NOTE: bootstrap css important in application.tpl.scss
// NOTE: bootstrap css imported in application.tpl.scss
'vendor/sass-bootstrap/dist/js/bootstrap.js',
'vendor/momentjs/moment.js',
'vendor/angular/angular.js',
'vendor/angular-route/angular-route.js',
'vendor/angular-resource/angular-resource.js',
'vendor/angular-bootstrap/ui-bootstrap-tpls.min.js',
'vendor/placeholders/angular-placeholders-0.0.1-SNAPSHOT.min.js',
'vendor/angular-bootstrap/ui-bootstrap-tpls.js',

// Don't know what depended on this - disabled because does not exist on disk or in bower
//'vendor/placeholders/angular-placeholders-0.0.1-SNAPSHOT.min.js',
'vendor/angular-ui-router/release/angular-ui-router.js',
'vendor/angular-ui-utils/modules/route/route.js',
// TODO: the following line is dodgy and bloats the app
'vendor/angular-ui-utils/modules/**/*.js', '!vendor/angular-ui-utils/modules/**/*Spec.js',
'vendor/modernizr/modernizr.js',
'vendor/lodash/dist/lodash.js',
'vendor/select2/select2.js',
'vendor/angular-ui-select2/src/select2.js'
//'vendor/select2/select2.js',
//'vendor/angular-ui-select2/src/select2.js'
'vendor/angular-tags/dist/angular-tags-0.2.10-tpls.js'

],
css: [
// NOTE: bootstrap css imported in application.tpl.scss

'vendor/hint.css/hint.css',
// TODO: remove bloat
'vendor/jquery-ui/themes/redmond/jquery-ui.css',
'vendor/select2/select2-bootstrap.css',
'vendor/select2/select2.css'
//'vendor/select2/select2-bootstrap.css',
//'vendor/select2/select2.css'

'vendor/angular-tags/dist/angular-tags-0.2.10.css'
],
assets: [
// jquery-ui is stoopid, special case
Expand Down
7 changes: 6 additions & 1 deletion src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ var app = angular.module('baw',
'ngRoute',
'ngResource',
'ui.utils', /* angular-ui project */
'ui.select2',
//'ui.select2',
'ui.bootstrap',
'ui.bootstrap.typeahead',
'ui.bootstrap.tpls',
'decipher.tags',


'bawApp.configuration', /* a mapping of all static path configurations
and a module that contains all app configuration */
Expand Down
66 changes: 52 additions & 14 deletions src/app/listen/listen.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('bawApp.listen', [])
angular.module('bawApp.listen', ['decipher.tags', 'ui.bootstrap.typeahead'])

.controller('ListenCtrl', ['$scope',
'$resource',
Expand Down Expand Up @@ -302,22 +302,60 @@ angular.module('bawApp.listen', [])
};


$scope.typeaheadOpts = {
//inputFormatter: myInputFormatterFunction,
//loading: myLoadingBoolean,
minLength: 1,
//onSelect: myOnSelectFunction, // this will be run in addition to directive internals
templateUrl: "template/typeahead/typeahead-popup.htmlzzzzzzzzz"
//waitMs: 500,
//allowsEditable: true
};

$scope.select2Settings = {
allowClear: true,
tags: $scope.tags
// id: function selectTagId(tag) {
// return tag.tagId;
// },
// initSelection: function (element, callback) {
// var data = [];
// $(element.val().split(",")).each(function () {
// data.push({id: this, text: this});
// });
// callback(data);
// }
$scope.taggerOptions = {
delimiter: ",",
addable: true,
//classes:
templateUrl: "/templates/tags.html",
tagTemplateUrl: "/templates/tags.html"
};

$scope.$on('decipher.tags.initialized', function(event) {
event.stopPropagation();
console.debug('decipher.tags.initialized', arguments);
});
$scope.$on('decipher.tags.keyup', function (event) {
event.stopPropagation();
console.debug('decipher.tags.keyup', arguments);
});
$scope.$on('decipher.tags.added', function (event) {
event.stopPropagation();
console.debug('decipher.tags.added', arguments);
});
$scope.$on('decipher.tags.addfailed', function (event) {
event.stopPropagation();
console.debug('decipher.tags.addfailed', arguments);
});
$scope.$on('decipher.tags.removed', function (event) {
event.stopPropagation();
console.debug('decipher.tags.removed', arguments);
});

// $scope.select2Settings = {
// allowClear: true,
// tags: $scope.tags
// // id: function selectTagId(tag) {
// // return tag.tagId;
// // },
// // initSelection: function (element, callback) {
// // var data = [];
// // $(element.val().split(",")).each(function () {
// // data.push({id: this, text: this});
// // });
// // callback(data);
// // }
// };

// $scope.select2Transformers = {
//
// fromElement: function (tagResources) {
Expand Down
103 changes: 53 additions & 50 deletions src/app/listen/listen.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,18 @@
</div>
<div ng-hide="errorState">

<h2 class="debug-ui">Timeline</h2>

<div id="timeline" class="clearfix debug-ui">
<div>
<div id="audioRecording">
<div>before</div>
<div>current</div>
<div>after</div>
</div>
<div id="playlist">
<div>pli</div>
<div>
<div>segment</div>
<div>
<div>chunk</div>
<div>
You are here
</div>
<div>chunk</div>
</div>
<div>segment</div>
</div>
<div>pli</div>
</div>
</div>
</div>
<h2 class="debug-ui">Stats</h2>
<ul class="debug-ui">
<li>
Audio recording: <span class="hint absolute-time hint--top">{{model.audioRecording.recordedDate | moment:"format":"dddd, MMMM Do YYYY, HH:mm:ss ZZ"}}</span>,
Duration of recording: <span class="hint duration hint--top">{{model.audioRecording.durationSeconds | formatTimeSpan}} </span>
</li>
<li>
Segment: <span class="hint absolute-time hint--top">--TODO--</span>, Duration of segment: <span
class="hint duration hint--top">--TODO-- </span>
</li>
<li>
On screen: <span class="hint absolute-time hint--top">{{absoluteDateChunkStart() | moment:"format":"dddd, MMMM Do YYYY, HH:mm:ss ZZ"}}</span>
, Duration of chunk: <span class="hint duration hint--top">{{durationChunk()}} </span>
</li>
</ul>

<h4 class="center-block">Site: {{model.audioRecording.siteId}}, <span class="hint absolute-time hint--top">{{absoluteDateChunkStart() | moment:"format":"dddd, MMMM Do YYYY, HH:mm:ss ZZ"}}</span><span></span>
</h4>
<baw-annotation-viewer model="model"></baw-annotation-viewer>
<div id="chunkTimeStamps" class="clear-pseudo">
<span class="left">Segment start: <span class="hint relative-recording-time hint--right">{{startOffsetChunk()}}</span>
<span class="left"> <span class="hint relative-recording-time hint--right">{{startOffsetChunk()}}</span>
</span>
<span class="position">
Position: <br/>
<span class="hint relative-chunk-time hint--bottom">{{currentOffsetChunk()}}</span><br/>
<!--<span class="hint relative-chunk-time hint--bottom">{{currentOffsetChunk()}}</span><br/>-->
<span class="hint relative-recording-time hint--bottom">{{currentOffsetRecording()}}</span>
</span>
<span class="right">Segment end: <span
class="hint relative-recording-time hint--left">{{endOffsetChunk()}}</span></span>
<span class="right"> <span class="hint relative-recording-time hint--left">{{endOffsetChunk()}}</span></span>
</div>
<div class="btn-toolbar">

Expand Down Expand Up @@ -97,13 +54,16 @@ <h4>Annotation edit</h4>


<form id="annotationEditForm" name="annotationEditForm" class="panel-body" ng-class="">
<span>Selected elements: {{model.selectedAudioEvents.length || 0}}</span>
<fieldset ng-disabled="singleEditDisabled()">
<legend>Tags</legend>
<label></label>
<input type="hidden" ng-multiple="true" tags multiple ui-select2="select2Settings"
ng-model="model.selectedAudioEvent.audioEventTags"
baw-inject-transformers="select2Transformers"/>
<!--<input type="hidden" ng-multiple="true" tags multiple ui-select2="select2Settings"-->
<!--ng-model="model.selectedAudioEvent.audioEventTags"-->
<!--baw-inject-transformers="select2Transformers"/>-->
<tags options="taggerOptions"
typeahead-options="typeaheadOpts"
ng-model="model.selectedAudioEvent.taggings"
src="b for t in tags"></tags>
</fieldset>
<fieldset ng-disabled="singleEditDisabled()">
<legend>
Expand Down Expand Up @@ -200,6 +160,49 @@ <h3>Annotations</h3>
</table>
</div>
</div>

<h2 class="debug-ui">Timeline</h2>

<div id="timeline" class="clearfix debug-ui">
<div>
<div id="audioRecording">
<div>before</div>
<div>current</div>
<div>after</div>
</div>
<div id="playlist">
<div>pli</div>
<div>
<div>segment</div>
<div>
<div>chunk</div>
<div>
You are here
</div>
<div>chunk</div>
</div>
<div>segment</div>
</div>
<div>pli</div>
</div>
</div>
</div>
<h2 class="debug-ui">Stats</h2>
<ul class="debug-ui">
<li>
Audio recording: <span class="hint absolute-time hint--top">{{model.audioRecording.recordedDate | moment:"format":"dddd, MMMM Do YYYY, HH:mm:ss ZZ"}}</span>,
Duration of recording: <span class="hint duration hint--top">{{model.audioRecording.durationSeconds | formatTimeSpan}} </span>
</li>
<li>
Segment: <span class="hint absolute-time hint--top">--TODO--</span>, Duration of segment: <span
class="hint duration hint--top">--TODO-- </span>
</li>
<li>
On screen: <span class="hint absolute-time hint--top">{{absoluteDateChunkStart() | moment:"format":"dddd, MMMM Do YYYY, HH:mm:ss ZZ"}}</span>
, Duration of chunk: <span class="hint duration hint--top">{{durationChunk()}} </span>
</li>
</ul>

<!--<baw-debug-info></baw-debug-info>-->
</div>
</div>
9 changes: 0 additions & 9 deletions src/app/tags/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ angular.module('bawApp.tags', [])
.controller('TagsCtrl', ['$scope', '$resource', '$routeParams', 'Tag',

function TagsCtrl($scope, $resource, $routeParams, Tag) {
$scope.tagsResource = $resource('/tags', {});
$scope.tags = $scope.tagsResource.query();

$scope.links = function (key) {
return TagsCtrl.linkList(this.tag.id)[key];
};

$scope["delete"] = function (id) {
alert("deleting tag {0}!".format(id));
};
}])

.controller('TagCtrl', ['$scope', '$resource', '$routeParams', 'Tag',
Expand Down

0 comments on commit da26e48

Please sign in to comment.