Skip to content

Commit

Permalink
General bug fixes
Browse files Browse the repository at this point in the history
Updated ng-resource dependency.

Fixed Angular whitelist bug when updating version.

Some basic work trying to add annotations.
  • Loading branch information
atruskie committed Nov 5, 2013
1 parent 79dd7ea commit f0c8ff7
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 29 deletions.
9 changes: 3 additions & 6 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
"angular-bootstrap": "~0.6.0",
"angular-ui-router": "~0.0.1",
"angular-ui-utils": "latest",
"sass-bootstrap": "~3.0.0",
"sass-bootstrap": "3.0.0",
"hint.css": "https://github.com/chinchang/hint.css.git",
"underscore": "~1.5.2",
"angular-resource": "~1.0.8",
"angular-resource": "~1.2.0",
"modernizr": "~2.6.2",
"jquery-ui": "~1.10.3",
"momentjs": "~2.3.0"
},
"dependencies": {},
"resolutions": {
"angular": "~1.2.0"
}
"dependencies": {}
}
2 changes: 1 addition & 1 deletion build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
build_configs: {
configFile: appConfigFile,
development: {
apiRoot: "http://staging.ecosounds.org",
apiRoot: "http://131.181.33.143:3000", //"http://staging.ecosounds.org",
siteRoot: "localhost:8080",
siteDir: "/"
},
Expand Down
10 changes: 5 additions & 5 deletions src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var app = angular.module('baw',
function ($routeProvider, $locationProvider, $httpProvider, paths, $sceDelegateProvider) {
// adjust security whitelist for resource urls
var currentWhitelist = $sceDelegateProvider.resourceUrlWhitelist();
currentWhitelist.push('^'+paths.api.root+'/.*');
currentWhitelist.push(paths.api.root+'/**');
$sceDelegateProvider.resourceUrlWhitelist(currentWhitelist);


Expand Down Expand Up @@ -257,12 +257,12 @@ var app = angular.module('baw',
function AppCtrl($scope, $location) {

$scope.showDebugUi = function() {
var r = window.cssRules.getCssRule(".debug-UI")
var r = window.cssRules.getCssRule(".debug-UI");
r.style.display = "";
}
};
$scope.hideDebugUi = function() {
var r = window.cssRules.getCssRule(".debug-UI")
var r = window.cssRules.getCssRule(".debug-UI");
r.style.display = "none";
}
};

}]);
16 changes: 10 additions & 6 deletions src/app/listen/listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,19 @@ angular.module('bawApp.listen', [])

$scope.addAnnotation = function createAnnotation() {
// BUG: ONLY SAVES FIRST ONE
var a = angular.copy(this.$scope.model.selectedAudioEvents[0]);
var a = $scope.model.selectedAudioEvents[0];
//TODO: BROKEN!
var a = $scope.model;

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

a.audio_recording_id = recordingId;
if (a.audioRecordingId != recordingId) {
throw "The audioRecordingId should have been set way earlier!";
}

AudioEvent.save({audioEventId: null}, a,
function createAnnotationSuccess(response, getResponseHeaders) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/listen/listen.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ <h4 class="center-block">Site: {{model.audioRecording.siteId}}, <span class="hin
<h3>
Annotation edit
</h3>
<span>Selected elements: {{model.selectedAudioEvents.length}}</span>
<span>Selected elements: {{model.selectedAudioEvents.length || 0}}</span>

<form id="annotationEditForm" name="annotationEditForm"
ng-repeat="selectedEvent in model.audioEvents | filter:selectedFilter">
Expand Down Expand Up @@ -136,7 +136,7 @@ <h3>

<!--<button type="button" ng-click="reset()">Clear</button>-->
<!--<button ng-click="addAnnotation()">Add annotation</button>-->

<button ng-click="addAnnotation()">Add</button>
</form>
</div>
<div class="debug-ui">
Expand Down
18 changes: 16 additions & 2 deletions src/components/models/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
throw new Error("Constructor called as a function");
}

var now = new Date();

this.__temporaryId__ = localId || Number.Unique();
this._selected = false;
this.audioEventTags = [];

if (localId) {
var now = new Date();

this.audioRecordingId = audioRecordingId;

this.createdAt = now;
Expand All @@ -38,6 +38,7 @@

}

// ensure JSON values taken from a resource have nicely formatted values
if (resource) {
angular.extend(this, resource);

Expand All @@ -49,8 +50,21 @@
this.lowFrequencyHertz = parseFloat(this.lowFrequencyHertz);
this.startTimeSeconds = parseFloat(this.startTimeSeconds);

this.audioEventTags = {};
angular.forEach(this.audioEventTags, function(value, key) {
this.audioEventTags[key] = new baw.AudioEventTag(value);
}, this);
}

// strip out unnecessary values;
this.create = function() {
// NO-OP
return this;
};
//
// this.toJSON = function() {
// return {
//
// }
// };
};
14 changes: 7 additions & 7 deletions src/sass/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ header {
//}

/* stick footer Opera Fix */
body:before {
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;
}
//body:before {
// content:"";
// height:100%;
// float:left;
// width:0;
// margin-top:-32767px;
//}

/* General Classes
-----------------------------------------------------------------------------*/
Expand Down

0 comments on commit f0c8ff7

Please sign in to comment.