diff --git a/.circleci/config.yml b/.circleci/config.yml index 1dd3b0234..afb2797a7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,6 +3,7 @@ jobs: build: docker: - image: circleci/node:10.16.0 + - image: circleci/python:3.7-stretch working_directory: ~/repo @@ -12,9 +13,9 @@ jobs: # Download and cache dependencies - restore_cache: keys: - - v1-dependencies-{{ checksum "package.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- + - v1-dependencies-{{ checksum "package.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- - run: name: Workaround for GoogleChrome/puppeteer#290 @@ -36,11 +37,20 @@ jobs: command: | mkdir -p ./test-results/junit yarn test --ci --reporters=jest-junit + - run: + name: Install awscli + command: | + sudo apt update + sudo apt install python-pip + python --version + pip --version + sudo pip install awscli + - run: + name: Deploy to S3 + command: aws s3 sync build s3://testcircleci - store_artifacts: path: ./test-results/junit - store_test_results: path: ./test-results - - diff --git a/gulp/build-tasks/node-docs-flatten.js b/gulp/build-tasks/node-docs-flatten.js index b4e23f7e2..fd0adc89d 100644 --- a/gulp/build-tasks/node-docs-flatten.js +++ b/gulp/build-tasks/node-docs-flatten.js @@ -3,7 +3,7 @@ // Node.js task to convert SSI includes to inline html const path = require('path'); -const ssiToStatic = require('./ssi-to-static.js'); +const ssiToStatic = require('../ssi-to-static.js'); let includeSrc = path.join('build'); let src = path.join('build', 'docs'); diff --git a/gulp/build-tasks/other-assets.js b/gulp/build-tasks/other-assets.js index 1de32bb54..9b0ba88f3 100644 --- a/gulp/build-tasks/other-assets.js +++ b/gulp/build-tasks/other-assets.js @@ -4,31 +4,31 @@ module.exports = function (gulp, plugins, config, es, dest) { return es.merge([ // Images gulp.src(`${config.basepath.src}/assets/_project/images/**/*`).pipe( - gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/images/`) + gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/images/`), ), // Libraries - //TODO just handle non js and css (all the js and css to be minified and combined) + //TODO just handle non js and css (all the js and css to be minified and combined) gulp.src(`${config.basepath.src}/assets/_project/lib/**`).pipe( - gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/lib/`) + gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/lib/`), ), // concat external js libraries gulp.src(extLibJSTarget) - // .pipe(plugins.debug({title: 'External js:'})) - .pipe(plugins.concat('all-ext-min.js')) - .pipe(plugins.uglify()) - .pipe(gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/lib/`)), + // .pipe(plugins.debug({title: 'External js:'})) + .pipe(plugins.concat('all-ext-min.js')) + .pipe(plugins.uglify()) + .pipe(gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/lib/`)), // Fonts gulp.src(`${config.basepath.node_modules}/bootstrap-sass/assets/fonts/**`).pipe( - gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/fonts`) + gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/fonts`), ), gulp.src(`${config.basepath.node_modules}/font-awesome/fonts/**`).pipe( - gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/fonts`) + gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/fonts`), ), gulp.src([`${config.basepath.src}/docs/**/*.js`, `${config.basepath.src}/docs/**/*.png`, `${config.basepath.src}/docs/**/*.css`, `${config.basepath.src}/docs/**/release-notes/**/*`]) .pipe(plugins.if(dest === 'docs/assets', gulp.dest(`${config.basepath.build}/docs/`))), - gulp.src(config.extLib.transferToBuild) + gulp.src(config.extLib.transferToBuild, { base: './node_modules' }) .pipe(gulp.dest(`${config.basepath.build}/${dest}/${config.versionName}/latest/lib/ext`)), ]); }; diff --git a/gulp/build-tasks/ssi-to-static.js b/gulp/build-tasks/ssi-to-static.js deleted file mode 100644 index 6ad2706ac..000000000 --- a/gulp/build-tasks/ssi-to-static.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -// Node.js task to convert SSI includes to inline html -// const path = require('path'); - -module.exports = function (includeSrc, src, dest, exclude) { - const SSI = require('node-ssi'); - const fsPath = require('fs-path'); - // const path = require('path'); - const ssi = new SSI({ - encoding: 'utf-8', - baseDir: includeSrc, // Source of includes - }); - - const folder = { - src: src, // Source path, use path.join - exclude: exclude, - build: dest, // Destination path, use path.join - }; - - fsPath.find(folder.src, function (filepath, stats, filename) { - // filters only html files and excludes folders assigned to folder.exclude - if ((stats === 'file' && /\.html$/.test(filename)) || (stats === 'directory' && folder.exclude.indexOf(filename) < 0)) { - return true; - } - return false; - }, function (err, list) { - if (err) return; - list.files.forEach(function (file) { //iterates through list of filtered files - ssi.compileFile(file, function (err, content) { - if (err) { - console.error(err); - return; - } - var buildFile = file.replace(folder.src, folder.build); //builds destination filepath - fsPath.writeFile(buildFile, content, function (err) { - if (err) { - console.error(err); - } else { - // console.log(buildFile + ' - Done'); - } - }); - }); - }); - }); -}; - -// fromDir(folder.src); diff --git a/gulp/gulp-config.js b/gulp/gulp-config.js index ee16aa1fa..8fe801ef0 100644 --- a/gulp/gulp-config.js +++ b/gulp/gulp-config.js @@ -63,6 +63,9 @@ module.exports = { transferToBuild: [ './node_modules/nodep-date-input-polyfill/nodep-date-input-polyfill.dist.js', './node_modules/stickyfilljs/dist/stickyfill.min.js', + './node_modules/jquery-ui-bundle/jquery-ui.min.css', + './node_modules/jquery-ui-bundle/jquery-ui.min.js', + './node_modules/jquery-ui-bundle/images/**', ], }, publish: { diff --git a/gulp/release-tasks/files.js b/gulp/release-tasks/files.js index 3bc0251f5..337e2e7bd 100644 --- a/gulp/release-tasks/files.js +++ b/gulp/release-tasks/files.js @@ -1,89 +1,97 @@ const cssnano = require('cssnano'); module.exports = function (gulp, plugins, config, es, webpack, path, banner) { - return function () { - const target = [ - `${config.basepath.build}/**/*`, - `!${config.basepath.build}/assets/**/*`, - `!${config.basepath.build}/template-pages/**/*`, - `!${config.basepath.build}/*`, - `!**/${config.versionName}/*.js`, // handled by JS task that minifies - `!**/${config.versionName}/*.css`, // handled by SCSS -> CSS task that minifies - ].concat(config.release.excludes); - const versionAssetsTarget = [ - `${config.basepath.build}/assets/${config.versionName}/**/*`, - `!**/${config.versionName}/**/*.js`, // handled by JS task that minifies - `!**/${config.versionName}/**/*.css`, // handled by SCSS -> CSS task that minifies - ].concat(config.release.excludes); - let includesLink = { - cdnRegex: new RegExp('="(/)?assets/includes-cdn/', 'g'), - localRegex: new RegExp('="(/)?assets/includes-local/', 'g'), - cdnReplacement: '="$1assets/includes-cdn/', - localReplacement: '="$1assets/includes-local/', - }; - - return es.merge([ - gulp.src(target, { dot: true }) - .on('error', console.log) - .pipe(gulp.dest(`${config.basepath.release}`)), + return function () { + const target = [ + `${config.basepath.build}/**/*`, + `!${config.basepath.build}/assets/**/*`, + `!${config.basepath.build}/template-pages/**/*`, + `!${config.basepath.build}/*`, + `!**/${config.versionName}/*.js`, // handled by JS task that minifies + `!**/${config.versionName}/*.css`, // handled by SCSS -> CSS task that minifies + ].concat(config.release.excludes); + const versionAssetsTarget = [ + `${config.basepath.build}/assets/${config.versionName}/**/*`, + `!**/${config.versionName}/**/*.js`, // handled by JS task that minifies + `!**/${config.versionName}/**/*.css`, // handled by SCSS -> CSS task that minifies + ].concat(config.release.excludes); + let includesLink = { + cdnRegex: new RegExp('="(/)?assets/includes-cdn/', 'g'), + localRegex: new RegExp('="(/)?assets/includes-local/', 'g'), + cdnReplacement: '="$1assets/includes-cdn/', + localReplacement: '="$1assets/includes-local/', + }; - //template with include-cdn links - gulp.src(`${config.basepath.build}/template-pages/**/*`, { dot: true }) - .on('error', console.log) - .pipe(plugins.replace(includesLink.localRegex, includesLink.cdnReplacement)) //checks for local includes and replaces with cdn includes - .pipe(gulp.dest(`${config.basepath.release}/template-cdn-ssi`)), - //template with include-local links - gulp.src(`${config.basepath.build}/template-pages/**/*`, { dot: true }) - .on('error', console.log) - .pipe(plugins.replace(includesLink.cdnRegex, includesLink.localReplacement)) //checks for cdn includes and replaces with local includes - .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi`)), + return es.merge([ + gulp.src(target, { dot: true }) + .on('error', console.log) + .pipe(gulp.dest(`${config.basepath.release}`)), - //assets with cdn assets links - gulp.src(`${config.basepath.build}/assets/includes-cdn/**/*`, { dot: true }) - .pipe(gulp.dest(`${config.basepath.release}/template-cdn-ssi/assets/includes-cdn/`)), - //assets with local assets links - gulp.src(`${config.basepath.build}/assets/includes-local/**/*`, { dot: true }) - .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/includes-local/`)), + //template with include-cdn links + gulp.src(`${config.basepath.build}/template-pages/**/*`, { dot: true }) + .on('error', console.log) + .pipe(plugins.replace(includesLink.localRegex, includesLink.cdnReplacement)) //checks for local includes and replaces with cdn includes + .pipe(gulp.dest(`${config.basepath.release}/template-cdn-ssi`)) + .pipe(gulp.dest(`${config.basepath.release}/template-cdn`)), + //template with include-local links + gulp.src(`${config.basepath.build}/template-pages/**/*`, { dot: true }) + .on('error', console.log) + .pipe(plugins.replace(includesLink.cdnRegex, includesLink.localReplacement)) //checks for cdn includes and replaces with local includes + .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi`)) + .pipe(gulp.dest(`${config.basepath.release}/template-local`)), - //JS task - gulp.src([`${config.basepath.build}/assets/${config.versionName}/**/*.js`, `!${config.basepath.build}/assets/${config.versionName}/**/lib/*.js`], { dot: true }) - .pipe(plugins.foreach(function (stream, file) { - let filename = path.basename(file.path); - let destPath = file.path.split(file.base)[1].split(filename)[0]; - return stream - .pipe(plugins.webpack({ - output: { - filename: filename, - }, - plugins: [new webpack.optimize.UglifyJsPlugin()], - }, webpack)) - .pipe(plugins.insert.prepend(banner)) - .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/${config.versionName}/${destPath}`)) - .pipe(gulp.dest(`${config.basepath.release}/template-local/assets/${config.versionName}/${destPath}`)) - .pipe(gulp.dest(`${config.basepath.static}/assets/${config.versionName}/${destPath}`)); - })), + //assets with cdn assets links + gulp.src(`${config.basepath.build}/assets/includes-cdn/**/*`, { dot: true }) + .pipe(gulp.dest(`${config.basepath.release}/template-cdn-ssi/assets/includes-cdn/`)), + //assets with local assets links + gulp.src(`${config.basepath.build}/assets/includes-local/**/*`, { dot: true }) + .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/includes-local/`)), - gulp.src(`${config.basepath.build}/assets/${config.versionName}/latest/lib/all-ext-min.js`) + //JS task + gulp.src([`${config.basepath.build}/assets/${config.versionName}/**/*.js`, `!${config.basepath.build}/assets/${config.versionName}/**/lib/*.js`], { dot: true }) + .pipe(plugins.foreach(function (stream, file) { + let filename = path.basename(file.path); + let destPath = file.path.split(file.base)[1].split(filename)[0]; + return stream + .pipe(plugins.webpack({ + output: { + filename: filename, + }, + plugins: [new webpack.optimize.UglifyJsPlugin()], + }, webpack)) .pipe(plugins.insert.prepend(banner)) - .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/${config.versionName}/latest/lib/`)) - .pipe(gulp.dest(`${config.basepath.release}/template-local/assets/${config.versionName}/latest/lib/`)) - .pipe(gulp.dest(`${config.basepath.static}/assets/${config.versionName}/latest/lib/`)), + .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/${config.versionName}/${destPath}`)) + .pipe(gulp.dest(`${config.basepath.release}/template-local/assets/${config.versionName}/${destPath}`)) + .pipe(gulp.dest(`${config.basepath.static}/assets/${config.versionName}/${destPath}`)); + })), - //CSS task - gulp.src(`${config.basepath.build}/assets/${config.versionName}/**/*.css`, { dot: true }) - .pipe(plugins.postcss([cssnano({ - discardComments: {removeAll: true} - })])) - .on('error', console.log) - .pipe(plugins.insert.prepend(banner)) - .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/${config.versionName}/`)) - .pipe(gulp.dest(`${config.basepath.release}/template-local/assets/${config.versionName}/`)) - .pipe(gulp.dest(`${config.basepath.static}/assets/${config.versionName}/`)), + gulp.src(`${config.basepath.build}/assets/${config.versionName}/latest/lib/all-ext-min.js`) + .pipe(plugins.insert.prepend(banner)) + .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/${config.versionName}/latest/lib/`)) + .pipe(gulp.dest(`${config.basepath.release}/template-local/assets/${config.versionName}/latest/lib/`)) + .pipe(gulp.dest(`${config.basepath.static}/assets/${config.versionName}/latest/lib/`)), - //other version assets - gulp.src(versionAssetsTarget, { dot: true }) - .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/${config.versionName}/`)) - .pipe(gulp.dest(`${config.basepath.release}/template-local/assets/${config.versionName}/`)) - .pipe(gulp.dest(`${config.basepath.static}/assets/${config.versionName}/`)), - ]); - }; + //CSS task + gulp.src(`${config.basepath.build}/assets/${config.versionName}/**/*.css`, { dot: true }) + .pipe(plugins.postcss([cssnano({ + discardComments: {removeAll: true}, + })])) + .on('error', console.log) + .pipe(plugins.insert.prepend(banner)) + .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/${config.versionName}/`)) + .pipe(gulp.dest(`${config.basepath.release}/template-local/assets/${config.versionName}/`)) + .pipe(gulp.dest(`${config.basepath.static}/assets/${config.versionName}/`)), + + //other version assets + gulp.src(versionAssetsTarget, { dot: true }) + .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/${config.versionName}/`)) + .pipe(gulp.dest(`${config.basepath.release}/template-local/assets/${config.versionName}/`)) + .pipe(gulp.dest(`${config.basepath.static}/assets/${config.versionName}/`)), + + //other version assets + gulp.src(versionAssetsTarget, { dot: true }) + .pipe(gulp.dest(`${config.basepath.release}/template-local-ssi/assets/${config.versionName}/`)) + .pipe(gulp.dest(`${config.basepath.release}/template-local/assets/${config.versionName}/`)) + .pipe(gulp.dest(`${config.basepath.static}/assets/${config.versionName}/`)), + ]); + }; }; diff --git a/gulp/release-tasks/node-template-flatten.js b/gulp/release-tasks/node-template-flatten.js index 2f912821d..032ee3116 100644 --- a/gulp/release-tasks/node-template-flatten.js +++ b/gulp/release-tasks/node-template-flatten.js @@ -1,9 +1,8 @@ 'use strict'; // Node.js task to convert SSI includes to inline html - const path = require('path'); -const ssiToStatic = require('../build-tasks/ssi-to-static.js'); +const ssiToStatic = require('../ssi-to-static.js'); -ssiToStatic(path.join('release', 'template-cdn-ssi'), path.join('release', 'template-cdn-ssi'), path.join('release', 'template-cdn'), []); -ssiToStatic(path.join('release', 'template-local-ssi'), path.join('release', 'template-local-ssi'), path.join('release', 'template-local'), []); +ssiToStatic(path.join('release', 'template-cdn-ssi'), path.join('release', 'template-cdn'), path.join('release', 'template-cdn'), []); +ssiToStatic(path.join('release', 'template-local-ssi'), path.join('release', 'template-local'), path.join('release', 'template-local'), []); diff --git a/gulp/ssi-to-static.js b/gulp/ssi-to-static.js new file mode 100644 index 000000000..3083150a7 --- /dev/null +++ b/gulp/ssi-to-static.js @@ -0,0 +1,51 @@ +'use strict'; + +// Node.js task to convert SSI includes to inline html +const SSI = require('node-ssi'); +const fs = require('fs'); + +/* + * This function loops through a directory recursively to get all the files and filter those to list Html files. + * @dir {string} directory to list all the files + * @files_ {array} files list accumulated recursively +*/ +const getFiles = function (dir, files_) { + files_ = files_ || []; + var files = fs.readdirSync(dir); + for (var i in files) { + var name = dir + '/' + files[i]; + if (fs.statSync(name).isDirectory()) { + getFiles(name, files_); + } else { + if (name && /\.html$/.test(name)) { + files_.push(name); + } + } + } + return files_; +}; + +module.exports = function (includeSrc, src, dest, exclude) { + // const path = require('path'); + const ssi = new SSI({ + encoding: 'utf-8', + baseDir: includeSrc, // Source of includes + }); + + let filesList = getFiles(src); + filesList.forEach(function (file) { + ssi.compileFile(file, function (err, content) { + if (err) { + console.error(err); + return; + } + fs.writeFile(file, content, function (err) { + if (err) { + console.error(err); + } else { + // console.log(buildFile + ' - Done'); + } + }); + }); + }); +}; diff --git a/gulp/test-tasks/lint.js b/gulp/test-tasks/lint.js index e2ff7ebd5..f1921bf16 100644 --- a/gulp/test-tasks/lint.js +++ b/gulp/test-tasks/lint.js @@ -1,15 +1,12 @@ var gulpif = require('gulp-if'); -module.exports = function (gulp, plugins, config, fsPath, eslintReporter) { +module.exports = function (gulp, plugins, config) { return () => { return gulp.src(config.test.lint) - .once('data', function () { console.log('\x1b[1m', ' \n---linting tests---\n '); }) - .pipe(plugins.eslint({ - configFile: '.eslintrc', - })) + .once('data', function () { console.log('\x1b[1m', ' \n---linting tests---\n '); }) + .pipe(plugins.eslint({ + configFile: '.eslintrc', + })) .pipe(plugins.eslint.format()) - .pipe(gulpif(process.env.NODE_ENV === 'prod', plugins.eslint.failAfterError())) - .pipe(plugins.eslint.format(eslintReporter, function (results) { - fsPath.writeFile('tests/reports/eslint/report.html', results); - })); + .pipe(gulpif(process.env.NODE_ENV === 'prod', plugins.eslint.failAfterError())); }; }; diff --git a/gulpfile.js b/gulpfile.js index f39ac269f..524c0909d 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -16,8 +16,6 @@ const path = require('path'); const addSrc = require('gulp-add-src'); // For testing -const fsPath = require('fs-path'); -const eslintReporter = require('eslint-html-reporter'); const connectssi = require('gulp-connect-ssi'); const connect = require('gulp-connect'); // const wait = require('gulp-wait'); @@ -72,18 +70,18 @@ gulp.task('assets-includes-cdn', require('./gulp/build-tasks/assets-includes')(g gulp.task('build', (cb) => { runSequence( - 'test:eslint', - 'assets-includes-docs', - 'assets-includes-cdn', - 'assets-includes-local', - 'template-pages', - 'js', - 'scss', - 'other-assets', - 'build-other-files', - 'template-pages-docs', - 'template-pages-to-docs', - cb + 'test:eslint', + 'assets-includes-docs', + 'assets-includes-cdn', + 'assets-includes-local', + 'template-pages', + 'js', + 'scss', + 'other-assets', + 'build-other-files', + 'template-pages-docs', + 'template-pages-to-docs', + cb, ); }); @@ -124,7 +122,7 @@ gulp.task('release', (cb) => { 'scss-src', 'release-other-files', ], - cb + cb, ); }); @@ -133,7 +131,7 @@ let randomPort = Math.floor(1000 + Math.random() * 9000); gulp.task('serve', require('./gulp/build-tasks/serve')(gulp, plugins, connect, connectssi, argv, path, randomPort)); /* TEST TASKS */ -gulp.task('test:eslint', require('./gulp/test-tasks/lint')(gulp, plugins, config, fsPath, eslintReporter)); +gulp.task('test:eslint', require('./gulp/test-tasks/lint')(gulp, plugins, config)); /* PUBLISH TASKS */ diff --git a/package.json b/package.json index 1a8457bb1..486fa8cb8 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "Queensland-Government-Web-Template", - "version": "3.1.9", - "subVersion": "1.0.10", - "wt-version": "3.1.9", + "version": "3.1.10", + "subVersion": "1.0.11", + "wt-version": "3.1.10", "description": "This template is designed to provide a template for all Franchise websites, and the underpinning technology for new Agency websites.", "main": "gulpfile.js", "repository": { @@ -18,7 +18,7 @@ "prerelease": "gulp clean-release", "release": "export NODE_ENV=prod && npm run build && gulp release && node gulp/release-tasks/node-template-flatten.js && gulp replace-links", "postrelease": "gulp clean-redundant-release", - "start": "yarn build && gulp watch", + "start": "npm run build && gulp watch", "watch": "gulp watch", "publish-npm": "gulp wt-clean && gulp wt-clone && gulp wt-sync && gulp wt-updateVersion && gulp wt-npm && gulp wt-add && gulp wt-commit && gulp wt-tag && gulp wt-push", "create-swe-release": "gulp swe-add && gulp swe-tag && gulp swe-commit && gulp swe-push", @@ -51,8 +51,6 @@ "extract-text-webpack-plugin": "^2.1.0", "file-loader": "^2.0.0", "font-awesome": "^4.7.0", - "fs": "0.0.1-security", - "fs-path": "0.0.24", "git-hooks": "^1.1.8", "gulp": "^3.9.0", "gulp-add-src": "^0.2.0", @@ -110,6 +108,7 @@ "chromium": "^2.1.1", "dotenv": "^4.0.0", "jquery": "^3.3.1", + "jquery-ui-bundle": "^1.12.1-migrate", "lato-webfont": "^2.15.1", "node-bourbon": "^4.2.8", "nodep-date-input-polyfill": "^5.2.0", diff --git a/src/assets/_project/_blocks/components/_misc.scss b/src/assets/_project/_blocks/components/_misc.scss index 369f64846..19f5e0d30 100644 --- a/src/assets/_project/_blocks/components/_misc.scss +++ b/src/assets/_project/_blocks/components/_misc.scss @@ -23,3 +23,8 @@ a{ color: #fff; } } + +// datepicker prev and next button positioning +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next, .ui-datepicker .ui-datepicker-next-hover { + top: 8px !important; +} diff --git a/src/assets/_project/_blocks/components/accordion/_accordion.scss b/src/assets/_project/_blocks/components/accordion/_accordion.scss index 6373cef3c..d9ff8335d 100644 --- a/src/assets/_project/_blocks/components/accordion/_accordion.scss +++ b/src/assets/_project/_blocks/components/accordion/_accordion.scss @@ -5,13 +5,22 @@ .qg-acc-controls{ text-align: right; margin-bottom: 0.4em; + button{ + border: none; + background: none; + color: #13578b!important; + font-weight: 700; + } a{ text-decoration: none !important; - padding: 0 0.7rem; + padding: 0.4rem 0.7rem; color: $qg-blue-dark !important; font-weight: bold; display: inline-block; } + .collapse:not(.show) { + display: inline; + } } //label selector is to provide backward compatibility in case projects are using old markup label[for="expand"], label[for="collapse"] { @@ -40,9 +49,14 @@ border-bottom: 1px solid $qg-light-gray; } .acc-heading { - margin: 5px; + //margin: 5px; position: relative; padding: 0.6rem 0.7rem; + width: 98.5%; + margin:5px; + background: transparent; + border:none; + text-align:left; .title{ display: block; &:hover { diff --git a/src/assets/_project/_blocks/components/accordion/accordion.js b/src/assets/_project/_blocks/components/accordion/accordion.js index 117ee0f04..cb22d0c5b 100644 --- a/src/assets/_project/_blocks/components/accordion/accordion.js +++ b/src/assets/_project/_blocks/components/accordion/accordion.js @@ -8,12 +8,26 @@ (function ($) { let accordion = '.qg-accordion'; if ($(accordion).length > 0) { - let tabindex = 1; let accordionControls = 'input[name=control]'; + let accItem = $(accordion).find('article'); let linkedpanel = window.location.hash && $('input[aria-controls=' + window.location.hash.substring(1) + ']'); + // keyboard accessibility + var a11yClick = function (event) { + if (event.type === 'click') { + return true; + } else if (event.type === 'keypress') { + var code = event.charCode || event.keyCode; + if ((code === 32) || (code === 13)) { + return true; + } + } else { + return false; + } + }; + //Handle events of accordion inputs - $(accordion).find('article input').on('change', function () { + $(accordion).find('article input[name=tabs]').on('change', function () { let checkedStatus = $(this).prop('checked'); let controlledPanedId = $('#' + $(this).attr('aria-controls')); $(this) @@ -22,21 +36,6 @@ controlledPanedId.attr('aria-hidden', !checkedStatus); }); - //expand all click - // label selector is to provide backward compatibility in case projects are using old markup - $('.qg-acc-controls .expand, label[for=\'expand\']').click(function (e) { - e.preventDefault(); - $(this).focus(); - $(this).parents('.qg-accordion').find('input:checkbox').prop('checked', true); - }); - - // collapse all click - // label selector is to provide backward compatibility in case projects are using old markup - $('.qg-acc-controls .collapse, label[for=\'collapse\']').click(function (e) { - e.preventDefault(); - $(this).parents('.qg-accordion').find('input:checkbox').prop('checked', false); - }); - // open on page load const hashTrigger = function () { linkedpanel = window.location.hash && $('input[aria-controls=' + window.location.hash.substring(1) + ']'); @@ -51,25 +50,62 @@ hashTrigger(); window.onhashchange = hashTrigger; - // inserting tab index dynamically - // label selector is to provide backward compatibility in case projects are using old markup - $('.qg-accordion .acc-heading, .qg-acc-controls .expand, .qg-acc-controls .collapse, label[for="expand"], label[for="collapse"]').each(function () { - if (this.type !== 'hidden') { - var $input = $(this); - $input.attr('tabindex', tabindex); - tabindex++; - } - }); $('input[name=tabs]').click(function () { $(this).parent('article').find('.acc-heading').focus(); }); // highlight title on hover - $('.qg-accordion article').hover(function () { + accItem.hover(function () { $(accordion).find('.title').removeClass('ht'); $(this).find('.title').addClass('ht'); }, function () { $(accordion).find('.title').removeClass('ht'); }); + + // expand/collapse on enter keypress + accItem.find('.acc-heading').on('keypress', function (event) { + if (event.target === event.currentTarget) { + event.preventDefault(); + if (a11yClick(event) === true) { + let parent = $(this).parent(); + if (parent.find('input[name="tabs"]:checked').length > 0) { + parent.find('input[name="tabs"]').prop('checked', false); + } else { + parent.find('input[name="tabs"]').prop('checked', true); + } + } + } + }); + accItem.find('.acc-heading').on('click', function (event) { + if (event.target === event.currentTarget) { + if (event.clientX !== 0) { + let parent = $(this).parent(); + if (parent.find('input[name="tabs"]:checked').length > 0) { + parent.find('input[name="tabs"]').prop('checked', false); + } else { + parent.find('input[name="tabs"]').prop('checked', true); + } + return false; + } + } + }); + //expand all click + // label selector is to provide backward compatibility in case projects are using old markup + $('.qg-acc-controls .expand, label[for=\'expand\']').on('click keypress', function (event) { + if (a11yClick(event) === true) { + $(this).parents('.qg-accordion').find('input:checkbox').prop('checked', true); + event.preventDefault(); + } + }); + + // collapse all click + // label selector is to provide backward compatibility in case projects are using old markup + $('.qg-acc-controls .collapse, label[for=\'collapse\']').on('click keypress', function (event) { + if (a11yClick(event) === true) { + $(this).parents('.qg-accordion').find('input:checkbox').prop('checked', false); + event.preventDefault(); + } + }); } }(jQuery)); + diff --git a/src/assets/_project/_blocks/components/forms/qg-address-autocomplete.js b/src/assets/_project/_blocks/components/forms/qg-address-autocomplete.js index 905a9ee85..5bab8eb1b 100644 --- a/src/assets/_project/_blocks/components/forms/qg-address-autocomplete.js +++ b/src/assets/_project/_blocks/components/forms/qg-address-autocomplete.js @@ -212,4 +212,4 @@ let qgInitAutocompleteAddress; }; qg.loadGoogle(qgInitAutocompleteAddress); } -}(qg, jQuery)); +}(qg, jQuery)); \ No newline at end of file diff --git a/src/assets/_project/_blocks/components/license.js b/src/assets/_project/_blocks/components/license.js index 2598c81e3..f59a68bcd 100644 --- a/src/assets/_project/_blocks/components/license.js +++ b/src/assets/_project/_blocks/components/license.js @@ -7,7 +7,7 @@ 'use strict'; const licenceOptions = { url: '//creativecommons.org/licenses/', - imgSrc: qg.cdn + qg.swe.paths.images + '/licences/', + imgSrc: '{{CDN}}/latest/images/licences/', types: { 'by': { 'name': 'Attribution', diff --git a/src/assets/_project/_blocks/components/quick-exit/quick-exit.js b/src/assets/_project/_blocks/components/quick-exit/quick-exit.js index 69c8aef9b..5ee951e66 100644 --- a/src/assets/_project/_blocks/components/quick-exit/quick-exit.js +++ b/src/assets/_project/_blocks/components/quick-exit/quick-exit.js @@ -1,31 +1,61 @@ -var quickExit = { - el: '.qg-quick-exit', - init: function () { - this.methods(); - }, - methods: function () { - var newloc = 'https://www.google.com.au'; - var el = $(this.el); - if (el.length > 0) { - $.getScript('{{CDN}}/latest/lib/ext/stickyfill.min.js', function () { - // IE 11 fix - /*global Stickyfill*/ - Stickyfill.add(el); - // navigating on pressing Escape key - $(document).keydown(function (e) { - if (e.keyCode === 27) { - window.open(newloc, '_blank', ''); - window.location.replace(newloc); - return false; - } - }); - // clicking on the quick exit button - $('body').on('click', '.qg-quick-exit__button', function () { - window.open(newloc, '_blank', ''); - window.location.replace(newloc); + +(function () { + var $quickExit = $('.qg-quick-exit'); + if ($quickExit.length > 0 && $('.qg-quick-exit__button').length > 0) { + var quickExitInit = function () { + var button = document.querySelector('.qg-quick-exit__button'); + var escapeSite = 'https://www.google.com.au/'; + var hotkey = 27; + + // add click handler + button.onclick = function (e) { + /*globals quickExit*/ + return quickExit(escapeSite); + }; + + // load a plugin only on IE browser to support position:sticky + if (/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) { + $.getScript('{{CDN}}/latest/lib/ext/stickyfilljs/dist/stickyfill.min.js', function () { + /*global Stickyfill*/ + console.log('loaded stickyfill'); + Stickyfill.add($quickExit); }); + } + + // add hotkey trigger + document.addEventListener('keydown', function (e) { + if (e.keyCode === hotkey) { + quickExit(escapeSite); + + if (e) { + // stop escape from cancelling redirect + e.preventDefault(); + + // early IEs don't have preventDefault + e.returnValue = false; + } + + return false; + } }); - } - }, -}; -quickExit.init(); + }; + window.quickExit = function (site) { + // then redirect to a non-sensitive site + window.open(site, '_blank'); + window.location.replace(site); + + // remove as much info from URL as possible + if (window.history) { + try { + window.history.replaceState({}, '', '/'); + } catch (e) { + + } + } + + // disable default event handling + return false; + }; + quickExitInit(); + } +})(); diff --git a/src/assets/_project/_blocks/layout/_pagemodels/_aggregation.scss b/src/assets/_project/_blocks/layout/_pagemodels/_aggregation.scss index ffa2e235f..2395f774a 100644 --- a/src/assets/_project/_blocks/layout/_pagemodels/_aggregation.scss +++ b/src/assets/_project/_blocks/layout/_pagemodels/_aggregation.scss @@ -1,4 +1,10 @@ .aggregation-index { + #qg-primary-content { + margin-top: 2rem; + } + .qg-primary-content_notice { + margin-bottom: 2rem; + } .additional-information { h2 { font-size: 1.56rem; diff --git a/src/assets/_project/_blocks/layout/_print.scss b/src/assets/_project/_blocks/layout/_print.scss index 420fa22db..53e74dbaa 100644 --- a/src/assets/_project/_blocks/layout/_print.scss +++ b/src/assets/_project/_blocks/layout/_print.scss @@ -101,6 +101,12 @@ background: #ffffff; color: #000000; } + .row { + display: block; + } + .qg-site-map { + display:none !important; + } #qg-primary-content{ margin-top: 0; h1 { @@ -273,4 +279,4 @@ form .label { border: none; } -} \ No newline at end of file +} diff --git a/src/assets/_project/_blocks/layout/content/content-types/_call-out-box.scss b/src/assets/_project/_blocks/layout/content/content-types/_call-out-box.scss index 98f47e5f6..1fda499d8 100644 --- a/src/assets/_project/_blocks/layout/content/content-types/_call-out-box.scss +++ b/src/assets/_project/_blocks/layout/content/content-types/_call-out-box.scss @@ -4,7 +4,7 @@ padding: 2em 1em; width: 100%; box-sizing: border-box; - margin: 1em auto; + margin: 0 auto; overflow: hidden; a.qg-btn { float: left; @@ -17,4 +17,4 @@ p { margin: 0; } -} \ No newline at end of file +} diff --git a/src/assets/_project/_blocks/layout/content/options.html b/src/assets/_project/_blocks/layout/content/options.html index 27510955a..090a4b9b6 100644 --- a/src/assets/_project/_blocks/layout/content/options.html +++ b/src/assets/_project/_blocks/layout/content/options.html @@ -14,7 +14,7 @@ method="post" action="https://www.smartservice.qld.gov.au/services/submissions/email/feedback/feedback" class="form" - data-recaptcha="true"> + data-recaptcha="true" data-action="homepage">
  1. @@ -107,6 +107,8 @@

    Page feedback

  2. + ` +