diff --git a/src/app/annotationLibrary/common.js b/src/app/annotationLibrary/common.js
index 52fbf5d0..b8090150 100644
--- a/src/app/annotationLibrary/common.js
+++ b/src/app/annotationLibrary/common.js
@@ -47,7 +47,7 @@ angular
var x = Media.get(
getMediaParameters(annotation),
- mediaGetSuccess.bind(null,annotation),
+ mediaGetSuccess.bind(null, annotation),
mediaGetFailure
);
diff --git a/src/app/annotationLibrary/libraryItem.tpl.html b/src/app/annotationLibrary/libraryItem.tpl.html
index ccf4b58f..60763c4b 100644
--- a/src/app/annotationLibrary/libraryItem.tpl.html
+++ b/src/app/annotationLibrary/libraryItem.tpl.html
@@ -20,7 +20,7 @@
Details
ng-href="{{tagging.tag.similarPartial}}"
title="Tag.">
- {{tagging.tag.typeOfTag.replace('_',' ')}}
+ {{tagging.tag.typeOfTag.replace('_', ' ')}}
retired
taxonomic
{{tagging.tag.text}} (ID {{tagging.tag.id}})
diff --git a/src/app/annotationViewer/_annotationViewer.scss b/src/app/annotationViewer/_annotationViewer.scss
index 9b3a2544..e9a882a2 100644
--- a/src/app/annotationViewer/_annotationViewer.scss
+++ b/src/app/annotationViewer/_annotationViewer.scss
@@ -126,7 +126,7 @@ baw-annotation-viewer {
z-index: 2;
// debug
- // @if $DEBUG { background-color: rgba(255,0,0,0.15) ;}
+ // @if $DEBUG { background-color: rgba(255, 0, 0, 0.15) ;}
// required for IE10
background-color: rgba(255, 255, 255, 0);
diff --git a/src/app/annotationViewer/gridLines/_gridLines.scss b/src/app/annotationViewer/gridLines/_gridLines.scss
index fc2f7838..5f7a1707 100644
--- a/src/app/annotationViewer/gridLines/_gridLines.scss
+++ b/src/app/annotationViewer/gridLines/_gridLines.scss
@@ -106,7 +106,7 @@ $scale-background: #f5f5f5; //#7eff5f
& .yTitle {
@include scale-title-base;
- @include vendor-prefix(transform, translateX(-100%) rotate3d(0,0,1,-90deg) translateX(50%));
+ @include vendor-prefix(transform, translateX(-100%) rotate3d(0, 0, 1, -90deg) translateX(50%));
@include vendor-prefix(transform-origin, 100% 0%);
diff --git a/src/app/app.js b/src/app/app.js
index ef9643ae..049ae36b 100644
--- a/src/app/app.js
+++ b/src/app/app.js
@@ -154,7 +154,7 @@ angular.module("baw",
* to /something/:foo/:bar
*/
function convertRouteParams (route) {
- return route.replace(/}/g,"").replace(/{/g,":");
+ return route.replace(/}/g, "").replace(/{/g, ":");
}
// routes
diff --git a/src/app/audio/ngAudio.js b/src/app/audio/ngAudio.js
index 24b29a82..82db6368 100644
--- a/src/app/audio/ngAudio.js
+++ b/src/app/audio/ngAudio.js
@@ -169,7 +169,7 @@ angular.module("bawApp.directives.ngAudio", [
target.currentState = event && event.type || "unknown";
- updateObject(element ,target);
+ updateObject(element, target);
target.isPlaying = !element.paused;
target.canPlay = element.readyState >= readyStates.haveFutureData;
diff --git a/src/app/citizenScience/bristlebird/bristlebird.js b/src/app/citizenScience/bristlebird/bristlebird.js
index 9fd466cf..6c3f119a 100644
--- a/src/app/citizenScience/bristlebird/bristlebird.js
+++ b/src/app/citizenScience/bristlebird/bristlebird.js
@@ -71,9 +71,9 @@ class BristlebirdController {
* "name": "Eastern Bristlebird",
* "examples": [{
* "annotationId": 124730
- * },{
+ * }, {
* "annotationId": 124727
- * },{
+ * }, {
* "annotationId": 98378
* }]
* },
@@ -100,33 +100,12 @@ class BristlebirdController {
this.showAudio = CitizenScienceCommon.bindShowAudio($scope);
-
-
CsApi.getLabels($scope.csProject).then(function (labels) {
$scope.labels = labels;
});
SampleLabels.init($scope.csProject, $scope.samples, $scope.labels);
-
- $scope.$on("label-toggle", function (e, labelNumber, value) {
- self.toggleLabel(labelNumber, value);
- });
-
- /**
- * applies or removes the tag-sets of the given label number
- * to the current sample
- * @param labelNumber
- * @param value boolean if omitted will flip the current value
- */
- self.toggleLabel = function (labelId, value) {
- console.log("toggling label ", labelId, value);
- if (typeof value !== "boolean") {
- value = !SampleLabels.getValue($scope.currentSample.id, labelId);
- }
- SampleLabels.setValue($scope.currentSample.id, labelId, value);
- };
-
/**
* Retrieve settings about this citizen science project
*/
diff --git a/src/app/citizenScience/citizenScience.js b/src/app/citizenScience/citizenScience.js
index 54f3f3b9..9af32212 100644
--- a/src/app/citizenScience/citizenScience.js
+++ b/src/app/citizenScience/citizenScience.js
@@ -1,5 +1,5 @@
angular
- .module("bawApp.citizenScience",[
+ .module("bawApp.citizenScience", [
"bawApp.citizenScience.bristlebird",
"bawApp.citizenScience.ipswich",
])
diff --git a/src/app/citizenScience/datasetProgress/datasetProgress.js b/src/app/citizenScience/datasetProgress/datasetProgress.js
index 919c8419..de9a8f70 100644
--- a/src/app/citizenScience/datasetProgress/datasetProgress.js
+++ b/src/app/citizenScience/datasetProgress/datasetProgress.js
@@ -1,19 +1,18 @@
angular.module("bawApp.components.progress", ["bawApp.citizenScience.csApiMock"])
- .component("datasetProgress",{
+ .component("datasetProgress", {
templateUrl: "citizenScience/datasetProgress/datasetProgress.tpl.html",
- controller: ["$scope", "$routeParams","$url", "conf.paths","CsApi","SampleLabels",
- function ($scope, $routeParams,$url,paths,CsApi,SampleLabels) {
+ controller: ["$scope", "$routeParams", "$url", "conf.paths", "CsApi", "SampleLabels",
+ function ($scope, $routeParams, $url, paths, CsApi, SampleLabels) {
var self = this;
$scope.selectItem = function (itemId) {
console.log("selecting item", itemId);
CsApi.getSample(itemId).then(function (apiResponse) {
self.currentSample = apiResponse;
+ SampleLabels.registerCurrentSampleId(self.currentSample.id);
+ $scope.totalSamplesViewed = SampleLabels.getNumSamplesViewed();
+ console.log("setting selected to ", itemId);
});
-
- $scope.totalSamplesViewed = SampleLabels.getNumSamplesViewed();
-
- console.log("setting selected to ", itemId);
};
$scope.selectItem($routeParams.sampleNum);
diff --git a/src/app/citizenScience/dummyApi/citizenScienceSampleLabels.js b/src/app/citizenScience/dummyApi/citizenScienceSampleLabels.js
index 2c81dca0..801c0c68 100644
--- a/src/app/citizenScience/dummyApi/citizenScienceSampleLabels.js
+++ b/src/app/citizenScience/dummyApi/citizenScienceSampleLabels.js
@@ -45,6 +45,8 @@ sampleLabels.factory("SampleLabels", [
};
+ self.currentSampleId = 0;
+
/**
* stringifies the object that acts as a join between samples and labels,
* then stores that json string in local storage
@@ -76,12 +78,16 @@ sampleLabels.factory("SampleLabels", [
/**
* Looks up the data to see if there is a boolean value stored for a given sampleId and labelId
* and if so, returns it.
- * @param sampleId
+ * @param sampleId. If omitted, will use the current sample if available
* @param labelId
* @returns {boolean}
*/
getValue : function (sampleId, labelId) {
+ if (sampleId === null) {
+ sampleId = self.currentSampleId;
+ }
+
if (self.data[sampleId] !== undefined) {
if (self.data[sampleId][labelId] !== undefined) {
return self.data[sampleId][labelId].value;
@@ -92,17 +98,26 @@ sampleLabels.factory("SampleLabels", [
/**
* updates the value of a labelId applied to a sampleId as either true or false
- * @param sampleId int
+ * @param sampleId int; if null, will use the current sample id
* @param labelId int; if omitted, we are not applying a label but noting that the sample has been viewed
* @param value int [0,1]
*/
setValue : function (sampleId, labelId, value) {
+
+ if (sampleId === null) {
+ sampleId = self.currentSampleId;
+ }
+
+ if (sampleId <= 0) {
+ console.warn("bad sampleId supplied");
+ return;
+ }
+
if (self.data[sampleId] === undefined) {
self.data[sampleId] = {};
}
-
if (labelId !== undefined) {
if (self.data[sampleId][labelId] === undefined) {
@@ -150,6 +165,10 @@ sampleLabels.factory("SampleLabels", [
},
+ registerCurrentSampleId : function (currentSampleId) {
+ self.currentSampleId = currentSampleId;
+ },
+
/**
* Dev function to delete all applied labels
*/
diff --git a/src/app/citizenScience/examples/_examples.scss b/src/app/citizenScience/examples/_examples.scss
index 02814152..2fe43380 100644
--- a/src/app/citizenScience/examples/_examples.scss
+++ b/src/app/citizenScience/examples/_examples.scss
@@ -13,12 +13,12 @@
background: #fff;
border-radius: 5px;
- -webkit-box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
- -moz-box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
- box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
+ -webkit-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
+ -moz-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
+ box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
.dark {
- background: rgba(0,0,0,0.7);
+ background: rgba(0, 0, 0, 0.7);
}
&.selected {
diff --git a/src/app/citizenScience/textLabels/labelCheck.js b/src/app/citizenScience/textLabels/labelCheck.js
index 012b4ebb..b8c1f037 100644
--- a/src/app/citizenScience/textLabels/labelCheck.js
+++ b/src/app/citizenScience/textLabels/labelCheck.js
@@ -13,14 +13,13 @@ angular.module("bawApp.components.citizenScienceLabelCheck", ["bawApp.citizenSci
* @param label string
*/
$scope.toggleLabel = function () {
- self.checked.value = !self.checked.value;
- self.onToggleSelected(self.checked.value);
+ self.onToggleSelected(!self.isChecked());
};
}],
bindings: {
- checked: "=",
+ isChecked: "=",
onToggleSelected: "=",
- text:"<"
+ text:"<",
}
});
\ No newline at end of file
diff --git a/src/app/citizenScience/textLabels/labelCheck.tpl.html b/src/app/citizenScience/textLabels/labelCheck.tpl.html
index 98dcdf1c..4c0eda82 100644
--- a/src/app/citizenScience/textLabels/labelCheck.tpl.html
+++ b/src/app/citizenScience/textLabels/labelCheck.tpl.html
@@ -2,7 +2,7 @@
{{$ctrl.text}}
diff --git a/src/app/citizenScience/thumbLabels/_thumbs.scss b/src/app/citizenScience/thumbLabels/_thumbs.scss
index 98859971..adfd2c7d 100644
--- a/src/app/citizenScience/thumbLabels/_thumbs.scss
+++ b/src/app/citizenScience/thumbLabels/_thumbs.scss
@@ -5,7 +5,7 @@ $triangle: '