diff --git a/mica-webapp/Gruntfile.js b/mica-webapp/Gruntfile.js index b011133c63..d4cb54e090 100644 --- a/mica-webapp/Gruntfile.js +++ b/mica-webapp/Gruntfile.js @@ -53,7 +53,6 @@ module.exports = function (grunt) { } }, autoprefixer: { - options: ['last 1 version'], dist: { files: [ { @@ -180,11 +179,10 @@ module.exports = function (grunt) { ] } }, - // not used since Uglify task does concat, - // but still available if needed - /*concat: { - dist: {} - },*/ + // generated dynamically by useminPrepare + //concat: { + // dist: {} + //}, rev: { dist: { files: { @@ -200,7 +198,16 @@ module.exports = function (grunt) { useminPrepare: { html: 'src/main/webapp/{,*/}*.html', options: { - dest: '<%= yeoman.dist %>' + dest: '<%= yeoman.dist %>', + flow: { + html: { + steps: { + css: ['concat', 'cssmin'], + js: ['concat', 'uglifyjs'] + }, + post: {} + } + } } }, usemin: { @@ -234,19 +241,20 @@ module.exports = function (grunt) { ] } }, - cssmin: { - // By default, your `index.html` will take care of - // minification. This option is pre-configured if you do not wish to use - // Usemin blocks. - // dist: { - // files: { - // '<%= yeoman.dist %>/styles/main.css': [ - // '.tmp/styles/{,*/}*.css', - // 'styles/{,*/}*.css' - // ] - // } - // } - }, + // generated dynamically by useminPrepare + //cssmin: { + // // By default, your `index.html` will take care of + // // minification. This option is pre-configured if you do not wish to use + // // Usemin blocks. + // dist: { + // files: { + // '<%= yeoman.dist %>/styles/main.css': [ + // '.tmp/styles/{,*/}*.css', + // 'styles/{,*/}*.css' + // ] + // } + // } + //}, htmlmin: { dist: { options: { @@ -328,18 +336,6 @@ module.exports = function (grunt) { html: ['<%= yeoman.dist %>/*.html'] } }, - ngmin: { - dist: { - files: [ - { - expand: true, - cwd: '.tmp/concat/scripts', - src: '*.js', - dest: '.tmp/concat/scripts' - } - ] - } - }, replace: { dist: { src: ['<%= yeoman.dist %>/index.html'], @@ -352,15 +348,21 @@ module.exports = function (grunt) { ] } }, - uglify: { - dist: { - files: { - '<%= yeoman.dist %>/app/scripts.js': [ - '<%= yeoman.dist %>/app/scripts.js' - ] - } + wiredep: { + task: { + src: 'src/main/webapp/index.html' } } + // generated dynamically by useminPrepare + //uglify: { + // dist: { + // files: { + // '<%= yeoman.dist %>/scripts/scripts.js': [ + // '<%= yeoman.dist %>/scripts/scripts.js' + // ] + // } + // } + //} }); grunt.registerTask('server', function (target) { @@ -396,7 +398,6 @@ module.exports = function (grunt) { 'autoprefixer', 'concat', 'copy:dist', - 'ngmin', 'cssmin', 'replace', 'uglify', @@ -408,4 +409,6 @@ module.exports = function (grunt) { 'test', 'build' ]); + + grunt.loadNpmTasks('grunt-wiredep'); }; diff --git a/mica-webapp/bower.json b/mica-webapp/bower.json index 168d65fd65..ebb17d57a3 100644 --- a/mica-webapp/bower.json +++ b/mica-webapp/bower.json @@ -29,10 +29,34 @@ "ng-obiba": "git@github.com:obiba/ng-obiba.git", "modernizr": "2.7.1", "swagger-ui": "2.0.16", - "filesize": "~2.0.3" + "filesize": "~2.0.3", + "angular-utils-pagination": "~0.6.0" }, "devDependencies": { "angular-mocks": "1.2.16", "angular-scenario": "1.2.16" + }, + "overrides": { + "angular-ui": { + "main": "./build/angular-ui.min.js" + }, + "filesize": { + "main": "./lib/filesize.min.js" + }, + "angular-dynamic-locale": { + "main": "./src/tmhDinamicLocale.js" + }, + "bootstrap": { + "main": "./dist/js/bootstrap.min.js" + }, + "chosen": { + "main": "./chosen.jquery.js" + }, + "ng-obiba": { + "main": "./dist/ng-obiba.js" + }, + "ng-file-upload": { + "main": ["angular-file-upload.js", "angular-file-upload-shim.min.js"] + } } } diff --git a/mica-webapp/package.json b/mica-webapp/package.json index b9183565b5..d3ce024ce0 100644 --- a/mica-webapp/package.json +++ b/mica-webapp/package.json @@ -21,6 +21,7 @@ "grunt-contrib-less": "^0.11.0", "grunt-contrib-uglify": "0.4.0", "grunt-contrib-watch": "0.6.1", + "grunt-wiredep": "^2.0.0", "grunt-karma": "0.8.3", "grunt-modernizr": "0.5.2", "grunt-ngmin": "0.0.3", diff --git a/mica-webapp/src/main/webapp/app/commons/attachment/attachment-directives.js b/mica-webapp/src/main/webapp/app/commons/attachment/attachment-directives.js index c1ffd0e62a..d9a03f0706 100644 --- a/mica-webapp/src/main/webapp/app/commons/attachment/attachment-directives.js +++ b/mica-webapp/src/main/webapp/app/commons/attachment/attachment-directives.js @@ -2,8 +2,7 @@ mica.attachment - .directive('attachmentInput', ['$upload', '$timeout', '$log', 'TempFileResource', - function ($upload, $timeout, $log, TempFileResource) { + .directive('attachmentInput', [function () { return { restrict: 'E', require: '^form', @@ -13,80 +12,83 @@ mica.attachment files: '=' }, templateUrl: 'app/commons/attachment/attachment-input-template.html', - controller: function ($scope) { - $scope.onFileSelect = function ($file) { - $scope.uploadedFiles = $file; - $scope.uploadedFiles.forEach(function (file) { - uploadFile(file); - }); - }; + controller: 'AttachmentCtrl' + }; + }]) + .controller('AttachmentCtrl', ['$scope', '$timeout', '$log', '$upload', 'TempFileResource', + function ($scope, $timeout, $log, $upload, TempFileResource) { + $scope.onFileSelect = function (file) { + $scope.uploadedFiles = file; + $scope.uploadedFiles.forEach(function (f) { + uploadFile(f); + }); + }; - var uploadFile = function (file) { - $log.debug('file', file); + var uploadFile = function (file) { + $log.debug('file', file); - var attachment = { - showProgressBar: true, - lang: 'en', - progress: 0, - file: file, - fileName: file.name, - size: file.size - }; + var attachment = { + showProgressBar: true, + lang: 'en', + progress: 0, + file: file, + fileName: file.name, + size: file.size + }; - if($scope.multiple) { - $scope.files.push(attachment); - } else { - $scope.files.splice(0, $scope.files.length); - $scope.files.push(attachment); - } + if ($scope.multiple) { + $scope.files.push(attachment); + } else { + $scope.files.splice(0, $scope.files.length); + $scope.files.push(attachment); + } - $scope.upload = $upload - .upload({ - url: '/ws/files/temp', - method: 'POST', - file: file - }) - .progress(function (evt) { - attachment.progress = parseInt(100.0 * evt.loaded / evt.total); - }) - .success(function (data, status, getResponseHeaders) { - var parts = getResponseHeaders().location.split('/'); - var fileId = parts[parts.length - 1]; - TempFileResource.get( - {id: fileId}, - function (tempFile) { - $log.debug('tempFile', tempFile); - attachment.id = tempFile.id; - attachment.md5 = tempFile.md5; - attachment.justUploaded = true; - // wait for 1 second before hiding progress bar - $timeout(function () { attachment.showProgressBar = false; }, 1000); - } - ); - }); - }; + $scope.upload = $upload + .upload({ + url: '/ws/files/temp', + method: 'POST', + file: file + }) + .progress(function (evt) { + attachment.progress = parseInt(100.0 * evt.loaded / evt.total); + }) + .success(function (data, status, getResponseHeaders) { + var parts = getResponseHeaders().location.split('/'); + var fileId = parts[parts.length - 1]; + TempFileResource.get( + {id: fileId}, + function (tempFile) { + $log.debug('tempFile', tempFile); + attachment.id = tempFile.id; + attachment.md5 = tempFile.md5; + attachment.justUploaded = true; + // wait for 1 second before hiding progress bar + $timeout(function () { attachment.showProgressBar = false; }, 1000); + } + ); + }); + }; - $scope.deleteTempFile = function (tempFileId) { - TempFileResource.delete( - {id: tempFileId}, - function () { - for (var i = $scope.files.length; i--;) { - var attachment = $scope.files[i]; - if (attachment.justUploaded && attachment.id === tempFileId) { - $scope.files.splice(i, 1); - } + $scope.deleteTempFile = function (tempFileId) { + TempFileResource.delete( + {id: tempFileId}, + function () { + for (var i = $scope.files.length; i--;) { + var attachment = $scope.files[i]; + if (attachment.justUploaded && attachment.id === tempFileId) { + $scope.files.splice(i, 1); } } - ); - }; + } + ); + }; - $scope.deleteFile = function (fileId) { - for(var i = $scope.files.length; i--;) { - if($scope.files[i].id === fileId) { - $scope.files.splice(i, 1); - } + $scope.deleteFile = function (fileId) { + for (var i = $scope.files.length; i--;) { + if ($scope.files[i].id === fileId) { + $scope.files.splice(i, 1); } - }; - } - }; - }]); + } + }; + } + ]); diff --git a/mica-webapp/src/main/webapp/app/commons/attachment/attachment.js b/mica-webapp/src/main/webapp/app/commons/attachment/attachment.js index 78763e3d7c..da8830b982 100644 --- a/mica-webapp/src/main/webapp/app/commons/attachment/attachment.js +++ b/mica-webapp/src/main/webapp/app/commons/attachment/attachment.js @@ -1,5 +1,8 @@ 'use strict'; mica.attachment = angular.module('mica.attachment', [ - 'mica.config' + 'mica.file', + 'ui', + 'ui.bootstrap', + 'angularFileUpload' ]); diff --git a/mica-webapp/src/main/webapp/app/file/file.js b/mica-webapp/src/main/webapp/app/file/file.js index 951ecc71cc..7d803b11bb 100644 --- a/mica-webapp/src/main/webapp/app/file/file.js +++ b/mica-webapp/src/main/webapp/app/file/file.js @@ -1,6 +1,5 @@ 'use strict'; mica.file = angular.module('mica.file', [ - 'angularFileUpload', 'ngResource' ]); diff --git a/mica-webapp/src/main/webapp/app/study/study-controller.js b/mica-webapp/src/main/webapp/app/study/study-controller.js index ceadd2b31d..8b12d3eea7 100644 --- a/mica-webapp/src/main/webapp/app/study/study-controller.js +++ b/mica-webapp/src/main/webapp/app/study/study-controller.js @@ -495,9 +495,9 @@ mica.study }]) - .controller('StudyEditController', ['$rootScope', '$scope', '$routeParams', '$log', '$location', '$upload', '$timeout', '$modal', 'DraftStudyResource', 'DraftStudiesResource', 'MicaConfigResource', 'StringUtils', 'FormServerValidation', + .controller('StudyEditController', ['$rootScope', '$scope', '$routeParams', '$log', '$location', '$modal', 'DraftStudyResource', 'DraftStudiesResource', 'MicaConfigResource', 'StringUtils', 'FormServerValidation', - function ($rootScope, $scope, $routeParams, $log, $location, $upload, $timeout, $modal, DraftStudyResource, DraftStudiesResource, MicaConfigResource, StringUtils, FormServerValidation) { + function ($rootScope, $scope, $routeParams, $log, $location, $modal, DraftStudyResource, DraftStudiesResource, MicaConfigResource, StringUtils, FormServerValidation) { $scope.fileTypes = '.doc, .docx, .odm, .odt, .gdoc, .pdf, .txt .xml .xls, .xlsx, .ppt'; $scope.accessTypes = ['data', 'bio_samples', 'other']; $scope.methodDesignTypes = ['case_control', 'case_only', 'clinical_trial', 'cohort_study', 'cross_sectional', 'other']; diff --git a/mica-webapp/src/main/webapp/app/study/study.js b/mica-webapp/src/main/webapp/app/study/study.js index 9b3b5edfb9..aadffc8ff8 100644 --- a/mica-webapp/src/main/webapp/app/study/study.js +++ b/mica-webapp/src/main/webapp/app/study/study.js @@ -4,7 +4,6 @@ mica.study = angular.module('mica.study', [ 'mica.config', 'obiba.form', 'mica.localized', - 'mica.file', 'mica.attributes', 'obiba.notification', 'mica.publish', @@ -13,5 +12,6 @@ mica.study = angular.module('mica.study', [ 'ngRoute', 'ui.bootstrap', 'ui', - 'pascalprecht.translate' + 'pascalprecht.translate', + 'mica.attachment' ]); diff --git a/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/.bower.json b/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/.bower.json index 27de5896bc..0d9e194394 100644 --- a/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/.bower.json +++ b/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/.bower.json @@ -1,6 +1,6 @@ { "name": "angularUtils-pagination", - "version": "0.6.0", + "version": "0.6.1", "homepage": "https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination", "authors": [ "Michael Bromley " @@ -28,14 +28,13 @@ "test", "tests" ], - "_release": "0.6.0", + "_release": "0.6.1", "_resolution": { "type": "version", - "tag": "v0.6.0", - "commit": "125b153636f8591cf0e782569a0d58f3f2ef74d4" + "tag": "v0.6.1", + "commit": "592bbbe3c0257aa64ea9d222a5d8e40fff63f20e" }, "_source": "git://github.com/michaelbromley/angularUtils-pagination.git", "_target": "~0.6.0", - "_originalSource": "angular-utils-pagination", - "_direct": true + "_originalSource": "angular-utils-pagination" } \ No newline at end of file diff --git a/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/bower.json b/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/bower.json index 630214a184..c068f1806a 100644 --- a/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/bower.json +++ b/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/bower.json @@ -1,6 +1,6 @@ { "name": "angularUtils-pagination", - "version": "0.6.0", + "version": "0.6.1", "homepage": "https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination", "authors": [ "Michael Bromley " diff --git a/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/dirPagination.js b/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/dirPagination.js index 552d78365e..0af3ad673e 100644 --- a/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/dirPagination.js +++ b/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/dirPagination.js @@ -280,6 +280,7 @@ scope.setCurrent = function(num) { if (isValidPageNumber(num)) { + num = parseInt(num, 10); paginationService.setCurrentPage(paginationId, num); } }; @@ -511,4 +512,4 @@ }; }; } -})(); \ No newline at end of file +})(); diff --git a/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/dirPagination.tpl.html b/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/dirPagination.tpl.html index f37a9686ec..558aa2073f 100644 --- a/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/dirPagination.tpl.html +++ b/mica-webapp/src/main/webapp/bower_components/angular-utils-pagination/dirPagination.tpl.html @@ -1,4 +1,4 @@ - \ No newline at end of file diff --git a/mica-webapp/src/main/webapp/bower_components/mica-study-timeline/.bower.json b/mica-webapp/src/main/webapp/bower_components/mica-study-timeline/.bower.json index f314d357ba..1765cfbb9b 100644 --- a/mica-webapp/src/main/webapp/bower_components/mica-study-timeline/.bower.json +++ b/mica-webapp/src/main/webapp/bower_components/mica-study-timeline/.bower.json @@ -4,7 +4,10 @@ "Cedric Thiebault " ], "description": "D3 Timeline for Mica Studies", - "main": "mica-study-timeline.js", + "main": [ + "./dist/mica-study-timeline.js", + "./dist/mica-study-timeline.css" + ], "dependencies": { "d3": "~3.4.6", "jquery": "~2.0.3" @@ -19,11 +22,11 @@ ], "license": "GNU Public License version 3", "homepage": "https://github.com/obiba/mica-study-timeline", - "_release": "cd6085305a", + "_release": "980e1c33fa", "_resolution": { "type": "branch", "branch": "master", - "commit": "cd6085305ad4178378f9d7b69a72283f5088543d" + "commit": "980e1c33faceaa24e80d6dcf88b833d8fd87ab91" }, "_source": "git@github.com:obiba/mica-study-timeline.git", "_target": "*", diff --git a/mica-webapp/src/main/webapp/bower_components/mica-study-timeline/bower.json b/mica-webapp/src/main/webapp/bower_components/mica-study-timeline/bower.json index be09f2840f..9e0c795e59 100644 --- a/mica-webapp/src/main/webapp/bower_components/mica-study-timeline/bower.json +++ b/mica-webapp/src/main/webapp/bower_components/mica-study-timeline/bower.json @@ -5,7 +5,7 @@ "Cedric Thiebault " ], "description": "D3 Timeline for Mica Studies", - "main": "mica-study-timeline.js", + "main": ["./dist/mica-study-timeline.js", "./dist/mica-study-timeline.css"], "dependencies": { "d3": "~3.4.6", "jquery": "~2.0.3" diff --git a/mica-webapp/src/main/webapp/index.html b/mica-webapp/src/main/webapp/index.html index 2610a98e69..505d0033b9 100644 --- a/mica-webapp/src/main/webapp/index.html +++ b/mica-webapp/src/main/webapp/index.html @@ -18,11 +18,13 @@ - + - - + + + + @@ -148,32 +150,35 @@ --> + - - - - - + + + + + + + + - - - - - - - - + - + + + + + + + - +