From: Kathy Lussier Date: Thu, 3 Nov 2016 18:03:10 +0000 (-0400) Subject: LP#1642086: Make jQuery available for both OPAC and staff use X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c8ade404367d7fa76089640b5e3c1425f4f47363;p=working%2FEvergreen.git LP#1642086: Make jQuery available for both OPAC and staff use First pass at moving files into common directory so that jQuery can be used in the OPAC in addition to the web client. Signed-off-by: Kathy Lussier --- diff --git a/Open-ILS/src/templates/staff/base_js.tt2 b/Open-ILS/src/templates/staff/base_js.tt2 index fac97115e7..726709e4d2 100644 --- a/Open-ILS/src/templates/staff/base_js.tt2 +++ b/Open-ILS/src/templates/staff/base_js.tt2 @@ -4,19 +4,19 @@ [% IF EXPAND_WEB_IMPORTS %] - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -47,7 +47,7 @@ [% ELSE %] - + [% END %] diff --git a/Open-ILS/src/templates/staff/config.tt2 b/Open-ILS/src/templates/staff/config.tt2 index c563d7ab97..a8366a8e2d 100644 --- a/Open-ILS/src/templates/staff/config.tt2 +++ b/Open-ILS/src/templates/staff/config.tt2 @@ -8,6 +8,6 @@ EVERGREEN_VERSION='0.0.1' EXPAND_WEB_IMPORTS = 1; # path to build files (js, css, fonts) -WEB_BUILD_PATH = ctx.media_prefix _ '/js/ui/default/staff/build/'; +WEB_BUILD_PATH = ctx.media_prefix _ '/js/ui/default/common/build/'; %] diff --git a/Open-ILS/web/js/ui/default/common/Gruntfile.js b/Open-ILS/web/js/ui/default/common/Gruntfile.js new file mode 100644 index 0000000000..36bcf669a8 --- /dev/null +++ b/Open-ILS/web/js/ui/default/common/Gruntfile.js @@ -0,0 +1,216 @@ +module.exports = function(grunt) { + + // Project configuration. + var config = { + pkg: grunt.file.readJSON('package.json'), + + // copy the files we care about from bower-fetched dependencies + // into our build directory + copy: { + + js : { + files: [{ + dest: 'build/js/', + flatten: true, + filter: 'isFile', + expand : true, + src: [ + 'bower_components/angular/angular.min.js', + 'bower_components/angular/angular.min.js.map', + 'bower_components/angular-animate/angular-animate.min.js', + 'bower_components/angular-animate/angular-animate.min.js.map', + 'bower_components/angular-sanitize/angular-sanitize.min.js', + 'bower_components/angular-sanitize/angular-sanitize.min.js.map', + 'bower_components/angular-route/angular-route.min.js', + 'bower_components/angular-route/angular-route.min.js.map', + 'bower_components/angular-bootstrap/ui-bootstrap.min.js', + 'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js', + 'bower_components/angular-hotkeys/build/hotkeys.min.js', + 'bower_components/angular-file-saver/dist/angular-file-saver.bundle.min.js', + 'bower_components/angular-location-update/angular-location-update.min.js', + 'bower_components/angular-tree-control/angular-tree-control.js', + 'bower_components/ngtoast/dist/ngToast.min.js', + 'bower_components/jquery/dist/jquery.min.js', + 'bower_components/angular-cookies/angular-cookies.min.js', + 'bower_components/angular-cookies/angular-cookies.min.js.map', + 'bower_components/iframe-resizer/js/iframeResizer.min.js', + 'bower_components/iframe-resizer/js/iframeResizer.map', + 'bower_components/iframe-resizer/js/iframeResizer.contentWindow.min.js' + ] + }] + }, + + css : { + files : [{ + dest : 'build/css/', + flatten : true, + filter : 'isFile', + expand : true, + src : [ + 'bower_components/angular-hotkeys/build/hotkeys.min.css', + 'bower_components/bootstrap/dist/css/bootstrap.min.css', + 'bower_components/ngtoast/dist/ngToast.min.css', + 'bower_components/ngtoast/dist/ngToast-animations.min.css', + 'bower_components/angular-tree-control/css/tree-control.css', + 'bower_components/angular-tree-control/css/tree-control-attribute.css', + ] + }] + }, + + fonts : { + files : [{ + dest : 'build/fonts/', + flatten : true, + filter : 'isFile', + expand : true, + src : [ + 'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot', + 'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg', + 'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf', + 'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff' + ] + }] + }, + + images : { + files : [{ + dest : 'build/images/', + flatten : true, + filter : 'isFile', + expand : true, + src : [ + 'bower_components/angular-tree-control/images/sample.png', + 'bower_components/angular-tree-control/images/node-opened-2.png', + 'bower_components/angular-tree-control/images/folder.png', + 'bower_components/angular-tree-control/images/node-closed.png', + 'bower_components/angular-tree-control/images/node-closed-light.png', + 'bower_components/angular-tree-control/images/node-opened.png', + 'bower_components/angular-tree-control/images/node-opened-light.png', + 'bower_components/angular-tree-control/images/folder-closed.png', + 'bower_components/angular-tree-control/images/node-closed-2.png', + 'bower_components/angular-tree-control/images/file.png' + ] + }] + } + }, + + // combine our CSS deps + // note: minification also supported, but not required (yet). + cssmin: { + combine: { + files: { + 'build/css/evergreen-staff-client-deps.<%= pkg.version %>.min.css' : [ + 'build/css/hotkeys.min.css', + 'build/css/bootstrap.min.css', + 'build/css/ngToast.min.css', + 'build/css/ngToast-animations.min.css', + 'build/css/tree-control.css', + 'build/css/tree-control-attribute.css', + ] + } + } + }, + + // concatenation + minification + uglify: { + options: { + banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' + }, + build: { + src: [ + // These are concatenated in order in the final build file. + // The order is important. + 'build/js/jquery.min.js', + 'build/js/angular.min.js', + 'build/js/angular-animate.min.js', + 'build/js/angular-sanitize.min.js', + 'build/js/angular-route.min.js', + 'build/js/ui-bootstrap.min.js', + 'build/js/ui-bootstrap-tpls.min.js', + 'build/js/hotkeys.min.js', + 'build/js/angular-tree-control.js', + 'build/js/ngToast.min.js', + // NOTE: OpenSRF must be installed + '/openils/lib/javascript/JSON_v1.js', + '/openils/lib/javascript/opensrf.js', + '/openils/lib/javascript/opensrf_ws.js', + '../staff/services/core.js', + '../staff/services/strings.js', + '../staff/services/idl.js', + '../staff/services/event.js', + '../staff/services/net.js', + '../staff/services/auth.js', + '../staff/services/pcrud.js', + '../staff/services/env.js', + '../staff/services/org.js', + '../staff/services/startup.js', + '../staff/services/hatch.js', + '../staff/services/print.js', + '../staff/services/audio.js', + '../staff/services/coresvc.js', + '../staff/services/navbar.js', + '../staff/services/statusbar.js', + '../staff/services/ui.js', + '../staff/services/date.js', + ], + dest: 'build/js/<%= pkg.name %>.<%= pkg.version %>.min.js' + } + }, + + // bare concat operation; useful for testing concat w/o minification + // to more easily detect if concat order is incorrect + concat: { + options: { + separator: ';', + } + }, + + exec : { + + // Generate test/data/IDL2js.js for unit tests. + // note: the output of this script is *not* part of the final build. + idl2js : { + command : 'cd ../staff/test/data && perl idl2js.pl', + }, + + // Remove the unit test IDL2js.js file. We don't need it after testing + rmidl2js : { + command : 'rm ../staff/test/data/IDL2js.js', + } + }, + + // unit tests configuration + karma : { + unit: { + configFile: '../staff/test/karma.conf.js', + //background: true // for now, visually babysit unit tests + } + } + }; + + // tell concat about our uglify build options (instead of repeating them) + config.concat.build = config.uglify.build; + + // apply our configuration + grunt.initConfig(config); + + // Load our modules + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-karma'); + grunt.loadNpmTasks('grunt-exec'); + + // note: "grunt concat" is not requried + grunt.registerTask('build', ['copy', 'cssmin', 'uglify']); + + // test only, no minification + grunt.registerTask('test', ['copy', 'exec:idl2js', 'karma:unit', 'exec:rmidl2js']); + + // note: "grunt concat" is not requried + grunt.registerTask('all', ['test', 'cssmin', 'uglify']); + +}; + +// vim: ts=2:sw=2:softtabstop=2 diff --git a/Open-ILS/web/js/ui/default/common/bower.json b/Open-ILS/web/js/ui/default/common/bower.json new file mode 100644 index 0000000000..ff2ede14b2 --- /dev/null +++ b/Open-ILS/web/js/ui/default/common/bower.json @@ -0,0 +1,39 @@ +{ + "name": "evergreen-staff-client", + "version": "0.0.1", + "authors": [ + "Bill Erickson " + ], + "description": "Evergreen HTML Staff Client", + "keywords": [ + "evergreen" + ], + "license": "GPL", + "homepage": "http://evergreen-ils.org", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "AngularJS": "angular-latest#~1.5.0", + "jquery": "~2.2.1", + "bootstrap": "~3.3.6", + "angular-route": "~1.5.0", + "angular-mocks": "~1.5.0", + "angular-bootstrap": "~1.2.4", + "angular-file-saver": "~1.1.0", + "angular-location-update": "~0.0.2", + "ngtoast": "~2.0.0", + "angular-tree-control": "~0.2.28", + "angular-animate": "~1.5.3", + "angular-hotkeys": "cfp-angular-hotkeys#^1.7.0", + "angular-cookies": "^1.5.8", + "iframe-resizer": "^3.5.5" + }, + "resolutions": { + "angular": "~1.5.5" + } +} diff --git a/Open-ILS/web/js/ui/default/common/package.json b/Open-ILS/web/js/ui/default/common/package.json new file mode 100644 index 0000000000..f820d68dbe --- /dev/null +++ b/Open-ILS/web/js/ui/default/common/package.json @@ -0,0 +1,29 @@ +{ + "name": "evergreen-staff-client", + "description": "Evergreen ILS Browser Staff Client", + "version": "0.0.1", + "license": "GPL", + "homepage": "http://evergreen-ils.org/", + "devDependencies": { + "bower": "^1.3.3", + "grunt": "~0.4.4", + "grunt-cli": "^0.1.13", + "grunt-contrib-concat": "^0.4.0", + "grunt-contrib-copy": "^0.5.0", + "grunt-contrib-cssmin": "^0.9.0", + "grunt-contrib-jasmine": "^0.6.4", + "grunt-contrib-uglify": "^0.4.0", + "grunt-exec": "^0.4.5", + "grunt-karma": "^0.8.3", + "phantomjs-prebuilt": "^2.1.7", + "karma": "^0.12.14", + "karma-jasmine": "^0.1.5", + "karma-phantomjs-launcher": "^1.0.0", + "karma-script-launcher": "~0.1.0", + "karma-spec-reporter": "0.0.12", + "karma-story-reporter": "^0.2.2" + }, + "scripts": { + "test": "grunt test" + } +} diff --git a/Open-ILS/web/js/ui/default/staff/Gruntfile.js b/Open-ILS/web/js/ui/default/staff/Gruntfile.js deleted file mode 100644 index 2d982c41ef..0000000000 --- a/Open-ILS/web/js/ui/default/staff/Gruntfile.js +++ /dev/null @@ -1,216 +0,0 @@ -module.exports = function(grunt) { - - // Project configuration. - var config = { - pkg: grunt.file.readJSON('package.json'), - - // copy the files we care about from bower-fetched dependencies - // into our build directory - copy: { - - js : { - files: [{ - dest: 'build/js/', - flatten: true, - filter: 'isFile', - expand : true, - src: [ - 'bower_components/angular/angular.min.js', - 'bower_components/angular/angular.min.js.map', - 'bower_components/angular-animate/angular-animate.min.js', - 'bower_components/angular-animate/angular-animate.min.js.map', - 'bower_components/angular-sanitize/angular-sanitize.min.js', - 'bower_components/angular-sanitize/angular-sanitize.min.js.map', - 'bower_components/angular-route/angular-route.min.js', - 'bower_components/angular-route/angular-route.min.js.map', - 'bower_components/angular-bootstrap/ui-bootstrap.min.js', - 'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js', - 'bower_components/angular-hotkeys/build/hotkeys.min.js', - 'bower_components/angular-file-saver/dist/angular-file-saver.bundle.min.js', - 'bower_components/angular-location-update/angular-location-update.min.js', - 'bower_components/angular-tree-control/angular-tree-control.js', - 'bower_components/ngtoast/dist/ngToast.min.js', - 'bower_components/jquery/dist/jquery.min.js', - 'bower_components/angular-cookies/angular-cookies.min.js', - 'bower_components/angular-cookies/angular-cookies.min.js.map', - 'bower_components/iframe-resizer/js/iframeResizer.min.js', - 'bower_components/iframe-resizer/js/iframeResizer.map', - 'bower_components/iframe-resizer/js/iframeResizer.contentWindow.min.js' - ] - }] - }, - - css : { - files : [{ - dest : 'build/css/', - flatten : true, - filter : 'isFile', - expand : true, - src : [ - 'bower_components/angular-hotkeys/build/hotkeys.min.css', - 'bower_components/bootstrap/dist/css/bootstrap.min.css', - 'bower_components/ngtoast/dist/ngToast.min.css', - 'bower_components/ngtoast/dist/ngToast-animations.min.css', - 'bower_components/angular-tree-control/css/tree-control.css', - 'bower_components/angular-tree-control/css/tree-control-attribute.css', - ] - }] - }, - - fonts : { - files : [{ - dest : 'build/fonts/', - flatten : true, - filter : 'isFile', - expand : true, - src : [ - 'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot', - 'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg', - 'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf', - 'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff' - ] - }] - }, - - images : { - files : [{ - dest : 'build/images/', - flatten : true, - filter : 'isFile', - expand : true, - src : [ - 'bower_components/angular-tree-control/images/sample.png', - 'bower_components/angular-tree-control/images/node-opened-2.png', - 'bower_components/angular-tree-control/images/folder.png', - 'bower_components/angular-tree-control/images/node-closed.png', - 'bower_components/angular-tree-control/images/node-closed-light.png', - 'bower_components/angular-tree-control/images/node-opened.png', - 'bower_components/angular-tree-control/images/node-opened-light.png', - 'bower_components/angular-tree-control/images/folder-closed.png', - 'bower_components/angular-tree-control/images/node-closed-2.png', - 'bower_components/angular-tree-control/images/file.png' - ] - }] - } - }, - - // combine our CSS deps - // note: minification also supported, but not required (yet). - cssmin: { - combine: { - files: { - 'build/css/evergreen-staff-client-deps.<%= pkg.version %>.min.css' : [ - 'build/css/hotkeys.min.css', - 'build/css/bootstrap.min.css', - 'build/css/ngToast.min.css', - 'build/css/ngToast-animations.min.css', - 'build/css/tree-control.css', - 'build/css/tree-control-attribute.css', - ] - } - } - }, - - // concatenation + minification - uglify: { - options: { - banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' - }, - build: { - src: [ - // These are concatenated in order in the final build file. - // The order is important. - 'build/js/jquery.min.js', - 'build/js/angular.min.js', - 'build/js/angular-animate.min.js', - 'build/js/angular-sanitize.min.js', - 'build/js/angular-route.min.js', - 'build/js/ui-bootstrap.min.js', - 'build/js/ui-bootstrap-tpls.min.js', - 'build/js/hotkeys.min.js', - 'build/js/angular-tree-control.js', - 'build/js/ngToast.min.js', - // NOTE: OpenSRF must be installed - '/openils/lib/javascript/JSON_v1.js', - '/openils/lib/javascript/opensrf.js', - '/openils/lib/javascript/opensrf_ws.js', - 'services/core.js', - 'services/strings.js', - 'services/idl.js', - 'services/event.js', - 'services/net.js', - 'services/auth.js', - 'services/pcrud.js', - 'services/env.js', - 'services/org.js', - 'services/startup.js', - 'services/hatch.js', - 'services/print.js', - 'services/audio.js', - 'services/coresvc.js', - 'services/navbar.js', - 'services/statusbar.js', - 'services/ui.js', - 'services/date.js', - ], - dest: 'build/js/<%= pkg.name %>.<%= pkg.version %>.min.js' - } - }, - - // bare concat operation; useful for testing concat w/o minification - // to more easily detect if concat order is incorrect - concat: { - options: { - separator: ';', - } - }, - - exec : { - - // Generate test/data/IDL2js.js for unit tests. - // note: the output of this script is *not* part of the final build. - idl2js : { - command : 'cd test/data && perl idl2js.pl', - }, - - // Remove the unit test IDL2js.js file. We don't need it after testing - rmidl2js : { - command : 'rm test/data/IDL2js.js', - } - }, - - // unit tests configuration - karma : { - unit: { - configFile: 'test/karma.conf.js', - //background: true // for now, visually babysit unit tests - } - } - }; - - // tell concat about our uglify build options (instead of repeating them) - config.concat.build = config.uglify.build; - - // apply our configuration - grunt.initConfig(config); - - // Load our modules - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-karma'); - grunt.loadNpmTasks('grunt-exec'); - - // note: "grunt concat" is not requried - grunt.registerTask('build', ['copy', 'cssmin', 'uglify']); - - // test only, no minification - grunt.registerTask('test', ['copy', 'exec:idl2js', 'karma:unit', 'exec:rmidl2js']); - - // note: "grunt concat" is not requried - grunt.registerTask('all', ['test', 'cssmin', 'uglify']); - -}; - -// vim: ts=2:sw=2:softtabstop=2 diff --git a/Open-ILS/web/js/ui/default/staff/bower.json b/Open-ILS/web/js/ui/default/staff/bower.json deleted file mode 100644 index ff2ede14b2..0000000000 --- a/Open-ILS/web/js/ui/default/staff/bower.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "evergreen-staff-client", - "version": "0.0.1", - "authors": [ - "Bill Erickson " - ], - "description": "Evergreen HTML Staff Client", - "keywords": [ - "evergreen" - ], - "license": "GPL", - "homepage": "http://evergreen-ils.org", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "AngularJS": "angular-latest#~1.5.0", - "jquery": "~2.2.1", - "bootstrap": "~3.3.6", - "angular-route": "~1.5.0", - "angular-mocks": "~1.5.0", - "angular-bootstrap": "~1.2.4", - "angular-file-saver": "~1.1.0", - "angular-location-update": "~0.0.2", - "ngtoast": "~2.0.0", - "angular-tree-control": "~0.2.28", - "angular-animate": "~1.5.3", - "angular-hotkeys": "cfp-angular-hotkeys#^1.7.0", - "angular-cookies": "^1.5.8", - "iframe-resizer": "^3.5.5" - }, - "resolutions": { - "angular": "~1.5.5" - } -} diff --git a/Open-ILS/web/js/ui/default/staff/package.json b/Open-ILS/web/js/ui/default/staff/package.json deleted file mode 100644 index f820d68dbe..0000000000 --- a/Open-ILS/web/js/ui/default/staff/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "evergreen-staff-client", - "description": "Evergreen ILS Browser Staff Client", - "version": "0.0.1", - "license": "GPL", - "homepage": "http://evergreen-ils.org/", - "devDependencies": { - "bower": "^1.3.3", - "grunt": "~0.4.4", - "grunt-cli": "^0.1.13", - "grunt-contrib-concat": "^0.4.0", - "grunt-contrib-copy": "^0.5.0", - "grunt-contrib-cssmin": "^0.9.0", - "grunt-contrib-jasmine": "^0.6.4", - "grunt-contrib-uglify": "^0.4.0", - "grunt-exec": "^0.4.5", - "grunt-karma": "^0.8.3", - "phantomjs-prebuilt": "^2.1.7", - "karma": "^0.12.14", - "karma-jasmine": "^0.1.5", - "karma-phantomjs-launcher": "^1.0.0", - "karma-script-launcher": "~0.1.0", - "karma-spec-reporter": "0.0.12", - "karma-story-reporter": "^0.2.2" - }, - "scripts": { - "test": "grunt test" - } -} diff --git a/Open-ILS/web/js/ui/default/staff/test/karma.conf.js b/Open-ILS/web/js/ui/default/staff/test/karma.conf.js index b0cef3fb7b..5b11d47978 100644 --- a/Open-ILS/web/js/ui/default/staff/test/karma.conf.js +++ b/Open-ILS/web/js/ui/default/staff/test/karma.conf.js @@ -6,15 +6,15 @@ module.exports = function(config){ logLevel: config.LOG_INFO, files : [ - 'build/js/angular.min.js', - 'build/js/angular-route.min.js', - 'bower_components/angular-mocks/angular-mocks.js', // testing only - 'bower_components/angular-file-saver/dist/angular-file-saver.bundle.min.js', - 'bower_components/ngtoast/dist/ngToast.min.js', - 'bower_components/angular-sanitize/angular-sanitize.min.js', - 'build/js/ui-bootstrap.min.js', - 'build/js/hotkeys.min.js', - 'build/js/angular-cookies.min.js', + '../common/build/js/angular.min.js', + '../common/build/js/angular-route.min.js', + '../common/bower_components/angular-mocks/angular-mocks.js', // testing only + '../common/bower_components/angular-file-saver/dist/angular-file-saver.bundle.min.js', + '../common/bower_components/ngtoast/dist/ngToast.min.js', + '../common/bower_components/angular-sanitize/angular-sanitize.min.js', + '../common/build/js/ui-bootstrap.min.js', + '../common/build/js/hotkeys.min.js', + '../common/build/js/angular-cookies.min.js', /* OpenSRF must be installed first */ '/openils/lib/javascript/md5.js', '/openils/lib/javascript/JSON_v1.js',