diff --git a/Gruntfile.js b/Gruntfile.js index d21c2cb..1f0ad14 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,26 +12,29 @@ module.exports = function(grunt) { font: { icons: { - src: ['app/public/fonts/svg-icons/*.svg'], - destCss: 'app/public/styles/less/icons.less', - destFonts: 'app/public/fonts/icons.woff', + src: ['front/src/fonts/svg-icons/*.svg'], + destCss: 'front/src/less/icons.less', + destFonts: 'front/src/fonts/icons.woff', // Optional: Custom routing of font filepaths for CSS cssRouter: function (fontpath) { var pathArray = fontpath.split('/'); var fileName = pathArray[pathArray.length - 1]; - return '/public/fonts/' + fileName; + return '/front/fonts/' + fileName; } } }, less: { all: { - files: { - 'app/public/styles/main.css': [ 'app/public/styles/less/main.less' ], - 'app/public/styles/index.css': [ 'app/public/styles/less/index.less' ], - 'app/public/styles/launchTest.css': [ 'app/public/styles/less/launchTest.less' ], - 'app/public/styles/results.css': [ 'app/public/styles/less/results.less' ] - } + files: [ + { + expand: true, + cwd: 'front/src/less/', + src: ['**/*.less'], + dest: 'front/src/css/', + ext: '.css' + } + ] } }, jshint: { @@ -51,6 +54,9 @@ module.exports = function(grunt) { icons: { src: ['tmp'] }, + dev: { + src: ['front/src/css'] + }, coverage: { src: ['coverage/'] } @@ -166,7 +172,8 @@ module.exports = function(grunt) { ]); grunt.registerTask('dev', [ - 'express:dev' + 'clean:dev', + 'less' ]); grunt.registerTask('test', [ diff --git a/app/public/scripts/app.js b/app/public/scripts/app.js index 3b54686..ec4f9b9 100644 --- a/app/public/scripts/app.js +++ b/app/public/scripts/app.js @@ -1,5 +1,6 @@ angular.module('YellowLabTools', [ 'Results', + 'Runs', 'ngModal', 'ShowOffendersDirective' ]); diff --git a/front/src/js/app.js b/front/src/js/app.js index aaea1b7..47c3210 100644 --- a/front/src/js/app.js +++ b/front/src/js/app.js @@ -2,7 +2,11 @@ var yltApp = angular.module('YellowLabTools', [ 'ngRoute', 'indexCtrl', 'aboutCtrl', - 'dashboardCtrl' + 'dashboardCtrl', + 'queueCtrl', + 'runsFactory', + 'resultsFactory', + 'gradeDirective' ]); yltApp.config(['$routeProvider', '$locationProvider', @@ -12,11 +16,15 @@ yltApp.config(['$routeProvider', '$locationProvider', templateUrl: 'front/views/index.html', controller: 'IndexCtrl' }). + when('/queue/:runId', { + templateUrl: 'front/views/queue.html', + controller: 'QueueCtrl' + }). when('/about', { templateUrl: 'front/views/about.html', controller: 'AboutCtrl' }). - when('/results/:runId', { + when('/result/:runId', { templateUrl: 'front/views/dashboard.html', controller: 'DashboardCtrl' }). diff --git a/front/src/js/controllers/indexCtrl.js b/front/src/js/controllers/indexCtrl.js index d308850..6b74e1c 100644 --- a/front/src/js/controllers/indexCtrl.js +++ b/front/src/js/controllers/indexCtrl.js @@ -1,5 +1,16 @@ var indexCtrl = angular.module('indexCtrl', []); -indexCtrl.controller('IndexCtrl', ['$scope', function($scope) { - $scope.toto = "Achraf"; +indexCtrl.controller('IndexCtrl', ['$scope', '$location', 'Runs', function($scope, $location, Runs) { + $scope.launchTest = function() { + if ($scope.url) { + Runs.save({ + url: $scope.url, + waitForResponse: false + }, function(data) { + console.log(data); + $location.path('/queue/' + data.runId); + }); + + } + } }]); \ No newline at end of file diff --git a/front/src/main.html b/front/src/main.html index 5142b30..d6cddde 100644 --- a/front/src/main.html +++ b/front/src/main.html @@ -1,7 +1,12 @@
-(This is a BETA, your feedback is more than welcome)
\ No newline at end of file diff --git a/lib/server/controllers/frontController.js b/lib/server/controllers/frontController.js index d13ea6d..25b84cc 100644 --- a/lib/server/controllers/frontController.js +++ b/lib/server/controllers/frontController.js @@ -3,17 +3,13 @@ var express = require('express'); var FrontController = function(app) { 'use strict'; - - app.get('/', function(req, res) { - res.sendFile(path.join(__dirname, '../../../front/src/main.html')); - }); - app.get('/about', function(req, res) { - res.sendFile(path.join(__dirname, '../../../front/src/main.html')); - }); + var routes = ['/', '/about', '/result/:runId', '/queue/:runId']; - app.get('/results/:runId', function(req, res) { - res.sendFile(path.join(__dirname, '../../../front/src/main.html')); + routes.forEach(function(route) { + app.get(route, function(req, res) { + res.sendFile(path.join(__dirname, '../../../front/src/main.html')); + }); }); app.use('/front', express.static(path.join(__dirname, '../../../front/src')));