diff --git a/Gruntfile.js b/Gruntfile.js index 76b3ff3c..48f92b70 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,8 +8,8 @@ module.exports = function (grunt) { // bit of bullshit to ensure the build fails for missing files in the concat task // note this overrides normal logging! not cool. // These problems (failing on missing files) are expected to be resolved in grunt 0.5 - grunt.log.oldWarn = grunt.log.warn; - grunt.log.warn = grunt.warn; + //grunt.log.oldWarn = grunt.log.warn; + //grunt.log.warn = grunt.warn; /** * Load required Grunt tasks. These are installed based on the versions listed diff --git a/src/app/app.js b/src/app/app.js index 58c9bcbd..38b10df2 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -164,12 +164,15 @@ var app = angular.module('baw', }]) - .run(['$rootScope', '$location', '$route', '$http', 'AudioEvent', 'conf.paths', - function ($rootScope, $location, $route, $http, AudioEvent, paths) { + .run(['$rootScope', '$location', '$route', '$http', 'AudioEvent', 'conf.paths', 'UserProfile', + function ($rootScope, $location, $route, $http, AudioEvent, paths, UserProfile) { // embed configuration for easy site-wide binding $rootScope.paths = paths; + // user profile - update user preferences when they change + UserProfile.get($rootScope, "userProfile"); + // helper function for printing scope objects baw.exports.print = $rootScope.print = function () { var seen = []; diff --git a/src/app/listen/listen.js b/src/app/listen/listen.js index 367c2c0b..011f2c30 100644 --- a/src/app/listen/listen.js +++ b/src/app/listen/listen.js @@ -81,7 +81,8 @@ angular.module('bawApp.listen', ['decipher.tags', 'ui.bootstrap.typeahead']) // set up some dummy objects for use later $scope.jumpToHide = true; $scope.model = { - audioElement: {}, + audioElement: { + }, audioEvents: [], media: null, selectedAudioEvent: null, @@ -90,6 +91,16 @@ angular.module('bawApp.listen', ['decipher.tags', 'ui.bootstrap.typeahead']) site: null }; + // bind + $scope.$watch(function () { + return $scope.model.audioElement; + }, function(newValue) { + $scope.$root.userProfile.preferences.volume = newValue; + }); + $scope.$watch("$root.userProfile.preferences.volume", function(newValue) { + $scope.model.audioElement = newValue; + }); + var formatPaths = function () { if ($scope.model.media && $scope.model.media.hasOwnProperty('id')) { //var authToken = $scope.authTokenQuery(); diff --git a/src/baw.configuration.tpl.js b/src/baw.configuration.tpl.js index 51ab355e..c10415c0 100644 --- a/src/baw.configuration.tpl.js +++ b/src/baw.configuration.tpl.js @@ -13,7 +13,7 @@ angular.module('bawApp.configuration', ['url']) * @param {...[string]} fragments * @returns {*} */ - function joinPathFragments(fragments) { + function joinPathFragments(fragments) { fragments = Array.prototype.slice.call(arguments, 0); if (fragments.length === 0) { @@ -33,14 +33,14 @@ angular.module('bawApp.configuration', ['url']) var f = fragments[i]; if ((typeof f) !== "string") { - throw "Path fragment " + f + " is not a string"; + throw "joingPathFragments: Path fragment " + f + " is not a string"; } var hasFirst = f[0] === "/"; var hasLast = (f.slice(-1))[0] === "/"; if (!hasFirst) { - f = "/" + f; + f = "/" + f; } if (hasLast && i !== (fragments.length - 1)) { @@ -64,19 +64,19 @@ angular.module('bawApp.configuration', ['url']) listShort: "/audio_recordings/{recordingId}", show: "/audio_recordings/{recordingId}", list: "/audio_recordings/" - }, + }, audioEvent: { list: "/audio_recordings/{recordingId}/audio_events", show: "/audio_recordings/{recordingId}/audio_events/{audioEventId}", - csv : "/audio_events/download." + csv: "/audio_events/download." }, tagging: { list: "/audio_recordings/{recordingId}/audio_events/{audioEventId}/taggings", show: "/audio_recordings/{recordingId}/audio_events/{audioEventId}/taggings/{taggingId}" }, tag: { - list: '/tags/', - show: '/tags/{tagId}' + list: '/tags/', + show: '/tags/{tagId}' }, media: { show: "/audio_recordings/{recordingId}/media.{format}" @@ -85,8 +85,9 @@ angular.module('bawApp.configuration', ['url']) ping: "/security/sign_in", signIn: "/my_account/sign_in" }, - users: { - settings: "I really don't know yet" + user: { + profile: "/my_account", + settings: "/my_account/prefs" } }, links: { @@ -104,7 +105,7 @@ angular.module('bawApp.configuration', ['url']) listen: 'listen/listen.tpl.html', annotationViewer: 'annotationViewer/annotationViewer.tpl.html', navigation: 'navigation/navigation.tpl.html', - birdWalk : { + birdWalk: { list: 'birdWalks/birdWalks.tpl.html', detail: 'birdWalks/birdWalk.tpl.html', spec: 'assets/bird_walk/bird_walk_spec.json', @@ -124,7 +125,6 @@ angular.module('bawApp.configuration', ['url']) }; - // add helper paths function recursivePath(source, root) { for (var key in source) { @@ -159,6 +159,14 @@ angular.module('bawApp.configuration', ['url']) unitConverter: { precisionSeconds: 9, precisionHertz: 6 - + }, + defaultProfile: { + createdAt: null, + email: null, + id: null, + preferences: { + volume: 1.0 + }, + userName: "Unknown user" } }); \ No newline at end of file diff --git a/src/components/directives/ngAudio.js b/src/components/directives/ngAudio.js index af69199c..d3153aa6 100644 --- a/src/components/directives/ngAudio.js +++ b/src/components/directives/ngAudio.js @@ -16,6 +16,11 @@ bawds.directive('ngAudio', ['$parse', function ($parse) { throw 'Cannot put ngAudio element on an element that is not a