From 3f09a87562c68cc4283d755a5de34d9ed0dd5aa1 Mon Sep 17 00:00:00 2001 From: Anthony Truskinger Date: Fri, 1 Nov 2013 00:03:11 +1000 Subject: [PATCH] Started work on integrating bootstrap. - Added devlopment guidelines as source of help for contributers - Added suport for processing application.tpl.scss as a template. This now means the $DEBUG flag is set correctly. TODO: automatically include css partials from src/app/**/*.scss - deleted old scripts that are no longer necessary - removed old css color swatch - bound new play/pause buttons to model. --- DevelopmentGuidelines.md | 10 + Gruntfile.js | 250 +++++++++++------- build.config.js | 8 +- package.json | 1 + scripts/e2e-test.bat | 11 - scripts/e2e-test.sh | 9 - scripts/test.bat | 11 - scripts/test.sh | 9 - scripts/web-server.js | 244 ----------------- .../annotationViewer/_annotation_viewer.scss | 27 +- src/app/app.js | 2 +- src/app/listen/listen.js | 2 +- src/app/listen/listen.tpl.html | 12 +- src/app/login/_login_control.scss | 7 +- .../_record_information.scss | 6 +- src/components/directives/ngAudio.js | 13 +- src/index.html | 238 +++++++++-------- src/sass/_base.scss | 18 +- src/sass/_dynamic.scss | 2 +- src/sass/_layout.scss | 37 +-- src/sass/_time_formats.scss | 2 +- ...{application.scss => application.tpl.scss} | 3 + 22 files changed, 381 insertions(+), 541 deletions(-) create mode 100644 DevelopmentGuidelines.md delete mode 100644 scripts/e2e-test.bat delete mode 100644 scripts/e2e-test.sh delete mode 100644 scripts/test.bat delete mode 100644 scripts/test.sh delete mode 100644 scripts/web-server.js rename src/sass/{application.scss => application.tpl.scss} (94%) diff --git a/DevelopmentGuidelines.md b/DevelopmentGuidelines.md new file mode 100644 index 00000000..bec532fd --- /dev/null +++ b/DevelopmentGuidelines.md @@ -0,0 +1,10 @@ +# Development guidelines + + +# Design guideline + +* Do NOT use elements if there is logical navigation destination +* Avoid using bootstrap classes in the html + * Instead use SASS to import/extend the appropriate classes in the .scss file + * Ideally, with appropriate exceptions, design and layout should only occur in css + * And, semantic structure should only occur in HTML \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index de0a9318..1d482ae4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,4 +1,6 @@ -var modRewrite = require('connect-modrewrite'); +var modRewrite = require('connect-modrewrite'), + path = require('path'); + module.exports = function (grunt) { @@ -7,6 +9,7 @@ module.exports = function (grunt) { * in `package.json` when you do `npm install` in this directory. */ grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-remove'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-concat'); @@ -60,14 +63,17 @@ module.exports = function (grunt) { if (development) { grunt.log.ok("Development build selected"); userConfig.build_configs.current = userConfig.build_configs.development; + userConfig.build_configs.current.key = 'development'; } if (staging) { grunt.log.ok("Staging build selected"); userConfig.build_configs.current = userConfig.build_configs.staging; + userConfig.build_configs.current.key = 'staging'; } if (production) { grunt.log.ok("Production build selected"); userConfig.build_configs.current = userConfig.build_configs.production; + userConfig.build_configs.current.key = 'production'; } @@ -81,7 +87,7 @@ module.exports = function (grunt) { * version. It's already there, so we don't repeat ourselves here. */ pkg: grunt.file.readJSON("package.json"), - + sassDest: '<%= build_dir %>/assets/styles/<%= pkg.name %>-<%= pkg.version %>.css', /** @@ -91,11 +97,11 @@ module.exports = function (grunt) { */ meta: { banner: '/**\n' + - ' * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' + - ' * <%= pkg.homepage %>\n' + - ' *\n' + - ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' + - ' * Licensed <%= pkg.licenses.type %> <<%= pkg.licenses.url %>>\n' + + ' * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' + + ' * <%= pkg.homepage %>\n' + + ' *\n' + + ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' + + ' * Licensed <%= pkg.licenses.type %> <<%= pkg.licenses.url %>>\n' + ' */\n' }, @@ -104,7 +110,7 @@ module.exports = function (grunt) { */ changelog: { options: { - dest: 'CHANGELOG.md', + dest: 'CHANGELOG.md', template: 'changelog.tpl' } }, @@ -114,31 +120,42 @@ module.exports = function (grunt) { */ bump: { options: { - files: [ + files: [ "package.json", "bower.json" ], - commit: false, + commit: false, commitMessage: 'chore(release): v%VERSION%', - commitFiles: [ + commitFiles: [ "package.json", "client/bower.json" ], - createTag: false, - tagName: 'v%VERSION%', - tagMessage: 'Version %VERSION%', - push: false, - pushTo: 'origin' + createTag: false, + tagName: 'v%VERSION%', + tagMessage: 'Version %VERSION%', + push: false, + pushTo: 'origin' } }, /** * The directories to delete when `grunt clean` is executed. */ - clean: [ - '<%= build_dir %>', - '<%= compile_dir %>' - ], + clean: { + processedSass: { + // sometimes clean is run when processedSass is not defined + // In this case, it is necessary to not provide an empty string because grunt complains + // so provide an always negative match instead + src: ['<%= app_files.processedSass || "!?" %>'], + filter: 'isFile' + }, + others: { + src: [ + '<%= build_dir %>', + '<%= compile_dir %>' + ] + } + }, /** * The `copy` task just copies files from A to B. We use it here to copy @@ -146,12 +163,12 @@ module.exports = function (grunt) { * `build_dir`, and then to copy the assets to `compile_dir`. */ copy: { - build_app_assets: { + build_app_assets: { files: [ { - src: [ '**' ], - dest: '<%= build_dir %>/assets/', - cwd: 'src/assets', + src: [ '**' ], + dest: '<%= build_dir %>/assets/', + cwd: 'src/assets', expand: true } ] @@ -159,17 +176,17 @@ module.exports = function (grunt) { build_vendor_assets: { files: [ { - src: [ '<%= vendor_files.assets %>' ], - dest: '<%= build_dir %>/assets/', - cwd: '.', - expand: true, + src: [ '<%= vendor_files.assets %>' ], + dest: '<%= build_dir %>/assets/', + cwd: '.', + expand: true, flatten: true } ] }, - build_appjs: { - options : { - processContent : function(content, srcPath) { + build_appjs: { + options: { + processContent: function (content, srcPath) { // if srcPath contain .tpl.js // for now since the angular templates use tpl as well, // we'll cheat and just use a direct file reference @@ -183,31 +200,31 @@ module.exports = function (grunt) { return content; } }, - files: [ + files: [ { - src: [ '<%= app_files.js %>' ], - dest: '<%= build_dir %>/', - cwd: '.', + src: [ '<%= app_files.js %>' ], + dest: '<%= build_dir %>/', + cwd: '.', expand: true } ] }, - build_vendorjs: { + build_vendorjs: { files: [ { - src: [ '<%= vendor_files.js %>' ], - dest: '<%= build_dir %>/', - cwd: '.', + src: [ '<%= vendor_files.js %>' ], + dest: '<%= build_dir %>/', + cwd: '.', expand: true } ] }, - compile_assets: { + compile_assets: { files: [ { - src: [ '**' ], - dest: '<%= compile_dir %>/assets', - cwd: '<%= build_dir %>/assets', + src: [ '**' ], + dest: '<%= compile_dir %>/assets', + cwd: '<%= build_dir %>/assets', expand: true } ] @@ -222,8 +239,8 @@ module.exports = function (grunt) { * The `build_css` target concatenates compiled CSS and vendor CSS * together. */ - build_css: { - src: [ + build_css: { + src: [ '<%= vendor_files.css %>', /*'<%= recess.build.dest %>',*/ '<%= build_dir %>/assets/styles/*.css' @@ -238,7 +255,7 @@ module.exports = function (grunt) { options: { banner: '<%= meta.banner %>' }, - src: [ + src: [ '<%= vendor_files.js %>', 'module.prefix', '<%= build_dir %>/src/**/*.js', @@ -246,7 +263,7 @@ module.exports = function (grunt) { '<%= html2js.common.dest %>', 'module.suffix' ], - dest: '<%= compile_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.js' + dest: '<%= compile_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.js' } }, @@ -262,11 +279,11 @@ module.exports = function (grunt) { options: { bare: true }, - expand: true, - cwd: '.', - src: [ '<%= app_files.coffee %>' ], - dest: '<%= build_dir %>', - ext: '.js' + expand: true, + cwd: '.', + src: [ '<%= app_files.coffee %>' ], + dest: '<%= build_dir %>', + ext: '.js' } }, @@ -278,9 +295,9 @@ module.exports = function (grunt) { compile: { files: [ { - src: [ '<%= app_files.js %>' ], - cwd: '<%= build_dir %>', - dest: '<%= build_dir %>', + src: [ '<%= app_files.js %>' ], + cwd: '<%= build_dir %>', + dest: '<%= build_dir %>', expand: true } ] @@ -295,7 +312,7 @@ module.exports = function (grunt) { options: { banner: '<%= meta.banner %>' }, - files: { + files: { '<%= concat.compile_js.dest %>': '<%= concat.compile_js.dest %>' } } @@ -355,21 +372,33 @@ module.exports = function (grunt) { },*/ sass: { - build: { + build: ['sassTemplate', 'sassReal:build', 'clean:processedSass'], + compile: ['sassTemplate', 'sassReal:compile', 'clean:processedSass'] + }, + + /** + * this is the actual sass compiler task. + * This task is run after the sass file template has been processed. + */ + sassReal: { + options: { + + }, + build: { options: { - outputStyle: 'expanded', + outputStyle: 'expanded', sourceComments: 'map' }, - src: '<%= app_files.sass %>', - dest: '<%= sassDest %>' + src: '<%= app_files.processedSass %>', + dest: '<%= sassDest %>' }, compile: { options: { - outputStyle: 'compressed', + outputStyle: 'compressed', sourceComments: 'none' }, - src: '<%= app_files.sass %>', - dest: '<%= sassDest %>' + src: '<%= app_files.processedSass %>', + dest: '<%= sassDest %>' } }, @@ -382,28 +411,28 @@ module.exports = function (grunt) { * nonetheless inside `src/`. */ jshint: { - src: [ + src: [ '<%= app_files.js %>' ], - test: [ + test: [ '<%= app_files.jsunit %>' ], gruntfile: [ 'Gruntfile.js' ], - options: { - curly: true, - immed: true, + options: { + curly: true, + immed: true, newcap: true, - noarg: true, - sub: true, - boss: true, + noarg: true, + sub: true, + boss: true, eqnull: true, /* HACK: At some point this should be turned off!" */ - force: true + force: true }, - globals: {} + globals: {} }, /** @@ -412,7 +441,7 @@ module.exports = function (grunt) { * the defaults here. */ coffeelint: { - src: { + src: { files: { src: [ '<%= app_files.coffee %>' ] } @@ -438,8 +467,8 @@ module.exports = function (grunt) { options: { base: 'src/app' }, - src: [ '<%= app_files.atpl %>' ], - dest: '<%= build_dir %>/templates-app.js' + src: [ '<%= app_files.atpl %>' ], + dest: '<%= build_dir %>/templates-app.js' }, /** @@ -449,8 +478,8 @@ module.exports = function (grunt) { options: { base: 'src/common' }, - src: [ '<%= app_files.ctpl %>' ], - dest: '<%= build_dir %>/templates-common.js' + src: [ '<%= app_files.ctpl %>' ], + dest: '<%= build_dir %>/templates-common.js' } }, @@ -458,11 +487,11 @@ module.exports = function (grunt) { * The Karma configurations. */ karma: { - options: { + options: { configFile: '<%= build_dir %>/karma-unit.js' }, - unit: { - port: 9019, + unit: { + port: 9019, background: true }, continuous: { @@ -533,17 +562,17 @@ module.exports = function (grunt) { connect: { server: { options: { - hostname: '*', - port: 8080, - base: '<%= build_dir %>', - debug: true, + hostname: '*', + port: 8080, + base: '<%= build_dir %>', + debug: true, livereload: true, /*keepalive: true,*/ middleware: function (connect, options) { return [ modRewrite([ - '!(\\..+)$ / [L]' - ]), + '!(\\..+)$ / [L]' + ]), connect.static(options.base) ]; } @@ -577,8 +606,8 @@ module.exports = function (grunt) { * your Gruntfile changes, it will automatically be reloaded! */ gruntfile: { - files: 'Gruntfile.js', - tasks: [ 'jshint:gruntfile' ], + files: 'Gruntfile.js', + tasks: [ 'jshint:gruntfile' ], options: { livereload: false } @@ -655,10 +684,10 @@ module.exports = function (grunt) { * run the unit tests. We don't want to do any live reloading. */ jsunit: { - files: [ + files: [ '<%= app_files.jsunit %>' ], - tasks: [ 'jshint:test', 'karma:unit:run' ], + tasks: [ 'jshint:test', 'karma:unit:run' ], options: { livereload: false } @@ -669,10 +698,10 @@ module.exports = function (grunt) { * run the unit tests. We don't want to do any live reloading. */ coffeeunit: { - files: [ + files: [ '<%= app_files.coffeeunit %>' ], - tasks: [ 'coffeelint:test', 'karma:unit:run' ], + tasks: [ 'coffeelint:test', 'karma:unit:run' ], options: { livereload: false } @@ -715,7 +744,8 @@ module.exports = function (grunt) { * minifying your code. */ grunt.registerTask('compile', [ - /*'recess:compile',*/ 'sass:compile', 'copy:compile_assets', 'ngmin', 'concat:compile_js', 'uglify', 'index:compile' + /*'recess:compile',*/ 'sass:compile', 'copy:compile_assets', 'ngmin', 'concat:compile_js', 'uglify', + 'index:compile' ]); /** @@ -757,16 +787,40 @@ module.exports = function (grunt) { return grunt.template.process(contents, { data: { build_configs: grunt.config('build_configs'), - scripts: jsFiles, - styles: cssFiles, - mainStyle: mainCss, - version: grunt.config('pkg.version') + scripts: jsFiles, + styles: cssFiles, + mainStyle: mainCss, + version: grunt.config('pkg.version') } }); } }); }); + /** + * This task handles the template processing for the main sass file. + * It injects itself as a task that occurs before the sass task. + */ + grunt.renameTask('sass', 'sassReal'); + grunt.registerTask('sassTemplate', 'Transforming sass file', function () { + var mainScss = grunt.config('app_files.sass'); + var processedScss = path.join(path.dirname(mainScss), path.basename(mainScss, ".tpl.scss")) + ".processed.scss"; + grunt.config.set('app_files.processedSass', processedScss); + + grunt.log.write("Temp file: " + processedScss); + + grunt.file.copy(mainScss, processedScss, { + process: function (contents, path) { + return grunt.template.process(contents, grunt.config()); + } + }); + }); + + grunt.registerMultiTask('sass', function() { + grunt.task.run(this.data); + }); + + /** * In order to avoid having to specify manually the files needed for karma to * run, we use grunt to manage the list for us. The `karma/*` files are diff --git a/build.config.js b/build.config.js index 9a1e7b11..9dacd45f 100644 --- a/build.config.js +++ b/build.config.js @@ -28,7 +28,9 @@ module.exports = { apiRoot: "http://ecosounds.org", siteRoot: "http://ecosounds.org/????", siteDir: "????" - } + }, + + current: {} }, /** @@ -51,7 +53,7 @@ module.exports = { ctpl: [ 'src/common/**/*.tpl.html' ], html: [ 'src/index.html'], - sass: [ 'src/sass/application.scss' ] + sass: [ 'src/sass/application.tpl.scss' ] //less: 'src/less/main.less' }, @@ -87,6 +89,8 @@ 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 + 'vendor/sass-bootstrap/dist/js/bootstrap.js', 'vendor/momentjs/moment.js', 'vendor/angular/angular.js', 'vendor/angular-route/angular-route.js', diff --git a/package.json b/package.json index 79b739fc..cd0c5da3 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-clean": "~0.4.1", + "grunt-remove": "~0.1", "grunt-contrib-copy": "~0.4.1", "grunt-contrib-jshint": "~0.4.3", "grunt-contrib-concat": "~0.3.0", diff --git a/scripts/e2e-test.bat b/scripts/e2e-test.bat deleted file mode 100644 index 0b2aee60..00000000 --- a/scripts/e2e-test.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off - -REM Windows script for running e2e tests -REM You have to run server and capture some browser first -REM -REM Requirements: -REM - NodeJS (http://nodejs.org/) -REM - Karma (npm install -g karma) - -set BASE_DIR=%~dp0 -karma start "%BASE_DIR%\..\config\karma-e2e.conf.js" %* diff --git a/scripts/e2e-test.sh b/scripts/e2e-test.sh deleted file mode 100644 index 5d8a335e..00000000 --- a/scripts/e2e-test.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -BASE_DIR=`dirname $0` - -echo "" -echo "Starting Karma Server (http://karma-runner.github.io)" -echo "-------------------------------------------------------------------" - -karma start $BASE_DIR/../config/karma-e2e.conf.js $* diff --git a/scripts/test.bat b/scripts/test.bat deleted file mode 100644 index 192fa038..00000000 --- a/scripts/test.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off - -REM Windows script for running unit tests -REM You have to run server and capture some browser first -REM -REM Requirements: -REM - NodeJS (http://nodejs.org/) -REM - Karma (npm install -g karma) - -set BASE_DIR=%~dp0 -karma start "%BASE_DIR%\..\config\karma.conf.js" %* diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100644 index 5fe9d02b..00000000 --- a/scripts/test.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -BASE_DIR=`dirname $0` - -echo "" -echo "Starting Karma Server (http://karma-runner.github.io)" -echo "-------------------------------------------------------------------" - -karma start $BASE_DIR/../config/karma.conf.js $* diff --git a/scripts/web-server.js b/scripts/web-server.js deleted file mode 100644 index 3f74441e..00000000 --- a/scripts/web-server.js +++ /dev/null @@ -1,244 +0,0 @@ -#!/usr/bin/env node - -var util = require('util'), - http = require('http'), - fs = require('fs'), - url = require('url'), - events = require('events'); - -var DEFAULT_PORT = 8000; - -function main(argv) { - new HttpServer({ - 'GET': createServlet(StaticServlet), - 'HEAD': createServlet(StaticServlet) - }).start(Number(argv[2]) || DEFAULT_PORT); -} - -function escapeHtml(value) { - return value.toString(). - replace('<', '<'). - replace('>', '>'). - replace('"', '"'); -} - -function createServlet(Class) { - var servlet = new Class(); - return servlet.handleRequest.bind(servlet); -} - -/** - * An Http server implementation that uses a map of methods to decide - * action routing. - * - * @param {Object} Map of method => Handler function - */ -function HttpServer(handlers) { - this.handlers = handlers; - this.server = http.createServer(this.handleRequest_.bind(this)); -} - -HttpServer.prototype.start = function(port) { - this.port = port; - this.server.listen(port); - util.puts('Http Server running at http://localhost:' + port + '/'); -}; - -HttpServer.prototype.parseUrl_ = function(urlString) { - var parsed = url.parse(urlString); - parsed.pathname = url.resolve('/', parsed.pathname); - return url.parse(url.format(parsed), true); -}; - -HttpServer.prototype.handleRequest_ = function(req, res) { - var logEntry = req.method + ' ' + req.url; - if (req.headers['user-agent']) { - logEntry += ' ' + req.headers['user-agent']; - } - util.puts(logEntry); - req.url = this.parseUrl_(req.url); - var handler = this.handlers[req.method]; - if (!handler) { - res.writeHead(501); - res.end(); - } else { - handler.call(this, req, res); - } -}; - -/** - * Handles static content. - */ -function StaticServlet() {} - -StaticServlet.MimeMap = { - 'txt': 'text/plain', - 'html': 'text/html', - 'css': 'text/css', - 'xml': 'application/xml', - 'json': 'application/json', - 'js': 'application/javascript', - 'jpg': 'image/jpeg', - 'jpeg': 'image/jpeg', - 'gif': 'image/gif', - 'png': 'image/png', -  'svg': 'image/svg+xml' -}; - -StaticServlet.prototype.handleRequest = function(req, res) { - var self = this; - var path = ('./' + req.url.pathname).replace('//','/').replace(/%(..)/g, function(match, hex){ - return String.fromCharCode(parseInt(hex, 16)); - }); - var parts = path.split('/'); - if (parts[parts.length-1].charAt(0) === '.') - return self.sendForbidden_(req, res, path); - fs.stat(path, function(err, stat) { - if (err) - return self.sendMissing_(req, res, path); - if (stat.isDirectory()) - return self.sendDirectory_(req, res, path); - return self.sendFile_(req, res, path); - }); -} - -StaticServlet.prototype.sendError_ = function(req, res, error) { - res.writeHead(500, { - 'Content-Type': 'text/html' - }); - res.write('\n'); - res.write('Internal Server Error\n'); - res.write('

Internal Server Error

'); - res.write('
' + escapeHtml(util.inspect(error)) + '
'); - util.puts('500 Internal Server Error'); - util.puts(util.inspect(error)); -}; - -StaticServlet.prototype.sendMissing_ = function(req, res, path) { - path = path.substring(1); - res.writeHead(404, { - 'Content-Type': 'text/html' - }); - res.write('\n'); - res.write('404 Not Found\n'); - res.write('

Not Found

'); - res.write( - '

The requested URL ' + - escapeHtml(path) + - ' was not found on this server.

' - ); - res.end(); - util.puts('404 Not Found: ' + path); -}; - -StaticServlet.prototype.sendForbidden_ = function(req, res, path) { - path = path.substring(1); - res.writeHead(403, { - 'Content-Type': 'text/html' - }); - res.write('\n'); - res.write('403 Forbidden\n'); - res.write('

Forbidden

'); - res.write( - '

You do not have permission to access ' + - escapeHtml(path) + ' on this server.

' - ); - res.end(); - util.puts('403 Forbidden: ' + path); -}; - -StaticServlet.prototype.sendRedirect_ = function(req, res, redirectUrl) { - res.writeHead(301, { - 'Content-Type': 'text/html', - 'Location': redirectUrl - }); - res.write('\n'); - res.write('301 Moved Permanently\n'); - res.write('

Moved Permanently

'); - res.write( - '

The document has moved here.

' - ); - res.end(); - util.puts('301 Moved Permanently: ' + redirectUrl); -}; - -StaticServlet.prototype.sendFile_ = function(req, res, path) { - var self = this; - var file = fs.createReadStream(path); - res.writeHead(200, { - 'Content-Type': StaticServlet. - MimeMap[path.split('.').pop()] || 'text/plain' - }); - if (req.method === 'HEAD') { - res.end(); - } else { - file.on('data', res.write.bind(res)); - file.on('close', function() { - res.end(); - }); - file.on('error', function(error) { - self.sendError_(req, res, error); - }); - } -}; - -StaticServlet.prototype.sendDirectory_ = function(req, res, path) { - var self = this; - if (path.match(/[^\/]$/)) { - req.url.pathname += '/'; - var redirectUrl = url.format(url.parse(url.format(req.url))); - return self.sendRedirect_(req, res, redirectUrl); - } - fs.readdir(path, function(err, files) { - if (err) - return self.sendError_(req, res, error); - - if (!files.length) - return self.writeDirectoryIndex_(req, res, path, []); - - var remaining = files.length; - files.forEach(function(fileName, index) { - fs.stat(path + '/' + fileName, function(err, stat) { - if (err) - return self.sendError_(req, res, err); - if (stat.isDirectory()) { - files[index] = fileName + '/'; - } - if (!(--remaining)) - return self.writeDirectoryIndex_(req, res, path, files); - }); - }); - }); -}; - -StaticServlet.prototype.writeDirectoryIndex_ = function(req, res, path, files) { - path = path.substring(1); - res.writeHead(200, { - 'Content-Type': 'text/html' - }); - if (req.method === 'HEAD') { - res.end(); - return; - } - res.write('\n'); - res.write('' + escapeHtml(path) + '\n'); - res.write('\n'); - res.write('

Directory: ' + escapeHtml(path) + '

'); - res.write('
    '); - files.forEach(function(fileName) { - if (fileName.charAt(0) !== '.') { - res.write('
  1. ' + - escapeHtml(fileName) + '
  2. '); - } - }); - res.write('
'); - res.end(); -}; - -// Must be last, -main(process.argv); diff --git a/src/app/annotationViewer/_annotation_viewer.scss b/src/app/annotationViewer/_annotation_viewer.scss index 62bf3b2a..f3027716 100644 --- a/src/app/annotationViewer/_annotation_viewer.scss +++ b/src/app/annotationViewer/_annotation_viewer.scss @@ -1,6 +1,13 @@ //@import 'base'; +// color-swatch +$spectrogramProgressLine: #FF0000; +$tagAlignmentLine: #ffa73c; +$marqueeBorderColorSelected: #FFFF00; +$marqueeBorderColorSelectedGlow: #f7ffef; +$marqueeBorderColorHover: #00ffe9; +$marqueeBorderColorInactive: #00FF00; baw-annotation-viewer { @@ -71,7 +78,7 @@ baw-annotation-viewer { } & .positionLine { - border-left: solid 1px red; + border-left: solid 1px $spectrogramProgressLine; height: 100%; width: 1px; position: absolute; @@ -91,13 +98,16 @@ baw-annotation-viewer { border-style: $border-style; border-width: $border-width; - border-color: nth($master-highlight, 2); + border-color: $marqueeBorderColorInactive; position: absolute; background-color: rgba(255,255,255,0.05); overflow: visible; &:before { - border-left: red solid 1px; + @if $DEBUG == false { + visibility: collapse; + } + border-left: $tagAlignmentLine solid 1px; height: 256px; position: relative; top: -257px; @@ -107,16 +117,19 @@ baw-annotation-viewer { } &[data-selected="true"] { - border-color: nth($master-complementary, 2); - @include glow(nth($master-background, 2)); + border-color: $marqueeBorderColorSelected; + @include glow($marqueeBorderColorSelectedGlow); & .close-icon{ visibility: visible; } } - &:hover .close-icon { - visibility: visible; + &:hover { + border-color: $marqueeBorderColorHover; + & .close-icon { + visibility: visible; + } } } diff --git a/src/app/app.js b/src/app/app.js index 7cb449bb..ad1e9d16 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -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); diff --git a/src/app/listen/listen.js b/src/app/listen/listen.js index c3cd5686..65c7e90f 100644 --- a/src/app/listen/listen.js +++ b/src/app/listen/listen.js @@ -118,7 +118,7 @@ angular.module('bawApp.listen', []) } else { if (value.sampleRate !== sampleRate) { - throw "The sample rates are not consistent for the media.json request. At the currest time all sub-resources returned must be equal!"; + throw "The sample rates are not consistent for the media.json request. At the current time all sub-resources returned must be equal!"; } } }; diff --git a/src/app/listen/listen.tpl.html b/src/app/listen/listen.tpl.html index 4d9325e9..611abecd 100644 --- a/src/app/listen/listen.tpl.html +++ b/src/app/listen/listen.tpl.html @@ -34,12 +34,12 @@ - + + @@ -49,8 +49,8 @@

Audio Controls

diff --git a/src/app/login/_login_control.scss b/src/app/login/_login_control.scss index eae03071..a61b652d 100644 --- a/src/app/login/_login_control.scss +++ b/src/app/login/_login_control.scss @@ -6,6 +6,7 @@ body.waiting-for-angular div#content-outer { } body.waiting-for-angular div#initializing-panel { display: block; + // TODO: THIS IS BROKEN BUT NOT USED background: image-url("angular-auth/loading.gif") center center no-repeat; position:absolute; top:0; @@ -15,7 +16,8 @@ body.waiting-for-angular div#initializing-panel { } #login-holder { - @include gradient("radial", nth($master-background,3) , nth($master-background,1)); + // TODO: FIX WHEN USED AGAIN + @include gradient("radial", #FEFEFE , #EEEEEE); // login is not needed until requested display: none; @@ -32,9 +34,8 @@ body.waiting-for-angular div#initializing-panel { } #loginbox { margin: 50px auto 0 auto; - background-color: nth($master-background, 2); + @extend .rounded-corners; - border-color: nth($master-highlight, 2); height: 312px; line-height: 12px; diff --git a/src/app/recordInformation/_record_information.scss b/src/app/recordInformation/_record_information.scss index dbe5601c..9dacb899 100644 --- a/src/app/recordInformation/_record_information.scss +++ b/src/app/recordInformation/_record_information.scss @@ -5,15 +5,11 @@ baw-record-information { font-family: Consolas, monaco, monospace; font-size: smaller; - color: nth($master-dark, 2); - - - background-color: nth($master-background, 2); &>span { &>span { - color: nth($master-dark-2, 2); + //color: nth($master-dark-2, 2); } } } \ No newline at end of file diff --git a/src/components/directives/ngAudio.js b/src/components/directives/ngAudio.js index 294d933f..f2d5adf6 100644 --- a/src/components/directives/ngAudio.js +++ b/src/components/directives/ngAudio.js @@ -8,7 +8,6 @@ var bawds = bawds || angular.module('bawApp.directives', ['bawApp.configuration' * like a "isBuffering" binding. */ bawds.directive('ngAudio', ['$parse', function ($parse) { - return { restrict: 'A', link: function (scope, elements, attributes, controller) { @@ -17,12 +16,21 @@ bawds.directive('ngAudio', ['$parse', function ($parse) { throw 'Cannot put ngAudio element on an element that is not a