Skip to content

Commit

Permalink
More work on getting annotation editor working.
Browse files Browse the repository at this point in the history
renamed:    app/assets/images/glyphicons-halflings-white.png -> app/assets/images/bootstrap/glyphicons-halflings-white.png
renamed:    app/assets/images/glyphicons-halflings.png -> app/assets/images/bootstrap/glyphicons-halflings.png
modified:   app/assets/stylesheets/_login_control.css.scss
modified:   app/views/layouts/application.html.erb
	-- modified close button on login screen to show an icon instead

new file:   app/assets/stylesheets/bootstrap/icons.css.scss
	-- stole the twitter css for icons

modified:   app/assets/javascripts/angular/controllers/listen.js
modified:   app/assets/javascripts/angular/directives/directives.js
modified:   app/assets/templates/listen.html
	-- work on annotation viewer

modified:   config/routes.rb

modified:   lib/assets/javascripts/jquery.drawabox.js
	-- minor refactoring and started the functionality to reverse set box dimensions (for two way data binding)
  • Loading branch information
atruskie committed Dec 29, 2012
1 parent e28c1ff commit 6fcd990
Show file tree
Hide file tree
Showing 9 changed files with 594 additions and 89 deletions.
File renamed without changes
3 changes: 2 additions & 1 deletion app/assets/javascripts/angular/controllers/listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function ListenCtrl($scope, $resource, $routeParams, Media, AudioEvent, Tag) {
// TODO: add time bounds
$scope.model.audioEvents = AudioEvent.query({byAudioId: recordingId});


$scope.tags = Tag.query();

$scope.limits = {
Expand All @@ -64,7 +65,7 @@ function ListenCtrl($scope, $resource, $routeParams, Media, AudioEvent, Tag) {

// prep tags
a.audio_event_tags_attributes = a.audioEventTags.map(function (v) {return {tag_id:v};});
delete a.audioEventTtags
delete a.audioEventTtags;

a.audio_recording_id = recordingId;

Expand Down
46 changes: 25 additions & 21 deletions app/assets/javascripts/angular/directives/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,65 +226,69 @@
scope.$canvas = $element.find(".annotation-viewer img + div").first();

// init drawabox
// we use hash (POJO) because most of our operations involve lookups
scope.model.audioEvents = scope.model.audioEvents || {};
scope.model.audioEvents = scope.model.audioEvents || [];
// store only the ids in this array (again for speed)
scope.model.selectedAudioEvents = scope.model.selectedAudioEvents || [];


scope.$canvas.drawabox({
"selectionCallbackTrigger": "mousedown",
"newBox": function (element, newBox) {
var newAudioEvent = create(newBox, "a dummy id!");


scope.$apply(function() {
scope.model.audioEvents[newAudioEvent.__temporaryId__] = newAudioEvent;
scope.model.audioEvents.push( newAudioEvent);

element[0].annotationViewerIndex = scope.model.audioEvents.length - 1;

console.log("newBox", newBox, newAudioEvent);
});
},
"boxSelected": function (element, selectedBox) {
console.log("boxSelected", selectedBox);

//var audioEvent = _.find(scope.model.audioEvents, function(value) { return value.__temporaryId__ === selectedBox.id});

// support for multiple selections - remove the clear
scope.model.selectedAudioEvents.length = 0;
scope.model.selectedAudioEvents.push(selectedBox.id);
scope.$apply(function() {
scope.model.selectedAudioEvents.length = 0;
scope.model.selectedAudioEvents.push(scope.model.audioEvents[element[0].annotationViewerIndex]);
});
},
"boxResizing": function (element, box) {
console.log("boxResizing");
resizeOrMoveWithApply(scope, scope.model.audioEvents[box.id], box);
resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);

},
"boxResized": function (element, box) {
console.log("boxResized");
resizeOrMoveWithApply(scope, scope.model.audioEvents[box.id], box);
resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
},
"boxMoving": function (element, box) {
console.log("boxMoving");
resizeOrMoveWithApply(scope, scope.model.audioEvents[box.id], box);
resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
},
"boxMoved": function (element, box) {
console.log("boxMoved");
resizeOrMoveWithApply(scope, scope.model.audioEvents[box.id], box);
resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
},
"boxDeleted": function (element, deletedBox) {
console.log("boxDeleted");

scope.$apply(function(){
// TODO: is this done by reference? does it even work?;
_(scope.model.audioEvents).reject(function (item) {
return item.id === deletedBox.id;
});
_(scope.model.selectedAudioEvents).reject(function (item) {
return item.id === deletedBox.id;
});
});
// TODO: i'm not sure how I should handle 'deleted' items yet
var itemToDelete = scope.model.audioEvents[element[0].annotationViewerIndex];
itemToDelete.deletedAt = (new Date());

if (scope.model.selectedAudioEvents.length > 0) {
var index = scope.model.selectedAudioEvents.indexOf(itemToDelete);

if (index >= 0) {
scope.model.selectedAudioEvents.splice(index, 1);
}
}
});
}
});


}
}
});
Expand Down
41 changes: 6 additions & 35 deletions app/assets/stylesheets/_login_control.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,6 @@ body.waiting-for-angular div#initializing-panel {
height: 100%;
}


//#content-outer {
// background: image-url("angular-auth/content_repeat.jpg") repeat-x;
// background-color: white;
//}
//#content {
// color: #333;
// font-family: Arial, Helvetica, sans-serif;
// font-size: 12px;
// line-height: 18px;
// margin: 0 auto 0 auto;
// max-width: 1260px;
// min-width: 780px;
// padding: 35px 0px 30px 0px;
//}
//h2 {
// color: #393939;
// font-size: 16px;
// font-weight: bold;
// line-height: 20px;
// margin-bottom: 10px;
//}
//h3 {
// color: #92b22c;
// font-size: 14px;
// font-weight: bold;
// line-height: 18px;
// margin-bottom: 10px;
//}
/* LOGIN -------------------------------------------------------------------------------- */

#login-holder {
@include gradient("radial", nth($master-background,3) , nth($master-background,1));

Expand Down Expand Up @@ -73,15 +42,17 @@ body.waiting-for-angular div#initializing-panel {
position: relative;
width: 508px;
}

#loginboxclose{
position:absolute;
top:10px;
right:10px;
font-weight: bold;
font-size: 16px;
font-family: monospace;
text-decoration: none;
//font-weight: bold;
//font-size: 16px;
//font-family: sans-serif;
//text-decoration: none;
}

#login-inner {
font-family: Tahoma;
font-size: 13px;
Expand Down
Loading

0 comments on commit 6fcd990

Please sign in to comment.