diff --git a/.circleci/config.yml b/.circleci/config.yml index b37e488d24..5954f27f7e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,9 +12,9 @@ jobs: key: pipenv-v1-{{ checksum "setup.py" }} # Only install if .venv wasn’t cached. - run: | - if [[ ! -e ".venv" ]]; then - pipenv install -e .[testing] - fi + if [[ ! -e ".venv" ]]; then + pipenv install -e .[testing] + fi - save_cache: key: pipenv-v1-{{ checksum "setup.py" }} paths: @@ -39,9 +39,9 @@ jobs: key: frontend-v1-{{ checksum "package-lock.json" }} # Only install if node_modules wasn’t cached. - run: | - if [[ ! -e "node_modules" ]]; then - npm install --no-save --no-optional --no-audit --no-fund --progress=false - fi + if [[ ! -e "node_modules" ]]; then + npm install --no-save --no-optional --no-audit --no-fund --progress=false + fi - save_cache: paths: - node_modules @@ -54,8 +54,7 @@ jobs: - wagtail - run: npm run lint:js - run: npm run lint:css - # TODO Remove || true and enforce a successful exit code. - - run: npm run lint:format || true + - run: npm run lint:format - run: npm run test:unit:coverage -- --runInBand - run: bash <(curl -s https://codecov.io/bash) -F frontend @@ -73,9 +72,9 @@ jobs: key: pipenv-v1-{{ checksum "setup.py" }} # Only install if .venv wasn’t cached. - run: | - if [[ ! -e ".venv" ]]; then - pipenv install -e .[testing] - fi + if [[ ! -e ".venv" ]]; then + pipenv install -e .[testing] + fi - save_cache: key: pipenv-v1-{{ checksum "setup.py" }} paths: @@ -84,9 +83,9 @@ jobs: key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }} # Only install if node_modules wasn’t cached. - run: | - if [[ ! -e "client/tests/integration/node_modules" ]]; then - npm --prefix ./client/tests/integration ci - fi + if [[ ! -e "client/tests/integration/node_modules" ]]; then + npm --prefix ./client/tests/integration ci + fi - save_cache: key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }} paths: @@ -123,22 +122,22 @@ jobs: - run: python scripts/nightly/upload.py workflows: - version: 2 - test: - jobs: - - backend - - frontend - - ui_tests: - requires: - - frontend + version: 2 + test: + jobs: + - backend + - frontend + - ui_tests: + requires: + - frontend - nightly: - jobs: - - nightly-build - triggers: - - schedule: - cron: "0 0 * * *" - filters: - branches: - only: - - main + nightly: + jobs: + - nightly-build + triggers: + - schedule: + cron: '0 0 * * *' + filters: + branches: + only: + - main diff --git a/.eslintrc.js b/.eslintrc.js index 6dc5a277f3..1ff41cdbc4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,83 +1,81 @@ // Rules which have been enforced in configuration upgrades and flag issues in existing code. // We need to consider whether to disable those rules permanently, or fix the issues. const legacyCode = { - "class-methods-use-this": "off", - "constructor-super": "off", - "default-param-last": "off", - "import/extensions": "off", - "import/first": "off", - "import/newline-after-import": "off", - "import/no-extraneous-dependencies": "off", - "import/no-unresolved": "off", - "import/no-useless-path-segments": "off", - "import/order": "off", - "import/prefer-default-export": "off", - "jsx-a11y/alt-text": "off", - "jsx-a11y/anchor-is-valid": "off", - "jsx-a11y/click-events-have-key-events": "off", - "jsx-a11y/interactive-supports-focus": "off", - "jsx-a11y/no-noninteractive-element-interactions": "off", - "jsx-a11y/role-supports-aria-props": "off", - "lines-between-class-members": "off", - "max-classes-per-file": "off", - "no-await-in-loop": "off", - "no-continue": "off", - "no-else-return": "off", - "no-extra-boolean-cast": "off", - "no-import-assign": "off", - "no-lonely-if": "off", - "no-plusplus": "off", - "no-prototype-builtins": "off", - "no-restricted-syntax": "off", - "no-this-before-super": "off", - "operator-assignment": "off", - "prefer-destructuring": "off", - "prefer-object-spread": "off", - "prefer-promise-reject-errors": "off", - "react-hooks/exhaustive-deps": "off", - "react-hooks/rules-of-hooks": "off", - "react/button-has-type": "off", - "react/destructuring-assignment": "off", - "react/forbid-prop-types": "off", - "react/function-component-definition": "off", - "react/jsx-curly-brace-presence": "off", - "react/jsx-filename-extension": "off", - "react/jsx-no-useless-fragment": "off", - "react/jsx-props-no-spreading": "off", - "react/no-danger": "off", - "react/no-deprecated": "off", - "react/require-default-props": "off", -} + 'class-methods-use-this': 'off', + 'constructor-super': 'off', + 'default-param-last': 'off', + 'import/extensions': 'off', + 'import/first': 'off', + 'import/newline-after-import': 'off', + 'import/no-extraneous-dependencies': 'off', + 'import/no-unresolved': 'off', + 'import/no-useless-path-segments': 'off', + 'import/order': 'off', + 'import/prefer-default-export': 'off', + 'jsx-a11y/alt-text': 'off', + 'jsx-a11y/anchor-is-valid': 'off', + 'jsx-a11y/click-events-have-key-events': 'off', + 'jsx-a11y/interactive-supports-focus': 'off', + 'jsx-a11y/no-noninteractive-element-interactions': 'off', + 'jsx-a11y/role-supports-aria-props': 'off', + 'lines-between-class-members': 'off', + 'max-classes-per-file': 'off', + 'no-await-in-loop': 'off', + 'no-continue': 'off', + 'no-else-return': 'off', + 'no-extra-boolean-cast': 'off', + 'no-import-assign': 'off', + 'no-lonely-if': 'off', + 'no-plusplus': 'off', + 'no-prototype-builtins': 'off', + 'no-restricted-syntax': 'off', + 'no-this-before-super': 'off', + 'operator-assignment': 'off', + 'prefer-destructuring': 'off', + 'prefer-object-spread': 'off', + 'prefer-promise-reject-errors': 'off', + 'react-hooks/exhaustive-deps': 'off', + 'react-hooks/rules-of-hooks': 'off', + 'react/button-has-type': 'off', + 'react/destructuring-assignment': 'off', + 'react/forbid-prop-types': 'off', + 'react/function-component-definition': 'off', + 'react/jsx-curly-brace-presence': 'off', + 'react/jsx-filename-extension': 'off', + 'react/jsx-no-useless-fragment': 'off', + 'react/jsx-props-no-spreading': 'off', + 'react/no-danger': 'off', + 'react/no-deprecated': 'off', + 'react/require-default-props': 'off', +}; module.exports = { - "extends": [ - "@wagtail/eslint-config-wagtail", - "plugin:@typescript-eslint/recommended" + extends: [ + '@wagtail/eslint-config-wagtail', + 'plugin:@typescript-eslint/recommended', ], - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint" - ], - "env": { - "jest": true, - "browser": true, + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + env: { + jest: true, + browser: true, }, - "rules": { - "no-underscore-dangle": ["error", { "allow": ["__REDUX_DEVTOOLS_EXTENSION__"] }], - // note you must disable the base rule as it can report incorrect errors - "no-use-before-define": "off", - "@typescript-eslint/no-use-before-define": ["error"], - - "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/explicit-member-accessibility": "off", - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/no-explicit-any": "off", - 'react/jsx-filename-extension': [ - "error", - { extensions: ['.js', '.tsx'] }, + rules: { + 'no-underscore-dangle': [ + 'error', + { allow: ['__REDUX_DEVTOOLS_EXTENSION__'] }, ], + // note you must disable the base rule as it can report incorrect errors + 'no-use-before-define': 'off', + '@typescript-eslint/no-use-before-define': ['error'], + + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/explicit-member-accessibility': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-explicit-any': 'off', + 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.tsx'] }], 'import/extensions': [ - "error", + 'error', 'always', { ignorePackages: true, @@ -91,66 +89,66 @@ module.exports = { ], ...legacyCode, }, - "overrides": [ + overrides: [ { // Rules we don’t want to enforce for test and tooling code. - "files": ["*.test.ts", "*.test.tsx", "*.test.js", "webpack.config.js"], - "rules": { - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-var-requires": "off" - } - }, - { - "files": ["docs/_static/**"], - "globals": { "$": "readonly" } - }, - { - "files": ["wagtail/**/**"], - "globals": { - "$": "readonly", - "addMessage": "readonly", - "buildExpandingFormset": "readonly", - "cancelSpinner": "readonly", - "escapeHtml": "readonly", - "insertRichTextDeleteControl": "readonly", - "jQuery": "readonly", - "jsonData": "readonly", - "ModalWorkflow": "readonly", - "DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS": "writable", - "EMBED_CHOOSER_MODAL_ONLOAD_HANDLERS": "writable", - "IMAGE_CHOOSER_MODAL_ONLOAD_HANDLERS": "writable", - "QUERY_CHOOSER_MODAL_ONLOAD_HANDLERS": "writable", - "SNIPPET_CHOOSER_MODAL_ONLOAD_HANDLERS": "writable" + files: ['*.test.ts', '*.test.tsx', '*.test.js', 'webpack.config.js'], + rules: { + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-var-requires': 'off', }, - "rules": { - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/no-use-before-define": "off", - "camelcase": [ - "error", + }, + { + files: ['docs/_static/**'], + globals: { $: 'readonly' }, + }, + { + files: ['wagtail/**/**'], + globals: { + $: 'readonly', + addMessage: 'readonly', + buildExpandingFormset: 'readonly', + cancelSpinner: 'readonly', + escapeHtml: 'readonly', + insertRichTextDeleteControl: 'readonly', + jQuery: 'readonly', + jsonData: 'readonly', + ModalWorkflow: 'readonly', + DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS: 'writable', + EMBED_CHOOSER_MODAL_ONLOAD_HANDLERS: 'writable', + IMAGE_CHOOSER_MODAL_ONLOAD_HANDLERS: 'writable', + QUERY_CHOOSER_MODAL_ONLOAD_HANDLERS: 'writable', + SNIPPET_CHOOSER_MODAL_ONLOAD_HANDLERS: 'writable', + }, + rules: { + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-use-before-define': 'off', + 'camelcase': [ + 'error', { - "allow": [ - "__unused_webpack_module", - "__webpack_modules__", - "__webpack_require__" + allow: [ + '__unused_webpack_module', + '__webpack_modules__', + '__webpack_require__', ], - "properties": "never" - } + properties: 'never', + }, ], - "consistent-return": "off", - "func-names": "off", - "id-length": "off", - "indent": "off", - "key-spacing": "off", - "new-cap": "off", - "newline-per-chained-call": "off", - "no-param-reassign": "off", - "no-underscore-dangle": "off", - "object-shorthand": "off", - "prefer-arrow-callback": "off", - "quote-props": "off", - "space-before-function-paren": "off", - "vars-on-top": "off" - } - } - ] -} + 'consistent-return': 'off', + 'func-names': 'off', + 'id-length': 'off', + 'indent': 'off', + 'key-spacing': 'off', + 'new-cap': 'off', + 'newline-per-chained-call': 'off', + 'no-param-reassign': 'off', + 'no-underscore-dangle': 'off', + 'object-shorthand': 'off', + 'prefer-arrow-callback': 'off', + 'quote-props': 'off', + 'space-before-function-paren': 'off', + 'vars-on-top': 'off', + }, + }, + ], +}; diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6d57af5599..d891c9e07c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,4 +1,4 @@ -name: "CodeQL" +name: 'CodeQL' on: schedule: @@ -13,16 +13,16 @@ jobs: fail-fast: false matrix: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - language: [ 'javascript', 'python' ] + language: ['javascript', 'python'] steps: - - name: Checkout repository - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dcae2c5065..bf08bafce9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,11 +3,10 @@ name: Wagtail CI on: push: paths-ignore: - - 'docs/**' + - 'docs/**' pull_request: paths-ignore: - - 'docs/**' - + - 'docs/**' # Our test suite should cover: # - all supported databases against current Python and Django @@ -36,8 +35,8 @@ jobs: strategy: matrix: include: - - python: "3.9" - django: "Django>=4.0,<4.1" + - python: '3.9' + django: 'Django>=4.0,<4.1' steps: - uses: actions/checkout@v2 @@ -62,22 +61,22 @@ jobs: strategy: matrix: include: - - python: "3.7" - django: "Django>=3.2,<3.3" + - python: '3.7' + django: 'Django>=3.2,<3.3' experimental: false - - python: "3.10" - django: "Django>=4.0,<4.1" + - python: '3.10' + django: 'Django>=4.0,<4.1' notz: notz experimental: false - - python: "3.10" - django: "Django>=4.0,<4.1" + - python: '3.10' + django: 'Django>=4.0,<4.1' experimental: false emailuser: emailuser - - python: "3.10" - django: "git+https://github.com/django/django.git@stable/4.0.x#egg=Django" + - python: '3.10' + django: 'git+https://github.com/django/django.git@stable/4.0.x#egg=Django' experimental: true - - python: "3.10" - django: "git+https://github.com/django/django.git@main#egg=Django" + - python: '3.10' + django: 'git+https://github.com/django/django.git@main#egg=Django' experimental: true services: @@ -116,11 +115,11 @@ jobs: strategy: matrix: include: - - python: "3.8" - django: "Django>=3.2,<3.3" + - python: '3.8' + django: 'Django>=3.2,<3.3' experimental: false - - python: "3.9" - django: "Django>=4.0,<4.1" + - python: '3.9' + django: 'Django>=4.0,<4.1' experimental: false services: @@ -150,7 +149,7 @@ jobs: ./runtests.py env: DATABASE_ENGINE: django.db.backends.mysql - DATABASE_HOST: "127.0.0.1" + DATABASE_HOST: '127.0.0.1' DATABASE_USER: root # https://github.com/elastic/elastic-github-actions doesn't work for Elasticsearch 5, @@ -160,8 +159,8 @@ jobs: strategy: matrix: include: - - python: "3.7" - django: "Django>=3.2,<3.3" + - python: '3.7' + django: 'Django>=3.2,<3.3' steps: - name: Configure sysctl limits run: | @@ -200,8 +199,8 @@ jobs: strategy: matrix: include: - - python: "3.9" - django: "Django>=4.0,<4.1" + - python: '3.9' + django: 'Django>=4.0,<4.1' emailuser: emailuser steps: - name: Configure sysctl limits @@ -244,8 +243,8 @@ jobs: strategy: matrix: include: - - python: "3.7" - django: "Django>=3.2,<3.3" + - python: '3.7' + django: 'Django>=3.2,<3.3' services: postgres: @@ -293,8 +292,8 @@ jobs: strategy: matrix: include: - - python: "3.8" - django: "Django>=4.0,<4.1" + - python: '3.8' + django: 'Django>=4.0,<4.1' experimental: false services: diff --git a/.readthedocs.yml b/.readthedocs.yml index 6e892b94b9..369c645dcb 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,4 +1,4 @@ python: - version: 3.7 - pip_install: true + version: 3.7 + pip_install: true requirements_file: null diff --git a/client/.storybook/main.js b/client/.storybook/main.js index 3e81d1f93b..4a6c4be52e 100644 --- a/client/.storybook/main.js +++ b/client/.storybook/main.js @@ -1,9 +1,7 @@ module.exports = { - "stories": [ - "../src/**/*.stories.@(js|jsx|ts|tsx)" - ], - "core": { - "builder": "webpack5" + stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'], + core: { + builder: 'webpack5', }, webpackFinal: (config) => { config.resolve.fallback.crypto = false; @@ -12,17 +10,17 @@ module.exports = { { test: /\.(scss|css)$/, use: [ - "style-loader", - "css-loader", + 'style-loader', + 'css-loader', { - loader: "postcss-loader", + loader: 'postcss-loader', options: { postcssOptions: { - plugins: ["autoprefixer", "cssnano"], + plugins: ['autoprefixer', 'cssnano'], }, }, }, - "sass-loader", + 'sass-loader', ], }, ]; diff --git a/client/.storybook/preview.js b/client/.storybook/preview.js index c9310b152a..ab2594549b 100644 --- a/client/.storybook/preview.js +++ b/client/.storybook/preview.js @@ -4,11 +4,11 @@ import '../../wagtail/admin/static_src/wagtailadmin/scss/core.scss'; import '../../wagtail/admin/static_src/wagtailadmin/scss/sidebar.scss'; export const parameters = { - actions: { argTypesRegex: "^on[A-Z].*" }, + actions: { argTypesRegex: '^on[A-Z].*' }, controls: { matchers: { color: /(background|color)$/i, date: /Date$/, }, }, -} +}; diff --git a/client/scss/components/_breadcrumb.scss b/client/scss/components/_breadcrumb.scss index 50d801dbf9..fda939ff1b 100644 --- a/client/scss/components/_breadcrumb.scss +++ b/client/scss/components/_breadcrumb.scss @@ -1,90 +1,89 @@ .breadcrumb { - @include unlist(); - @include clearfix(); - padding-top: 1.4em; - font-size: 0.85em; - line-height: 1.5em; - margin-left: 2em; - background: $color-teal; + @include unlist(); + @include clearfix(); + padding-top: 1.4em; + font-size: 0.85em; + line-height: 1.5em; + margin-left: 2em; + background: $color-teal; - li, - .breadcrumb-item { - display: block; - float: left; - position: relative; - text-decoration: none; - white-space: nowrap; - padding: 4px; + li, + .breadcrumb-item { + display: block; + float: left; + position: relative; + text-decoration: none; + white-space: nowrap; + padding: 4px; - &:hover { - background: $color-teal-dark; - } - - &.breadcrumb-dropdown { - padding: 0; - font-size: initial; - } - - .t-default .u-btn-current { - color: inherit; - background: rgba(0, 91, 94, 0.6); - font-size: 1.15em; - border: 0; - line-height: 1.6; - } + &:hover { + background: $color-teal-dark; } - li > a, - .breadcrumb-link { - color: $color-white; - display: block; - padding: calc(0.5em - 4px) 1em; - white-space: nowrap; - line-height: 1.6em; - - &:hover { - background: $color-teal-dark; - color: $color-white; - - .arrow_right_icon { - color: $color-teal; - } - } - - .title { - display: inline-block; - max-width: 11.8em; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - vertical-align: bottom; - } + &.breadcrumb-dropdown { + padding: 0; + font-size: initial; } + .t-default .u-btn-current { + color: inherit; + background: rgba(0, 91, 94, 0.6); + font-size: 1.15em; + border: 0; + line-height: 1.6; + } + } + + li > a, + .breadcrumb-link { + color: $color-white; + display: block; + padding: calc(0.5em - 4px) 1em; + white-space: nowrap; + line-height: 1.6em; + + &:hover { + background: $color-teal-dark; + color: $color-white; + + .arrow_right_icon { + color: $color-teal; + } + } + + .title { + display: inline-block; + max-width: 11.8em; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + vertical-align: bottom; + } + } + + .home_icon { + @include svg-icon(1em); + transform: scale(1.5) translate(0, 0.1em); + } + + .arrow_right_icon { + @include svg-icon(1em); + color: $color-teal-dark; + transform: scale(1.75) translate(0.3em, 0.1em); + } + + @include media-breakpoint-up(sm) { + padding-top: 0; + background: $color-teal-darker; + margin-left: -($desktop-nice-padding); + margin-right: -($desktop-nice-padding); + .home_icon { - @include svg-icon(1em); - transform: scale(1.5) translate(0, 0.1em); + margin-left: 1.25em; } .arrow_right_icon { - @include svg-icon(1em); - color: $color-teal-dark; - transform: scale(1.75) translate(0.3em, 0.1em); - } - - @include media-breakpoint-up(sm) { - padding-top: 0; - background: $color-teal-darker; - margin-left: -($desktop-nice-padding); - margin-right: -($desktop-nice-padding); - - .home_icon { - margin-left: 1.25em; - } - - .arrow_right_icon { - color: $color-teal; - } + color: $color-teal; } + } } - diff --git a/client/scss/components/_bulk_actions.scss b/client/scss/components/_bulk_actions.scss index ec49c37a05..5ffc1d272e 100644 --- a/client/scss/components/_bulk_actions.scss +++ b/client/scss/components/_bulk_actions.scss @@ -1,109 +1,108 @@ .bulk-actions-filter-checkbox { - .table-headers & { - > div { - display: flex; - align-items: center; - } - - .c-dropdown__button { - padding-left: 0.3rem; - } - - .bulk-actions-choices, - .bulk-actions-choices > ul { - display: flex; - align-items: center; - } - - .bulk-actions-choices li { - margin: 0 0.5em; - } - - .bulk-actions-choices span { - text-transform: none; - } + .table-headers & { + > div { + display: flex; + align-items: center; } -} + .c-dropdown__button { + padding-left: 0.3rem; + } + + .bulk-actions-choices, + .bulk-actions-choices > ul { + display: flex; + align-items: center; + } + + .bulk-actions-choices li { + margin: 0 0.5em; + } + + .bulk-actions-choices span { + text-transform: none; + } + } +} .bulk-actions-choices { - &.footer { - @include transition(transform 0.1s ease 0.1s); + &.footer { + @include transition(transform 0.1s ease 0.1s); - &.hidden { - transform: translateY(200px); - visibility: hidden; - } - - .button { - font-weight: 600; - } - - .bulk-actions-more { - .button { - border: 0; - } - - .button:not(:hover) { - color: $color-teal; - } - - .c-dropdown__button { - text-transform: uppercase; - } - - .c-dropdown__menu { - bottom: 50px; - flex-direction: column; - } - } - - .bulk-actions-more.is-open { - .c-dropdown__menu.u-toggle { - display: flex; - } - } + &.hidden { + transform: translateY(200px); + visibility: hidden; } - .footer__container { + .button { + font-weight: 600; + } + + .bulk-actions-more { + .button { + border: 0; + } + + .button:not(:hover) { + color: $color-teal; + } + + .c-dropdown__button { + text-transform: uppercase; + } + + .c-dropdown__menu { + bottom: 50px; + flex-direction: column; + } + } + + .bulk-actions-more.is-open { + .c-dropdown__menu.u-toggle { display: flex; - justify-content: space-around; - width: 100%; - align-items: center; - padding: 1.25em; - border-radius: 4px 4px 0 0; - margin-left: 30px; - - input[type='checkbox'] { - margin-right: 1.25em; - } - - .bulk-actions-buttons { - border-left: 1px solid $color-grey-2; - padding-left: 1.5em; - - .bulk-action-btn { - max-width: 160px; - overflow-x: hidden; - text-overflow: ellipsis; - } - } - - .num-objects { - text-transform: none; - margin: 0 5px; - } - - .num-objects-in-listing { - color: $color-teal-light; - background-color: transparent; - border: 0; - font-family: $font-sans; - padding: 0; - } - - .button:not(:hover) { - background-color: $color-white; - } + } } + } + + .footer__container { + display: flex; + justify-content: space-around; + width: 100%; + align-items: center; + padding: 1.25em; + border-radius: 4px 4px 0 0; + margin-left: 30px; + + input[type='checkbox'] { + margin-right: 1.25em; + } + + .bulk-actions-buttons { + border-left: 1px solid $color-grey-2; + padding-left: 1.5em; + + .bulk-action-btn { + max-width: 160px; + overflow-x: hidden; + text-overflow: ellipsis; + } + } + + .num-objects { + text-transform: none; + margin: 0 5px; + } + + .num-objects-in-listing { + color: $color-teal-light; + background-color: transparent; + border: 0; + font-family: $font-sans; + padding: 0; + } + + .button:not(:hover) { + background-color: $color-white; + } + } } diff --git a/client/scss/components/_button-select.scss b/client/scss/components/_button-select.scss index 68819b115d..2a02cbb19f 100644 --- a/client/scss/components/_button-select.scss +++ b/client/scss/components/_button-select.scss @@ -1,21 +1,21 @@ .button-select { - &__option { - display: block; - width: 100%; - margin-bottom: 10px; + &__option { + display: block; + width: 100%; + margin-bottom: 10px; - background-color: #fff; - border-color: $color-teal; - color: #262626; + background-color: #fff; + border-color: $color-teal; + color: #262626; - &--selected { - background-color: $color-teal; - color: #fff; - } + &--selected { + background-color: $color-teal; + color: #fff; } + } } .button-select .button-select__option { - /* override default margin from horizontally-aligned buttons */ - margin-left: 0; + /* override default margin from horizontally-aligned buttons */ + margin-left: 0; } diff --git a/client/scss/components/_button.scss b/client/scss/components/_button.scss index 621d4b45d3..a53bc5002f 100644 --- a/client/scss/components/_button.scss +++ b/client/scss/components/_button.scss @@ -1,4 +1,4 @@ -@use "sass:color"; +@use 'sass:color'; // Core button style // Note that these styles include methods to render buttons the same x-browser, described here: // http: //cbjdigital.com/blog/2010/08/bulletproof_css_input_button_heights @@ -6,18 +6,196 @@ // input[type=reset], // input[type=button], .button { - border-radius: 3px; - font-family: $font-sans; + border-radius: 3px; + font-family: $font-sans; + width: auto; + height: 2.4em; + padding: 0 1em; + font-size: 0.9em; + font-weight: normal; + vertical-align: middle; + display: inline-block; + background-color: $color-button; + border: 1px solid $color-button; + color: $color-white; + text-decoration: none; + text-transform: uppercase; + white-space: nowrap; + position: relative; + overflow: hidden; + box-sizing: border-box; + -webkit-font-smoothing: auto; + // stylelint-disable-next-line property-no-vendor-prefix + -moz-appearance: none; + + transition: background-color 0.1s ease; + + &:hover { + color: $color-teal; + } + + &.yes { + background-color: $color-button-yes; + border: 1px solid $color-button-yes; + + &.button-secondary { + border: 1px solid $color-button-yes; + color: $color-button-yes; + background-color: transparent; + } + + &:hover { + color: $color-white; + border-color: transparent; + background-color: $color-button-yes-hover; + } + + &.button-nobg:hover { + color: $color-button-yes; + background-color: transparent; + } + } + + &.warning { + background-color: $color-button-warning; + border: 1px solid $color-button-warning; + + &.button-secondary { + border: 1px solid $color-button-warning; + color: $color-button-warning; + background-color: transparent; + } + + &:hover { + color: $color-white; + border-color: transparent; + background-color: $color-button-warning-hover; + } + + &.button-nobg:hover { + color: $color-button-warning; + background-color: transparent; + } + } + + &.no, + &.serious { + background-color: $color-button-no; + border: 1px solid $color-button-no; + + &.button-secondary { + border: 1px solid $color-button-no; + color: $color-button-no; + background-color: transparent; + } + + &:hover { + color: $color-white; + border-color: transparent; + background-color: $color-button-no-hover; + } + + &.button-nobg:hover { + color: $color-button-no; + background-color: transparent; + } + } + + &.button-nobg { + border: 0; + background-color: transparent; + } + + &.bicolor { + border: 1px solid transparent; + padding-left: 3.5em; + + &:before { + // iconfont + font-size: 1rem; + position: absolute; + left: 0; + top: 0; + width: 2em; + line-height: 1.85em; + height: 100%; + text-align: center; + background-color: rgba(0, 0, 0, 0.2); + display: block; + border-top-left-radius: inherit; + border-bottom-left-radius: inherit; + } + + .icon-wrapper { + background-color: rgba(0, 0, 0, 0.2); + display: block; + position: absolute; + left: 0; + top: 0; + width: 3em; + line-height: 1.85em; + height: 100%; + text-align: center; + border-top-left-radius: inherit; + border-bottom-left-radius: inherit; + } + + &.button--icon { + &:before { + display: none; // TODO: remove once the icon font styles are gone + } + + .icon { + @include svg-icon(1rem); + padding: 0.75em; + } + } + + &.button--icon-flipped { + .icon { + transform: scaleX(-1); + } + } + + &.button-secondary { + border: 1px solid rgba(0, 0, 0, 0.2); + } + } + + &.button-small.bicolor { + padding-left: 3.5em; + + .icon-wrapper { + width: 2em; + } + + &.button--icon .icon { + @include svg-icon(0.9rem); + padding: 0.25em; + } + } + + // + input[type=submit], + // + input[type=reset], + // + input[type=button], + + .button { + // + button { + margin-left: 1em; + } + + // A completely unstyled button + &.unbutton { + border-radius: 0; width: auto; - height: 2.4em; - padding: 0 1em; - font-size: 0.9em; + height: auto; + padding: 0; + font-size: inherit; font-weight: normal; vertical-align: middle; - display: inline-block; - background-color: $color-button; - border: 1px solid $color-button; - color: $color-white; + display: inline; + background-color: transparent; + border: 0; + color: inherit; text-decoration: none; text-transform: uppercase; white-space: nowrap; @@ -28,620 +206,439 @@ // stylelint-disable-next-line property-no-vendor-prefix -moz-appearance: none; - transition: background-color 0.1s ease; + &:hover, + &:focus, + &:active { + background-color: transparent; + } + } - &:hover { - color: $color-teal; + // stylelint-disable-next-line no-duplicate-selectors + &:hover { + background-color: $color-button-hover; + color: $color-white; + border-color: transparent; + + &.hover-no { + background-color: $color-button-no; + } + } + + &.button-longrunning { + span { + // iconfont + @include transition(all 0.3s ease); + transform: scale(0.9); + display: inline-block; + height: 0.9em; + position: relative; + opacity: 0; + width: 0; + visibility: hidden; + text-align: center; + padding-right: 0; } - - &.yes { - background-color: $color-button-yes; - border: 1px solid $color-button-yes; - - &.button-secondary { - border: 1px solid $color-button-yes; - color: $color-button-yes; - background-color: transparent; - } - - &:hover { - color: $color-white; - border-color: transparent; - background-color: $color-button-yes-hover; - } - - &.button-nobg:hover { - color: $color-button-yes; - background-color: transparent; - } + em { + font-style: normal; } - &.warning { - background-color: $color-button-warning; - border: 1px solid $color-button-warning; - - &.button-secondary { - border: 1px solid $color-button-warning; - color: $color-button-warning; - background-color: transparent; - } - - &:hover { - color: $color-white; - border-color: transparent; - background-color: $color-button-warning-hover; - } - - &.button-nobg:hover { - color: $color-button-warning; - background-color: transparent; - } + &.button-longrunning-active span { + // iconfont + transform: scale(1); + visibility: visible; + width: 1em; + height: 1em; + opacity: 0.8; + padding-right: 0.5em; } - - &.no, - &.serious { - background-color: $color-button-no; - border: 1px solid $color-button-no; - - &.button-secondary { - border: 1px solid $color-button-no; - color: $color-button-no; - background-color: transparent; - } - - &:hover { - color: $color-white; - border-color: transparent; - background-color: $color-button-no-hover; - } - - &.button-nobg:hover { - color: $color-button-no; - background-color: transparent; - } + span.icon-spinner:after { + // iconfont + text-align: center; + position: absolute; + left: 0; + margin: 0; + line-height: 1em; + display: inline-block; + font-size: 1em; } - &.button-nobg { - border: 0; - background-color: transparent; + svg.icon-spinner { + @include transition(all 0.3s ease); + display: none; } - &.bicolor { - border: 1px solid transparent; - padding-left: 3.5em; + &.button-longrunning-active svg.icon-spinner { + @include svg-icon(); - &:before { // iconfont - font-size: 1rem; - position: absolute; - left: 0; - top: 0; - width: 2em; - line-height: 1.85em; - height: 100%; - text-align: center; - background-color: rgba(0, 0, 0, 0.2); - display: block; - border-top-left-radius: inherit; - border-bottom-left-radius: inherit; - } - - .icon-wrapper { - background-color: rgba(0, 0, 0, 0.2); - display: block; - position: absolute; - left: 0; - top: 0; - width: 3em; - line-height: 1.85em; - height: 100%; - text-align: center; - border-top-left-radius: inherit; - border-bottom-left-radius: inherit; - } - - &.button--icon { - &:before { - display: none; // TODO: remove once the icon font styles are gone - } - - .icon { - @include svg-icon(1rem); - padding: 0.75em; - } - } - - &.button--icon-flipped { - .icon { - transform: scaleX(-1); - } - } - - &.button-secondary { - border: 1px solid rgba(0, 0, 0, 0.2); - } + transform: scale(1); + display: inline-block; + opacity: 0.8; + padding: 0; + margin-right: 0.5em; } - &.button-small.bicolor { - padding-left: 3.5em; - - .icon-wrapper { - width: 2em; - } - - &.button--icon .icon { - @include svg-icon(0.9rem); - padding: 0.25em; - } + &.button-longrunning-active .button-longrunning__icon { + display: none; } + } - - // + input[type=submit], - // + input[type=reset], - // + input[type=button], - + .button { - // + button { - margin-left: 1em; - } - - // A completely unstyled button - &.unbutton { - border-radius: 0; - width: auto; - height: auto; - padding: 0; - font-size: inherit; - font-weight: normal; - vertical-align: middle; - display: inline; - background-color: transparent; - border: 0; - color: inherit; - text-decoration: none; - text-transform: uppercase; - white-space: nowrap; - position: relative; - overflow: hidden; - box-sizing: border-box; - -webkit-font-smoothing: auto; - // stylelint-disable-next-line property-no-vendor-prefix - -moz-appearance: none; - - &:hover, - &:focus, - &:active { - background-color: transparent; - } - } - - // stylelint-disable-next-line no-duplicate-selectors - &:hover { - background-color: $color-button-hover; - color: $color-white; - border-color: transparent; - - &.hover-no { - background-color: $color-button-no; - } - } - - &.button-longrunning { - span { // iconfont - @include transition(all 0.3s ease); - transform: scale(0.9); - display: inline-block; - height: 0.9em; - position: relative; - opacity: 0; - width: 0; - visibility: hidden; - text-align: center; - padding-right: 0; - } - - em { - font-style: normal; - } - - &.button-longrunning-active span { // iconfont - transform: scale(1); - visibility: visible; - width: 1em; - height: 1em; - opacity: 0.8; - padding-right: 0.5em; - } - - span.icon-spinner:after { // iconfont - text-align: center; - position: absolute; - left: 0; - margin: 0; - line-height: 1em; - display: inline-block; - font-size: 1em; - } - - svg.icon-spinner { - @include transition(all 0.3s ease); - display: none; - } - - &.button-longrunning-active svg.icon-spinner { - @include svg-icon(); - - transform: scale(1); - display: inline-block; - opacity: 0.8; - padding: 0; - margin-right: 0.5em; - } - - &.button-longrunning-active .button-longrunning__icon { - display: none; - } - } - - &:disabled, - &[disabled], - &.disabled { - background-color: $color-grey-3; - border-color: $color-grey-3; - color: $color-grey-2; - cursor: default; - } - - &.button-secondary:disabled, - &.button-secondary[disabled], - &.button-secondary.disabled { - background-color: $color-white; - border-color: $color-grey-3; - color: $color-grey-3; - } - - &.button-nostroke { - border: 0; - } - - &.button-strokeonhover { - border: 1px solid transparent; - - &:hover { - border-color: $color-grey-2; - } - - &.button-nobg:hover { - background-color: transparent; - } - } - - &.text-notransform { - text-transform: initial; - } - - &.button--icon { - .icon { - @include svg-icon(1.5em); - } - } - - @include media-breakpoint-up(sm) { - font-size: 0.95em; - padding: 0 1.4em; - height: 3em; - - &.bicolor { - padding-left: 3.7em; - - &:before { - width: 2em; - line-height: 2.2em; - font-size: 1.1rem; - } - } - - &.button-small.bicolor { - // line-height: 2.2em; - padding-left: 3em; - - &:before { - width: 1.8em; - line-height: 1.65em; - } - } - } -} - - -.button-small { - padding: 0 0.8em; - height: 2em; - font-size: 0.95em; -} - -.button-secondary { - color: $color-button; - background-color: transparent; -} - -// Buttons which are only an icon -.button.icon.text-replace { // iconfont - font-size: 0; // unavoidable duplication of setting in icons.scss - width: 1.8rem; - height: 1.8rem; - - &:before { - line-height: 1.7em; - } - - @include media-breakpoint-up(sm) { - width: 2.2rem; - height: 2.2rem; - - &:before { - line-height: 2.1em; - } - - - &.button-small { - height: 1.8rem; - width: 1.8rem; - - // stylelint-disable-next-line max-nesting-depth - &:before { - line-height: 1.7em; - } - } - } -} - -.button--icon.text-replace { - font-size: 0; - text-align: center; - - .icon { - font-size: initial; - @include svg-icon(1rem, middle); - padding: 0.5em; - } - - &.button-small { - line-height: 1.7rem; - height: 1.8rem; - width: 1.8rem; - - .icon { - padding: 0.25em; - } - } - - @include media-breakpoint-up(sm) { - width: 2.2rem; - height: 2.2rem; - } -} - -button.button.bicolor .icon-wrapper { - line-height: 1.65em; // work around differences in a and button elements -} - -.button-neutral { + &:disabled, + &[disabled], + &.disabled { + background-color: $color-grey-3; + border-color: $color-grey-3; color: $color-grey-2; + cursor: default; + } + + &.button-secondary:disabled, + &.button-secondary[disabled], + &.button-secondary.disabled { + background-color: $color-white; + border-color: $color-grey-3; + color: $color-grey-3; + } + + &.button-nostroke { + border: 0; + } + + &.button-strokeonhover { + border: 1px solid transparent; &:hover { - color: $color-teal; - } -} - -.yes { - background-color: $color-button-yes; - border: 1px solid $color-button-yes; - - &.button-secondary { - border: 1px solid $color-button-yes; - color: $color-button-yes; - background-color: transparent; - } - - &:hover { - color: $color-white; - border-color: transparent; - background-color: $color-button-yes-hover; + border-color: $color-grey-2; } &.button-nobg:hover { - color: $color-button-yes; - background-color: transparent; + background-color: transparent; } + } + + &.text-notransform { + text-transform: initial; + } + + &.button--icon { + .icon { + @include svg-icon(1.5em); + } + } + + @include media-breakpoint-up(sm) { + font-size: 0.95em; + padding: 0 1.4em; + height: 3em; + + &.bicolor { + padding-left: 3.7em; + + &:before { + width: 2em; + line-height: 2.2em; + font-size: 1.1rem; + } + } + + &.button-small.bicolor { + // line-height: 2.2em; + padding-left: 3em; + + &:before { + width: 1.8em; + line-height: 1.65em; + } + } + } +} + +.button-small { + padding: 0 0.8em; + height: 2em; + font-size: 0.95em; +} + +.button-secondary { + color: $color-button; + background-color: transparent; +} + +// Buttons which are only an icon +.button.icon.text-replace { + // iconfont + font-size: 0; // unavoidable duplication of setting in icons.scss + width: 1.8rem; + height: 1.8rem; + + &:before { + line-height: 1.7em; + } + + @include media-breakpoint-up(sm) { + width: 2.2rem; + height: 2.2rem; + + &:before { + line-height: 2.1em; + } + + &.button-small { + height: 1.8rem; + width: 1.8rem; + + // stylelint-disable-next-line max-nesting-depth + &:before { + line-height: 1.7em; + } + } + } +} + +.button--icon.text-replace { + font-size: 0; + text-align: center; + + .icon { + font-size: initial; + @include svg-icon(1rem, middle); + padding: 0.5em; + } + + &.button-small { + line-height: 1.7rem; + height: 1.8rem; + width: 1.8rem; + + .icon { + padding: 0.25em; + } + } + + @include media-breakpoint-up(sm) { + width: 2.2rem; + height: 2.2rem; + } +} + +button.button.bicolor .icon-wrapper { + line-height: 1.65em; // work around differences in a and button elements +} + +.button-neutral { + color: $color-grey-2; + + &:hover { + color: $color-teal; + } +} + +.yes { + background-color: $color-button-yes; + border: 1px solid $color-button-yes; + + &.button-secondary { + border: 1px solid $color-button-yes; + color: $color-button-yes; + background-color: transparent; + } + + &:hover { + color: $color-white; + border-color: transparent; + background-color: $color-button-yes-hover; + } + + &.button-nobg:hover { + color: $color-button-yes; + background-color: transparent; + } } .no, .serious { - background-color: $color-button-no; + background-color: $color-button-no; + border: 1px solid $color-button-no; + + &.button-secondary { border: 1px solid $color-button-no; + color: $color-button-no; + background-color: transparent; + } - &.button-secondary { - border: 1px solid $color-button-no; - color: $color-button-no; - background-color: transparent; - } + &:hover { + color: $color-white; + border-color: transparent; + background-color: $color-button-no-hover; + } - &:hover { - color: $color-white; - border-color: transparent; - background-color: $color-button-no-hover; - } - - &.button-nobg:hover { - color: $color-button-no; - background-color: transparent; - } + &.button-nobg:hover { + color: $color-button-no; + background-color: transparent; + } } .button-nobg { - border: 0; - background-color: transparent; + border: 0; + background-color: transparent; } .bicolor { - border: 0; - padding-left: 3.5em; + border: 0; + padding-left: 3.5em; - &:before { - font-size: 1rem; - position: absolute; - left: 0; - top: 0; - width: 2em; - line-height: 1.85em; - height: 100%; - text-align: center; - background-color: rgba(0, 0, 0, 0.2); - display: block; - } + &:before { + font-size: 1rem; + position: absolute; + left: 0; + top: 0; + width: 2em; + line-height: 1.85em; + height: 100%; + text-align: center; + background-color: rgba(0, 0, 0, 0.2); + display: block; + } } .button-small.bicolor { - padding-left: 3.5em; + padding-left: 3.5em; - &:before { - width: 2em; - font-size: 0.8rem; - line-height: 1.65em; - } + &:before { + width: 2em; + font-size: 0.8rem; + line-height: 1.65em; + } } - a.button { - line-height: 2.4em; - height: auto; + line-height: 2.4em; + height: auto; - &.button-small { - line-height: 1.85em; - } + &.button-small { + line-height: 1.85em; + } - @include media-breakpoint-up(sm) { - line-height: 2.9em; - } + @include media-breakpoint-up(sm) { + line-height: 2.9em; + } } // Special styles to counteract Firefox's completely unwarranted assumptions about button styles -input[type=submit], -input[type=reset], -input[type=button], +input[type='submit'], +input[type='reset'], +input[type='button'], button { - padding: 0 1em; + padding: 0 1em; - @include media-breakpoint-up(sm) { - &.button-small { - height: 2em; - } + @include media-breakpoint-up(sm) { + &.button-small { + height: 2em; } + } } .button-group { - @include clearfix; + @include clearfix; - input[type=submit], - input[type=reset], - input[type=button], + input[type='submit'], + input[type='reset'], + input[type='button'], + .button, + button { + border-radius: 0; + float: left; + margin-right: 1px; + margin-left: 0; + + &:only-child { + border-radius: 3px; + } + + &:first-child { + border-radius: 3px 0 0 3px; + } + + &:last-child { + border-radius: 0 3px 3px 0; + margin-right: 0; + } + } + + &.button-group-square { + &, + input[type='submit'], + input[type='reset'], + input[type='button'], .button, button { - border-radius: 0; - float: left; - margin-right: 1px; - margin-left: 0; - - &:only-child { - border-radius: 3px; - } - - &:first-child { - border-radius: 3px 0 0 3px; - } - - &:last-child { - border-radius: 0 3px 3px 0; - margin-right: 0; - } - } - - &.button-group-square { - &, - input[type=submit], - input[type=reset], - input[type=button], - .button, - button { - border-radius: 0; - } + border-radius: 0; } + } } - .multiple { - padding: 0; - max-width: 1024px - 50px; + padding: 0; + max-width: 1024px - 50px; + overflow: hidden; + + > li { + @include row(); + border-radius: 2px; + position: relative; overflow: hidden; + background-color: $color-white; + padding: 1em 10em 1em 1.5em; // 10em padding leaves room for controls + margin-bottom: 1em; + border: 1px solid color.adjust($color-grey-4, $lightness: 3%); // really trying to avoid creating more greys, but this one is better than grey 4 or 5 + } - > li { - @include row(); - border-radius: 2px; - position: relative; - overflow: hidden; - background-color: $color-white; - padding: 1em 10em 1em 1.5em; // 10em padding leaves room for controls - margin-bottom: 1em; - border: 1px solid color.adjust($color-grey-4, $lightness: 3%); // really trying to avoid creating more greys, but this one is better than grey 4 or 5 + &.moving { + position: relative; + } + + li.moving { + position: absolute; + width: 100%; + } + + fieldset { + padding-top: 0; + padding-bottom: 0; + } + + // Object controls + .controls { + position: absolute; + z-index: 1; + right: 1em; + top: 1em; + color: $color-white; + + li { + float: left; + margin-right: 1px; + + &:last-child { + margin-right: 0; + } } - &.moving { - position: relative; + .disabled { + display: none; + visibility: hidden; } - - li.moving { - position: absolute; - width: 100%; - } - - fieldset { - padding-top: 0; - padding-bottom: 0; - } - - // Object controls - .controls { - position: absolute; - z-index: 1; - right: 1em; - top: 1em; - color: $color-white; - - li { - float: left; - margin-right: 1px; - - &:last-child { - margin-right: 0; - } - } - - .disabled { - display: none; - visibility: hidden; - } - } - + } } // wrapper around add button for multiple objects .add { - font-weight: 700; - cursor: pointer; - margin-top: 0; - margin-bottom: 0; - padding-top: 1em; - padding-bottom: 2em; - clear: both; + font-weight: 700; + cursor: pointer; + margin-top: 0; + margin-bottom: 0; + padding-top: 1em; + padding-bottom: 2em; + clear: both; } diff --git a/client/scss/components/_chooser.scss b/client/scss/components/_chooser.scss index 6059144d80..0a1ed15698 100644 --- a/client/scss/components/_chooser.scss +++ b/client/scss/components/_chooser.scss @@ -9,84 +9,88 @@ overridden here? hmm. */ .chooser { - // We show the 'chosen' state... - @include clearfix(); + // We show the 'chosen' state... + @include clearfix(); - input[type=text] { - float: left; - width: 50%; - margin-right: 1em; + input[type='text'] { + float: left; + width: 50%; + margin-right: 1em; + } + + .chosen { + display: block; + } + + .unchosen, + .chosen { + position: relative; + + .icon { + color: $color-grey-3; + @include svg-icon(2.5em); + vertical-align: middle; + margin-right: 0.625rem; } - .chosen { - display: block; + // TODO: [icon-font] remove when the Wagtail icon font is removed + &:before { + vertical-align: middle; + font-family: $font-wagtail-icons; + content: ''; + // position: relative + display: inline-block; + // float: left; + color: $color-grey-3; + line-height: 1em; + font-size: 2.5em; + margin-right: 0.3em; } + } - .unchosen, + .unchosen { + display: none; + } + + .actions { + @include clearfix; + overflow: hidden; + + li { + float: left; + margin: 0.3em; + } + } + + // ...unless the .page-chooser has the 'blank' class set + &.blank { .chosen { - position: relative; - - .icon { - color: $color-grey-3; - @include svg-icon(2.5em); - vertical-align: middle; - margin-right: 0.625rem; - } - - // TODO: [icon-font] remove when the Wagtail icon font is removed - &:before { - vertical-align: middle; - font-family: $font-wagtail-icons; - content: ''; - // position: relative - display: inline-block; - // float: left; - color: $color-grey-3; - line-height: 1em; - font-size: 2.5em; - margin-right: 0.3em; - } + display: none; } .unchosen { - display: none; - } - - .actions { - @include clearfix; - overflow: hidden; - - li { - float: left; - margin: 0.3em; - } - } - - // ...unless the .page-chooser has the 'blank' class set - &.blank { - .chosen { display: none; } - - .unchosen { display: block; } + display: block; } + } } // standard way of doing a chooser where the chosen object's title is overlaid .page-chooser, .snippet-chooser, .document-chooser { - .chosen { - .title { - color: $color-grey-1; - // display: block; - padding-left: 1em; - display: inline-block; - } - - .actions { - clear: both; - padding-top: 0.6em; - } + .chosen { + .title { + color: $color-grey-1; + // display: block; + padding-left: 1em; + display: inline-block; } + + .actions { + clear: both; + padding-top: 0.6em; + } + } } // TODO: [icon-font] remove when the Wagtail icon font is removed @@ -94,37 +98,37 @@ overridden here? hmm. .snippet-chooser, .document-chooser, .image-chooser { - .unchosen, - .chosen { - &:before { - display: none; - } + .unchosen, + .chosen { + &:before { + display: none; } + } } .image-chooser { - .chosen { - padding-left: $thumbnail-width; + .chosen { + padding-left: $thumbnail-width; - &:before { - display: inline-block; - } - - .preview-image { - float: left; - margin-left: -($thumbnail-width); - margin-right: 1em; - max-width: $thumbnail-width; - - // Resize standard Wagtail thumbnail size (165x165) to 130 for space-saving purposes. - // We could request a 130x130 rendition, but that's just unnecessary and burdens installations - // where images are store off-site with higher rendering times. - img { - max-width: $thumbnail-width; - max-height: $thumbnail-width; - height: auto; - width: auto; - } - } + &:before { + display: inline-block; } + + .preview-image { + float: left; + margin-left: -($thumbnail-width); + margin-right: 1em; + max-width: $thumbnail-width; + + // Resize standard Wagtail thumbnail size (165x165) to 130 for space-saving purposes. + // We could request a 130x130 rendition, but that's just unnecessary and burdens installations + // where images are store off-site with higher rendering times. + img { + max-width: $thumbnail-width; + max-height: $thumbnail-width; + height: auto; + width: auto; + } + } + } } diff --git a/client/scss/components/_comments-controls.scss b/client/scss/components/_comments-controls.scss index 02ba6263dc..ca1b5981c2 100644 --- a/client/scss/components/_comments-controls.scss +++ b/client/scss/components/_comments-controls.scss @@ -1,113 +1,113 @@ .comments-controls { - position: relative; - display: flex; - justify-content: flex-end; - padding-right: 2px; - height: 42px; - box-sizing: border-box; + position: relative; + display: flex; + justify-content: flex-end; + padding-right: 2px; + height: 42px; + box-sizing: border-box; - @include media-breakpoint-up(sm) { - padding-right: 30px; - height: 43px; - } + @include media-breakpoint-up(sm) { + padding-right: 30px; + height: 43px; + } } .comments-toggle { - $root: &; - float: none; + $root: &; + float: none; + position: relative; + cursor: pointer; + display: flex; + width: auto; + align-items: center; + + // Wagtail adds some top padding to labels on mobile + padding: 0; + + &--active, + &:hover { + #{$root}__label { + opacity: 1; + } + + #{$root}__icon { + color: $color-white; + } + } + + &__icon { + position: absolute; + left: -12px; + bottom: 3px; + width: 52px; + height: 52px; + color: $color-teal-dark; + transition: color 100ms cubic-bezier(0.4, 0, 0.2, 1); + } + + &__count { + position: absolute; + top: -1px; + right: -8px; + width: 19px; + height: 19px; + box-sizing: border-box; + border-radius: 50%; + background-color: $color-salmon; + border: 1px solid $color-teal; + color: $color-white; + font-size: 9px; + font-weight: 700; + text-align: center; + line-height: 17px; + + &:empty { + display: none; + } + } + + &__icon-wrapper { + width: 28px; + height: 52px; position: relative; - cursor: pointer; - display: flex; - width: auto; - align-items: center; + } - // Wagtail adds some top padding to labels on mobile - padding: 0; + &__label { + font-size: 12px; + text-transform: uppercase; + color: $color-white; + font-weight: 400; + margin-right: 10px; + opacity: 0; + pointer-events: none; + transition: opacity 100ms cubic-bezier(0.4, 0, 0.2, 1); + } - &--active, - &:hover { - #{$root}__label { - opacity: 1; - } + [type='checkbox'] { + position: absolute; + opacity: 0; + pointer-events: none; + top: -20px; + } - #{$root}__icon { - color: $color-white; - } - } - - &__icon { - position: absolute; - left: -12px; - bottom: 3px; - width: 52px; - height: 52px; - color: $color-teal-dark; - transition: color 100ms cubic-bezier(0.4, 0, 0.2, 1); - } - - &__count { - position: absolute; - top: -1px; - right: -8px; - width: 19px; - height: 19px; - box-sizing: border-box; - border-radius: 50%; - background-color: $color-salmon; - border: 1px solid $color-teal; - color: $color-white; - font-size: 9px; - font-weight: 700; - text-align: center; - line-height: 17px; - - &:empty { - display: none; - } - } - - &__icon-wrapper { - width: 28px; - height: 52px; - position: relative; - } - - &__label { - font-size: 12px; - text-transform: uppercase; - color: $color-white; - font-weight: 400; - margin-right: 10px; - opacity: 0; - pointer-events: none; - transition: opacity 100ms cubic-bezier(0.4, 0, 0.2, 1); - } - - [type=checkbox] { - position: absolute; - opacity: 0; - pointer-events: none; - top: -20px; - } - - [type=checkbox]:checked + &__icon { - opacity: 1; - } + [type='checkbox']:checked + &__icon { + opacity: 1; + } } .comment-notifications-toggle { - label { - padding: 0; - margin: 0; - padding-top: 5px; - font-weight: normal; - font-size: 13px; - color: $color-white; - display: flex; - justify-content: space-between; - } + label { + padding: 0; + margin: 0; + padding-top: 5px; + font-weight: normal; + font-size: 13px; + color: $color-white; + display: flex; + justify-content: space-between; + } - .switch__toggle { - margin-left: 15px; - } + .switch__toggle { + margin-left: 15px; + } } diff --git a/client/scss/components/_comments-notification-dropdown.scss b/client/scss/components/_comments-notification-dropdown.scss index 2a69f70bf7..c4b8b34dff 100644 --- a/client/scss/components/_comments-notification-dropdown.scss +++ b/client/scss/components/_comments-notification-dropdown.scss @@ -1,66 +1,66 @@ .comment-notifications-toggle-button { - $root: &; - padding: 0 17px; - margin: 0; - display: flex; - align-items: center; - border: 0; - background-color: transparent; + $root: &; + padding: 0 17px; + margin: 0; + display: flex; + align-items: center; + border: 0; + background-color: transparent; - &--active, - &:hover { - #{$root}__icon { - color: $color-white; - } + &--active, + &:hover { + #{$root}__icon { + color: $color-white; } + } - &--icon-toggle { - #{$root}__icon { - transform: rotate(180deg) translate3d(3px, 10px, 0); - } + &--icon-toggle { + #{$root}__icon { + transform: rotate(180deg) translate3d(3px, 10px, 0); } + } - &__icon { - width: 15px; - height: 18px; - color: $color-teal-dark; - transition: color 100ms cubic-bezier(0.4, 0, 0.2, 1); - } + &__icon { + width: 15px; + height: 18px; + color: $color-teal-dark; + transition: color 100ms cubic-bezier(0.4, 0, 0.2, 1); + } } .comment-notifications-dropdown { + position: absolute; + display: none; + bottom: -92px; + z-index: 51; + background-color: $color-text-base; + padding: 20px; + border-radius: 6px; + min-width: 260px; + box-sizing: border-box; + border: 1px solid $color-text-base; + + &__title { + font-size: 12px; + text-transform: uppercase; + font-weight: 700; + color: $color-white; + } + + &--active { + display: block; + } + + &::before { + content: ''; position: absolute; - display: none; - bottom: -92px; - z-index: 51; - background-color: $color-text-base; - padding: 20px; - border-radius: 6px; - min-width: 260px; - box-sizing: border-box; - border: 1px solid $color-text-base; - - &__title { - font-size: 12px; - text-transform: uppercase; - font-weight: 700; - color: $color-white; - } - - &--active { - display: block; - } - - &::before { - content: ''; - position: absolute; - top: -8px; - width: 0; - height: 0; - z-index: 2; - right: 18px; - border-style: solid; - border-width: 0 8px 8px 8px; - border-color: transparent transparent $color-text-base transparent; - } + top: -8px; + width: 0; + height: 0; + z-index: 2; + right: 18px; + border-style: solid; + border-width: 0 8px 8px 8px; + border-color: transparent transparent $color-text-base transparent; + } } diff --git a/client/scss/components/_dropdown.legacy.scss b/client/scss/components/_dropdown.legacy.scss index 59c0cb0deb..6fd8eda1d9 100644 --- a/client/scss/components/_dropdown.legacy.scss +++ b/client/scss/components/_dropdown.legacy.scss @@ -1,342 +1,343 @@ .dropdown { - @include clearfix(); - position: relative; + @include clearfix(); + position: relative; - input[type=submit], - input[type=reset], - input[type=button], - button, - .button { - padding: 0 5em 0 1em; - display: block; - width: 100%; - height: 3em; - line-height: 3em; - text-align: left; - float: left; + input[type='submit'], + input[type='reset'], + input[type='button'], + button, + .button { + padding: 0 5em 0 1em; + display: block; + width: 100%; + height: 3em; + line-height: 3em; + text-align: left; + float: left; + } + + .action-secondary { + opacity: 0.8; + } + + input[type='submit'], + input[type='reset'], + input[type='button'], + button { + line-height: inherit; + } + + ul { + @include unlist(); + background-color: $color-teal; + position: absolute; + overflow: hidden; + top: 100%; + left: -2000px; + z-index: 500; + opacity: 0; + + li { + float: none; + border-color: rgba(255, 255, 255, 0.2); + border-style: solid; + border-width: 1px 0 0; + overflow: hidden; + + a:focus, + button:focus { + border: 3px solid $color-focus-outline; + } } - .action-secondary { - opacity: 0.8; + // Media for Windows High Contrast + @media (forced-colors: $media-forced-colours) { + li { + border-width: 1px; + } + + li:hover { + border-color: Highlight; + } + + li a, + li button { + forced-color-adjust: none; + background-color: $color-black; + border-color: $color-white; + color: $color-white; + } + + li a:focus, + li button:focus { + background-color: $color-black; + forced-color-adjust: none; + border: 4px solid #0ff; + color: $color-white; + } } - input[type=submit], - input[type=reset], - input[type=button], + a { + box-sizing: border-box; + white-space: nowrap; + position: relative; + text-decoration: none; + text-transform: uppercase; + display: block; + color: $color-white; + padding: 1em; + font-weight: normal; + + &:hover { + background-color: $color-teal-darker; + } + + &.icon { + padding-right: 5em; + + // stylelint-disable-next-line max-nesting-depth + &:before, + &:after { + right: 1em; + } + } + + &.shortcut { + padding-right: 7em; + } + } + + a, + input[type='submit'], + input[type='reset'], + input[type='button'], + .button, button { - line-height: inherit; + border-radius: 0; + font-size: 0.95em; + -webkit-font-smoothing: auto; } - ul { - @include unlist(); - background-color: $color-teal; - position: absolute; - overflow: hidden; - top: 100%; - left: -2000px; - z-index: 500; - opacity: 0; - - li { - float: none; - border-color: rgba(255, 255, 255, 0.2); - border-style: solid; - border-width: 1px 0 0; - overflow: hidden; - - a:focus, - button:focus { - border: 3px solid $color-focus-outline; - } - } - - // Media for Windows High Contrast - @media (forced-colors: $media-forced-colours) { - li { - border-width: 1px; - } - - li:hover { - border-color: Highlight; - } - - li a, - li button { - forced-color-adjust: none; - background-color: $color-black; - border-color: $color-white; - color: $color-white; - } - - li a:focus, - li button:focus { - background-color: $color-black; - forced-color-adjust: none; - border: 4px solid #0ff; - color: $color-white; - } - } - - a { - box-sizing: border-box; - white-space: nowrap; - position: relative; - text-decoration: none; - text-transform: uppercase; - display: block; - color: $color-white; - padding: 1em; - font-weight: normal; - - &:hover { - background-color: $color-teal-darker; - } - - &.icon { - padding-right: 5em; - - // stylelint-disable-next-line max-nesting-depth - &:before, - &:after { - right: 1em; - } - } - - &.shortcut { - padding-right: 7em; - } - } - - a, - input[type=submit], - input[type=reset], - input[type=button], - .button, - button { - border-radius: 0; - font-size: 0.95em; - -webkit-font-smoothing: auto; - } - - label { - padding: 1.3em; - } - - .kbd { - position: absolute; - right: 1em; - font-weight: 600; - font-size: 0.8em; - color: rgba(0, 0, 0, 0.3); - } - + label { + padding: 1.3em; } - &.open ul { - box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.2); - opacity: 1; - left: 0; - display: block; + .kbd { + position: absolute; + right: 1em; + font-weight: 600; + font-size: 0.8em; + color: rgba(0, 0, 0, 0.3); + } + } + + &.open ul { + box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.2); + opacity: 1; + left: 0; + display: block; + } + + &.match-width ul { + width: 100%; + min-width: 110px; + + li { + white-space: nowrap; + } + } + + &.dropup ul { + box-shadow: 0 -3px 3px 0 rgba(0, 0, 0, 0.2); + top: auto; + bottom: 100%; + + li { + border-width: 0 0 1px; + } + } + + .dropdown-toggle { + color: $color-white; + text-transform: uppercase; + background-color: $color-teal; + line-height: 2.8em; + cursor: pointer; + height: 100%; + border-left: 1px solid rgba(255, 255, 255, 0.2); + position: absolute; + right: 0; + padding: 0 0.5em; + text-align: center; + + &:before, + &:after { + margin: 0; } - &.match-width ul { - width: 100%; - min-width: 110px; - - li { - white-space: nowrap; - } + &:before { + width: 1em; + font-size: 1.2rem; } - &.dropup ul { - box-shadow: 0 -3px 3px 0 rgba(0, 0, 0, 0.2); - top: auto; - bottom: 100%; + &:hover { + background-color: $color-teal-darker; + } - li { - border-width: 0 0 1px; - } + svg.icon { + // TODO: remove svg qualifier once the icon font styles are gone + @include svg-icon(1.3em); + } + } + + .bicolor + .dropdown-toggle { + background-color: $color-teal-darker; + + &:hover { + background-color: $color-teal-dark; + } + } + + &.open .dropdown-toggle { + background-color: $color-teal-darker; + } + + .bicolor:hover { + background-color: $color-teal-dark; + } + + // Styles for dropdowns which are also buttons e.g page editor + &.dropdown-button { + // Media for Windows High Contrast + @media (forced-colors: $media-forced-colours) { + button { + border-color: ActiveText; + } + + button:hover { + border-color: Highlight; + } + + a.button.bicolor.button:hover { + border-color: Highlight; + } } .dropdown-toggle { - color: $color-white; - text-transform: uppercase; - background-color: $color-teal; - line-height: 2.8em; - cursor: pointer; - height: 100%; - border-left: 1px solid rgba(255, 255, 255, 0.2); - position: absolute; - right: 0; - padding: 0 0.5em; - text-align: center; - - &:before, - &:after { - margin: 0; - } - - &:before { - width: 1em; - font-size: 1.2rem; - } - - &:hover { - background-color: $color-teal-darker; - } - - svg.icon { // TODO: remove svg qualifier once the icon font styles are gone - @include svg-icon(1.3em); - } + border-radius: 0 3px 3px 0; + // Media for Windows High Contrast + @media (forced-colors: $media-forced-colours) { + background: transparent; + box-sizing: border-box; + border: 1px solid ActiveText; + } } - .bicolor + .dropdown-toggle { - background-color: $color-teal-darker; - - &:hover { - background-color: $color-teal-dark; - } + .dropdown-toggle:hover { + // Media for Windows High Contrast + @media (forced-colors: $media-forced-colours) { + background-color: transparent; + border: 1px solid Highlight; + } } - &.open .dropdown-toggle { - background-color: $color-teal-darker; + &.open { + > input[type='button'], + > input[type='submit'], + > button, + > .button { + border-radius: 3px 3px 0 0; + } + + .dropdown-toggle { + border-radius: 0 3px 0 0; + } + } + } + + &.dropdown-button--white { + ul { + background-color: $color-grey-3; } - .bicolor:hover { - background-color: $color-teal-dark; + li a, + li .button { + background-color: $color-white; + color: $color-button; + border: 0; + + &:hover { + background-color: $color-grey-4; + } + + &.no { + color: $color-button-no; + } + + &.warning { + color: $color-button-warning; + } } + } - // Styles for dropdowns which are also buttons e.g page editor - &.dropdown-button { - // Media for Windows High Contrast - @media (forced-colors: $media-forced-colours) { - button { - border-color: ActiveText; - } + &.dropup.dropdown-button { + &.open { + > input[type='button'], + > input[type='submit'], + > button, + > .button { + border-radius: 0 0 3px 3px; + } - button:hover { - border-color: Highlight; - } - - a.button.bicolor.button:hover { - border-color: Highlight; - } - } - - .dropdown-toggle { - border-radius: 0 3px 3px 0; - // Media for Windows High Contrast - @media (forced-colors: $media-forced-colours) { - background: transparent; - box-sizing: border-box; - border: 1px solid ActiveText; - } - } - - .dropdown-toggle:hover { - // Media for Windows High Contrast - @media (forced-colors: $media-forced-colours) { - background-color: transparent; - border: 1px solid Highlight; - } - } - - &.open { - > input[type=button], - > input[type=submit], - > button, - > .button { - border-radius: 3px 3px 0 0; - } - - .dropdown-toggle { - border-radius: 0 3px 0 0; - } - } - } - - &.dropdown-button--white { - ul { - background-color: $color-grey-3; - } - - li a, - li .button { - background-color: $color-white; - color: $color-button; - border: 0; - - &:hover { - background-color: $color-grey-4; - } - - &.no { - color: $color-button-no; - } - - &.warning { - color: $color-button-warning; - } - } - } - - &.dropup.dropdown-button { - &.open { - > input[type=button], - > input[type=submit], - > button, - > .button { - border-radius: 0 0 3px 3px; - } - - .dropdown-toggle { - border-radius: 0 0 3px; - } - } + .dropdown-toggle { + border-radius: 0 0 3px; + } } + } } .dropdown.white { - ul { - background-color: $color-white; + ul { + background-color: $color-white; - li { - border-top: 1px solid rgba(0, 0, 0, 0.1); - } - - a { - color: $color-grey-2; - - &:hover { - background-color: $color-grey-3; - } - } + li { + border-top: 1px solid rgba(0, 0, 0, 0.1); } + + a { + color: $color-grey-2; + + &:hover { + background-color: $color-grey-3; + } + } + } } .dropdown.warning { - ul { - background-color: $color-button-warning; - } + ul { + background-color: $color-button-warning; + } - .dropdown-toggle { - background-color: $color-button-warning; + .dropdown-toggle { + background-color: $color-button-warning; - &:hover { - background-color: $color-button-warning-hover; - } + &:hover { + background-color: $color-button-warning-hover; } + } } // Transitions // stylelint-disable-next-line no-duplicate-selectors .dropdown ul { - @include transition(opacity 0.2s linear); + @include transition(opacity 0.2s linear); } .dropdown-button { - .button svg.icon { // TODO: leave only class when iconfont styles are removed - @include svg-icon(); - margin-right: 0.5em; - } + .button svg.icon { + // TODO: leave only class when iconfont styles are removed + @include svg-icon(); + margin-right: 0.5em; + } } diff --git a/client/scss/components/_dropdown.scss b/client/scss/components/_dropdown.scss index 615c681bb3..2742787b1c 100644 --- a/client/scss/components/_dropdown.scss +++ b/client/scss/components/_dropdown.scss @@ -5,105 +5,105 @@ // .c-dropdown { // } .c-dropdown__button { - display: inline-block; - box-sizing: border-box; - padding-left: 0.5rem; - padding-right: 0.25rem; - // Make this the same as the other buttons - line-height: 1.85; - border: solid 1px transparent; - border-radius: 2px; - font-size: 0.95em; - cursor: pointer; - -webkit-font-smoothing: subpixel-antialiased; - user-select: none; + display: inline-block; + box-sizing: border-box; + padding-left: 0.5rem; + padding-right: 0.25rem; + // Make this the same as the other buttons + line-height: 1.85; + border: solid 1px transparent; + border-radius: 2px; + font-size: 0.95em; + cursor: pointer; + -webkit-font-smoothing: subpixel-antialiased; + user-select: none; } .c-dropdown--large .c-dropdown__button { - line-height: 2.9em; - padding-left: 0.5rem; - padding-right: 0.5rem; + line-height: 2.9em; + padding-left: 0.5rem; + padding-right: 0.5rem; - .icon-site { - padding-right: 0.2rem; - } + .icon-site { + padding-right: 0.2rem; + } } .c-dropdown__icon { - padding-left: 0.4rem; - padding-right: 0.4rem; + padding-left: 0.4rem; + padding-right: 0.4rem; } .c-dropdown__toggle { - display: inline-block; + display: inline-block; } .c-dropdown__togle--icon { - &:before { - display: none; // TODO: remove when iconfont styles are removed - } + &:before { + display: none; // TODO: remove when iconfont styles are removed + } - .icon { - @include svg-icon(1em, middle); - } + .icon { + @include svg-icon(1em, middle); + } - .icon-arrow-up { - display: none; - } + .icon-arrow-up { + display: none; + } } .is-open .c-dropdown__togle--icon { - .icon-arrow-up { - display: inline-block; - } + .icon-arrow-up { + display: inline-block; + } - .icon-arrow-down { - display: none; - } + .icon-arrow-down { + display: none; + } } .c-dropdown__menu.c-dropdown__menu { - margin-top: 0.75rem; - padding: 0.75rem 1rem; - min-width: 8rem; - text-transform: none; - position: absolute; - z-index: 1000; - animation: dropdownIn 0.1s ease-out backwards; - list-style: none; - // Override any right alignment that might've been set by a parent element - // (such as the snippets header) - text-align: left; + margin-top: 0.75rem; + padding: 0.75rem 1rem; + min-width: 8rem; + text-transform: none; + position: absolute; + z-index: 1000; + animation: dropdownIn 0.1s ease-out backwards; + list-style: none; + // Override any right alignment that might've been set by a parent element + // (such as the snippets header) + text-align: left; } .c-dropdown__item { - margin-bottom: 0.375rem; - font-size: 0.8rem; + margin-bottom: 0.375rem; + font-size: 0.8rem; - &:hover { - .c-dropdown__indicator { - opacity: 0.6; - } + &:hover { + .c-dropdown__indicator { + opacity: 0.6; } + } } .c-dropdown__item:last-child { - margin-bottom: 0; + margin-bottom: 0; } .c-dropdown__divider { - border-color: #555; - border-style: dotted; - margin-top: 12px; - margin-bottom: 12px; + border-color: #555; + border-style: dotted; + margin-top: 12px; + margin-bottom: 12px; } @keyframes dropdownIn { - 0% { - opacity: 0; - } + 0% { + opacity: 0; + } - 100% { - opacity: 1; - } + 100% { + opacity: 1; + } } diff --git a/client/scss/components/_footer.scss b/client/scss/components/_footer.scss index d1ad6a91f1..9783c09b00 100644 --- a/client/scss/components/_footer.scss +++ b/client/scss/components/_footer.scss @@ -1,167 +1,167 @@ -@use "sass:math"; +@use 'sass:math'; .footer { - $border-curvature: 3px; - @include transition(bottom 0.5s ease 1s); - @include row(); + $border-curvature: 3px; + @include transition(bottom 0.5s ease 1s); + @include row(); - ul { - @include unlist(); + ul { + @include unlist(); + } + + li { + float: left; + + .dropdown li, // dropdown li + &:last-child { + margin-right: 0; + } + } + + &__container { + border-radius: $border-curvature $border-curvature 0 0; + background: $color-grey-1; + color: $color-white; + margin-top: 0; + margin-right: 0; + transition: transform 1s; + + &:first-child { + margin-top: 0; + box-shadow: 0 0 2px rgba(255, 255, 255, 0.5); + } + + &.footer__container--hidden { + transform: translateY(100%); } li { - float: left; + margin-right: 1em; + } + } - .dropdown li, // dropdown li - &:last-child { - margin-right: 0; - } + &__save-warning { + font-size: 0.95em; + display: flex; + align-items: center; + + .icon { + font-size: 1.2em; + margin-right: 0.5em; + } + + p { + margin: -0.2em 0 0 0; + } + } + + &__emphasise-span-tags span { + color: $color-orange; + } + + .actions { + width: 250px; + + &--primary { + width: 350px; + } + + .dropdown { + input[type='submit'], + input[type='reset'], + input[type='button'], + button, + .button { + padding-right: 2.6em; + } + } + } + + .preview .dropdown { + width: 250px; + } + + .meta { + float: right; + text-align: right; + padding: 7px math.div($grid-gutter-width, 2); + font-size: 0.85em; + + p { + margin: 0; + margin-right: $grid-gutter-width; + white-space: nowrap; + } + + a { + color: inherit; + + &:hover { + color: $color-link; + } + } + } + + @include media-breakpoint-down(xs) { + .actions, + .preview, + &__container, + .preview .dropdown { + width: 100%; + } + + margin-top: $mobile-nice-padding; + + .meta { + p { + white-space: normal; + width: 100%; + } + + .avatar { + left: auto; + } } &__container { - border-radius: $border-curvature $border-curvature 0 0; - background: $color-grey-1; - color: $color-white; - margin-top: 0; - margin-right: 0; - transition: transform 1s; + &:not(:first-child) { + border-radius: 0; + } - &:first-child { - margin-top: 0; - box-shadow: 0 0 2px rgba(255, 255, 255, 0.5); - } - - &.footer__container--hidden { - transform: translateY(100%); - } - - li { - margin-right: 1em; - } + &--hidden { + display: none; + } } &__save-warning { - font-size: 0.95em; - display: flex; - align-items: center; + display: flex; + flex-direction: row; + justify-content: center; + } + } - .icon { - font-size: 1.2em; - margin-right: 0.5em; - } + @include media-breakpoint-up(sm) { + margin-left: calc(#{$desktop-nice-padding} - 0.75em); + margin-right: $desktop-nice-padding; + width: auto; + position: fixed; + bottom: 0; - p { - margin: -0.2em 0 0 0; - } + > ul { + display: flex; } - &__emphasise-span-tags span { - color: $color-orange; + &__container { + padding: 0.75em; + margin-right: 0; + + &:not(:first-child) { + margin-left: -$border-curvature; + } } - .actions { - width: 250px; - - &--primary { - width: 350px; - } - - .dropdown { - input[type=submit], - input[type=reset], - input[type=button], - button, - .button { - padding-right: 2.6em; - } - } - } - - .preview .dropdown { - width: 250px; - } - - .meta { - float: right; - text-align: right; - padding: 7px math.div($grid-gutter-width, 2); - font-size: 0.85em; - - p { - margin: 0; - margin-right: $grid-gutter-width; - white-space: nowrap; - } - - a { - color: inherit; - - &:hover { - color: $color-link; - } - } - } - - @include media-breakpoint-down(xs) { - .actions, - .preview, - &__container, - .preview .dropdown { - width: 100%; - } - - margin-top: $mobile-nice-padding; - - .meta { - p { - white-space: normal; - width: 100%; - } - - .avatar { - left: auto; - } - } - - &__container { - &:not(:first-child) { - border-radius: 0; - } - - &--hidden { - display: none; - } - } - - &__save-warning { - display: flex; - flex-direction: row; - justify-content: center; - } - } - - @include media-breakpoint-up(sm) { - margin-left: calc(#{$desktop-nice-padding} - 0.75em); - margin-right: $desktop-nice-padding; - width: auto; - position: fixed; - bottom: 0; - - > ul { - display: flex; - } - - &__container { - padding: 0.75em; - margin-right: 0; - - &:not(:first-child) { - margin-left: -$border-curvature; - } - } - - &__save-warning { - margin-right: 50px; - } + &__save-warning { + margin-right: 50px; } + } } diff --git a/client/scss/components/_forms.scss b/client/scss/components/_forms.scss index a73592ab7d..7c918c5cd9 100644 --- a/client/scss/components/_forms.scss +++ b/client/scss/components/_forms.scss @@ -1,5 +1,5 @@ -@use "sass:map"; -@use "sass:math"; +@use 'sass:map'; +@use 'sass:math'; // stylelint-disable scss/comment-no-empty // These are the generic stylings for forms of any type. // If you're styling something specific to the page editing interface, @@ -26,12 +26,12 @@ // } // } .plain-checkbox-label { - // cancel heavy / floated label styles, for labels that should appear inline against checkboxes + // cancel heavy / floated label styles, for labels that should appear inline against checkboxes - float: none; - color: inherit; - font-weight: inherit; - font-size: inherit; + float: none; + color: inherit; + font-weight: inherit; + font-size: inherit; } // TODO: mixin, @@ -76,7 +76,7 @@ // Reset the arrow on ``s in IE10+. select::-ms-expand { - display: none; + display: none; } .file_field { - .input { - label { - float: none; - display: inline; - padding: 0; - } - - input[type=checkbox] { - margin-top: 5px; - } - - a { - &:after { - content: ' '; - display: block; - } - } + .input { + label { + float: none; + display: inline; + padding: 0; } -} + input[type='checkbox'] { + margin-top: 5px; + } + + a { + &:after { + content: ' '; + display: block; + } + } + } +} // radio and check boxes -input[type=radio], -input[type=checkbox] { - border-radius: 0; - cursor: pointer; - border: 0; - padding: 0; +input[type='radio'], +input[type='checkbox'] { + border-radius: 0; + cursor: pointer; + border: 0; + padding: 0; } -input[type=radio] { - height: 12px; - width: auto; - position: relative; - margin-right: 27px; +input[type='radio'] { + height: 12px; + width: auto; + position: relative; + margin-right: 27px; } -input[type=radio]:before { - border-radius: 100%; - font-family: $font-wagtail-icons; - font-style: normal; - text-align: center; - position: absolute; - top: -5px; - left: -2px; - cursor: pointer; - display: block; - content: map.get($icons, 'radio-full'); - width: 1em; - height: 1em; - line-height: 1.1em; - padding: 4px; - background-color: $color-white; - color: $color-grey-4; - border: 1px solid $color-grey-4; +input[type='radio']:before { + border-radius: 100%; + font-family: $font-wagtail-icons; + font-style: normal; + text-align: center; + position: absolute; + top: -5px; + left: -2px; + cursor: pointer; + display: block; + content: map.get($icons, 'radio-full'); + width: 1em; + height: 1em; + line-height: 1.1em; + padding: 4px; + background-color: $color-white; + color: $color-grey-4; + border: 1px solid $color-grey-4; } -input[type=radio]:checked:before { - content: map.get($icons, 'radio-full'); - color: $color-teal; +input[type='radio']:checked:before { + content: map.get($icons, 'radio-full'); + color: $color-teal; } -input[type=checkbox] { - height: 12px; - width: 22px; - position: relative; - margin-right: 5px; +input[type='checkbox'] { + height: 12px; + width: 22px; + position: relative; + margin-right: 5px; } -input[type=checkbox]:before { - font-family: $font-wagtail-icons; - font-style: normal; - text-align: center; - position: absolute; - top: -5px; - cursor: pointer; - display: block; - content: ''; - line-height: 20px; - width: 20px; - height: 20px; - background-color: $color-white; - border: 1px solid $color-grey-4; - color: $color-teal; +input[type='checkbox']:before { + font-family: $font-wagtail-icons; + font-style: normal; + text-align: center; + position: absolute; + top: -5px; + cursor: pointer; + display: block; + content: ''; + line-height: 20px; + width: 20px; + height: 20px; + background-color: $color-white; + border: 1px solid $color-grey-4; + color: $color-teal; } -input[type=checkbox]:checked:before { - content: map.get($icons, 'tick'); +input[type='checkbox']:checked:before { + content: map.get($icons, 'tick'); } -input[type=checkbox][disabled]:before { - cursor: not-allowed; +input[type='checkbox'][disabled]:before { + cursor: not-allowed; } - // Special styles to counteract Firefox's completely unwarranted assumptions about button styles -input[type=submit], -input[type=reset], -input[type=button], +input[type='submit'], +input[type='reset'], +input[type='button'], button { - padding: 0 1em; + padding: 0 1em; - @include media-breakpoint-up(sm) { - &.button-small { - height: 2em; - } + @include media-breakpoint-up(sm) { + &.button-small { + height: 2em; } + } } // Transitions @@ -244,5 +241,5 @@ fieldset, input, textarea, select { - @include transition(background-color 0.2s ease); + @include transition(background-color 0.2s ease); } diff --git a/client/scss/elements/_root.scss b/client/scss/elements/_root.scss index 485f40a4f4..a6fd336583 100644 --- a/client/scss/elements/_root.scss +++ b/client/scss/elements/_root.scss @@ -1,10 +1,34 @@ :root { - @include define-color('color-primary', #007d7e); - @include define-color('color-primary-darker', css-darken(css-adjust-hue(get-color('color-primary'), 1), 4%)); - @include define-color('color-primary-dark', css-darken(css-adjust-hue(get-color('color-primary'), 1), 7%)); - @include define-color('color-primary-lighter', css-lighten(css-desaturate(css-adjust-hue(get-color('color-primary'), 1), 46%), 48%)); - @include define-color('color-primary-light', css-lighten(css-desaturate(css-adjust-hue(get-color('color-primary'), 1), 44%), 58%)); + @include define-color('color-primary', #007d7e); + @include define-color( + 'color-primary-darker', + css-darken(css-adjust-hue(get-color('color-primary'), 1), 4%) + ); + @include define-color( + 'color-primary-dark', + css-darken(css-adjust-hue(get-color('color-primary'), 1), 7%) + ); + @include define-color( + 'color-primary-lighter', + css-lighten( + css-desaturate(css-adjust-hue(get-color('color-primary'), 1), 46%), + 48% + ) + ); + @include define-color( + 'color-primary-light', + css-lighten( + css-desaturate(css-adjust-hue(get-color('color-primary'), 1), 44%), + 58% + ) + ); - @include define-color('color-input-focus', css-lighten(css-desaturate(get-color('color-primary'), 40%), 72%)); - @include define-color('color-input-focus-border', css-lighten(css-saturate(get-color('color-primary'), 12%), 10%)); + @include define-color( + 'color-input-focus', + css-lighten(css-desaturate(get-color('color-primary'), 40%), 72%) + ); + @include define-color( + 'color-input-focus-border', + css-lighten(css-saturate(get-color('color-primary'), 12%), 10%) + ); } diff --git a/client/scss/elements/_typography.scss b/client/scss/elements/_typography.scss index ae93f03e22..3c642da7de 100644 --- a/client/scss/elements/_typography.scss +++ b/client/scss/elements/_typography.scss @@ -1,9 +1,9 @@ body { - -webkit-font-smoothing: antialiased; // Do not remove! - font-family: $font-sans; - font-size: 85%; - line-height: 1.5em; - color: $color-text-base; + -webkit-font-smoothing: antialiased; // Do not remove! + font-family: $font-sans; + font-size: 85%; + line-height: 1.5em; + color: $color-text-base; } h1, @@ -12,75 +12,75 @@ h3, h4, h5, h6 { - font-weight: normal; + font-weight: normal; } h1 { - line-height: 1.3em; - font-size: 1.5em; - text-transform: uppercase; - color: $color-grey-1; - font-weight: 700; + line-height: 1.3em; + font-size: 1.5em; + text-transform: uppercase; + color: $color-grey-1; + font-weight: 700; - span { - text-transform: none; - font-weight: 300; - } + span { + text-transform: none; + font-weight: 300; + } } h2 { - text-transform: uppercase; - font-size: 1.3em; - font-family: $font-sans; - font-weight: 600; - color: $color-grey-2; + text-transform: uppercase; + font-size: 1.3em; + font-family: $font-sans; + font-weight: 600; + color: $color-grey-2; } p { - margin-top: 0; + margin-top: 0; } a { - // @include transition(color 0.2s ease, background-color 0.2s ease); - color: $color-link; - text-decoration: none; + // @include transition(color 0.2s ease, background-color 0.2s ease); + color: $color-link; + text-decoration: none; - &:hover { - color: $color-link-hover; - } + &:hover { + color: $color-link-hover; + } } code { - box-shadow: inset 0 0 4px 0 rgba(0, 0, 0, 0.2); - background-color: $color-fieldset-hover; - padding: 2px 5px; + box-shadow: inset 0 0 4px 0 rgba(0, 0, 0, 0.2); + background-color: $color-fieldset-hover; + padding: 2px 5px; } kbd { - border-radius: 3px; - font-family: $font-sans; - border: 1px solid $color-grey-2; - border-color: rgba(0, 0, 0, 0.2); - padding: 0.3em 0.5em; + border-radius: 3px; + font-family: $font-sans; + border: 1px solid $color-grey-2; + border-color: rgba(0, 0, 0, 0.2); + padding: 0.3em 0.5em; } dl, dt, dd { - padding: 0; - margin: 0; + padding: 0; + margin: 0; } dl { - margin-top: 1em; + margin-top: 1em; } dt { - color: $color-grey-2; - text-transform: uppercase; - font-size: 0.9em; + color: $color-grey-2; + text-transform: uppercase; + font-size: 0.9em; } dd { - margin-bottom: 1em; + margin-bottom: 1em; } diff --git a/client/scss/objects/_avatar.scss b/client/scss/objects/_avatar.scss index 5099885244..703b18b36c 100644 --- a/client/scss/objects/_avatar.scss +++ b/client/scss/objects/_avatar.scss @@ -1,40 +1,40 @@ // user avatars .avatar { - border-radius: 100%; - position: relative; - display: inline-block; + border-radius: 100%; + position: relative; + display: inline-block; + vertical-align: middle; + text-align: center; + overflow: hidden; + width: 50px; + height: 50px; + + img { + position: absolute; + z-index: 2; + top: 0; + left: 0; + right: 0; + border: 0; + } + + &.small { vertical-align: middle; - text-align: center; - overflow: hidden; - width: 50px; - height: 50px; + margin: 0 0.5em; + width: 25px; + height: 25px; + } - img { - position: absolute; - z-index: 2; - top: 0; - left: 0; - right: 0; - border: 0; - } - - &.small { - vertical-align: middle; - margin: 0 0.5em; - width: 25px; - height: 25px; - } - - &.large { - width: 100px; - height: 100px; - } - - &.square { - border-radius: 0; - - &:before { - border-radius: 0; - } + &.large { + width: 100px; + height: 100px; + } + + &.square { + border-radius: 0; + + &:before { + border-radius: 0; } + } } diff --git a/client/scss/objects/_objects.scss b/client/scss/objects/_objects.scss index b1ff5f7e58..9f54ce5cd5 100644 --- a/client/scss/objects/_objects.scss +++ b/client/scss/objects/_objects.scss @@ -1,16 +1,15 @@ .o-pill { - display: inline-block; - padding: 0.2em 0.5em; - border-radius: 0.25em; - vertical-align: middle; - line-height: 1.5; + display: inline-block; + padding: 0.2em 0.5em; + border-radius: 0.25em; + vertical-align: middle; + line-height: 1.5; } - // For dropdowns .o-icon { - display: inline-block; - vertical-align: middle; - line-height: 1; - margin-top: -0.25rem; + display: inline-block; + vertical-align: middle; + line-height: 1; + margin-top: -0.25rem; } diff --git a/client/scss/overrides/_pages.homepage.scss b/client/scss/overrides/_pages.homepage.scss index f903223a8f..aa40eb87f2 100644 --- a/client/scss/overrides/_pages.homepage.scss +++ b/client/scss/overrides/_pages.homepage.scss @@ -1,3 +1,3 @@ .homepage h1 { - text-transform: none; + text-transform: none; } diff --git a/client/scss/overrides/_pages.page-explorer.scss b/client/scss/overrides/_pages.page-explorer.scss index 6579e27f4a..e1aba9d9d9 100644 --- a/client/scss/overrides/_pages.page-explorer.scss +++ b/client/scss/overrides/_pages.page-explorer.scss @@ -1,3 +1,3 @@ .page-explorer h2 { - text-transform: none; + text-transform: none; } diff --git a/client/scss/overrides/_utilities.dropdowns.scss b/client/scss/overrides/_utilities.dropdowns.scss index 0643637139..65cdf42d51 100644 --- a/client/scss/overrides/_utilities.dropdowns.scss +++ b/client/scss/overrides/_utilities.dropdowns.scss @@ -2,20 +2,20 @@ // Arrows // ============================================================================= .u-arrow:before { - content: ''; - border: solid 0.35rem transparent; - display: block; - position: absolute; + content: ''; + border: solid 0.35rem transparent; + display: block; + position: absolute; } .u-arrow--tl:before { - bottom: 100%; - left: 1rem; + bottom: 100%; + left: 1rem; } .dropup .u-arrow--tl:before { - top: 100%; - transform: rotateZ(180deg); + top: 100%; + transform: rotateZ(180deg); } // ============================================================================= @@ -26,85 +26,84 @@ // } .t-default .u-btn-current { - border-color: rgba(0, 0, 0, 0.15); - color: $color-teal; + border-color: rgba(0, 0, 0, 0.15); + color: $color-teal; } .t-default .u-btn-current:hover { - background: $color-teal; - color: #fff; - border-color: $color-teal; + background: $color-teal; + color: #fff; + border-color: $color-teal; } .t-default .u-btn-current:active { - background: #333; - color: #fff; - border-color: #333; + background: #333; + color: #fff; + border-color: #333; } .t-inverted .u-btn-current { - border-color: rgba(0, 0, 0, 0.35); - color: #fff; + border-color: rgba(0, 0, 0, 0.35); + color: #fff; } .t-inverted .u-btn-current:hover { - background-color: $color-teal-darker; - border-color: rgba(0, 0, 0, 0.35); + background-color: $color-teal-darker; + border-color: rgba(0, 0, 0, 0.35); } .t-inverted .u-btn-current:active { - border-color: rgba(0, 0, 0, 0.35); - background: #333; - color: #fff; + border-color: rgba(0, 0, 0, 0.35); + background: #333; + color: #fff; } - // ============================================================================= // Dark theme // ============================================================================= .t-dark .u-link { - color: #fff; + color: #fff; } .t-dark .u-link:hover { - color: #aaa; + color: #aaa; } .t-dark .u-background { - background: #333; + background: #333; } .t-dark .u-arrow:before { - border-bottom-color: #333; + border-bottom-color: #333; } // ============================================================================= // Light theme // ============================================================================= .t-light .u-link { - color: #333; + color: #333; } .t-light .u-link:hover { - color: #aaa; + color: #aaa; } .t-light .u-background { - background: #fff; - border-color: #ccc; + background: #fff; + border-color: #ccc; } .t-light .u-arrow:before { - border-bottom-color: #fff; + border-bottom-color: #fff; } // ============================================================================= // States // ============================================================================= .u-toggle { - display: none; + display: none; } .is-open .u-toggle { - display: block; + display: block; } diff --git a/client/scss/overrides/_utilities.focus.scss b/client/scss/overrides/_utilities.focus.scss index e53f1aaf69..1b3c28f927 100644 --- a/client/scss/overrides/_utilities.focus.scss +++ b/client/scss/overrides/_utilities.focus.scss @@ -3,9 +3,9 @@ // without individual components having to explicitly define focus styles. // Using !important because we want to enforce only one style is used across the UI. .focus-outline-on *:focus { - outline: $focus-outline-width solid $color-focus-outline !important; + outline: $focus-outline-width solid $color-focus-outline !important; } .focus-outline-off *:focus { - outline: none !important; + outline: none !important; } diff --git a/client/scss/overrides/_utilities.hidden.scss b/client/scss/overrides/_utilities.hidden.scss index b2b697b0e3..dd14dd6ecf 100644 --- a/client/scss/overrides/_utilities.hidden.scss +++ b/client/scss/overrides/_utilities.hidden.scss @@ -1,40 +1,40 @@ // stylelint-disable declaration-no-important .u-hidden { - display: none !important; + display: none !important; } .u-hidden\@sm { - @include media-breakpoint-up(sm) { - display: none !important; - } + @include media-breakpoint-up(sm) { + display: none !important; + } } .u-hidden\@xs { - @include media-breakpoint-down(xs) { - display: none !important; - } + @include media-breakpoint-down(xs) { + display: none !important; + } } .u-inline\@sm { - @include media-breakpoint-up(sm) { - display: inline !important; - } + @include media-breakpoint-up(sm) { + display: inline !important; + } } .u-inline\@xs { - @include media-breakpoint-down(xs) { - display: inline !important; - } + @include media-breakpoint-down(xs) { + display: inline !important; + } } .u-block\@sm { - @include media-breakpoint-up(sm) { - display: block !important; - } + @include media-breakpoint-up(sm) { + display: block !important; + } } .u-block\@xs { - @include media-breakpoint-down(xs) { - display: block !important; - } + @include media-breakpoint-down(xs) { + display: block !important; + } } diff --git a/client/scss/overrides/_utilities.legacy.scss b/client/scss/overrides/_utilities.legacy.scss index 9719d97cf0..a7ce504b84 100644 --- a/client/scss/overrides/_utilities.legacy.scss +++ b/client/scss/overrides/_utilities.legacy.scss @@ -1,55 +1,54 @@ .clearfix { - @include clearfix(); + @include clearfix(); } .nice-padding { - padding-left: $mobile-nice-padding; - padding-right: $mobile-nice-padding; + padding-left: $mobile-nice-padding; + padding-right: $mobile-nice-padding; - @include media-breakpoint-up(sm) { - padding-left: $desktop-nice-padding; - padding-right: $desktop-nice-padding; - } + @include media-breakpoint-up(sm) { + padding-left: $desktop-nice-padding; + padding-right: $desktop-nice-padding; + } } @include media-breakpoint-up(sm) { - .divider-before { - border-left: 1px solid $color-grey-4; - } - - .divider-after { - border-right: 1px solid $color-grey-4; - } + .divider-before { + border-left: 1px solid $color-grey-4; + } + .divider-after { + border-right: 1px solid $color-grey-4; + } } body.reordering { - overflow: visible; + overflow: visible; } // Show a transparency grid in background .show-transparency { - background: url('#{$images-root}transparency.svg'); + background: url('#{$images-root}transparency.svg'); } // make a block-level element inline .inline { - display: inline; + display: inline; } .inline-block { - display: inline-block; + display: inline-block; } .block { - display: block; + display: block; } .unlist { - @include unlist(); + @include unlist(); } // utility class to allow things to be scrollable if their contents can't wrap more nicely .overflow { - overflow: auto; + overflow: auto; } diff --git a/client/scss/overrides/_utilities.text.legacy.scss b/client/scss/overrides/_utilities.text.legacy.scss index 84e7d3602c..f03d0e6a12 100644 --- a/client/scss/overrides/_utilities.text.legacy.scss +++ b/client/scss/overrides/_utilities.text.legacy.scss @@ -1,3 +1,3 @@ .unbold { - font-weight: normal; + font-weight: normal; } diff --git a/client/scss/overrides/_utilities.text.scss b/client/scss/overrides/_utilities.text.scss index 9f97d0099a..52d2014a36 100644 --- a/client/scss/overrides/_utilities.text.scss +++ b/client/scss/overrides/_utilities.text.scss @@ -1,11 +1,11 @@ .u-text-transform-uppercase { - text-transform: uppercase; + text-transform: uppercase; } .u-text-weight-normal { - font-weight: normal; + font-weight: normal; } .u-para { - margin-bottom: 1rem; + margin-bottom: 1rem; } diff --git a/client/scss/overrides/_utilities.visuallyhidden.scss b/client/scss/overrides/_utilities.visuallyhidden.scss index 41166b92a5..adcc6f19e9 100644 --- a/client/scss/overrides/_utilities.visuallyhidden.scss +++ b/client/scss/overrides/_utilities.visuallyhidden.scss @@ -1,7 +1,7 @@ .visuallyvisible { - @include visuallyvisible; + @include visuallyvisible; } .visuallyhidden { - @include visuallyhidden; + @include visuallyhidden; } diff --git a/client/scss/overrides/_vendor.datetimepicker.scss b/client/scss/overrides/_vendor.datetimepicker.scss index 939f570ced..0ea314fc99 100644 --- a/client/scss/overrides/_vendor.datetimepicker.scss +++ b/client/scss/overrides/_vendor.datetimepicker.scss @@ -1,328 +1,335 @@ -@use "sass:map"; +@use 'sass:map'; .xdsoft_datetimepicker { - box-shadow: 0 5px 10px -5px rgba(0, 0, 0, 0.4); - background: $color-white; - border: 1px solid $color-input-focus-border; - padding: 8px; - padding-left: 0; - padding-top: 2px; - position: absolute; - z-index: 5; + box-shadow: 0 5px 10px -5px rgba(0, 0, 0, 0.4); + background: $color-white; + border: 1px solid $color-input-focus-border; + padding: 8px; + padding-left: 0; + padding-top: 2px; + position: absolute; + z-index: 5; + box-sizing: border-box; + display: none; + + * { box-sizing: border-box; + padding: 0; + margin: 0; + } + + iframe { + position: absolute; + left: 0; + top: 0; + width: 75px; + height: 210px; + background: transparent; + border: 0; + } + + .xdsoft_datepicker, + .xdsoft_timepicker { display: none; - * { - box-sizing: border-box; - padding: 0; - margin: 0; + &.active { + display: block; + } + } + + .xdsoft_datepicker { + float: left; + margin-left: 8px; + } + + .xdsoft_datepicker.active + .xdsoft_timepicker { + margin-top: 8px; + margin-bottom: 3px; + } + + .xdsoft_mounthpicker { + position: relative; + text-align: center; + } + + .xdsoft_next, + .xdsoft_prev, + .xdsoft_today_button { + background-color: transparent; + cursor: pointer; + display: block; + border: 0; + overflow: hidden; + padding: 5px 0; + position: relative; + white-space: nowrap; + width: 2em; + color: $color-teal; + text-transform: none; + text-align: center; + + &:before { + font-size: 1.5em; + font-family: $font-wagtail-icons; + width: 1em; + line-height: 1.3em; + text-align: center; + margin: 0; } - iframe { - position: absolute; - left: 0; - top: 0; - width: 75px; - height: 210px; - background: transparent; - border: 0; + &:hover { + color: $color-teal-darker; } + } - .xdsoft_datepicker, - .xdsoft_timepicker { - display: none; + .xdsoft_prev { + float: left; - &.active { - display: block; - } + &:before { + content: map.get($icons, 'arrow-left'); } + } - .xdsoft_datepicker { - float: left; - margin-left: 8px; + .xdsoft_today_button { + float: left; + margin-left: 5px; + + &:before { + content: map.get($icons, 'home'); } + } - .xdsoft_datepicker.active + .xdsoft_timepicker { - margin-top: 8px; - margin-bottom: 3px; + .xdsoft_next { + float: right; + + &:before { + content: map.get($icons, 'arrow-right'); } + } - .xdsoft_mounthpicker { - position: relative; - text-align: center; - } + .xdsoft_timepicker { + min-width: 70px; + float: left; + text-align: center; + margin-left: 8px; + margin-top: 0; - .xdsoft_next, .xdsoft_prev, - .xdsoft_today_button { - background-color: transparent; - cursor: pointer; - display: block; - border: 0; - overflow: hidden; - padding: 5px 0; - position: relative; - white-space: nowrap; - width: 2em; - color: $color-teal; - text-transform: none; - text-align: center; - - &:before { - font-size: 1.5em; - font-family: $font-wagtail-icons; - width: 1em; - line-height: 1.3em; - text-align: center; - margin: 0; - } - - &:hover { - color: $color-teal-darker; - } - } - - .xdsoft_prev { - float: left; - - &:before { - content: map.get($icons, 'arrow-left'); - } - } - - .xdsoft_today_button { - float: left; - margin-left: 5px; - - &:before { - content: map.get($icons, 'home'); - } - } - .xdsoft_next { - float: right; + float: none; + height: 1.5em; + display: block; + text-align: center; + width: 100%; + padding: 0; - &:before { - content: map.get($icons, 'arrow-right'); - } + &:before { + width: 100%; + } } - .xdsoft_timepicker { - min-width: 70px; - float: left; - text-align: center; - margin-left: 8px; - margin-top: 0; - - .xdsoft_prev, - .xdsoft_next { - float: none; - height: 1.5em; - display: block; - text-align: center; - width: 100%; - padding: 0; - - &:before { - width: 100%; - } - } - - .xdsoft_prev:before { - content: map.get($icons, 'arrow-up'); - } - - .xdsoft_next:before { - content: map.get($icons, 'arrow-down'); - } - - .xdsoft_time_box { - position: relative; - border: 1px solid #ccc; - height: 170px; - overflow: hidden; - border-bottom: 1px solid #ddd; - - > div > div { - background: #f5f5f5; - border-top: 1px solid #ddd; - color: #666; - font-size: 1em; - text-align: center; - border-collapse: collapse; - cursor: pointer; - border-bottom-width: 0; - height: 2.3em; - line-height: 2.3em; - padding-left: 0.6em; - padding-right: 0.6em; - - // stylelint-disable-next-line max-nesting-depth - &:first-child { - border-top-width: 0; - } - } - } + .xdsoft_prev:before { + content: map.get($icons, 'arrow-up'); } - .xdsoft_label { - display: inline; - position: relative; - z-index: 9999; - margin: 0; - padding: 5px 3px; - font-size: 14px; - line-height: 20px; - font-weight: bold; - background-color: $color-white; - float: left; - width: 182px; + .xdsoft_next:before { + content: map.get($icons, 'arrow-down'); + } + + .xdsoft_time_box { + position: relative; + border: 1px solid #ccc; + height: 170px; + overflow: hidden; + border-bottom: 1px solid #ddd; + + > div > div { + background: #f5f5f5; + border-top: 1px solid #ddd; + color: #666; + font-size: 1em; text-align: center; + border-collapse: collapse; cursor: pointer; + border-bottom-width: 0; + height: 2.3em; + line-height: 2.3em; + padding-left: 0.6em; + padding-right: 0.6em; - &:hover { - text-decoration: underline; + // stylelint-disable-next-line max-nesting-depth + &:first-child { + border-top-width: 0; } + } + } + } - > .xdsoft_select { - border: 1px solid #ccc; - position: absolute; - right: 0; - top: 30px; - z-index: 101; - display: none; - background: $color-white; - max-height: 160px; - overflow-y: hidden; - - &.xdsoft_monthselect {right: -7px;} - - &.xdsoft_yearselect {right: 2px;} - - > div > .xdsoft_option:hover { - color: $color-white; - background: #ff8000; - } - - > div > .xdsoft_option { - padding: 2px 15px 2px 5px; - } - - > div > .xdsoft_option.xdsoft_current { - background: #3af; - color: $color-white; - font-weight: 700; - } - } + .xdsoft_label { + display: inline; + position: relative; + z-index: 9999; + margin: 0; + padding: 5px 3px; + font-size: 14px; + line-height: 20px; + font-weight: bold; + background-color: $color-white; + float: left; + width: 182px; + text-align: center; + cursor: pointer; + &:hover { + text-decoration: underline; } - .xdsoft_month { - width: 90px; - text-align: right; - } + > .xdsoft_select { + border: 1px solid #ccc; + position: absolute; + right: 0; + top: 30px; + z-index: 101; + display: none; + background: $color-white; + max-height: 160px; + overflow-y: hidden; - .xdsoft_year { - width: 56px; - } + &.xdsoft_monthselect { + right: -7px; + } - .xdsoft_calendar { - clear: both; + &.xdsoft_yearselect { + right: 2px; + } - table { - border-collapse: collapse; - } + > div > .xdsoft_option:hover { + color: $color-white; + background: #ff8000; + } - td > div { - padding-right: 5px; - } + > div > .xdsoft_option { + padding: 2px 15px 2px 5px; + } - td, - th { - width: 14.285%; - border: 1px solid #ddd; - color: #666; - font-size: 12px; - text-align: right; - padding: 5px 7px; - border-collapse: collapse; - cursor: pointer; - height: 25px; - } - - td { - background-color: $color-white; - } - - th { - background: #f1f1f1; - font-weight: 700; - font-size: 0.85em; - text-align: center; - cursor: default; - } - } - - .xdsoft_calendar td.xdsoft_default, - .xdsoft_calendar td.xdsoft_current, - .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current { - background: $color-salmon; + > div > .xdsoft_option.xdsoft_current { + background: #3af; color: $color-white; font-weight: 700; + } + } + } + + .xdsoft_month { + width: 90px; + text-align: right; + } + + .xdsoft_year { + width: 56px; + } + + .xdsoft_calendar { + clear: both; + + table { + border-collapse: collapse; } - .xdsoft_calendar td.xdsoft_other_month, - .xdsoft_calendar td.xdsoft_disabled, - .xdsoft_time_box > div > div.xdsoft_disabled { - opacity: 0.5; - background: $color-grey-3; + td > div { + padding-right: 5px; } - .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled { - opacity: 0.2; + td, + th { + width: 14.285%; + border: 1px solid #ddd; + color: #666; + font-size: 12px; + text-align: right; + padding: 5px 7px; + border-collapse: collapse; + cursor: pointer; + height: 25px; } - .xdsoft_calendar td:hover, - .xdsoft_timepicker .xdsoft_time_box > div > div:hover { - color: $color-white; - background: $color-teal; + td { + background-color: $color-white; } - .xdsoft_calendar td.xdsoft_today { - font-weight: 700; + th { + background: #f1f1f1; + font-weight: 700; + font-size: 0.85em; + text-align: center; + cursor: default; } + } + + .xdsoft_calendar td.xdsoft_default, + .xdsoft_calendar td.xdsoft_current, + .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current { + background: $color-salmon; + color: $color-white; + font-weight: 700; + } + + .xdsoft_calendar td.xdsoft_other_month, + .xdsoft_calendar td.xdsoft_disabled, + .xdsoft_time_box > div > div.xdsoft_disabled { + opacity: 0.5; + background: $color-grey-3; + } + + .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled { + opacity: 0.2; + } + + .xdsoft_calendar td:hover, + .xdsoft_timepicker .xdsoft_time_box > div > div:hover { + color: $color-white; + background: $color-teal; + } + + .xdsoft_calendar td.xdsoft_today { + font-weight: 700; + } } .xdsoft_noselect { - user-select: none; + user-select: none; } -.xdsoft_noselect::selection { background: transparent; } +.xdsoft_noselect::selection { + background: transparent; +} -.xdsoft_noselect::-moz-selection { background: transparent; } +.xdsoft_noselect::-moz-selection { + background: transparent; +} .xdsoft_datetimepicker.xdsoft_inline { - display: inline-block; - position: static; - box-shadow: none; + display: inline-block; + position: static; + box-shadow: none; } .xdsoft_scroller_box { - position: relative; + position: relative; } .xdsoft_scrollbar { - position: absolute; - width: 7px; - right: 0; - top: 0; - bottom: 0; - cursor: pointer; + position: absolute; + width: 7px; + right: 0; + top: 0; + bottom: 0; + cursor: pointer; - > .xdsoft_scroller { - // stylelint-disable-next-line declaration-no-important - background: #ccc !important; - height: 20px; - border-radius: 3px; - } + > .xdsoft_scroller { + // stylelint-disable-next-line declaration-no-important + background: #ccc !important; + height: 20px; + border-radius: 3px; + } } diff --git a/client/scss/overrides/_vendor.tagit.scss b/client/scss/overrides/_vendor.tagit.scss index a991a83a4c..1bcc755d35 100644 --- a/client/scss/overrides/_vendor.tagit.scss +++ b/client/scss/overrides/_vendor.tagit.scss @@ -1,44 +1,45 @@ -@use "sass:map"; +@use 'sass:map'; // taggit tagging .tagit { - padding: 0.6em 1.2em; + padding: 0.6em 1.2em; - .tagit-choice { - border: 0; - } + .tagit-choice { + border: 0; + } } // Additional specificity (.admin_tag_widget ) required to override tagit stylesheets, // which get added after the core CSS, and otherwise trump our styles. .admin_tag_widget ul.tagit input[type='text'] { - padding: 0.2em 0.5em; + padding: 0.2em 0.5em; } // Additional specificity (.admin_tag_widget ) required to override tagit stylesheets, // which get added after the core CSS, and otherwise trump our styles. .admin_tag_widget ul.tagit li.tagit-choice-editable { - padding: 0 23px 0 0; + padding: 0 23px 0 0; } -.ui-front { // provided by jqueryui but not high enough an index - z-index: 1000; +.ui-front { + // provided by jqueryui but not high enough an index + z-index: 1000; } .tagit-close { - .ui-icon-close { - margin-left: 1em; - text-indent: 0; - background: none; - } + .ui-icon-close { + margin-left: 1em; + text-indent: 0; + background: none; + } - .ui-icon-close:before { - font-family: $font-wagtail-icons; - display: block; - color: $color-grey-3; - content: map.get($icons, 'cross'); - } + .ui-icon-close:before { + font-family: $font-wagtail-icons; + display: block; + color: $color-grey-3; + content: map.get($icons, 'cross'); + } - .ui-icon-close:hover:before { - color: $color-red; - } + .ui-icon-close:hover:before { + color: $color-red; + } } diff --git a/client/scss/settings/_variables.icons.scss b/client/scss/settings/_variables.icons.scss index cd2a8697cb..82852fb148 100644 --- a/client/scss/settings/_variables.icons.scss +++ b/client/scss/settings/_variables.icons.scss @@ -1,91 +1,91 @@ -@use "sass:map"; +@use 'sass:map'; $icons: ( - 'arrow-down-big': '\e030', - 'arrow-down': '\e01a', - 'arrow-left': '\e022', - 'arrow-right': '\e017', - 'arrow-up-big': '\e02f', - 'arrow-up': '\e010', - 'arrows-up-down': '\e016', - 'bin': '\e038', - 'bold': '\e026', - 'chain-broken': '\e047', - 'code': '\e001', - 'cog': '\e020', - 'cogs': '\e00c', - 'collapse-down': '\e03f', - 'collapse-up': '\e03e', - 'cross': '\e012', - 'date': '\e045', - 'doc-empty-inverse': '\e00d', - 'doc-empty': '\e00e', - 'doc-full-inverse': '\e01b', - 'doc-full': '\e018', - 'download': '\e044', - 'duplicate': '\e902', - 'edit': '\e00f', - 'folder-inverse': '\e014', - 'folder-open-1': '\e013', - 'folder-open-inverse': '\e01f', - 'folder': '\e01c', - 'form': '\e00b', - 'grip': '\e03b', - 'group': '\e031', - 'help': '\e041', - // help-inverse directly renders the corresponding character. - 'help-inverse': '?', - 'home': '\e035', - // horizontalrule is not rendered as an icon font – it uses a unicode dash character rendered with a fallback font. - 'horizontalrule': '\2014', - 'image': '\e019', - 'italic': '\e027', - 'link': '\e02c', - 'list-ol': '\e029', - 'list-ul': '\e028', - 'locked': '\e009', - 'logout': '\e049', - 'mail': '\e015', - 'media': '\e032', - 'no-view': '\e006', - 'openquote': '\e000', - 'order-down': '\e036', - 'order-up': '\e037', - 'order': '\e034', - 'password': '\e033', - 'pick': '\e03d', - 'pilcrow': '\e002', - 'placeholder': '\e003', - 'plus-inverse': '\e024', - 'plus': '\e01d', - 'radio-empty': '\e02e', - 'radio-full': '\e02d', - 'redirect': '\e03c', - 'repeat': '\e02b', - 'search': '\e011', - 'site': '\e007', - 'snippet': '\e025', - 'spinner': '\e03a', - 'strikethrough': '\e04a', - 'subscript': '\e04c', - 'success': '\e043', - 'superscript': '\e04b', - 'table': '\e048', - 'tag': '\e01e', - 'tick-inverse': '\e023', - 'tick': '\e021', - 'time': '\e008', - 'title': '\e046', - 'undo': '\e02a', - 'unlocked': '\e00a', - 'user': '\e004', - 'view': '\e005', - 'wagtail-inverse': '\e040', - 'wagtail': '\e039', - 'warning': '\e042', + 'arrow-down-big': '\e030', + 'arrow-down': '\e01a', + 'arrow-left': '\e022', + 'arrow-right': '\e017', + 'arrow-up-big': '\e02f', + 'arrow-up': '\e010', + 'arrows-up-down': '\e016', + 'bin': '\e038', + 'bold': '\e026', + 'chain-broken': '\e047', + 'code': '\e001', + 'cog': '\e020', + 'cogs': '\e00c', + 'collapse-down': '\e03f', + 'collapse-up': '\e03e', + 'cross': '\e012', + 'date': '\e045', + 'doc-empty-inverse': '\e00d', + 'doc-empty': '\e00e', + 'doc-full-inverse': '\e01b', + 'doc-full': '\e018', + 'download': '\e044', + 'duplicate': '\e902', + 'edit': '\e00f', + 'folder-inverse': '\e014', + 'folder-open-1': '\e013', + 'folder-open-inverse': '\e01f', + 'folder': '\e01c', + 'form': '\e00b', + 'grip': '\e03b', + 'group': '\e031', + 'help': '\e041', + // help-inverse directly renders the corresponding character. + 'help-inverse': '?', + 'home': '\e035', + // horizontalrule is not rendered as an icon font – it uses a unicode dash character rendered with a fallback font. + 'horizontalrule': '\2014', + 'image': '\e019', + 'italic': '\e027', + 'link': '\e02c', + 'list-ol': '\e029', + 'list-ul': '\e028', + 'locked': '\e009', + 'logout': '\e049', + 'mail': '\e015', + 'media': '\e032', + 'no-view': '\e006', + 'openquote': '\e000', + 'order-down': '\e036', + 'order-up': '\e037', + 'order': '\e034', + 'password': '\e033', + 'pick': '\e03d', + 'pilcrow': '\e002', + 'placeholder': '\e003', + 'plus-inverse': '\e024', + 'plus': '\e01d', + 'radio-empty': '\e02e', + 'radio-full': '\e02d', + 'redirect': '\e03c', + 'repeat': '\e02b', + 'search': '\e011', + 'site': '\e007', + 'snippet': '\e025', + 'spinner': '\e03a', + 'strikethrough': '\e04a', + 'subscript': '\e04c', + 'success': '\e043', + 'superscript': '\e04b', + 'table': '\e048', + 'tag': '\e01e', + 'tick-inverse': '\e023', + 'tick': '\e021', + 'time': '\e008', + 'title': '\e046', + 'undo': '\e02a', + 'unlocked': '\e00a', + 'user': '\e004', + 'view': '\e005', + 'wagtail-inverse': '\e040', + 'wagtail': '\e039', + 'warning': '\e042', ); $icons-after: ( - 'arrow-down-after': map.get($icons, 'arrow-down'), - 'arrow-right-after': map.get($icons, 'arrow-right'), - 'arrow-up-after': map.get($icons, 'arrow-up'), + 'arrow-down-after': map.get($icons, 'arrow-down'), + 'arrow-right-after': map.get($icons, 'arrow-right'), + 'arrow-up-after': map.get($icons, 'arrow-up'), ); diff --git a/client/scss/settings/_variables.scss b/client/scss/settings/_variables.scss index ced9760292..93aeaa2f4a 100644 --- a/client/scss/settings/_variables.scss +++ b/client/scss/settings/_variables.scss @@ -1,4 +1,4 @@ -@use "sass:color"; +@use 'sass:color'; // paths // We can't use absolute paths here, because those are dependent on Django's @@ -19,11 +19,15 @@ $desktop-nice-padding: 50px; // screen breakpoints $breakpoints: ( - xs: 0, - sm: 50em, // 800px - md: 56.25em, // 900px - lg: 75em, // 1200px - xl: 100em, // 1440px + xs: 0, + sm: 50em, + // 800px + md: 56.25em, + // 900px + lg: 75em, + // 1200px + xl: 100em, + // 1440px ); // colours @@ -62,7 +66,10 @@ $color-fieldset-hover: $color-grey-5; $color-input-border: $color-grey-4; $color-input-focus: var(--color-input-focus); $color-input-focus-border: var(--color-input-focus-border); -$color-input-error-bg: color.adjust(color.adjust($color-red, $saturation: 28%), $lightness: 45%); +$color-input-error-bg: color.adjust( + color.adjust($color-red, $saturation: 28%), + $lightness: 45% +); $color-button: $color-teal; $color-button-hover: $color-teal-darker; @@ -71,7 +78,10 @@ $color-button-yes-hover: color.adjust($color-button-yes, $lightness: -8%); $color-button-no: $color-red-dark; $color-button-no-hover: color.adjust($color-button-no, $lightness: -20%); $color-button-warning: $color-orange-dark; -$color-button-warning-hover: color.adjust($color-button-warning, $lightness: -20%); +$color-button-warning-hover: color.adjust( + $color-button-warning, + $lightness: -20% +); $color-link: $color-teal-darker; $color-link-hover: $color-teal-dark; @@ -95,7 +105,8 @@ $system-color-link-text: LinkText; $system-color-button-text: ButtonText; // Fonts -$font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; +$font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, + sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; // Legacy icon font, to be removed in the near future. $font-wagtail-icons: wagtail; @@ -145,5 +156,13 @@ $nav-search-focus-bg: $nav-item-hover-bg; // Form Errors $color-text-error: color.change($color-red, $saturation: 69%, $lightness: 52%); -$color-text-error-forced-color: color.change($color-red, $saturation: 100%, $lightness: 50%); -$color-text-warning-forced-color: color.change($color-orange, $saturation: 100%, $lightness: 70%); +$color-text-error-forced-color: color.change( + $color-red, + $saturation: 100%, + $lightness: 50% +); +$color-text-warning-forced-color: color.change( + $color-orange, + $saturation: 100%, + $lightness: 70% +); diff --git a/client/scss/sidebar.scss b/client/scss/sidebar.scss index 54fdf1401e..be26b01906 100644 --- a/client/scss/sidebar.scss +++ b/client/scss/sidebar.scss @@ -10,7 +10,6 @@ see core.scss for details. ==============================================================================*/ - /* SETTINGS These are variables, maps, and fonts. * No CSS should be produced by these files @@ -18,7 +17,6 @@ These are variables, maps, and fonts. @import 'settings'; - /* TOOLS These are functions and mixins. * No CSS should be produced by these files. @@ -26,7 +24,6 @@ These are functions and mixins. @import 'tools'; - /* GENERIC This is for resets and other rules that affect large collections of bare elements. * Changes to them should be very rare. @@ -34,7 +31,6 @@ This is for resets and other rules that affect large collections of bare element @import 'generic/generic'; - /* ELEMENTS These are base styles for bare HTML elements. * Changes to them should be very rare. @@ -45,7 +41,6 @@ These are base styles for bare HTML elements. @import 'elements/forms'; @import 'elements/root'; - /* OBJECTS These are classes related to layout, known as 'objects' in ITCSS or OOCSS. * This is for grids, wrappers, and other non-consmetic layout utilities. @@ -55,7 +50,6 @@ These are classes related to layout, known as 'objects' in ITCSS or OOCSS. @import 'objects/objects'; @import 'objects/avatar'; - /* COMPONENTS These are classes for components. * These classes (unless legacy) are prefixed with `.c-`. @@ -69,6 +63,5 @@ These are classes for components. @import '../src/components/PageExplorer/PageExplorer'; @import '../src/components/Sidebar/Sidebar'; - // Legacy @import 'components/icons'; diff --git a/client/scss/tools/_functions.breakpoints.scss b/client/scss/tools/_functions.breakpoints.scss index a3d4cf4315..4640e49e2e 100644 --- a/client/scss/tools/_functions.breakpoints.scss +++ b/client/scss/tools/_functions.breakpoints.scss @@ -1,5 +1,5 @@ -@use "sass:list"; -@use "sass:map"; +@use 'sass:list'; +@use 'sass:map'; // Based upon the fine work and thoughts from Bootstrap v4. // Copyright 2011-2018 The Bootstrap Authors // Copyright 2011-2018 Twitter, Inc. @@ -9,23 +9,27 @@ // >> breakpoint-next(sm) // md @function breakpoint-next($name) { - $breakpoint-names: map.keys($breakpoints); - $n: list.index($breakpoint-names, $name); - @return if($n < list.length($breakpoint-names), list.nth($breakpoint-names, $n + 1), null); + $breakpoint-names: map.keys($breakpoints); + $n: list.index($breakpoint-names, $name); + @return if( + $n < list.length($breakpoint-names), + list.nth($breakpoint-names, $n + 1), + null + ); } // Minimum breakpoint width. Null for the smallest (first) breakpoint. // >> breakpoint-min(sm) // 50em @function breakpoint-min($name) { - $min: map.get($breakpoints, $name); - @return if($min != 0, $min, null); + $min: map.get($breakpoints, $name); + @return if($min != 0, $min, null); } // Maximum breakpoint width. Null for the largest (last) breakpoint. // >> breakpoint-max(sm) // 56.1875em @function breakpoint-max($name) { - $next: breakpoint-next($name); - @return if($next, breakpoint-min($next) - 0.0625em, null); + $next: breakpoint-next($name); + @return if($next, breakpoint-min($next) - 0.0625em, null); } diff --git a/client/scss/tools/_mixins.breakpoints.scss b/client/scss/tools/_mixins.breakpoints.scss index fd2c91de26..a5b743a544 100644 --- a/client/scss/tools/_mixins.breakpoints.scss +++ b/client/scss/tools/_mixins.breakpoints.scss @@ -3,29 +3,28 @@ // Copyright 2011-2018 Twitter, Inc. // Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) - // Media of at least the minimum breakpoint width. No query for the smallest breakpoint. // Makes the @content apply to the given breakpoint and wider. @mixin media-breakpoint-up($name) { - $min: breakpoint-min($name); - @if $min { - @media screen and (min-width: $min) { - @content; - } - } @else { - @content; + $min: breakpoint-min($name); + @if $min { + @media screen and (min-width: $min) { + @content; } + } @else { + @content; + } } // Media of at most the maximum breakpoint width. No query for the largest breakpoint. // Makes the @content apply to the given breakpoint and narrower. @mixin media-breakpoint-down($name) { - $max: breakpoint-max($name); - @if $max { - @media screen and (max-width: $max) { - @content; - } - } @else { - @content; + $max: breakpoint-max($name); + @if $max { + @media screen and (max-width: $max) { + @content; } + } @else { + @content; + } } diff --git a/client/scss/tools/_mixins.general.scss b/client/scss/tools/_mixins.general.scss index 1d872d5bda..d7e4dd14cc 100644 --- a/client/scss/tools/_mixins.general.scss +++ b/client/scss/tools/_mixins.general.scss @@ -6,111 +6,109 @@ // Turns on font-smoothing when used. Use sparingly. @mixin font-smoothing { - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } @mixin clearfix() { - &:before, - &:after { - content: ' '; - display: table; - } + &:before, + &:after { + content: ' '; + display: table; + } - &:after { - clear: both; - } + &:after { + clear: both; + } } @mixin unlist() { - margin-top: 0; - margin-bottom: 0; - padding-left: 0; + margin-top: 0; + margin-bottom: 0; + padding-left: 0; + list-style-type: none; + font-style: normal; + + li { list-style-type: none; font-style: normal; - - li { - list-style-type: none; - font-style: normal; - } + } } - // remove list styles, but only for the immediate element - // allow nested lists inside it to keep the default style @mixin unlistimmediate() { - margin-top: 0; - margin-bottom: 0; - padding-left: 0; + margin-top: 0; + margin-bottom: 0; + padding-left: 0; + list-style-type: none; + font-style: normal; + + > li { list-style-type: none; font-style: normal; - - > li { - list-style-type: none; - font-style: normal; - } + } } @mixin transition($transition...) { - body.ready & { - transition: $transition; - } + body.ready & { + transition: $transition; + } } @mixin visuallyhidden { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; } - @mixin visuallyvisible { - clip: auto; - height: auto; - width: auto; - margin: initial; - overflow: visible; - position: initial; + clip: auto; + height: auto; + width: auto; + margin: initial; + overflow: visible; + position: initial; } -@mixin svg-icon ($size: 1.5em, $position: text-top) { - width: $size; - height: $size; - vertical-align: $position; +@mixin svg-icon($size: 1.5em, $position: text-top) { + width: $size; + height: $size; + vertical-align: $position; } -@mixin icon () { - @include font-smoothing; - font-family: $font-wagtail-icons; - font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - speak: none; - text-decoration: none; - width: 1.3em; - line-height: 1em; - text-align: left; - vertical-align: middle; - margin-right: 0.2em; +@mixin icon() { + @include font-smoothing; + font-family: $font-wagtail-icons; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + speak: none; + text-decoration: none; + width: 1.3em; + line-height: 1em; + text-align: left; + vertical-align: middle; + margin-right: 0.2em; } // Applies given rules on hover, except for touch screens. // Relies on feature detection to add a no-touch class on the html element. @mixin hover { - .no-touch &:hover { - @content; - } + .no-touch &:hover { + @content; + } } // Where included, show the focus outline within focusable items instead of around them. // This is useful when focusable items are tightly packed and there is no space in-between. @mixin show-focus-outline-inside { - outline-offset: -1 * $focus-outline-width; + outline-offset: -1 * $focus-outline-width; } diff --git a/client/scss/tools/_mixins.grid.scss b/client/scss/tools/_mixins.grid.scss index f0a379c9e0..2c1899e2e2 100644 --- a/client/scss/tools/_mixins.grid.scss +++ b/client/scss/tools/_mixins.grid.scss @@ -1,75 +1,75 @@ -@use "sass:math"; +@use 'sass:math'; // Utility variable - you should never need to modify this $padding: math.div($grid-gutter-width, 2); // Our row container @mixin row($padding: 0) { - @include clearfix(); - box-sizing: border-box; - display: block; - margin-right: auto; - margin-left: auto; - padding-right: $padding; - padding-left: $padding; + @include clearfix(); + box-sizing: border-box; + display: block; + margin-right: auto; + margin-left: auto; + padding-right: $padding; + padding-left: $padding; } @mixin row-flush() { - margin-left: -$padding; - margin-right: -$padding; + margin-left: -$padding; + margin-right: -$padding; } // Our column container @mixin column($x, $padding: $padding, $grid-columns: $grid-columns) { - box-sizing: border-box; - display: inline; - float: left; - width: 100% * math.div($x, $grid-columns); - padding-right: $padding; - padding-left: $padding; + box-sizing: border-box; + display: inline; + float: left; + width: 100% * math.div($x, $grid-columns); + padding-right: $padding; + padding-left: $padding; } @mixin table-column($x, $padding: $padding, $grid-columns: $grid-columns) { - box-sizing: border-box; - width: 100% * math.div($x, $grid-columns); + box-sizing: border-box; + width: 100% * math.div($x, $grid-columns); } // Push adds left padding @mixin push($offset: 1, $grid-columns: $grid-columns) { - margin-left: 100% * math.div($offset, $grid-columns); + margin-left: 100% * math.div($offset, $grid-columns); } @mixin push-padding($offset: 1, $grid-columns: $grid-columns) { - padding-left: 100% * math.div($offset, $grid-columns); + padding-left: 100% * math.div($offset, $grid-columns); } // Pull adds right padding @mixin pull($offset: 1, $grid-columns: $grid-columns) { - margin-right: 100% * math.div($offset, $grid-columns); + margin-right: 100% * math.div($offset, $grid-columns); } @mixin pull-padding($offset: 1, $grid-columns: $grid-columns) { - padding-right: 100% * math.div($offset, $grid-columns); + padding-right: 100% * math.div($offset, $grid-columns); } // only used in places where padding not applied to same elements as row or row-flush // most of the time this class should be applied directly to the html elements @mixin nice-padding { - padding-left: $mobile-nice-padding; - padding-right: $mobile-nice-padding; + padding-left: $mobile-nice-padding; + padding-right: $mobile-nice-padding; - @include media-breakpoint-up(sm) { - padding-left: $desktop-nice-padding; - padding-right: $desktop-nice-padding; - } + @include media-breakpoint-up(sm) { + padding-left: $desktop-nice-padding; + padding-right: $desktop-nice-padding; + } } @mixin nice-margin { - margin-left: $mobile-nice-padding; - margin-right: $mobile-nice-padding; + margin-left: $mobile-nice-padding; + margin-right: $mobile-nice-padding; - @include media-breakpoint-up(sm) { - margin-left: $desktop-nice-padding; - margin-right: $desktop-nice-padding; - } + @include media-breakpoint-up(sm) { + margin-left: $desktop-nice-padding; + margin-right: $desktop-nice-padding; + } } diff --git a/client/scss/tools/_various.colors.scss b/client/scss/tools/_various.colors.scss index 2658018674..b9bdbd96c0 100644 --- a/client/scss/tools/_various.colors.scss +++ b/client/scss/tools/_various.colors.scss @@ -1,67 +1,73 @@ -@use "sass:math"; -@use "sass:color"; -@use "sass:list"; -@use "sass:meta"; +@use 'sass:math'; +@use 'sass:color'; +@use 'sass:list'; +@use 'sass:meta'; // $color is either a color or an hsl tuple @mixin define-color($name, $color) { - $h: null; - $s: null; - $l: null; + $h: null; + $s: null; + $l: null; - @if meta.type-of($color) == color { - $h: math.div(color.hue($color), 1deg); // Cast to unitless - $s: color.saturation($color); - $l: color.lightness($color); - } @else { - $h: list.nth($color, 1); - $s: list.nth($color, 2); - $l: list.nth($color, 3); - } + @if meta.type-of($color) == color { + $h: math.div(color.hue($color), 1deg); // Cast to unitless + $s: color.saturation($color); + $l: color.lightness($color); + } @else { + $h: list.nth($color, 1); + $s: list.nth($color, 2); + $l: list.nth($color, 3); + } - --#{$name}-hue: #{$h}; - --#{$name}-saturation: #{$s}; - --#{$name}-lightness: #{$l}; - --#{$name}: hsl(#{ var(--#{$name}-hue), var(--#{$name}-saturation), var(--#{$name}-lightness) }); + --#{$name}-hue: #{$h}; + --#{$name}-saturation: #{$s}; + --#{$name}-lightness: #{$l}; + // Prettier causes a linting issue when reformatting this. + /* prettier-ignore */ + --#{$name}: hsl(#{ var(--#{$name}-hue), var(--#{$name}-saturation), var(--#{$name}-lightness) }); } @function get-color($name) { - @return (var(--#{$name}-hue), var(--#{$name}-saturation), var(--#{$name}-lightness)); + @return ( + var(--#{$name}-hue), + var(--#{$name}-saturation), + var(--#{$name}-lightness) + ); } @function css-darken($hsl-tuple, $darken-by) { - $h: list.nth($hsl-tuple, 1); - $s: list.nth($hsl-tuple, 2); - $l: list.nth($hsl-tuple, 3); - @return ($h, $s, calc(#{$l} - #{$darken-by + 0%})); + $h: list.nth($hsl-tuple, 1); + $s: list.nth($hsl-tuple, 2); + $l: list.nth($hsl-tuple, 3); + @return ($h, $s, calc(#{$l} - #{$darken-by + 0%})); } @function css-lighten($hsl-tuple, $lighten-by) { - $h: list.nth($hsl-tuple, 1); - $s: list.nth($hsl-tuple, 2); - $l: list.nth($hsl-tuple, 3); - @return ($h, $s, calc(#{$l} + #{$lighten-by + 0%})); + $h: list.nth($hsl-tuple, 1); + $s: list.nth($hsl-tuple, 2); + $l: list.nth($hsl-tuple, 3); + @return ($h, $s, calc(#{$l} + #{$lighten-by + 0%})); } @function css-saturate($hsl-tuple, $saturate-by) { - $h: list.nth($hsl-tuple, 1); - $s: list.nth($hsl-tuple, 2); - $l: list.nth($hsl-tuple, 3); - @return ($h, calc(#{$s} + #{$saturate-by + 0%}), $l); + $h: list.nth($hsl-tuple, 1); + $s: list.nth($hsl-tuple, 2); + $l: list.nth($hsl-tuple, 3); + @return ($h, calc(#{$s} + #{$saturate-by + 0%}), $l); } @function css-desaturate($hsl-tuple, $desaturate-by) { - $h: list.nth($hsl-tuple, 1); - $s: list.nth($hsl-tuple, 2); - $l: list.nth($hsl-tuple, 3); - @return ($h, calc(#{$s} - #{$desaturate-by + 0%}), $l); + $h: list.nth($hsl-tuple, 1); + $s: list.nth($hsl-tuple, 2); + $l: list.nth($hsl-tuple, 3); + @return ($h, calc(#{$s} - #{$desaturate-by + 0%}), $l); } @function css-adjust-hue($hsl-tuple, $adjust-by) { - $h: list.nth($hsl-tuple, 1); - $s: list.nth($hsl-tuple, 2); - $l: list.nth($hsl-tuple, 3); - @return (calc(#{$h} + #{$adjust-by}), $s, $l); + $h: list.nth($hsl-tuple, 1); + $s: list.nth($hsl-tuple, 2); + $l: list.nth($hsl-tuple, 3); + @return (calc(#{$h} + #{$adjust-by}), $s, $l); } @function css-transparentize($hsl-tuple, $alpha) { - $h: list.nth($hsl-tuple, 1); - $s: list.nth($hsl-tuple, 2); - $l: list.nth($hsl-tuple, 3); - @return ($h, $s, $l, $alpha); + $h: list.nth($hsl-tuple, 1); + $s: list.nth($hsl-tuple, 2); + $l: list.nth($hsl-tuple, 3); + @return ($h, $s, $l, $alpha); } diff --git a/client/src/api/admin.test.js b/client/src/api/admin.test.js index 90bde5dfb0..579eeea638 100644 --- a/client/src/api/admin.test.js +++ b/client/src/api/admin.test.js @@ -8,10 +8,7 @@ const stubResult = { verbose_name: 'Test', }, }, - items: [ - { meta: { type: 'test' } }, - { meta: { type: 'foo' } }, - ], + items: [{ meta: { type: 'test' } }, { meta: { type: 'foo' } }], }; client.get = jest.fn(() => Promise.resolve(stubResult)); @@ -20,27 +17,29 @@ describe('admin API', () => { describe('getPageChildren', () => { it('works', () => { getPageChildren(3); - expect(client.get).toBeCalledWith(`${ADMIN_API.PAGES}?child_of=3&for_explorer=1&fields=parent`); + expect(client.get).toBeCalledWith( + `${ADMIN_API.PAGES}?child_of=3&for_explorer=1&fields=parent`, + ); }); it('#fields', () => { getPageChildren(3, { fields: ['title', 'latest_revision_created_at'] }); expect(client.get).toBeCalledWith( - `${ADMIN_API.PAGES}?child_of=3&for_explorer=1&fields=parent,title%2Clatest_revision_created_at` + `${ADMIN_API.PAGES}?child_of=3&for_explorer=1&fields=parent,title%2Clatest_revision_created_at`, ); }); it('#onlyWithChildren', () => { getPageChildren(3, { onlyWithChildren: true }); expect(client.get).toBeCalledWith( - `${ADMIN_API.PAGES}?child_of=3&for_explorer=1&fields=parent&has_children=1` + `${ADMIN_API.PAGES}?child_of=3&for_explorer=1&fields=parent&has_children=1`, ); }); it('#offset', () => { getPageChildren(3, { offset: 5 }); expect(client.get).toBeCalledWith( - `${ADMIN_API.PAGES}?child_of=3&for_explorer=1&fields=parent&offset=5` + `${ADMIN_API.PAGES}?child_of=3&for_explorer=1&fields=parent&offset=5`, ); }); }); diff --git a/client/src/api/admin.ts b/client/src/api/admin.ts index 81968b1e40..80626e9dbf 100644 --- a/client/src/api/admin.ts +++ b/client/src/api/admin.ts @@ -8,9 +8,9 @@ export interface WagtailPageAPI { status: { status: string; live: boolean; - + has_unpublished_changes: boolean; - } + }; children: any; parent: { id: number; @@ -18,13 +18,12 @@ export interface WagtailPageAPI { locale?: string; translations?: any; }; - + admin_display_title?: string; } interface WagtailPageListAPI { meta: { - total_count: number; }; items: WagtailPageAPI[]; @@ -42,12 +41,17 @@ interface GetPageChildrenOptions { offset?: number; } -type GetPageChildren = (id: number, options: GetPageChildrenOptions) => Promise; +type GetPageChildren = ( + id: number, + options: GetPageChildrenOptions, +) => Promise; export const getPageChildren: GetPageChildren = (id, options = {}) => { let url = `${ADMIN_API.PAGES}?child_of=${id}&for_explorer=1`; if (options.fields) { - url += `&fields=parent,${window.encodeURIComponent(options.fields.join(','))}`; + url += `&fields=parent,${window.encodeURIComponent( + options.fields.join(','), + )}`; } else { url += '&fields=parent'; } @@ -70,12 +74,17 @@ interface GetPageTranslationsOptions { onlyWithChildren?: boolean; offset?: number; } -type GetPageTranslations = (id: number, options: GetPageTranslationsOptions) => Promise; +type GetPageTranslations = ( + id: number, + options: GetPageTranslationsOptions, +) => Promise; export const getPageTranslations: GetPageTranslations = (id, options = {}) => { let url = `${ADMIN_API.PAGES}?translation_of=${id}&limit=20`; if (options.fields) { - url += `&fields=parent,${global.encodeURIComponent(options.fields.join(','))}`; + url += `&fields=parent,${global.encodeURIComponent( + options.fields.join(','), + )}`; } else { url += '&fields=parent'; } @@ -96,14 +105,20 @@ interface GetAllPageTranslationsOptions { onlyWithChildren?: boolean; } -export const getAllPageTranslations = async (id: number, options: GetAllPageTranslationsOptions) => { +export const getAllPageTranslations = async ( + id: number, + options: GetAllPageTranslationsOptions, +) => { const items: WagtailPageAPI[] = []; let iterLimit = 100; for (;;) { - const page = await getPageTranslations(id, { offset: items.length, ...options }); + const page = await getPageTranslations(id, { + offset: items.length, + ...options, + }); - page.items.forEach(item => items.push(item)); + page.items.forEach((item) => items.push(item)); if (items.length >= page.meta.total_count || iterLimit-- <= 0) { return items; diff --git a/client/src/api/client.js b/client/src/api/client.js index 9e7301dc89..9ce60d7a49 100644 --- a/client/src/api/client.js +++ b/client/src/api/client.js @@ -3,7 +3,7 @@ const Headers = global.Headers; const REQUEST_TIMEOUT = 15000; -const checkStatus = (response) => { +const checkStatus = (response) => { if (response.status >= 200 && response.status < 300) { return response; } @@ -13,7 +13,7 @@ const checkStatus = (response) => { throw error; }; -const parseJSON = response => response.json(); +const parseJSON = (response) => response.json(); // Response timeout cancelling the promise (not the request). // See https://github.com/github/fetch/issues/175#issuecomment-216791333. @@ -23,13 +23,16 @@ const timeout = (ms, promise) => { reject(new Error('Response timeout')); }, ms); - promise.then((res) => { - clearTimeout(timeoutId); - resolve(res); - }, (err) => { - clearTimeout(timeoutId); - reject(err); - }); + promise.then( + (res) => { + clearTimeout(timeoutId); + resolve(res); + }, + (err) => { + clearTimeout(timeoutId); + reject(err); + }, + ); }); return race; @@ -46,7 +49,7 @@ const request = (method, url) => { 'Accept': 'application/json', 'Content-Type': 'application/json', }), - method: method + method: method, }; return timeout(REQUEST_TIMEOUT, fetch(url, options)) @@ -54,4 +57,4 @@ const request = (method, url) => { .then(parseJSON); }; -export const get = url => request('GET', url); +export const get = (url) => request('GET', url); diff --git a/client/src/components/Button/Button.test.js b/client/src/components/Button/Button.test.js index be14fabac2..57f0121771 100644 --- a/client/src/components/Button/Button.test.js +++ b/client/src/components/Button/Button.test.js @@ -17,7 +17,9 @@ describe('Button', () => { }); it('#accessibleLabel', () => { - expect(shallow( ); } - return ( - - {children} - - ); + return {children}; }; interface CommentReply { @@ -65,7 +61,14 @@ interface CommentHeaderProps { } export const CommentHeader: FunctionComponent = ({ - commentReply, store, strings, onResolve, onEdit, onDelete, descriptionId, focused + commentReply, + store, + strings, + onResolve, + onEdit, + onDelete, + descriptionId, + focused, }) => { const { author, date } = commentReply; @@ -115,7 +118,11 @@ export const CommentHeader: FunctionComponent = ({ }, [menuOpen]); const handleClickOutside = (e: MouseEvent) => { - if (menuContainerRef.current && e.target instanceof Node && !menuContainerRef.current.contains(e.target)) { + if ( + menuContainerRef.current && + e.target instanceof Node && + !menuContainerRef.current.contains(e.target) + ) { setMenuOpen(false); } }; @@ -130,8 +137,11 @@ export const CommentHeader: FunctionComponent = ({ return (
- {(onEdit || onDelete || onResolve) && -
+ {(onEdit || onDelete || onResolve) && ( +
= ({ -
- {onEdit && } - {onDelete && } - {onResolve && } +
+ {onEdit && ( + + )} + {onDelete && ( + + )} + {onResolve && ( + + )}
- } + )}
- {author && author.avatarUrl && - } + {author && author.avatarUrl && ( + + )}

{author ? author.name : ''}

-

{dateFormat(date, 'd mmm yyyy HH:MM')}

+

+ {dateFormat(date, 'd mmm yyyy HH:MM')} +

); diff --git a/client/src/components/CommentApp/components/CommentHeader/style.scss b/client/src/components/CommentApp/components/CommentHeader/style.scss index e2ef112abc..f096711e69 100644 --- a/client/src/components/CommentApp/components/CommentHeader/style.scss +++ b/client/src/components/CommentApp/components/CommentHeader/style.scss @@ -1,144 +1,151 @@ .comment-header { - position: relative; + position: relative; - &__avatar { + &__avatar { + position: absolute; + width: 30px; + height: 30px; + border-radius: 15px; + } + + &__author, + &__date { + max-width: calc( + 100% - 110px + ); // Leave room for actions to the right and avatar to the left + margin: 0; + margin-left: 45px; + font-size: 11px; + line-height: 15px; + } + + &__date { + color: $color-grey-25; + } + + &__actions { + position: absolute; + right: 0; + } + + &__action { + float: left; + margin-left: 5px; + border-radius: 5px; + width: 30px; + height: 30px; + + &:hover { + background-color: $color-grey-7; + } + + > button, + > details > summary, + .details-fallback > .details-fallback__summary { + // IE11 uses divs instead with these classes + // Hides triangle on Firefox + list-style-type: none; + // Hides triangle on Chrome + &::-webkit-details-marker { + display: none; + } + width: 30px; + height: 30px; + position: relative; + background-color: unset; + border: unset; + -moz-outline-radius: 10px; + padding: 0; + box-sizing: border-box; + + svg { position: absolute; - width: 30px; - height: 30px; - border-radius: 15px; + top: 7.5px; + left: 7.5px; + width: 15px; + height: 15px; + } + + &:hover { + cursor: pointer; + } } - &__author, - &__date { - max-width: calc(100% - 110px); // Leave room for actions to the right and avatar to the left - margin: 0; - margin-left: 45px; - font-size: 11px; - line-height: 15px; - } + > details, + > .details-fallback { + // IE11 uses divs instead with these classes + position: relative; - &__date { - color: $color-grey-25; - } - - &__actions { + > div { position: absolute; right: 0; + top: 35px; + } } - &__action { - float: left; - margin-left: 5px; - border-radius: 5px; - width: 30px; - height: 30px; + &--more { + > button, + > details > summary, + > .details-fallback > .details-fallback__summary { + // IE11 uses divs instead with these classes + color: #767676; + // stylelint-disable-next-line max-nesting-depth &:hover { - background-color: $color-grey-7; + color: $color-grey-25; } + } + } + } - > button, - > details > summary, - .details-fallback > .details-fallback__summary { // IE11 uses divs instead with these classes - // Hides triangle on Firefox - list-style-type: none; - // Hides triangle on Chrome - &::-webkit-details-marker { display: none; } - width: 30px; - height: 30px; - position: relative; - background-color: unset; - border: unset; - -moz-outline-radius: 10px; - padding: 0; - box-sizing: border-box; + &__more-actions { + background-color: #333; + color: $color-grey-5; + text-transform: none; + position: absolute; + z-index: 1000; + list-style: none; + text-align: left; + border-radius: 3px; - svg { - position: absolute; - top: 7.5px; - left: 7.5px; - width: 15px; - height: 15px; - } - - &:hover { - cursor: pointer; - } - } - - > details, - > .details-fallback { // IE11 uses divs instead with these classes - position: relative; - - > div { - position: absolute; - right: 0; - top: 35px; - } - } - - &--more { - > button, - > details > summary, - > .details-fallback > .details-fallback__summary { // IE11 uses divs instead with these classes - color: #767676; - - // stylelint-disable-next-line max-nesting-depth - &:hover { - color: $color-grey-25; - } - } - } + &:before { + content: ''; + border: 6px solid transparent; + border-bottom-color: #333; + display: block; + position: absolute; + bottom: 100%; + right: 9px; } - &__more-actions { - background-color: #333; - color: $color-grey-5; - text-transform: none; - position: absolute; - z-index: 1000; - list-style: none; - text-align: left; - border-radius: 3px; + button { + display: block; + background: none; + border: 0; + color: #fff; + padding: 5px 10px; + font-size: 13px; + width: 100px; + text-align: left; - &:before { - content: ''; - border: 6px solid transparent; - border-bottom-color: #333; - display: block; - position: absolute; - bottom: 100%; - right: 9px; - } - - button { - display: block; - background: none; - border: 0; - color: #fff; - padding: 5px 10px; - font-size: 13px; - width: 100px; - text-align: left; - - &:hover { - color: #aaa; - cursor: pointer; - } - } + &:hover { + color: #aaa; + cursor: pointer; + } } + } } .comment--mode-deleting .comment-header, .comment-reply--mode-deleting .comment-header { - opacity: 0.5; + opacity: 0.5; } // IE11 only uses these classes .details-fallback .comment-header__more-actions { - display: none; + display: none; } .details-fallback--open .comment-header__more-actions { - display: block; + display: block; } diff --git a/client/src/components/CommentApp/components/CommentReply/index.stories.tsx b/client/src/components/CommentApp/components/CommentReply/index.stories.tsx index 4af4e7ba22..1eba91d0c8 100644 --- a/client/src/components/CommentApp/components/CommentReply/index.stories.tsx +++ b/client/src/components/CommentApp/components/CommentReply/index.stories.tsx @@ -41,7 +41,8 @@ export function replyFromSomeoneElse() { author: { id: 2, name: 'Someone else', - avatarUrl: 'https://gravatar.com/avatar/31c3d5cc27d1faa321c2413589e8a53f?s=200&d=robohash&r=x', + avatarUrl: + 'https://gravatar.com/avatar/31c3d5cc27d1faa321c2413589e8a53f?s=200&d=robohash&r=x', }, }); diff --git a/client/src/components/CommentApp/components/CommentReply/index.tsx b/client/src/components/CommentApp/components/CommentReply/index.tsx index 2eca4b3fce..8401ca1a4c 100644 --- a/client/src/components/CommentApp/components/CommentReply/index.tsx +++ b/client/src/components/CommentApp/components/CommentReply/index.tsx @@ -1,24 +1,22 @@ - - import React from 'react'; import type { Store } from '../../state'; import type { Comment, CommentReply, Author } from '../../state/comments'; import { updateReply, deleteReply } from '../../actions/comments'; import type { TranslatableStrings } from '../../main'; -import { CommentHeader } from '../CommentHeader'; +import { CommentHeader } from '../CommentHeader'; import TextArea from '../TextArea'; import Icon from '../../../Icon/Icon'; export async function saveCommentReply( comment: Comment, reply: CommentReply, - store: Store + store: Store, ) { store.dispatch( updateReply(comment.localId, reply.localId, { mode: 'saving', - }) + }), ); try { @@ -27,7 +25,7 @@ export async function saveCommentReply( mode: 'default', text: reply.newText, author: reply.author, - }) + }), ); } catch (err) { /* eslint-disable-next-line no-console */ @@ -35,7 +33,7 @@ export async function saveCommentReply( store.dispatch( updateReply(comment.localId, reply.localId, { mode: 'save_error', - }) + }), ); } } @@ -43,12 +41,12 @@ export async function saveCommentReply( async function deleteCommentReply( comment: Comment, reply: CommentReply, - store: Store + store: Store, ) { store.dispatch( updateReply(comment.localId, reply.localId, { mode: 'deleting', - }) + }), ); try { @@ -57,7 +55,7 @@ async function deleteCommentReply( store.dispatch( updateReply(comment.localId, reply.localId, { mode: 'delete_error', - }) + }), ); } } @@ -79,7 +77,7 @@ export default class CommentReplyComponent extends React.Component - +

{reply.text}

{strings.SAVING}
@@ -157,7 +160,12 @@ export default class CommentReplyComponent extends React.Component - +

{reply.text}

{strings.SAVE_ERROR} @@ -188,13 +196,18 @@ export default class CommentReplyComponent extends React.Component - +

{reply.text}

{strings.CONFIRM_DELETE_COMMENT} @@ -222,7 +235,12 @@ export default class CommentReplyComponent extends React.Component - +

{reply.text}

{strings.DELETING}
@@ -244,13 +262,18 @@ export default class CommentReplyComponent extends React.Component - +

{reply.text}

{strings.DELETE_ERROR} @@ -279,13 +302,16 @@ export default class CommentReplyComponent extends React.Component { store.dispatch( updateReply(comment.localId, reply.localId, { mode: 'editing', newText: reply.text, - }) + }), ); }; @@ -293,7 +319,7 @@ export default class CommentReplyComponent extends React.Component

{reply.text}

- {notice && + {notice && (
{notice}
- } + )} ); } @@ -331,33 +357,33 @@ export default class CommentReplyComponent extends React.Component + additionalAttributes?: React.ComponentPropsWithoutRef<'textarea'>; } -const TextArea = React.forwardRef(({ - value, - className, - placeholder, - onChange, - focusOnMount, - focusTarget = false, - additionalAttributes = {} -}, ref) => { - const onChangeValue = (e: React.ChangeEvent) => { - if (onChange) { - onChange(e.target.value); - } - }; +const TextArea = React.forwardRef( + ( + { + value, + className, + placeholder, + onChange, + focusOnMount, + focusTarget = false, + additionalAttributes = {}, + }, + ref, + ) => { + const onChangeValue = (e: React.ChangeEvent) => { + if (onChange) { + onChange(e.target.value); + } + }; - // Resize the textarea whenever the value is changed - const textAreaElement = React.useRef(null); - React.useImperativeHandle(ref, () => textAreaElement.current); + // Resize the textarea whenever the value is changed + const textAreaElement = React.useRef(null); + React.useImperativeHandle< + HTMLTextAreaElement | null, + HTMLTextAreaElement | null + >(ref, () => textAreaElement.current); - React.useEffect(() => { - if (textAreaElement.current) { - textAreaElement.current.style.height = ''; - textAreaElement.current.style.height = - textAreaElement.current.scrollHeight + 'px'; - } - }, [value, textAreaElement]); + React.useEffect(() => { + if (textAreaElement.current) { + textAreaElement.current.style.height = ''; + textAreaElement.current.style.height = + textAreaElement.current.scrollHeight + 'px'; + } + }, [value, textAreaElement]); - // Focus the textarea when it is mounted - React.useEffect(() => { - if (focusOnMount && textAreaElement.current) { - textAreaElement.current.focus(); - } - }, [textAreaElement]); + // Focus the textarea when it is mounted + React.useEffect(() => { + if (focusOnMount && textAreaElement.current) { + textAreaElement.current.focus(); + } + }, [textAreaElement]); - return ( - ', - '__ID__' - ] + '__ID__', + ], }); - boundWidget = widgetDef.render($('#placeholder'), 'the-name', 'the-id', 'The Value'); + boundWidget = widgetDef.render( + $('#placeholder'), + 'the-name', + 'the-id', + 'The Value', + ); }); test('it renders correctly', () => { - expect(document.body.innerHTML).toBe(''); + expect(document.body.innerHTML).toBe( + '', + ); expect(document.querySelector('textarea').value).toBe('The Value'); }); test('window.autosize was called', () => { expect(window.autosize.mock.calls.length).toBe(1); - expect(window.autosize.mock.calls[0][0].get(0)).toBe(document.querySelector('textarea')); + expect(window.autosize.mock.calls[0][0].get(0)).toBe( + document.querySelector('textarea'), + ); }); test('getValue() returns the current value', () => { @@ -333,23 +367,28 @@ describe('telepath: wagtail.widgets.DraftailRichTextArea', () => { let boundWidget; const TEST_VALUE = JSON.stringify({ - blocks: [{ - key: 't30wm', - type: 'unstyled', - depth: 0, - text: 'Test Bold Italic', - inlineStyleRanges: [{ - offset: 5, - length: 4, - style: 'BOLD' - }, { - offset: 10, - length: 6, - style: 'ITALIC' - }], - entityRanges: [] - }], - entityMap: {} + blocks: [ + { + key: 't30wm', + type: 'unstyled', + depth: 0, + text: 'Test Bold Italic', + inlineStyleRanges: [ + { + offset: 5, + length: 4, + style: 'BOLD', + }, + { + offset: 10, + length: 6, + style: 'ITALIC', + }, + ], + entityRanges: [], + }, + ], + entityMap: {}, }); beforeEach(() => { @@ -359,52 +398,67 @@ describe('telepath: wagtail.widgets.DraftailRichTextArea', () => { // Unpack and render a Draftail input const widgetDef = window.telepath.unpack({ _type: 'wagtail.widgets.DraftailRichTextArea', - _args: [{ - entityTypes: [{ - _dict: { - type: 'LINK', - icon: 'link', - description: 'Link', - attributes: ['url', 'id', 'parentId'], - whitelist: { - href: '^(http:|https:|undefined$)' - } - }, - }, { - _dict: { - type: 'IMAGE', - icon: 'image', - description: 'Image', - attributes: ['id', 'src', 'alt', 'format'], - whitelist: { - id: true - } - }, - }], - enableHorizontalRule: true, - inlineStyles: [{ - _dict: { - type: 'BOLD', - icon: 'bold', - description: 'Bold' - }, - }, { - _dict: { - type: 'ITALIC', - icon: 'italic', - description: 'Italic' - }, - }], - blockTypes: [{ - _dict: { - label: 'H2', - type: 'header-two', - description: 'Heading 2' - }, - }] - }] + _args: [ + { + entityTypes: [ + { + _dict: { + type: 'LINK', + icon: 'link', + description: 'Link', + attributes: ['url', 'id', 'parentId'], + whitelist: { + href: '^(http:|https:|undefined$)', + }, + }, + }, + { + _dict: { + type: 'IMAGE', + icon: 'image', + description: 'Image', + attributes: ['id', 'src', 'alt', 'format'], + whitelist: { + id: true, + }, + }, + }, + ], + enableHorizontalRule: true, + inlineStyles: [ + { + _dict: { + type: 'BOLD', + icon: 'bold', + description: 'Bold', + }, + }, + { + _dict: { + type: 'ITALIC', + icon: 'italic', + description: 'Italic', + }, + }, + ], + blockTypes: [ + { + _dict: { + label: 'H2', + type: 'header-two', + description: 'Heading 2', + }, + }, + ], + }, + ], }); - boundWidget = widgetDef.render(document.getElementById('placeholder'), 'the-name', 'the-id', TEST_VALUE); + boundWidget = widgetDef.render( + document.getElementById('placeholder'), + 'the-name', + 'the-id', + TEST_VALUE, + ); }); test('it renders correctly', () => { @@ -422,15 +476,17 @@ describe('telepath: wagtail.widgets.DraftailRichTextArea', () => { test('setState() changes the current state', () => { const NEW_VALUE = JSON.stringify({ - blocks: [{ - key: 't30wm', - type: 'unstyled', - depth: 0, - text: 'New value', - inlineStyleRanges: [], - entityRanges: [] - }], - entityMap: {} + blocks: [ + { + key: 't30wm', + type: 'unstyled', + depth: 0, + text: 'New value', + inlineStyleRanges: [], + entityRanges: [], + }, + ], + entityMap: {}, }); expect(() => { @@ -443,7 +499,9 @@ describe('telepath: wagtail.widgets.DraftailRichTextArea', () => { jest.useFakeTimers(); boundWidget.focus(); jest.runAllTimers(); - expect(document.activeElement).toBe(document.querySelector('.public-DraftEditor-content')); + expect(document.activeElement).toBe( + document.querySelector('.public-DraftEditor-content'), + ); }); }); @@ -459,16 +517,25 @@ describe('telepath: wagtail.widgets.DateInput', () => { // Render const widgetDef = window.telepath.unpack({ _type: 'wagtail.widgets.AdminDateInput', - _args: [{ - dayOfWeekStart: 0, - format: 'Y-m-d' - }] + _args: [ + { + dayOfWeekStart: 0, + format: 'Y-m-d', + }, + ], }); - boundWidget = widgetDef.render($('#placeholder'), 'the-name', 'the-id', '2021-01-19'); + boundWidget = widgetDef.render( + $('#placeholder'), + 'the-name', + 'the-id', + '2021-01-19', + ); }); test('it renders correctly', () => { - expect(document.body.innerHTML).toBe(''); + expect(document.body.innerHTML).toBe( + '', + ); expect(document.querySelector('input').value).toBe('2021-01-19'); }); @@ -477,7 +544,7 @@ describe('telepath: wagtail.widgets.DateInput', () => { expect(window.initDateChooser.mock.calls[0][0]).toBe('the-id'); expect(window.initDateChooser.mock.calls[0][1]).toEqual({ dayOfWeekStart: 0, - format: 'Y-m-d' + format: 'Y-m-d', }); }); @@ -512,16 +579,25 @@ describe('telepath: wagtail.widgets.TimeInput', () => { // Render const widgetDef = window.telepath.unpack({ _type: 'wagtail.widgets.AdminTimeInput', - _args: [{ - format: 'H:i', - formatTime: 'H:i' - }] + _args: [ + { + format: 'H:i', + formatTime: 'H:i', + }, + ], }); - boundWidget = widgetDef.render($('#placeholder'), 'the-name', 'the-id', '11:59'); + boundWidget = widgetDef.render( + $('#placeholder'), + 'the-name', + 'the-id', + '11:59', + ); }); test('it renders correctly', () => { - expect(document.body.innerHTML).toBe(''); + expect(document.body.innerHTML).toBe( + '', + ); expect(document.querySelector('input').value).toBe('11:59'); }); @@ -530,7 +606,7 @@ describe('telepath: wagtail.widgets.TimeInput', () => { expect(window.initTimeChooser.mock.calls[0][0]).toBe('the-id'); expect(window.initTimeChooser.mock.calls[0][1]).toEqual({ format: 'H:i', - formatTime: 'H:i' + formatTime: 'H:i', }); }); @@ -565,17 +641,26 @@ describe('telepath: wagtail.widgets.DateTimeInput', () => { // Render const widgetDef = window.telepath.unpack({ _type: 'wagtail.widgets.AdminDateTimeInput', - _args: [{ - dayOfWeekStart: 0, - format: 'Y-m-d H:i', - formatTime: 'H:i' - }] + _args: [ + { + dayOfWeekStart: 0, + format: 'Y-m-d H:i', + formatTime: 'H:i', + }, + ], }); - boundWidget = widgetDef.render($('#placeholder'), 'the-name', 'the-id', '2021-01-19 11:59'); + boundWidget = widgetDef.render( + $('#placeholder'), + 'the-name', + 'the-id', + '2021-01-19 11:59', + ); }); test('it renders correctly', () => { - expect(document.body.innerHTML).toBe(''); + expect(document.body.innerHTML).toBe( + '', + ); expect(document.querySelector('input').value).toBe('2021-01-19 11:59'); }); @@ -585,7 +670,7 @@ describe('telepath: wagtail.widgets.DateTimeInput', () => { expect(window.initDateTimeChooser.mock.calls[0][1]).toEqual({ dayOfWeekStart: 0, format: 'Y-m-d H:i', - formatTime: 'H:i' + formatTime: 'H:i', }); }); diff --git a/client/src/entrypoints/admin/userbar.js b/client/src/entrypoints/admin/userbar.js index 82f5ebd540..b0bc96109f 100644 --- a/client/src/entrypoints/admin/userbar.js +++ b/client/src/entrypoints/admin/userbar.js @@ -32,7 +32,6 @@ document.addEventListener('DOMContentLoaded', () => { // eslint-disable-next-line @typescript-eslint/no-use-before-define list.addEventListener('focusout', handleFocusChange); - // eslint-disable-next-line @typescript-eslint/no-use-before-define resetItemsTabIndex(); // On initialisation, all menu items should be disabled for roving tab index @@ -85,12 +84,15 @@ document.addEventListener('DOMContentLoaded', () => { } function isFocusOnItems() { - return document.activeElement && !!document.activeElement.closest('.wagtail-userbar-items'); + return ( + document.activeElement && + !!document.activeElement.closest('.wagtail-userbar-items') + ); } /** Reset all focusable menu items to `tabIndex = -1` */ function resetItemsTabIndex() { - listItems.forEach(listItem => { + listItems.forEach((listItem) => { // eslint-disable-next-line no-param-reassign listItem.firstElementChild.tabIndex = -1; }); @@ -129,7 +131,8 @@ document.addEventListener('DOMContentLoaded', () => { if (element.firstElementChild === document.activeElement) { if (idx + 1 < listItems.length) { focusElement(listItems[idx + 1].firstElementChild); - } else { // Loop around + } else { + // Loop around setFocusToFirstItem(); } } @@ -169,24 +172,24 @@ document.addEventListener('DOMContentLoaded', () => { // List items are in focus, move focus if needed if (isFocusOnItems()) { switch (event.key) { - case 'ArrowDown': - event.preventDefault(); - setFocusToNextItem(); - return false; - case 'ArrowUp': - event.preventDefault(); - setFocusToPreviousItem(); - return false; - case 'Home': - event.preventDefault(); - setFocusToFirstItem(); - return false; - case 'End': - event.preventDefault(); - setFocusToLastItem(); - return false; - default: - break; + case 'ArrowDown': + event.preventDefault(); + setFocusToNextItem(); + return false; + case 'ArrowUp': + event.preventDefault(); + setFocusToPreviousItem(); + return false; + case 'Home': + event.preventDefault(); + setFocusToFirstItem(); + return false; + case 'End': + event.preventDefault(); + setFocusToLastItem(); + return false; + default: + break; } } } @@ -195,7 +198,11 @@ document.addEventListener('DOMContentLoaded', () => { function handleFocusChange(event) { // Is the focus is still in the menu? If so, don't to anything - if (event.relatedTarget == null || (event.relatedTarget && event.relatedTarget.closest('.wagtail-userbar-items'))) { + if ( + event.relatedTarget == null || + (event.relatedTarget && + event.relatedTarget.closest('.wagtail-userbar-items')) + ) { return; } // List items not in focus - the menu should close @@ -209,26 +216,29 @@ document.addEventListener('DOMContentLoaded', () => { */ function handleTriggerKeyDown(event) { // Check if the userbar is focused (but not open yet) and should be opened by keyboard input - if (trigger === document.activeElement && trigger.getAttribute('aria-expanded') === 'false') { + if ( + trigger === document.activeElement && + trigger.getAttribute('aria-expanded') === 'false' + ) { switch (event.key) { - case 'ArrowUp': - event.preventDefault(); - showUserbar(false); + case 'ArrowUp': + event.preventDefault(); + showUserbar(false); - // Workaround for focus bug - // Needs extra delay to account for the userbar open animation. Otherwise won't focus properly. - setTimeout(() => setFocusToLastItem(), 300); - break; - case 'ArrowDown': - event.preventDefault(); - showUserbar(false); + // Workaround for focus bug + // Needs extra delay to account for the userbar open animation. Otherwise won't focus properly. + setTimeout(() => setFocusToLastItem(), 300); + break; + case 'ArrowDown': + event.preventDefault(); + showUserbar(false); - // Workaround for focus bug - // Needs extra delay to account for the userbar open animation. Otherwise won't focus properly. - setTimeout(() => setFocusToFirstItem(), 300); - break; - default: - break; + // Workaround for focus bug + // Needs extra delay to account for the userbar open animation. Otherwise won't focus properly. + setTimeout(() => setFocusToFirstItem(), 300); + break; + default: + break; } } } diff --git a/client/src/entrypoints/admin/workflow-action.js b/client/src/entrypoints/admin/workflow-action.js index cf29592b6d..fa7668214d 100644 --- a/client/src/entrypoints/admin/workflow-action.js +++ b/client/src/entrypoints/admin/workflow-action.js @@ -12,87 +12,112 @@ window._addHiddenInput = addHiddenInput; /* When a workflow action button is clicked, either show a modal or make a POST request to the workflow action view */ function ActivateWorkflowActionsForDashboard(csrfToken) { - const workflowActionElements = document.querySelectorAll('[data-workflow-action-url]'); + const workflowActionElements = document.querySelectorAll( + '[data-workflow-action-url]', + ); [...workflowActionElements].forEach((buttonElement) => { - buttonElement.addEventListener('click', (e) => { - // Stop the button from submitting the form - e.preventDefault(); - e.stopPropagation(); - - if ('launchModal' in buttonElement.dataset) { - // eslint-disable-next-line no-undef - ModalWorkflow({ - url: buttonElement.dataset.workflowActionUrl, - onload: { - action(modal) { - const nextElement = document.createElement('input'); - nextElement.type = 'hidden'; - nextElement.name = 'next'; - nextElement.value = window.location; - $('form', modal.body).append(nextElement); - modal.ajaxifyForm($('form', modal.body)); - }, - success(modal, jsonData) { - window.location.href = jsonData.redirect; - } - }, - }); - } else { - // if not opening a modal, submit a POST request to the action url - const formElement = document.createElement('form'); - - formElement.action = buttonElement.dataset.workflowActionUrl; - formElement.method = 'POST'; - - addHiddenInput(formElement, 'csrfmiddlewaretoken', csrfToken); - addHiddenInput(formElement, 'next', window.location); - - document.body.appendChild(formElement); - formElement.submit(); - } - }, { capture: true }); - }); -} -window.ActivateWorkflowActionsForDashboard = ActivateWorkflowActionsForDashboard; - -function ActivateWorkflowActionsForEditView(formSelector) { - const form = $(formSelector).get(0); - - const workflowActionElements = document.querySelectorAll('[data-workflow-action-name]'); - [...workflowActionElements].forEach((buttonElement) => { - buttonElement.addEventListener('click', (e) => { - if ('workflowActionModalUrl' in buttonElement.dataset) { - // This action requires opening a modal to collect additional data. + buttonElement.addEventListener( + 'click', + (e) => { // Stop the button from submitting the form e.preventDefault(); e.stopPropagation(); - // open the modal at the given URL - // eslint-disable-next-line no-undef - ModalWorkflow({ - url: buttonElement.dataset.workflowActionModalUrl, - onload: { - action(modal) { - modal.ajaxifyForm($('form', modal.body)); + if ('launchModal' in buttonElement.dataset) { + // eslint-disable-next-line no-undef + ModalWorkflow({ + url: buttonElement.dataset.workflowActionUrl, + onload: { + action(modal) { + const nextElement = document.createElement('input'); + nextElement.type = 'hidden'; + nextElement.name = 'next'; + nextElement.value = window.location; + $('form', modal.body).append(nextElement); + modal.ajaxifyForm($('form', modal.body)); + }, + success(modal, jsonData) { + window.location.href = jsonData.redirect; + }, }, - success(modal, jsonData) { - // a success response includes the additional data to submit with the edit form - addHiddenInput(form, 'action-workflow-action', 'true'); - addHiddenInput(form, 'workflow-action-name', buttonElement.dataset.workflowActionName); - addHiddenInput(form, 'workflow-action-extra-data', JSON.stringify(jsonData.cleaned_data)); - // note: need to submit via jQuery (as opposed to form.submit()) so that the onsubmit handler - // that disables the dirty-form prompt doesn't get bypassed - $(form).submit(); - } - }, - }); - } else { - // no modal, so let the form submission to the edit view proceed, with additional - // hidden inputs to tell it to perform our action - addHiddenInput(form, 'action-workflow-action', 'true'); - addHiddenInput(form, 'workflow-action-name', buttonElement.dataset.workflowActionName); - } - }, { capture: true }); + }); + } else { + // if not opening a modal, submit a POST request to the action url + const formElement = document.createElement('form'); + + formElement.action = buttonElement.dataset.workflowActionUrl; + formElement.method = 'POST'; + + addHiddenInput(formElement, 'csrfmiddlewaretoken', csrfToken); + addHiddenInput(formElement, 'next', window.location); + + document.body.appendChild(formElement); + formElement.submit(); + } + }, + { capture: true }, + ); + }); +} +window.ActivateWorkflowActionsForDashboard = + ActivateWorkflowActionsForDashboard; + +function ActivateWorkflowActionsForEditView(formSelector) { + const form = $(formSelector).get(0); + + const workflowActionElements = document.querySelectorAll( + '[data-workflow-action-name]', + ); + [...workflowActionElements].forEach((buttonElement) => { + buttonElement.addEventListener( + 'click', + (e) => { + if ('workflowActionModalUrl' in buttonElement.dataset) { + // This action requires opening a modal to collect additional data. + // Stop the button from submitting the form + e.preventDefault(); + e.stopPropagation(); + + // open the modal at the given URL + // eslint-disable-next-line no-undef + ModalWorkflow({ + url: buttonElement.dataset.workflowActionModalUrl, + onload: { + action(modal) { + modal.ajaxifyForm($('form', modal.body)); + }, + success(modal, jsonData) { + // a success response includes the additional data to submit with the edit form + addHiddenInput(form, 'action-workflow-action', 'true'); + addHiddenInput( + form, + 'workflow-action-name', + buttonElement.dataset.workflowActionName, + ); + addHiddenInput( + form, + 'workflow-action-extra-data', + JSON.stringify(jsonData.cleaned_data), + ); + // note: need to submit via jQuery (as opposed to form.submit()) so that the onsubmit handler + // that disables the dirty-form prompt doesn't get bypassed + $(form).submit(); + }, + }, + }); + } else { + // no modal, so let the form submission to the edit view proceed, with additional + // hidden inputs to tell it to perform our action + addHiddenInput(form, 'action-workflow-action', 'true'); + addHiddenInput( + form, + 'workflow-action-name', + buttonElement.dataset.workflowActionName, + ); + } + }, + { capture: true }, + ); }); } window.ActivateWorkflowActionsForEditView = ActivateWorkflowActionsForEditView; diff --git a/client/src/entrypoints/contrib/table_block/table.js b/client/src/entrypoints/contrib/table_block/table.js index 397de92fee..a535fb1c6f 100644 --- a/client/src/entrypoints/contrib/table_block/table.js +++ b/client/src/entrypoints/contrib/table_block/table.js @@ -23,7 +23,10 @@ function initTable(id, tableOptions) { }; const getHeight = function () { const tableParent = $('#' + id).parent(); - return tableParent.find('.htCore').height() + (tableParent.find('.input').height() * 2); + return ( + tableParent.find('.htCore').height() + + tableParent.find('.input').height() * 2 + ); }; const resizeTargets = ['.input > .handsontable', '.wtHider', '.wtHolder']; const resizeHeight = function (height) { @@ -38,7 +41,9 @@ function initTable(id, tableOptions) { }); const parentDiv = $('.widget-table_input').parent(); parentDiv.find('.field-content').width(width); - parentDiv.find('.fieldname-table .field-content .field-content').width('80%'); + parentDiv + .find('.fieldname-table .field-content .field-content') + .width('80%'); } try { @@ -49,7 +54,10 @@ function initTable(id, tableOptions) { if (dataForForm !== null) { if (dataForForm.hasOwnProperty('first_row_is_table_header')) { - tableHeaderCheckbox.prop('checked', dataForForm.first_row_is_table_header); + tableHeaderCheckbox.prop( + 'checked', + dataForForm.first_row_is_table_header, + ); } if (dataForForm.hasOwnProperty('first_col_is_header')) { colHeaderCheckbox.prop('checked', dataForForm.first_col_is_header); @@ -59,12 +67,15 @@ function initTable(id, tableOptions) { } } - if (!tableOptions.hasOwnProperty('width') || !tableOptions.hasOwnProperty('height')) { + if ( + !tableOptions.hasOwnProperty('width') || + !tableOptions.hasOwnProperty('height') + ) { // Size to parent .sequence-member-inner width if width is not given in tableOptions $(window).on('resize', () => { hot.updateSettings({ width: getWidth(), - height: getHeight() + height: getHeight(), }); resizeWidth('100%'); }); @@ -78,7 +89,7 @@ function initTable(id, tableOptions) { cellsClassnames.push({ row: meta[i].row, col: meta[i].col, - className: meta[i].className + className: meta[i].className, }); } } @@ -86,18 +97,20 @@ function initTable(id, tableOptions) { }; const persist = function () { - hiddenStreamInput.val(JSON.stringify({ - data: hot.getData(), - cell: getCellsClassnames(), - first_row_is_table_header: tableHeaderCheckbox.prop('checked'), - first_col_is_header: colHeaderCheckbox.prop('checked'), - table_caption: tableCaption.val() - })); + hiddenStreamInput.val( + JSON.stringify({ + data: hot.getData(), + cell: getCellsClassnames(), + first_row_is_table_header: tableHeaderCheckbox.prop('checked'), + first_col_is_header: colHeaderCheckbox.prop('checked'), + table_caption: tableCaption.val(), + }), + ); }; const cellEvent = function (change, source) { if (source === 'loadData') { - return; // don't save this change + return; // don't save this change } persist(); @@ -209,7 +222,7 @@ class TableInput {

- ${this.strings['A heading that identifies the overall topic of the table, and is useful for screen reader users'] } + ${this.strings['A heading that identifies the overall topic of the table, and is useful for screen reader users']}

diff --git a/client/src/entrypoints/contrib/table_block/table.test.js b/client/src/entrypoints/contrib/table_block/table.test.js index 9a7a8a9880..075dfed394 100644 --- a/client/src/entrypoints/contrib/table_block/table.test.js +++ b/client/src/entrypoints/contrib/table_block/table.test.js @@ -21,37 +21,39 @@ const TEST_OPTIONS = { 'remove_col', '---------', 'undo', - 'redo' + 'redo', ], editor: 'text', stretchH: 'all', height: 108, renderer: 'text', autoColumnSize: false, - language: 'en-us' + language: 'en-us', }; const TEST_STRINGS = { 'Row header': 'Row header', 'Display the first row as a header.': 'Display the first row as a header.', 'Column header': 'Column header', - 'Display the first column as a header.': 'Display the first column as a header.', + 'Display the first column as a header.': + 'Display the first column as a header.', 'Table caption': 'Table caption', - - 'A heading that identifies the overall topic of the table, and is useful for screen reader users': 'A heading that identifies the overall topic of the table, and is useful for screen reader users', - 'Table': 'Table' + + 'A heading that identifies the overall topic of the table, and is useful for screen reader users': + 'A heading that identifies the overall topic of the table, and is useful for screen reader users', + 'Table': 'Table', }; const TEST_VALUE = { data: [ ['Test', 'Heading'], ['Foo', '123'], - ['Bar', '456'] + ['Bar', '456'], ], cell: [], first_row_is_table_header: true, first_col_is_header: false, - table_caption: '' + table_caption: '', }; // Note: Tests both TableInput and initTable together as this is the only supported way to use them @@ -72,14 +74,16 @@ describe('telepath: wagtail.widgets.TableInput', () => { // Unpack and render a simple text block widget const widgetDef = window.telepath.unpack({ _type: 'wagtail.widgets.TableInput', - _args: [testOptions, testStrings] + _args: [testOptions, testStrings], }); return widgetDef.render($('#placeholder'), 'the-name', 'the-id', testValue); }; beforeEach(() => { handsontableConstructorMock = jest.fn(); - window.Handsontable = (...args) => { handsontableConstructorMock(...args); }; + window.Handsontable = (...args) => { + handsontableConstructorMock(...args); + }; window.Handsontable.prototype.render = jest.fn(); // Reset options, strings, and value for each test @@ -91,18 +95,28 @@ describe('telepath: wagtail.widgets.TableInput', () => { test('it renders correctly', () => { render(); expect(document.body.innerHTML).toMatchSnapshot(); - expect(document.querySelector('input[name="the-name"]').value).toEqual(JSON.stringify(testValue)); + expect(document.querySelector('input[name="the-name"]').value).toEqual( + JSON.stringify(testValue), + ); }); test('Handsontable constructor is called', () => { render(); expect(handsontableConstructorMock.mock.calls.length).toBe(1); - expect(handsontableConstructorMock.mock.calls[0][0]).toBe(document.getElementById('the-id-handsontable-container')); - expect(handsontableConstructorMock.mock.calls[0][1].autoColumnSize).toBe(false); + expect(handsontableConstructorMock.mock.calls[0][0]).toBe( + document.getElementById('the-id-handsontable-container'), + ); + expect(handsontableConstructorMock.mock.calls[0][1].autoColumnSize).toBe( + false, + ); expect(handsontableConstructorMock.mock.calls[0][1].cell).toEqual([]); expect(handsontableConstructorMock.mock.calls[0][1].colHeaders).toBe(false); - expect(handsontableConstructorMock.mock.calls[0][1].contextMenu).toEqual(testOptions.contextMenu); - expect(handsontableConstructorMock.mock.calls[0][1].data).toEqual(testValue.data); + expect(handsontableConstructorMock.mock.calls[0][1].contextMenu).toEqual( + testOptions.contextMenu, + ); + expect(handsontableConstructorMock.mock.calls[0][1].data).toEqual( + testValue.data, + ); expect(handsontableConstructorMock.mock.calls[0][1].editor).toBe('text'); expect(handsontableConstructorMock.mock.calls[0][1].height).toBe(108); expect(handsontableConstructorMock.mock.calls[0][1].language).toBe('en-us'); @@ -123,13 +137,16 @@ describe('telepath: wagtail.widgets.TableInput', () => { test('translation', () => { testStrings = { 'Row header': 'En-tête de ligne', - 'Display the first row as a header.': 'Affichez la première ligne sous forme d\'en-tête.', + 'Display the first row as a header.': + "Affichez la première ligne sous forme d'en-tête.", 'Column header': 'En-tête de colonne', - 'Display the first column as a header.': 'Affichez la première colonne sous forme d\'en-tête.', + 'Display the first column as a header.': + "Affichez la première colonne sous forme d'en-tête.", 'Table caption': 'Légende du tableau', - - 'A heading that identifies the overall topic of the table, and is useful for screen reader users': 'Un en-tête qui identifie le sujet général du tableau et qui est utile pour les utilisateurs de lecteurs d\'écran', - 'Table': 'Tableau' + + 'A heading that identifies the overall topic of the table, and is useful for screen reader users': + "Un en-tête qui identifie le sujet général du tableau et qui est utile pour les utilisateurs de lecteurs d'écran", + 'Table': 'Tableau', }; render(); expect(document.body.innerHTML).toMatchSnapshot(); @@ -149,6 +166,8 @@ describe('telepath: wagtail.widgets.TableInput', () => { const boundWidget = render(); testValue.data.push(['Baz', '789']); boundWidget.setState(testValue); - expect(document.querySelector('input[name="the-name"]').value).toEqual(JSON.stringify(testValue)); + expect(document.querySelector('input[name="the-name"]').value).toEqual( + JSON.stringify(testValue), + ); }); }); diff --git a/client/src/entrypoints/contrib/typed_table_block/typed_table_block.js b/client/src/entrypoints/contrib/typed_table_block/typed_table_block.js index 7f4c999a09..019f1b0226 100644 --- a/client/src/entrypoints/contrib/typed_table_block/typed_table_block.js +++ b/client/src/entrypoints/contrib/typed_table_block/typed_table_block.js @@ -2,7 +2,6 @@ import { escapeHtml as h } from '../../../utils/text'; - export class TypedTableBlock { constructor(blockDef, placeholder, prefix, initialState, initialError) { this.blockDef = blockDef; @@ -34,15 +33,19 @@ export class TypedTableBlock { this.rowCountIncludingDeleted = 0; this.prefix = prefix; this.childBlockDefsByName = {}; - this.blockDef.childBlockDefs.forEach(childBlockDef => { + this.blockDef.childBlockDefs.forEach((childBlockDef) => { this.childBlockDefsByName[childBlockDef.name] = childBlockDef; }); const strings = this.blockDef.meta.strings; const dom = $(`
- - + +
@@ -63,7 +66,9 @@ export class TypedTableBlock {
' + '', ).text(childBlockDef.meta.label); columnTypeButton.on('click', () => { if (this.addColumnCallback) this.addColumnCallback(childBlockDef); @@ -120,11 +125,13 @@ export class TypedTableBlock { const li = $('
  • ').append(columnTypeButton); this.addColumnMenu.append(li); }); - this.addColumnMenuBaseElement = null; // the element the add-column menu is attached to + this.addColumnMenuBaseElement = null; // the element the add-column menu is attached to this.appendColumnButton.on('click', () => { this.toggleAddColumnMenu(this.appendColumnButton, (chosenBlockDef) => { - this.insertColumn(this.columns.length, chosenBlockDef, { addInitialRow: true }); + this.insertColumn(this.columns.length, chosenBlockDef, { + addInitialRow: true, + }); }); }); @@ -169,8 +176,12 @@ export class TypedTableBlock { const headerRow = this.thead.children[0]; // delete all header cells except for the control columns - headerRow.replaceChildren(headerRow.firstElementChild, headerRow.lastElementChild); - this.appendColumnButton.text(this.blockDef.meta.strings.ADD_COLUMN) + headerRow.replaceChildren( + headerRow.firstElementChild, + headerRow.lastElementChild, + ); + this.appendColumnButton + .text(this.blockDef.meta.strings.ADD_COLUMN) .removeClass('button--icon text-replace white') .removeAttr('aria-label') .removeAttr('title'); @@ -214,7 +225,8 @@ export class TypedTableBlock { newHeaderCell.appendChild(column.positionInput); column.deletedInput = document.createElement('input'); column.deletedInput.type = 'hidden'; - column.deletedInput.name = this.prefix + '-column-' + column.id + '-deleted'; + column.deletedInput.name = + this.prefix + '-column-' + column.id + '-deleted'; column.deletedInput.value = ''; this.deletedFieldsContainer.appendChild(column.deletedInput); @@ -227,12 +239,15 @@ export class TypedTableBlock { $(newHeaderCell).append(prependColumnButton); prependColumnButton.on('click', () => { this.toggleAddColumnMenu(prependColumnButton, (chosenBlockDef) => { - this.insertColumn(column.position, chosenBlockDef, { addInitialRow: true }); + this.insertColumn(column.position, chosenBlockDef, { + addInitialRow: true, + }); }); }); column.headingInput = document.createElement('input'); - column.headingInput.name = this.prefix + '-column-' + column.id + '-heading'; + column.headingInput.name = + this.prefix + '-column-' + column.id + '-heading'; column.headingInput.className = 'column-heading'; column.headingInput.placeholder = this.blockDef.meta.strings.COLUMN_HEADING; newHeaderCell.appendChild(column.headingInput); @@ -249,7 +264,8 @@ export class TypedTableBlock { }); // add new cell to each body row - const initialCellState = this.blockDef.childBlockDefaultStates[blockDef.name]; + const initialCellState = + this.blockDef.childBlockDefaultStates[blockDef.name]; Array.from(this.tbody.children).forEach((tr, rowIndex) => { const row = this.rows[rowIndex]; const cells = tr.children; @@ -258,23 +274,23 @@ export class TypedTableBlock { // has an extra final cell to contain the 'delete row' button. // The +1 accounts for the 'control' column on the left side, holding the 'insert row' buttons. tr.insertBefore(newCellElement, cells[index + 1]); - const newCellBlock = this.initCell(newCellElement, column, row, initialCellState); + const newCellBlock = this.initCell( + newCellElement, + column, + row, + initialCellState, + ); row.blocks.splice(index, 0, newCellBlock); }); /* after first column is added, enable adding rows */ this.addRowButton.show(); - this.appendColumnButton.html( - '' - ) - .addClass( - 'button--icon text-replace white' + this.appendColumnButton + .html( + '', ) - .attr( - 'aria-label', this.blockDef.meta.strings.ADD_COLUMN - ) - .attr( - 'title', this.blockDef.meta.strings.ADD_COLUMN - ); + .addClass('button--icon text-replace white') + .attr('aria-label', this.blockDef.meta.strings.ADD_COLUMN) + .attr('title', this.blockDef.meta.strings.ADD_COLUMN); if (opts && opts.addInitialRow && this.tbody.children.length === 0) { /* add an initial row */ @@ -346,7 +362,8 @@ export class TypedTableBlock { initialState = initialStates[i]; } else { // use block's default state - initialState = this.blockDef.childBlockDefaultStates[column.blockDef.name]; + initialState = + this.blockDef.childBlockDefaultStates[column.blockDef.name]; } const newCell = document.createElement('td'); rowElement.appendChild(newCell); @@ -441,24 +458,26 @@ export class TypedTableBlock { getState() { const state = { - columns: this.columns.map(column => ( - { type: column.blockDef.name, heading: column.headingInput.value } - )), - rows: this.rows.map(row => ( - { values: row.blocks.map(block => block.getState()) } - )), + columns: this.columns.map((column) => ({ + type: column.blockDef.name, + heading: column.headingInput.value, + })), + rows: this.rows.map((row) => ({ + values: row.blocks.map((block) => block.getState()), + })), }; return state; } getValue() { const value = { - columns: this.columns.map(column => ( - { type: column.blockDef.name, heading: column.headingInput.value } - )), - rows: this.rows.map(row => ( - { values: row.blocks.map(block => block.getValue()) } - )), + columns: this.columns.map((column) => ({ + type: column.blockDef.name, + heading: column.headingInput.value, + })), + rows: this.rows.map((row) => ({ + values: row.blocks.map((block) => block.getValue()), + })), }; return value; } @@ -477,7 +496,7 @@ export class TypedTableBlock { // always use the first child, truncated as necessary result = childLabel; } else { - const newResult = (result + ', ' + childLabel); + const newResult = result + ', ' + childLabel; if (maxLength && newResult.length > maxLength - 1) { // too long, so don't add this; return the current list with an ellipsis instead if (!result.endsWith('…')) result += '…'; @@ -512,10 +531,19 @@ export class TypedTableBlockDefinition { } render(placeholder, prefix, initialState, initialError) { - return new TypedTableBlock(this, placeholder, prefix, initialState, initialError); + return new TypedTableBlock( + this, + placeholder, + prefix, + initialState, + initialError, + ); } } -window.telepath.register('wagtail.contrib.typed_table_block.blocks.TypedTableBlock', TypedTableBlockDefinition); +window.telepath.register( + 'wagtail.contrib.typed_table_block.blocks.TypedTableBlock', + TypedTableBlockDefinition, +); export class TypedTableBlockValidationError { constructor(cellErrors) { @@ -523,5 +551,6 @@ export class TypedTableBlockValidationError { } } window.telepath.register( - 'wagtail.contrib.typed_table_block.TypedTableBlockValidationError', TypedTableBlockValidationError + 'wagtail.contrib.typed_table_block.TypedTableBlockValidationError', + TypedTableBlockValidationError, ); diff --git a/client/src/entrypoints/contrib/typed_table_block/typed_table_block.test.js b/client/src/entrypoints/contrib/typed_table_block/typed_table_block.test.js index 545ad84395..f337c44172 100644 --- a/client/src/entrypoints/contrib/typed_table_block/typed_table_block.test.js +++ b/client/src/entrypoints/contrib/typed_table_block/typed_table_block.test.js @@ -27,18 +27,29 @@ class DummyWidgetDefinition { const widgetName = this.widgetName; constructor(widgetName, { name, id, initialState }); - $(placeholder).replaceWith(`

    ${widgetName}

    `); + $(placeholder).replaceWith( + `

    ${widgetName}

    `, + ); return { - setState(state) { setState(widgetName, state); }, - getState() { getState(widgetName); return `state: ${widgetName} - ${name}`; }, - getValue() { getValue(widgetName); return `value: ${widgetName} - ${name}`; }, - focus() { focus(widgetName); }, + setState(state) { + setState(widgetName, state); + }, + getState() { + getState(widgetName); + return `state: ${widgetName} - ${name}`; + }, + getValue() { + getValue(widgetName); + return `value: ${widgetName} - ${name}`; + }, + focus() { + focus(widgetName); + }, idForLabel: id, }; } } - describe('wagtail.contrib.typed_table_block.blocks.TypedTableBlock', () => { let blockDef; let boundBlock; @@ -61,8 +72,9 @@ describe('wagtail.contrib.typed_table_block.blocks.TypedTableBlock', () => { label: 'Test Block A', required: true, icon: 'placeholder', - classname: 'field char_field widget-text_input fieldname-test_charblock' - } + classname: + 'field char_field widget-text_input fieldname-test_charblock', + }, ); childBlockB = new FieldBlockDefinition( 'test_block_b', @@ -71,8 +83,9 @@ describe('wagtail.contrib.typed_table_block.blocks.TypedTableBlock', () => { label: 'Test Block B', required: true, icon: 'pilcrow', - classname: 'field char_field widget-admin_auto_height_text_input fieldname-test_textblock' - } + classname: + 'field char_field widget-admin_auto_height_text_input fieldname-test_textblock', + }, ); blockDef = new TypedTableBlockDefinition( @@ -98,21 +111,22 @@ describe('wagtail.contrib.typed_table_block.blocks.TypedTableBlock', () => { INSERT_ROW: 'Insert row', DELETE_ROW: 'Delete row', }, - } + }, ); // Render it document.body.innerHTML = '
    '; - boundBlock = blockDef.render(document.getElementById('placeholder'), 'mytable', { - columns: [ - { type: 'test_block_a', heading: 'Item' }, - { type: 'test_block_b', heading: 'Quantity' }, - ], - rows: [ - { values: ['Cheese', 3] }, - { values: ['Peas', 5] }, - ] - }); + boundBlock = blockDef.render( + document.getElementById('placeholder'), + 'mytable', + { + columns: [ + { type: 'test_block_a', heading: 'Item' }, + { type: 'test_block_b', heading: 'Quantity' }, + ], + rows: [{ values: ['Cheese', 3] }, { values: ['Peas', 5] }], + }, + ); }); test('it renders correctly', () => { @@ -125,14 +139,18 @@ describe('wagtail.contrib.typed_table_block.blocks.TypedTableBlock', () => { boundBlock.clear(); expect(boundBlock.columns.length).toBe(0); expect(boundBlock.rows.length).toBe(0); - expect(document.getElementsByName('mytable-column-count')[0].value).toBe('0'); + expect(document.getElementsByName('mytable-column-count')[0].value).toBe( + '0', + ); expect(document.getElementsByName('mytable-row-count')[0].value).toBe('0'); }); test('supports inserting columns', () => { boundBlock.insertColumn(1, childBlockA); expect(boundBlock.columns.length).toBe(3); - expect(document.getElementsByName('mytable-column-count')[0].value).toBe('3'); + expect(document.getElementsByName('mytable-column-count')[0].value).toBe( + '3', + ); }); test('supports deleting columns', () => { @@ -141,14 +159,18 @@ describe('wagtail.contrib.typed_table_block.blocks.TypedTableBlock', () => { // column count field still counts deleted columns (as it's used by the server-side code // to find out the maximum column ID to look for) - expect(document.getElementsByName('mytable-column-count')[0].value).toBe('2'); + expect(document.getElementsByName('mytable-column-count')[0].value).toBe( + '2', + ); }); test('counts deleted columns in column-count hidden field', () => { boundBlock.deleteColumn(0); boundBlock.insertColumn(1, childBlockA); expect(boundBlock.columns.length).toBe(2); - expect(document.getElementsByName('mytable-column-count')[0].value).toBe('3'); + expect(document.getElementsByName('mytable-column-count')[0].value).toBe( + '3', + ); }); test('supports inserting rows', () => { diff --git a/client/src/entrypoints/documents/document-chooser-telepath.js b/client/src/entrypoints/documents/document-chooser-telepath.js index 1d4542d239..4f495d8ea0 100644 --- a/client/src/entrypoints/documents/document-chooser-telepath.js +++ b/client/src/entrypoints/documents/document-chooser-telepath.js @@ -15,4 +15,7 @@ class DocumentChooser { return chooser; } } -window.telepath.register('wagtail.documents.widgets.DocumentChooser', DocumentChooser); +window.telepath.register( + 'wagtail.documents.widgets.DocumentChooser', + DocumentChooser, +); diff --git a/client/src/entrypoints/documents/document-chooser.js b/client/src/entrypoints/documents/document-chooser.js index ebb52944e5..9d939d2bdd 100644 --- a/client/src/entrypoints/documents/document-chooser.js +++ b/client/src/entrypoints/documents/document-chooser.js @@ -62,8 +62,8 @@ function createDocumentChooser(id) { responses: { documentChosen: (result) => { chooser.setState(result); - } - } + }, + }, }); }, diff --git a/client/src/entrypoints/images/image-chooser.js b/client/src/entrypoints/images/image-chooser.js index ecf43adb2c..71e4608d24 100644 --- a/client/src/entrypoints/images/image-chooser.js +++ b/client/src/entrypoints/images/image-chooser.js @@ -26,7 +26,7 @@ function createImageChooser(id) { url: previewImage.attr('src'), width: previewImage.attr('width'), height: previewImage.attr('height'), - } + }, }; } @@ -42,7 +42,7 @@ function createImageChooser(id) { width: newState.preview.width, height: newState.preview.height, alt: newState.title, - title: newState.title + title: newState.title, }); chooserElement.removeClass('blank'); editLink.attr('href', newState.edit_link); @@ -81,7 +81,7 @@ function createImageChooser(id) { clear: () => { chooser.setState(null); - } + }, }; /* hook up chooser API to the buttons */ diff --git a/client/src/entrypoints/snippets/snippet-chooser-telepath.js b/client/src/entrypoints/snippets/snippet-chooser-telepath.js index fadb7e111a..a09115dc34 100644 --- a/client/src/entrypoints/snippets/snippet-chooser-telepath.js +++ b/client/src/entrypoints/snippets/snippet-chooser-telepath.js @@ -15,4 +15,7 @@ class SnippetChooser { return chooser; } } -window.telepath.register('wagtail.snippets.widgets.SnippetChooser', SnippetChooser); +window.telepath.register( + 'wagtail.snippets.widgets.SnippetChooser', + SnippetChooser, +); diff --git a/client/src/entrypoints/snippets/snippet-chooser.js b/client/src/entrypoints/snippets/snippet-chooser.js index 33ebfc4e11..7680f28f9b 100644 --- a/client/src/entrypoints/snippets/snippet-chooser.js +++ b/client/src/entrypoints/snippets/snippet-chooser.js @@ -80,7 +80,6 @@ function createSnippetChooser(id) { clear: () => { chooser.setState(null); }, - }; $('.action-choose', chooserElement).on('click', () => { diff --git a/client/src/includes/initIE11Warning.js b/client/src/includes/initIE11Warning.js index 879c3c741c..8739f62cd0 100644 --- a/client/src/includes/initIE11Warning.js +++ b/client/src/includes/initIE11Warning.js @@ -8,9 +8,11 @@ const initIE11Warning = () => { return; } - const warnings = [].slice.call(document.querySelectorAll('[data-ie11-warning]')); + const warnings = [].slice.call( + document.querySelectorAll('[data-ie11-warning]'), + ); - warnings.forEach(warning => { + warnings.forEach((warning) => { // eslint-disable-next-line no-param-reassign warning.hidden = false; }); diff --git a/client/src/includes/initSubmenus.js b/client/src/includes/initSubmenus.js index 482432a915..6f67402b32 100644 --- a/client/src/includes/initSubmenus.js +++ b/client/src/includes/initSubmenus.js @@ -10,21 +10,21 @@ const initSubmenus = () => { } const subMenuTriggers = document.querySelectorAll( - '[data-nav-primary-submenu-trigger]' + '[data-nav-primary-submenu-trigger]', ); const activeClass = 'submenu-active'; - [...subMenuTriggers].forEach(subMenuTrigger => { - subMenuTrigger.addEventListener('click', clickEvent => { + [...subMenuTriggers].forEach((subMenuTrigger) => { + subMenuTrigger.addEventListener('click', (clickEvent) => { const submenuContainer = subMenuTrigger.parentNode; primaryNavContainer.classList.remove(activeClass); - [...subMenuTriggers].forEach(sm => sm.classList.remove(activeClass)); + [...subMenuTriggers].forEach((sm) => sm.classList.remove(activeClass)); primaryNavContainer.classList.toggle(activeClass); submenuContainer.classList.toggle(activeClass); - document.addEventListener('mousedown', e => { + document.addEventListener('mousedown', (e) => { if ( !submenuContainer.contains(e.target) && subMenuTrigger !== e.target @@ -34,7 +34,7 @@ const initSubmenus = () => { } }); - document.addEventListener('keydown', e => { + document.addEventListener('keydown', (e) => { // IE11 uses "Esc" instead of "Escape" if (e.key === 'Escape' || e.key === 'Esc') { primaryNavContainer.classList.remove(activeClass); diff --git a/client/src/utils/actions.ts b/client/src/utils/actions.ts index 6bcac7a5e8..a9130285bd 100644 --- a/client/src/utils/actions.ts +++ b/client/src/utils/actions.ts @@ -15,7 +15,7 @@ interface Action { export function createAction( type: N, actionCreator: (...args: T) => P = identity, - metaCreator?: (...args: T) => M + metaCreator?: (...args: T) => M, ): (...args: T) => Action { return (...args) => { const action: Action = { diff --git a/client/src/utils/cleanForSlug.js b/client/src/utils/cleanForSlug.js index df1e7ed34c..38f65614e5 100644 --- a/client/src/utils/cleanForSlug.js +++ b/client/src/utils/cleanForSlug.js @@ -14,7 +14,13 @@ export function cleanForSlug(val, useURLify) { // just do the "replace" if (window.unicodeSlugsEnabled) { - return val.replace(/\s/g, '-').replace(/[&/\\#,+()$~%.'":`@^!*?<>{}]/g, '').toLowerCase(); + return val + .replace(/\s/g, '-') + .replace(/[&/\\#,+()$~%.'":`@^!*?<>{}]/g, '') + .toLowerCase(); } - return val.replace(/\s/g, '-').replace(/[^A-Za-z0-9\-_]/g, '').toLowerCase(); + return val + .replace(/\s/g, '-') + .replace(/[^A-Za-z0-9\-_]/g, '') + .toLowerCase(); } diff --git a/client/src/utils/cleanForSlug.test.js b/client/src/utils/cleanForSlug.test.js index d582e44559..d464303d95 100644 --- a/client/src/utils/cleanForSlug.test.js +++ b/client/src/utils/cleanForSlug.test.js @@ -1,5 +1,6 @@ // eslint-disable-next-line no-unused-expressions -require('../../../wagtail/admin/static_src/wagtailadmin/js/vendor/urlify').default; +require('../../../wagtail/admin/static_src/wagtailadmin/js/vendor/urlify') + .default; import { cleanForSlug } from './cleanForSlug'; describe('page-editor tests', () => { @@ -12,9 +13,13 @@ describe('page-editor tests', () => { /* true triggers to use django's urlify */ expect(cleanForSlug('Before', true)).toBe('before'); expect(cleanForSlug('The', true)).toBe('the'); - expect(cleanForSlug('Before the sun rises', true)).toBe('before-the-sun-rises'); + expect(cleanForSlug('Before the sun rises', true)).toBe( + 'before-the-sun-rises', + ); expect(cleanForSlug('ON', true)).toBe('on'); - expect(cleanForSlug('ON this day in november', true)).toBe('on-this-day-in-november'); + expect(cleanForSlug('ON this day in november', true)).toBe( + 'on-this-day-in-november', + ); expect(cleanForSlug('This & That', true)).toBe('this-that'); }); @@ -22,9 +27,13 @@ describe('page-editor tests', () => { /* false triggers ignores django's urlify */ expect(cleanForSlug('Before', false)).toBe('before'); expect(cleanForSlug('The', false)).toBe('the'); - expect(cleanForSlug('Before the sun rises', false)).toBe('before-the-sun-rises'); + expect(cleanForSlug('Before the sun rises', false)).toBe( + 'before-the-sun-rises', + ); expect(cleanForSlug('ON', false)).toBe('on'); - expect(cleanForSlug('ON this day in november', false)).toBe('on-this-day-in-november'); + expect(cleanForSlug('ON this day in november', false)).toBe( + 'on-this-day-in-november', + ); expect(cleanForSlug('This & That', false)).toBe('this--that'); }); }); diff --git a/client/src/utils/focus.js b/client/src/utils/focus.js index 08cb13d2a5..53992d8619 100644 --- a/client/src/utils/focus.js +++ b/client/src/utils/focus.js @@ -20,7 +20,7 @@ export const initFocusOutline = () => { window.addEventListener('mousedown', removeFocusOutline); window.addEventListener('touchstart', removeFocusOutline); - window.addEventListener('keydown', e => { + window.addEventListener('keydown', (e) => { const isTabKey = e.keyCode === 9; if (isTabKey) { diff --git a/client/src/utils/focus.test.js b/client/src/utils/focus.test.js index ff0739a7b4..df8e106a0e 100644 --- a/client/src/utils/focus.test.js +++ b/client/src/utils/focus.test.js @@ -14,8 +14,8 @@ describe('initFocusOutline', () => { initFocusOutline(); window.dispatchEvent( Object.assign(new Event('keydown'), { - keyCode: 9 - }) + keyCode: 9, + }), ); expect(document.body.className).toBe('focus-outline-on'); }); @@ -29,8 +29,8 @@ describe('initFocusOutline', () => { it('removes styles when using a mouse', () => { window.dispatchEvent( Object.assign(new Event('keydown'), { - keyCode: 9 - }) + keyCode: 9, + }), ); window.dispatchEvent(new Event('mousedown')); expect(document.body.className).toBe('focus-outline-off'); @@ -39,8 +39,8 @@ describe('initFocusOutline', () => { it('removes styles when using a touch screen', () => { window.dispatchEvent( Object.assign(new Event('keydown'), { - keyCode: 9 - }) + keyCode: 9, + }), ); window.dispatchEvent(new Event('touchstart')); expect(document.body.className).toBe('focus-outline-off'); diff --git a/client/src/utils/performance.js b/client/src/utils/performance.js index 4ac8deb577..11c942553e 100644 --- a/client/src/utils/performance.js +++ b/client/src/utils/performance.js @@ -28,6 +28,4 @@ if (process.env.NODE_ENV !== 'production') { }; } -export { - perfMiddleware, -}; +export { perfMiddleware }; diff --git a/client/src/utils/version.js b/client/src/utils/version.js index 64aedc22eb..3e9e075077 100644 --- a/client/src/utils/version.js +++ b/client/src/utils/version.js @@ -17,7 +17,4 @@ function versionOutOfDate(latestVersion, currentVersion) { return compareVersion(latestVersion, currentVersion) > 0; } -export { - compareVersion, - versionOutOfDate, -}; +export { compareVersion, versionOutOfDate }; diff --git a/client/tests/integration/.eslintrc.js b/client/tests/integration/.eslintrc.js index 57c0bfedcb..3ac3678939 100644 --- a/client/tests/integration/.eslintrc.js +++ b/client/tests/integration/.eslintrc.js @@ -12,10 +12,10 @@ module.exports = { env: { jest: true, browser: true, - node: true + node: true, }, globals: { page: 'readonly', - TEST_ORIGIN: 'readonly' + TEST_ORIGIN: 'readonly', }, }; diff --git a/client/tests/integration/PuppeteerEnvironment.js b/client/tests/integration/PuppeteerEnvironment.js index 91ac2f1c0c..a9bdbff151 100644 --- a/client/tests/integration/PuppeteerEnvironment.js +++ b/client/tests/integration/PuppeteerEnvironment.js @@ -19,7 +19,8 @@ class PuppeteerEnvironment extends NodeEnvironment { throw new Error('wsEndpoint not found'); } - this.global.TEST_ORIGIN = process.env.TEST_ORIGIN ?? 'http://localhost:8000'; + this.global.TEST_ORIGIN = + process.env.TEST_ORIGIN ?? 'http://localhost:8000'; // connect to puppeteer this.global.browser = await puppeteer.connect({ diff --git a/client/tests/integration/editbird.test.js b/client/tests/integration/editbird.test.js index 83de94d807..800b521b15 100644 --- a/client/tests/integration/editbird.test.js +++ b/client/tests/integration/editbird.test.js @@ -7,10 +7,12 @@ describe.skip('Editbird', () => { const trigger = await page.$('[aria-controls="wagtail-userbar-items"]'); await Promise.all([ trigger.click(), - page.waitForSelector('[aria-labelledby="wagtail-userbar-trigger"]', { visible: true }), + page.waitForSelector('[aria-labelledby="wagtail-userbar-trigger"]', { + visible: true, + }), ]); await expect(page).toPassAxeTests({ - exclude: '[role="menuitem"]' + exclude: '[role="menuitem"]', }); }); }); diff --git a/client/tests/integration/editor.test.js b/client/tests/integration/editor.test.js index 19379f3397..5f40beff9e 100644 --- a/client/tests/integration/editor.test.js +++ b/client/tests/integration/editor.test.js @@ -2,9 +2,7 @@ describe('Editor', () => { const globalEditorExcludes = '.skiplink, .sidebar__collapse-toggle, #wagtail-sidebar, li[aria-controls^="tab-"]'; beforeAll(async () => { - await page.goto( - `${TEST_ORIGIN}/admin/pages/add/demosite/standardpage/2/` - ); + await page.goto(`${TEST_ORIGIN}/admin/pages/add/demosite/standardpage/2/`); }); it('has the right heading', async () => { diff --git a/client/tests/integration/groups.test.js b/client/tests/integration/groups.test.js index ece98d9566..e31e4c4dcc 100644 --- a/client/tests/integration/groups.test.js +++ b/client/tests/integration/groups.test.js @@ -9,7 +9,7 @@ describe('Groups', () => { it('axe', async () => { await expect(page).toPassAxeTests({ - exclude: '.skiplink, .sidebar__collapse-toggle, #wagtail-sidebar' + exclude: '.skiplink, .sidebar__collapse-toggle, #wagtail-sidebar', }); }); }); diff --git a/client/tests/integration/jest.config.js b/client/tests/integration/jest.config.js index b91082b996..15581ca9d7 100644 --- a/client/tests/integration/jest.config.js +++ b/client/tests/integration/jest.config.js @@ -2,8 +2,5 @@ module.exports = { globalSetup: './setup.js', globalTeardown: './teardown.js', testEnvironment: './PuppeteerEnvironment.js', - setupFilesAfterEnv: [ - 'expect-puppeteer', - '@wordpress/jest-puppeteer-axe' - ] + setupFilesAfterEnv: ['expect-puppeteer', '@wordpress/jest-puppeteer-axe'], }; diff --git a/client/tests/integration/listing.test.js b/client/tests/integration/listing.test.js index d2a03a9910..c45d218d9d 100644 --- a/client/tests/integration/listing.test.js +++ b/client/tests/integration/listing.test.js @@ -4,12 +4,15 @@ describe('Listing', () => { }); it('has the right heading', async () => { - expect(await page.title()).toContain('Wagtail - Exploring Welcome to your new Wagtail site!'); + expect(await page.title()).toContain( + 'Wagtail - Exploring Welcome to your new Wagtail site!', + ); }); it('axe', async () => { await expect(page).toPassAxeTests({ - exclude: '.skiplink, .sidebar__collapse-toggle, #wagtail-sidebar, a[href$="dummy-button"]' + exclude: + '.skiplink, .sidebar__collapse-toggle, #wagtail-sidebar, a[href$="dummy-button"]', }); }); }); diff --git a/client/tests/integration/users.test.js b/client/tests/integration/users.test.js index df101bedbb..920474b6b0 100644 --- a/client/tests/integration/users.test.js +++ b/client/tests/integration/users.test.js @@ -7,7 +7,7 @@ describe('Users', () => { const toggle = await page.$('[aria-label="Select all"]'); await toggle.click(); await expect(page).toPassAxeTests({ - exclude: '.skiplink, .sidebar__collapse-toggle, #wagtail-sidebar' + exclude: '.skiplink, .sidebar__collapse-toggle, #wagtail-sidebar', }); }); }); diff --git a/client/tests/mock-fetch.js b/client/tests/mock-fetch.js index c7ab2853d0..95e6aee32d 100644 --- a/client/tests/mock-fetch.js +++ b/client/tests/mock-fetch.js @@ -4,26 +4,32 @@ global.Headers = jest.fn(); // Helper to mock a success response. fetch.mockResponseSuccess = (body) => { - fetch.mockImplementationOnce(() => Promise.resolve({ - json: () => Promise.resolve(JSON.parse(body)), - status: 200, - statusText: 'OK', - })); + fetch.mockImplementationOnce(() => + Promise.resolve({ + json: () => Promise.resolve(JSON.parse(body)), + status: 200, + statusText: 'OK', + }), + ); }; // Helper to mock a failure response. fetch.mockResponseFailure = () => { - fetch.mockImplementationOnce(() => Promise.resolve({ - status: 500, - statusText: 'Internal Error', - })); + fetch.mockImplementationOnce(() => + Promise.resolve({ + status: 500, + statusText: 'Internal Error', + }), + ); }; fetch.mockResponseCrash = () => { - fetch.mockImplementationOnce(() => Promise.reject({ - status: 500, - statusText: 'Internal Error', - })); + fetch.mockImplementationOnce(() => + Promise.reject({ + status: 500, + statusText: 'Internal Error', + }), + ); }; // Helper to mock a timeout response. diff --git a/client/tests/stubs.js b/client/tests/stubs.js index 7d90a1ffda..c0d28e52fa 100644 --- a/client/tests/stubs.js +++ b/client/tests/stubs.js @@ -40,12 +40,13 @@ global.wagtailConfig = { RELOAD_EDITOR: 'Reload saved content', SHOW_LATEST_CONTENT: 'Show latest content', SHOW_ERROR: 'Show error', - EDITOR_CRASH: 'The editor just crashed. Content has been reset to the last saved version.', + EDITOR_CRASH: + 'The editor just crashed. Content has been reset to the last saved version.', BROKEN_LINK: 'Broken link', MISSING_DOCUMENT: 'Missing document', CLOSE: 'Close', - EDIT_PAGE: 'Edit \'{title}\'', - VIEW_CHILD_PAGES_OF_PAGE: 'View child pages of \'{title}\'', + EDIT_PAGE: "Edit '{title}'", + VIEW_CHILD_PAGES_OF_PAGE: "View child pages of '{title}'", PAGE_EXPLORER: 'Page explorer', SAVE: 'Save', SAVING: 'Saving...', @@ -72,14 +73,14 @@ global.wagtailConfig = { LOCALES: [ { code: 'en', - display_name: 'English' + display_name: 'English', }, { code: 'fr', - display_nam: 'French' - } + display_nam: 'French', + }, ], - ACTIVE_LOCALE: 'en' + ACTIVE_LOCALE: 'en', }; global.wagtailVersion = '1.6a1'; diff --git a/client/webpack.config.js b/client/webpack.config.js index e50bff4d14..b5f69e89cb 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -10,7 +10,7 @@ const getOutputPath = (app, folder, filename) => { 'contrib/typed_table_block': 'typed_table_block', 'contrib/styleguide': 'wagtailstyleguide', 'contrib/modeladmin': 'wagtailmodeladmin', - } + }; const appLabel = exceptions[app] || `wagtail${app}`; @@ -59,31 +59,18 @@ module.exports = function exports(env, argv) { 'wagtailadmin', 'workflow-action', 'workflow-status', - 'bulk-actions' - ], - 'images': [ - 'image-chooser', - 'image-chooser-telepath', - ], - 'documents': [ - 'document-chooser', - 'document-chooser-telepath', - ], - 'snippets': [ - 'snippet-chooser', - 'snippet-chooser-telepath', - ], - 'contrib/table_block': [ - 'table', - ], - 'contrib/typed_table_block': [ - 'typed_table_block', + 'bulk-actions', ], + 'images': ['image-chooser', 'image-chooser-telepath'], + 'documents': ['document-chooser', 'document-chooser-telepath'], + 'snippets': ['snippet-chooser', 'snippet-chooser-telepath'], + 'contrib/table_block': ['table'], + 'contrib/typed_table_block': ['typed_table_block'], }; const entry = {}; for (const [appName, moduleNames] of Object.entries(entrypoints)) { - moduleNames.forEach(moduleName => { + moduleNames.forEach((moduleName) => { entry[moduleName] = { import: [`./client/src/entrypoints/${appName}/${moduleName}.js`], filename: getOutputPath(appName, 'js', moduleName) + '.js', @@ -100,31 +87,226 @@ module.exports = function exports(env, argv) { } const sassEntry = {}; - sassEntry[getOutputPath('admin', 'css', 'core')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'core.scss'); - sassEntry[getOutputPath('admin', 'css', 'layouts/404')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'layouts', '404.scss'); - sassEntry[getOutputPath('admin', 'css', 'layouts/account')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'layouts', 'account.scss'); - sassEntry[getOutputPath('admin', 'css', 'layouts/compare-revisions')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'layouts', 'compare-revisions.scss'); - sassEntry[getOutputPath('admin', 'css', 'layouts/home')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'layouts', 'home.scss'); - sassEntry[getOutputPath('admin', 'css', 'layouts/login')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'layouts', 'login.scss'); - sassEntry[getOutputPath('admin', 'css', 'layouts/page-editor')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'layouts', 'page-editor.scss'); - sassEntry[getOutputPath('admin', 'css', 'layouts/report')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'layouts', 'report.scss'); - sassEntry[getOutputPath('admin', 'css', 'layouts/workflow-edit')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'layouts', 'workflow-edit.scss'); - sassEntry[getOutputPath('admin', 'css', 'layouts/workflow-progress')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'layouts', 'workflow-progress.scss'); + sassEntry[getOutputPath('admin', 'css', 'core')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'core.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'layouts/404')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'layouts', + '404.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'layouts/account')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'layouts', + 'account.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'layouts/compare-revisions')] = + path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'layouts', + 'compare-revisions.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'layouts/home')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'layouts', + 'home.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'layouts/login')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'layouts', + 'login.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'layouts/page-editor')] = + path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'layouts', + 'page-editor.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'layouts/report')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'layouts', + 'report.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'layouts/workflow-edit')] = + path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'layouts', + 'workflow-edit.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'layouts/workflow-progress')] = + path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'layouts', + 'workflow-progress.scss', + ); // sassEntry[getOutputPath('admin', 'css', 'normalize')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'css', 'normalize.css'); - sassEntry[getOutputPath('admin', 'css', 'panels/draftail')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'panels', 'draftail.scss'); - sassEntry[getOutputPath('admin', 'css', 'panels/hallo')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'panels', 'hallo.scss'); - sassEntry[getOutputPath('admin', 'css', 'panels/streamfield')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'panels', 'streamfield.scss'); - sassEntry[getOutputPath('admin', 'css', 'sidebar')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'sidebar.scss'); - sassEntry[getOutputPath('admin', 'css', 'userbar')] = path.resolve('wagtail', 'admin', 'static_src', 'wagtailadmin', 'scss', 'userbar.scss'); - sassEntry[getOutputPath('documents', 'css', 'add-multiple')] = path.resolve('wagtail', 'documents', 'static_src', 'wagtaildocs', 'scss', 'add-multiple.scss'); - sassEntry[getOutputPath('images', 'css', 'add-multiple')] = path.resolve('wagtail', 'images', 'static_src', 'wagtailimages', 'scss', 'add-multiple.scss'); - sassEntry[getOutputPath('images', 'css', 'focal-point-chooser')] = path.resolve('wagtail', 'images', 'static_src', 'wagtailimages', 'scss', 'focal-point-chooser.scss'); - sassEntry[getOutputPath('users', 'css', 'groups_edit')] = path.resolve('wagtail', 'users', 'static_src', 'wagtailusers', 'scss', 'groups_edit.scss'); - sassEntry[getOutputPath('contrib/styleguide', 'css', 'styleguide')] = path.resolve('wagtail', 'contrib', 'styleguide', 'static_src', 'wagtailstyleguide', 'scss', 'styleguide.scss'); - sassEntry[getOutputPath('contrib/modeladmin', 'css', 'index')] = path.resolve('wagtail', 'contrib', 'modeladmin', 'static_src', 'wagtailmodeladmin', 'scss', 'index.scss'); - sassEntry[getOutputPath('contrib/modeladmin', 'css', 'breadcrumbs_page')] = path.resolve('wagtail', 'contrib', 'modeladmin', 'static_src', 'wagtailmodeladmin', 'scss', 'breadcrumbs_page.scss'); - sassEntry[getOutputPath('contrib/modeladmin', 'css', 'choose_parent_page')] = path.resolve('wagtail', 'contrib', 'modeladmin', 'static_src', 'wagtailmodeladmin', 'scss', 'choose_parent_page.scss'); - sassEntry[getOutputPath('contrib/typed_table_block', 'css', 'typed_table_block')] = path.resolve('wagtail', 'contrib', 'typed_table_block', 'static_src', 'typed_table_block', 'scss', 'typed_table_block.scss'); + sassEntry[getOutputPath('admin', 'css', 'panels/draftail')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'panels', + 'draftail.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'panels/hallo')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'panels', + 'hallo.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'panels/streamfield')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'panels', + 'streamfield.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'sidebar')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'sidebar.scss', + ); + sassEntry[getOutputPath('admin', 'css', 'userbar')] = path.resolve( + 'wagtail', + 'admin', + 'static_src', + 'wagtailadmin', + 'scss', + 'userbar.scss', + ); + sassEntry[getOutputPath('documents', 'css', 'add-multiple')] = path.resolve( + 'wagtail', + 'documents', + 'static_src', + 'wagtaildocs', + 'scss', + 'add-multiple.scss', + ); + sassEntry[getOutputPath('images', 'css', 'add-multiple')] = path.resolve( + 'wagtail', + 'images', + 'static_src', + 'wagtailimages', + 'scss', + 'add-multiple.scss', + ); + sassEntry[getOutputPath('images', 'css', 'focal-point-chooser')] = + path.resolve( + 'wagtail', + 'images', + 'static_src', + 'wagtailimages', + 'scss', + 'focal-point-chooser.scss', + ); + sassEntry[getOutputPath('users', 'css', 'groups_edit')] = path.resolve( + 'wagtail', + 'users', + 'static_src', + 'wagtailusers', + 'scss', + 'groups_edit.scss', + ); + sassEntry[getOutputPath('contrib/styleguide', 'css', 'styleguide')] = + path.resolve( + 'wagtail', + 'contrib', + 'styleguide', + 'static_src', + 'wagtailstyleguide', + 'scss', + 'styleguide.scss', + ); + sassEntry[getOutputPath('contrib/modeladmin', 'css', 'index')] = path.resolve( + 'wagtail', + 'contrib', + 'modeladmin', + 'static_src', + 'wagtailmodeladmin', + 'scss', + 'index.scss', + ); + sassEntry[getOutputPath('contrib/modeladmin', 'css', 'breadcrumbs_page')] = + path.resolve( + 'wagtail', + 'contrib', + 'modeladmin', + 'static_src', + 'wagtailmodeladmin', + 'scss', + 'breadcrumbs_page.scss', + ); + sassEntry[getOutputPath('contrib/modeladmin', 'css', 'choose_parent_page')] = + path.resolve( + 'wagtail', + 'contrib', + 'modeladmin', + 'static_src', + 'wagtailmodeladmin', + 'scss', + 'choose_parent_page.scss', + ); + sassEntry[ + getOutputPath('contrib/typed_table_block', 'css', 'typed_table_block') + ] = path.resolve( + 'wagtail', + 'contrib', + 'typed_table_block', + 'static_src', + 'typed_table_block', + 'scss', + 'typed_table_block.scss', + ); return { entry: { @@ -156,15 +338,51 @@ module.exports = function exports(env, argv) { }), new CopyPlugin({ patterns: [ - { from: 'wagtail/admin/static_src/', to: 'wagtail/admin/static/', globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] } }, - { from: 'wagtail/documents/static_src/', to: 'wagtail/documents/static/', globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] } }, - { from: 'wagtail/embeds/static_src/', to: 'wagtail/embeds/static/', globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] } }, - { from: 'wagtail/images/static_src/', to: 'wagtail/images/static/', globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] } }, - { from: 'wagtail/search/static_src/', to: 'wagtail/search/static/', globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] } }, - { from: 'wagtail/snippets/static_src/', to: 'wagtail/snippets/static/', globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] } }, - { from: 'wagtail/users/static_src/', to: 'wagtail/users/static/', globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] } }, - { from: 'wagtail/contrib/settings/static_src/', to: 'wagtail/contrib/settings/static/', globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] } }, - { from: 'wagtail/contrib/modeladmin/static_src/', to: 'wagtail/contrib/modeladmin/static/', globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] } }, + { + from: 'wagtail/admin/static_src/', + to: 'wagtail/admin/static/', + globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] }, + }, + { + from: 'wagtail/documents/static_src/', + to: 'wagtail/documents/static/', + globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] }, + }, + { + from: 'wagtail/embeds/static_src/', + to: 'wagtail/embeds/static/', + globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] }, + }, + { + from: 'wagtail/images/static_src/', + to: 'wagtail/images/static/', + globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] }, + }, + { + from: 'wagtail/search/static_src/', + to: 'wagtail/search/static/', + globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] }, + }, + { + from: 'wagtail/snippets/static_src/', + to: 'wagtail/snippets/static/', + globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] }, + }, + { + from: 'wagtail/users/static_src/', + to: 'wagtail/users/static/', + globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] }, + }, + { + from: 'wagtail/contrib/settings/static_src/', + to: 'wagtail/contrib/settings/static/', + globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] }, + }, + { + from: 'wagtail/contrib/modeladmin/static_src/', + to: 'wagtail/contrib/modeladmin/static/', + globOptions: { ignore: ['**/{app,scss}/**', '*.{css,txt}'] }, + }, ], }), ], @@ -197,35 +415,34 @@ module.exports = function exports(env, argv) { loader: 'postcss-loader', options: { postcssOptions: { - plugins: [ - "autoprefixer", - "cssnano", - ] - } + plugins: ['autoprefixer', 'cssnano'], + }, }, }, - 'sass-loader' + 'sass-loader', ], }, - ].concat(Object.keys(exposedDependencies).map((name) => { - const globalName = exposedDependencies[name]; + ].concat( + Object.keys(exposedDependencies).map((name) => { + const globalName = exposedDependencies[name]; - // Create expose-loader configs for each Wagtail dependency. - return { - test: require.resolve(name), - use: [ - { - loader: 'expose-loader', - options: { - exposes: { - globalName, - override: true - } + // Create expose-loader configs for each Wagtail dependency. + return { + test: require.resolve(name), + use: [ + { + loader: 'expose-loader', + options: { + exposes: { + globalName, + override: true, + }, + }, }, - }, - ], - }; - })) + ], + }; + }), + ), }, optimization: { @@ -253,7 +470,7 @@ module.exports = function exports(env, argv) { // Disable performance hints – currently there are much more valuable // optimizations for us to do outside of Webpack performance: { - hints: false + hints: false, }, stats: { diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css index f3ff66ed24..041feafcbb 100644 --- a/docs/_static/css/custom.css +++ b/docs/_static/css/custom.css @@ -1,92 +1,95 @@ body.wy-body-for-nav { - font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif; - line-height: 1.5em; - color: #333; /*$color-grey-1*/ - background-color: #e6e6e6; /*$color-grey-4*/ + font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, + Arial, sans-serif; + line-height: 1.5em; + color: #333; /*$color-grey-1*/ + background-color: #e6e6e6; /*$color-grey-4*/ } nav.wy-nav-side { - background-color: #333; /*color-grey-1*/ + background-color: #333; /*color-grey-1*/ } .body--autocomplete-open .wy-nav-side { - position: absolute; - overflow: visible; + position: absolute; + overflow: visible; } .body--autocomplete-open .wy-side-scroll { - overflow: visible; + overflow: visible; } div.wy-side-nav-search { - background-color: #007d7e; /*color-teal*/ + background-color: #007d7e; /*color-teal*/ } .wy-nav-top { - background-color: #007d7e; /*color-teal*/ + background-color: #007d7e; /*color-teal*/ } -.wy-side-nav-search>a:hover, .wy-side-nav-search .wy-dropdown>a:hover { - background: None; /*background for logo*/ +.wy-side-nav-search > a:hover, +.wy-side-nav-search .wy-dropdown > a:hover { + background: None; /*background for logo*/ } -.wy-side-nav-search>div.version { - color: white; +.wy-side-nav-search > div.version { + color: white; } -.wy-side-nav-search input[type=text] { - border-color: #d9d9d9; /*color-grey-3*/ +.wy-side-nav-search input[type='text'] { + border-color: #d9d9d9; /*color-grey-3*/ } .logo { - transition: all 0.25s cubic-bezier(0.28, 0.15, 0, 2.1); + transition: all 0.25s cubic-bezier(0.28, 0.15, 0, 2.1); } .logo:hover { - transform: rotate(4deg); + transform: rotate(4deg); } details { - margin-bottom: 1em; + margin-bottom: 1em; } /* Wagtail Space */ a.wagtailspace { - background: #00676a; - color: white; - padding: 15px; - border-radius: 6px; - margin-bottom: 1.25em; - display: flex; - justify-content: space-between; - align-items: flex-start; + background: #00676a; + color: white; + padding: 15px; + border-radius: 6px; + margin-bottom: 1.25em; + display: flex; + justify-content: space-between; + align-items: flex-start; } .wagtailspace svg { - margin-right: 1em; - width: 56px; + margin-right: 1em; + width: 56px; } .wagtailspace div { - text-align: left; - flex-grow: 2; + text-align: left; + flex-grow: 2; } .wagtailspace strong { - font-size: 1.25em; + font-size: 1.25em; } .wagtailspace .close { - margin-left: 1em; - margin-bottom: 1em; - cursor: pointer; - font-weight: bold; - font-size: 1.25em; + margin-left: 1em; + margin-bottom: 1em; + cursor: pointer; + font-weight: bold; + font-size: 1.25em; } /* Bounce the UFO on hover */ @-webkit-keyframes bounce { - 0%, 100% { + 0%, + 100% { -webkit-transform: translateY(0); } 50% { @@ -95,7 +98,8 @@ a.wagtailspace { } @keyframes bounce { - 0%, 100% { + 0%, + 100% { transform: translateY(0); } 50% { @@ -104,8 +108,8 @@ a.wagtailspace { } a.wagtailspace:hover svg { - -webkit-animation-duration: .5s; - animation-duration: .5s; + -webkit-animation-duration: 0.5s; + animation-duration: 0.5s; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-timing-function: linear; diff --git a/docs/_static/css/docsearch.overrides.css b/docs/_static/css/docsearch.overrides.css index b2b4c396a8..2f0c4ded78 100644 --- a/docs/_static/css/docsearch.overrides.css +++ b/docs/_static/css/docsearch.overrides.css @@ -1,17 +1,17 @@ .search .algolia-docsearch-suggestion--highlight, .algolia-autocomplete .algolia-docsearch-suggestion--highlight { - color: #2980B9; - background: #F1C40F; + color: #2980b9; + background: #f1c40f; } .algolia-autocomplete { - width: 100%; + width: 100%; } #search-results a, a.algolia-docsearch-suggestion { - border-bottom: 0; + border-bottom: 0; } -#search-results h2 { - display: none; +#search-results h2 { + display: none; } diff --git a/docs/_static/js/banner.js b/docs/_static/js/banner.js index cdd10476fc..3f9da613c2 100644 --- a/docs/_static/js/banner.js +++ b/docs/_static/js/banner.js @@ -1,9 +1,12 @@ function setCookie(name, value, days) { const date = new Date(); - date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); - document.cookie = encodeURIComponent(name) + '=' + - encodeURIComponent(value) + - '; expires=' + date.toGMTString(); + date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); + document.cookie = + encodeURIComponent(name) + + '=' + + encodeURIComponent(value) + + '; expires=' + + date.toGMTString(); } function hasCookie(name, value) { @@ -13,16 +16,18 @@ function hasCookie(name, value) { $(() => { const $wagtailspace = $( '' + - ' ' + - '
    ' + - ' Wagtail Space
    13 – 15 March 2019 Arnhem, The Netherlands' + - '
    ' + - ' ×' + - '
    ' + ' ' + + '
    ' + + ' Wagtail Space
    13 – 15 March 2019 Arnhem, The Netherlands' + + '
    ' + + ' ×' + + '', ); - if (!hasCookie('wagtailspaceClosed', 'true') - && new Date() < new Date(2019, 2, 15)) { + if ( + !hasCookie('wagtailspaceClosed', 'true') && + new Date() < new Date(2019, 2, 15) + ) { $('.wy-nav-content').prepend($wagtailspace); $wagtailspace.find('.close').click((e) => { e.preventDefault(); diff --git a/tsconfig.json b/tsconfig.json index 37a6a6fd29..f7dc8ead5d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,14 @@ { - "compilerOptions": { - "jsx": "react", - "lib": ["es2015", "dom"], - "noImplicitAny": false, // TODO: Enable once all existing code is typed - "noUnusedLocals": true, - "noUnusedParameters": true, - "strictNullChecks": true, - "esModuleInterop": true, - "allowJs": true, - "downlevelIteration": true - }, - "files": [ - "client/src/index.ts", - "client/src/custom.d.ts" - ] + "compilerOptions": { + "jsx": "react", + "lib": ["es2015", "dom"], + "noImplicitAny": false, // TODO: Enable once all existing code is typed + "noUnusedLocals": true, + "noUnusedParameters": true, + "strictNullChecks": true, + "esModuleInterop": true, + "allowJs": true, + "downlevelIteration": true + }, + "files": ["client/src/index.ts", "client/src/custom.d.ts"] } diff --git a/wagtail/admin/static_src/wagtailadmin/css/normalize.css b/wagtail/admin/static_src/wagtailadmin/css/normalize.css index 8d945b3ec9..ddd29bdb87 100644 --- a/wagtail/admin/static_src/wagtailadmin/css/normalize.css +++ b/wagtail/admin/static_src/wagtailadmin/css/normalize.css @@ -20,7 +20,7 @@ main, nav, section, summary { - display: block; + display: block; } /** @@ -30,9 +30,9 @@ summary { audio, canvas, video { - display: inline-block; - *display: inline; - *zoom: 1; + display: inline-block; + *display: inline; + *zoom: 1; } /** @@ -41,8 +41,8 @@ video { */ audio:not([controls]) { - display: none; - height: 0; + display: none; + height: 0; } /** @@ -51,7 +51,7 @@ audio:not([controls]) { */ [hidden] { - display: none; + display: none; } /* ========================================================================== @@ -70,11 +70,11 @@ audio:not([controls]) { */ html { - background: #fff; /* 1 */ - color: #000; /* 2 */ - font-size: 100%; /* 3 */ - -webkit-text-size-adjust: 100%; /* 4 */ - -ms-text-size-adjust: 100%; /* 4 */ + background: #fff; /* 1 */ + color: #000; /* 2 */ + font-size: 100%; /* 3 */ + -webkit-text-size-adjust: 100%; /* 4 */ + -ms-text-size-adjust: 100%; /* 4 */ } /** @@ -87,7 +87,7 @@ button, input, select, textarea { - font-family: sans-serif; + font-family: sans-serif; } /** @@ -95,7 +95,7 @@ textarea { */ body { - margin: 0; + margin: 0; } /* ========================================================================== @@ -107,7 +107,7 @@ body { */ a:focus { - outline: thin dotted; + outline: thin dotted; } /** @@ -116,7 +116,7 @@ a:focus { a:active, a:hover { - outline: 0; + outline: 0; } /* ========================================================================== @@ -130,33 +130,33 @@ a:hover { */ h1 { - font-size: 2em; - margin: 0.67em 0; + font-size: 2em; + margin: 0.67em 0; } h2 { - font-size: 1.5em; - margin: 0.83em 0; + font-size: 1.5em; + margin: 0.83em 0; } h3 { - font-size: 1.17em; - margin: 1em 0; + font-size: 1.17em; + margin: 1em 0; } h4 { - font-size: 1em; - margin: 1.33em 0; + font-size: 1em; + margin: 1.33em 0; } h5 { - font-size: 0.83em; - margin: 1.67em 0; + font-size: 0.83em; + margin: 1.67em 0; } h6 { - font-size: 0.67em; - margin: 2.33em 0; + font-size: 0.67em; + margin: 2.33em 0; } /** @@ -164,7 +164,7 @@ h6 { */ abbr[title] { - border-bottom: 1px dotted; + border-bottom: 1px dotted; } /** @@ -173,11 +173,11 @@ abbr[title] { b, strong { - font-weight: bold; + font-weight: bold; } blockquote { - margin: 1em 40px; + margin: 1em 40px; } /** @@ -185,7 +185,7 @@ blockquote { */ dfn { - font-style: italic; + font-style: italic; } /** @@ -194,9 +194,9 @@ dfn { */ hr { - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; } /** @@ -204,8 +204,8 @@ hr { */ mark { - background: #ff0; - color: #000; + background: #ff0; + color: #000; } /** @@ -214,7 +214,7 @@ mark { p, pre { - margin: 1em 0; + margin: 1em 0; } /** @@ -225,9 +225,9 @@ code, kbd, pre, samp { - font-family: monospace, serif; - _font-family: 'courier new', monospace; - font-size: 1em; + font-family: monospace, serif; + _font-family: 'courier new', monospace; + font-size: 1em; } /** @@ -235,9 +235,9 @@ samp { */ pre { - white-space: pre; - white-space: pre-wrap; - word-wrap: break-word; + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; } /** @@ -245,7 +245,7 @@ pre { */ q { - quotes: none; + quotes: none; } /** @@ -254,8 +254,8 @@ q { q:before, q:after { - content: ''; - content: none; + content: ''; + content: none; } /** @@ -263,7 +263,7 @@ q:after { */ small { - font-size: 80%; + font-size: 80%; } /** @@ -272,18 +272,18 @@ small { sub, sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; } sup { - top: -0.5em; + top: -0.5em; } sub { - bottom: -0.25em; + bottom: -0.25em; } /* ========================================================================== @@ -298,11 +298,11 @@ dl, menu, ol, ul { - margin: 1em 0; + margin: 1em 0; } dd { - margin: 0 0 0 40px; + margin: 0 0 0 40px; } /** @@ -312,7 +312,7 @@ dd { menu, ol, ul { - padding: 0 0 0 40px; + padding: 0 0 0 40px; } /** @@ -321,8 +321,8 @@ ul { nav ul, nav ol { - list-style: none; - list-style-image: none; + list-style: none; + list-style-image: none; } /* ========================================================================== @@ -335,8 +335,8 @@ nav ol { */ img { - border: 0; /* 1 */ - -ms-interpolation-mode: bicubic; /* 2 */ + border: 0; /* 1 */ + -ms-interpolation-mode: bicubic; /* 2 */ } /** @@ -344,7 +344,7 @@ img { */ svg:not(:root) { - overflow: hidden; + overflow: hidden; } /* ========================================================================== @@ -356,7 +356,7 @@ svg:not(:root) { */ figure { - margin: 0; + margin: 0; } /* ========================================================================== @@ -368,7 +368,7 @@ figure { */ form { - margin: 0; + margin: 0; } /** @@ -376,9 +376,9 @@ form { */ fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; } /** @@ -388,10 +388,10 @@ fieldset { */ legend { - border: 0; /* 1 */ - padding: 0; - white-space: normal; /* 2 */ - *margin-left: -7px; /* 3 */ + border: 0; /* 1 */ + padding: 0; + white-space: normal; /* 2 */ + *margin-left: -7px; /* 3 */ } /** @@ -405,10 +405,10 @@ button, input, select, textarea { - font-size: 100%; /* 1 */ - margin: 0; /* 2 */ - vertical-align: baseline; /* 3 */ - *vertical-align: middle; /* 3 */ + font-size: 100%; /* 1 */ + margin: 0; /* 2 */ + vertical-align: baseline; /* 3 */ + *vertical-align: middle; /* 3 */ } /** @@ -418,7 +418,7 @@ textarea { button, input { - line-height: normal; + line-height: normal; } /** @@ -430,7 +430,7 @@ input { button, select { - text-transform: none; + text-transform: none; } /** @@ -447,9 +447,9 @@ button, html input[type="button"], /* 1 */ input[type="reset"], input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ - *overflow: visible; /* 4 */ + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ + *overflow: visible; /* 4 */ } /** @@ -459,12 +459,12 @@ input[type="submit"] { * Known issue: excess padding remains in IE 6. */ -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ - *height: 13px; /* 3 */ - *width: 13px; /* 3 */ +input[type='checkbox'], +input[type='radio'] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ + *height: 13px; /* 3 */ + *width: 13px; /* 3 */ } /** @@ -473,11 +473,11 @@ input[type="radio"] { * (include `-moz` to future-proof). */ -input[type="search"] { - -webkit-appearance: textfield; /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; /* 2 */ - box-sizing: content-box; +input[type='search'] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; } /** @@ -485,9 +485,9 @@ input[type="search"] { * on OS X. */ -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; +input[type='search']::-webkit-search-cancel-button, +input[type='search']::-webkit-search-decoration { + -webkit-appearance: none; } /** @@ -496,8 +496,8 @@ input[type="search"]::-webkit-search-decoration { button::-moz-focus-inner, input::-moz-focus-inner { - border: 0; - padding: 0; + border: 0; + padding: 0; } /** @@ -506,8 +506,8 @@ input::-moz-focus-inner { */ textarea { - overflow: auto; /* 1 */ - vertical-align: top; /* 2 */ + overflow: auto; /* 1 */ + vertical-align: top; /* 2 */ } /* ========================================================================== @@ -519,6 +519,6 @@ textarea { */ table { - border-collapse: collapse; - border-spacing: 0; + border-collapse: collapse; + border-spacing: 0; } diff --git a/wagtail/admin/static_src/wagtailadmin/fonts/wagtail-icomoon.json b/wagtail/admin/static_src/wagtailadmin/fonts/wagtail-icomoon.json index 1b8016ff64..e77e52f2ae 100644 --- a/wagtail/admin/static_src/wagtailadmin/fonts/wagtail-icomoon.json +++ b/wagtail/admin/static_src/wagtailadmin/fonts/wagtail-icomoon.json @@ -6,19 +6,13 @@ "paths": [ "M327.030 64c-13.576 0-25.455 3.392-33.939 13.576-8.485 8.485-13.576 18.667-13.576 32.243v106.909h-108.606c-13.575 0-25.454 3.392-33.939 13.576-8.484 8.484-13.576 18.666-13.576 32.242v651.636c0 13.576 5.088 23.757 13.576 32.243 8.485 10.182 20.364 13.576 33.939 13.576h526.061c13.576 0 25.455-3.392 33.939-13.576 8.485-8.485 13.576-18.667 13.576-32.243v-106.909h108.606c13.575 0 25.454-3.392 33.939-13.576 8.484-8.484 13.576-18.666 13.576-32.242v-434.424c0-13.576-3.392-27.152-10.182-42.424-6.788-15.272-13.576-28.849-23.758-37.333l-151.030-151.030c-8.485-8.485-20.364-16.97-35.636-23.757-16.97-6.788-30.545-8.485-44.122-8.485zM342.303 125.091h247.757v201.939c0 13.576 5.088 23.757 13.575 32.243 8.486 10.182 20.364 13.576 32.243 13.576h201.94v373.333h-495.515zM652.849 128.483c8.485 3.392 15.272 6.788 18.666 11.879l152.728 151.030c3.392 3.392 6.788 10.181 10.182 20.363h-181.576zM186.182 277.816h93.333v483.636c0 13.576 5.088 23.757 13.576 32.242 8.484 10.182 20.364 13.576 33.939 13.576h354.666v91.636h-495.515z" ], - "attrs": [ - {} - ], + "attrs": [{}], "isMulticolor": false, "isMulticolor2": false, "grid": 14, - "tags": [ - "duplicate" - ] + "tags": ["duplicate"] }, - "attrs": [ - {} - ], + "attrs": [{}], "properties": { "order": 37, "id": 78, @@ -38,9 +32,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "text-height" - ], + "tags": ["text-height"], "defaultCode": 57414, "grid": 14 }, @@ -65,10 +57,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "chain-broken", - "unlink" - ], + "tags": ["chain-broken", "unlink"], "defaultCode": 57415, "grid": 14 }, @@ -93,9 +82,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "table" - ], + "tags": ["table"], "defaultCode": 57416, "grid": 14 }, @@ -127,9 +114,7 @@ ], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "logout" - ], + "tags": ["logout"], "defaultCode": 57417, "grid": 14 }, @@ -161,9 +146,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "strikethrough" - ], + "tags": ["strikethrough"], "defaultCode": 57418, "grid": 14 }, @@ -188,9 +171,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "superscript" - ], + "tags": ["superscript"], "defaultCode": 57419, "grid": 14 }, @@ -215,9 +196,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "subscript" - ], + "tags": ["subscript"], "defaultCode": 57420, "grid": 14 }, @@ -252,10 +231,7 @@ } ] }, - "tags": [ - "quotes-left", - "ldquo" - ], + "tags": ["quotes-left", "ldquo"], "defaultCode": 57344, "grid": 16 }, @@ -309,12 +285,7 @@ } ] }, - "tags": [ - "embed", - "code", - "html", - "xml" - ], + "tags": ["embed", "code", "html", "xml"], "defaultCode": 57345, "grid": 16 }, @@ -359,10 +330,7 @@ } ] }, - "tags": [ - "pilcrow", - "wysiwyg" - ], + "tags": ["pilcrow", "wysiwyg"], "defaultCode": 57346, "grid": 16 }, @@ -401,11 +369,7 @@ } ] }, - "tags": [ - "marquee", - "square", - "dashed" - ], + "tags": ["marquee", "square", "dashed"], "defaultCode": 57347, "grid": 16 }, @@ -434,9 +398,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "user" - ], + "tags": ["user"], "defaultCode": 57348, "grid": 16 }, @@ -461,9 +423,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "eye" - ], + "tags": ["eye"], "defaultCode": 57349, "grid": 16 }, @@ -488,9 +448,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "eye-slash" - ], + "tags": ["eye-slash"], "defaultCode": 57350, "grid": 16 }, @@ -516,9 +474,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "globe" - ], + "tags": ["globe"], "defaultCode": 57351, "grid": 16 }, @@ -543,11 +499,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "clock", - "time", - "schedule" - ], + "tags": ["clock", "time", "schedule"], "defaultCode": 57352, "grid": 16 }, @@ -573,9 +525,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "lock39 copy" - ], + "tags": ["lock39 copy"], "defaultCode": 57353, "grid": 16 }, @@ -601,9 +551,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "lock39-open" - ], + "tags": ["lock39-open"], "defaultCode": 57354, "grid": 16 }, @@ -628,9 +576,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "form" - ], + "tags": ["form"], "defaultCode": 57355, "grid": 16 }, @@ -727,9 +673,7 @@ "attrs": [], "isMulticolor": false, "isMulticolor2": false, - "tags": [ - "" - ], + "tags": [""], "defaultCode": 57359, "grid": 16 }, diff --git a/wagtail/admin/static_src/wagtailadmin/scss/layouts/404.scss b/wagtail/admin/static_src/wagtailadmin/scss/layouts/404.scss index ffdb9b4646..56b4e87507 100644 --- a/wagtail/admin/static_src/wagtailadmin/scss/layouts/404.scss +++ b/wagtail/admin/static_src/wagtailadmin/scss/layouts/404.scss @@ -2,79 +2,80 @@ @import '../../../../../../client/scss/tools'; .page404__bg { - position: fixed; - top: 0; - left: 0; - width: 100vw; - height: 100vh; - background-color: $color-teal-darker; - font-family: $font-sans; - color: $color-white; + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background-color: $color-teal-darker; + font-family: $font-sans; + color: $color-white; } .page404__wrapper { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - display: flex; - justify-content: center; - align-items: center; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + display: flex; + justify-content: center; + align-items: center; } .wagtail-logo-container__desktop { - float: left; - width: 400px; - height: 500px; + float: left; + width: 400px; + height: 500px; } .page404__text-container { - float: right; - width: 600px; - height: 500px; - text-align: center; + float: right; + width: 600px; + height: 500px; + text-align: center; } .page404__header { - font-size: 6.8em; - margin-bottom: 0.2em; - color: inherit; + font-size: 6.8em; + margin-bottom: 0.2em; + color: inherit; } .page404__text { - font-size: 2.25em; - line-height: 1.25em; - color: inherit; + font-size: 2.25em; + line-height: 1.25em; + color: inherit; } -a.button.page404__button { // more specific to override standard button styles - font-size: 1.5em; - line-height: 2em; - height: 2.5em; - padding: 0 0.5em; - background-color: $color-teal-darker; - border: 4px solid $color-teal; - color: inherit; +a.button.page404__button { + // more specific to override standard button styles + font-size: 1.5em; + line-height: 2em; + height: 2.5em; + padding: 0 0.5em; + background-color: $color-teal-darker; + border: 4px solid $color-teal; + color: inherit; - &:hover { - background-color: $color-teal; - } + &:hover { + background-color: $color-teal; + } } // SMALL DESKTOP CHANGES: @include media-breakpoint-down(sm) { - .wagtail-logo-container__desktop { - display: none; - } + .wagtail-logo-container__desktop { + display: none; + } } // MOBILE CHANGES: @include media-breakpoint-down(xs) { - .page404__text-container { - width: 400px; - } + .page404__text-container { + width: 400px; + } - .page404__header { - font-size: 5em; - } + .page404__header { + font-size: 5em; + } } diff --git a/wagtail/admin/static_src/wagtailadmin/scss/layouts/account.scss b/wagtail/admin/static_src/wagtailadmin/scss/layouts/account.scss index 35cbfb083a..161d7fd3e6 100644 --- a/wagtail/admin/static_src/wagtailadmin/scss/layouts/account.scss +++ b/wagtail/admin/static_src/wagtailadmin/scss/layouts/account.scss @@ -1,38 +1,38 @@ @import '../../../../../../client/scss/settings/variables'; .top-padding { - padding-top: $object-title-height + 12px; + padding-top: $object-title-height + 12px; } .avatar-panel { + margin-top: 20px; + + &__image { + float: left; + width: 16%; + margin-bottom: 20px; + } + + &__form { + float: left; + + label { + display: block; + padding: 0; + width: unset; + float: unset; + margin-bottom: 10px; + } + } + + &__revert-to-gravatar { margin-top: 20px; + margin-bottom: 20px; + } - &__image { - float: left; - width: 16%; - margin-bottom: 20px; - } - - &__form { - float: left; - - label { - display: block; - padding: 0; - width: unset; - float: unset; - margin-bottom: 10px; - } - } - - &__revert-to-gravatar { - margin-top: 20px; - margin-bottom: 20px; - } - - &::after { - content: ' '; - display: table; - clear: both; - } + &::after { + content: ' '; + display: table; + clear: both; + } } diff --git a/wagtail/admin/static_src/wagtailadmin/scss/layouts/compare-revisions.scss b/wagtail/admin/static_src/wagtailadmin/scss/layouts/compare-revisions.scss index 67a54ad2bf..4c303d06bf 100644 --- a/wagtail/admin/static_src/wagtailadmin/scss/layouts/compare-revisions.scss +++ b/wagtail/admin/static_src/wagtailadmin/scss/layouts/compare-revisions.scss @@ -7,63 +7,63 @@ $color-deletion-dark: #f8cbcb; $color-deletion-light: #ffebeb; .comparison { - &__child-object { - border-top: 1px dashed $color-grey-4; - padding: 1em; + &__child-object { + border-top: 1px dashed $color-grey-4; + padding: 1em; - dd { - margin-left: 40px; - } - - &:first-child { - border-top: 0; - } - - &.addition { - background-color: $color-addition-light; - } - - &.deletion { - background-color: $color-deletion-light; - } + dd { + margin-left: 40px; } - &__list { - margin-top: 0; - margin-bottom: -1em; + &:first-child { + border-top: 0; } - span.addition { - background-color: $color-addition-dark; + &.addition { + background-color: $color-addition-light; } - span.deletion { - background-color: $color-deletion-dark; + &.deletion { + background-color: $color-deletion-light; + } + } + + &__list { + margin-top: 0; + margin-bottom: -1em; + } + + span.addition { + background-color: $color-addition-dark; + } + + span.deletion { + background-color: $color-deletion-dark; + } + + .preview-image { + display: inline-block; + + &.addition, + &.deletion { + padding: 5px; + margin-right: 5px; + border-style: solid; + border-width: 1px; } - .preview-image { - display: inline-block; - - &.addition, - &.deletion { - padding: 5px; - margin-right: 5px; - border-style: solid; - border-width: 1px; - } - - &.addition { - background-color: $color-addition-light; - border-color: $color-addition-dark; - } - - &.deletion { - background-color: $color-deletion-light; - border-color: $color-deletion-dark; - } - - img { - display: block; - } + &.addition { + background-color: $color-addition-light; + border-color: $color-addition-dark; } + + &.deletion { + background-color: $color-deletion-light; + border-color: $color-deletion-dark; + } + + img { + display: block; + } + } } diff --git a/wagtail/admin/static_src/wagtailadmin/scss/layouts/home.scss b/wagtail/admin/static_src/wagtailadmin/scss/layouts/home.scss index 22869ff1c7..13ba8b03a8 100644 --- a/wagtail/admin/static_src/wagtailadmin/scss/layouts/home.scss +++ b/wagtail/admin/static_src/wagtailadmin/scss/layouts/home.scss @@ -2,174 +2,174 @@ @import '../../../../../../client/scss/tools'; h1 { - font-weight: 300; - font-size: 2.2em; + font-weight: 300; + font-size: 2.2em; } header { - .col1 { - width: 50px; - margin-right: 1em; - padding: 0; + .col1 { + width: 50px; + margin-right: 1em; + padding: 0; - // make way for the nav-menu button on mobile - @include media-breakpoint-down(xs) { - position: relative; - left: $mobile-nav-indent; - } + // make way for the nav-menu button on mobile + @include media-breakpoint-down(xs) { + position: relative; + left: $mobile-nav-indent; } + } - h1, - .user-name { - color: $color-white; - } + h1, + .user-name { + color: $color-white; + } - .user-name { - text-transform: none; - font-size: 1.3em; - font-weight: 600; - } + .user-name { + text-transform: none; + font-size: 1.3em; + font-weight: 600; + } } .panel { - margin-bottom: 4em; + margin-bottom: 4em; } .summary { + @include clearfix(); + margin-bottom: 2em; + padding-top: 2em; + + ul.stats { @include clearfix(); - margin-bottom: 2em; - padding-top: 2em; + @include unlist(); + width: 100%; + margin-left: -$padding; - ul.stats { - @include clearfix(); - @include unlist(); - width: 100%; - margin-left: -$padding; + li { + @include column(4); + margin-bottom: 2em; - li { - @include column(4); - margin-bottom: 2em; - - @include media-breakpoint-down(sm) { - width: 50%; - } - } - - li.icon::before, - li svg.icon { - opacity: 0.2; - font-size: 6em; - float: left; - - @include media-breakpoint-down(md) { - font-size: 5em; - } - - @include media-breakpoint-down(sm) { - font-size: 4.5em; - } - - @include media-breakpoint-down(xs) { - font-size: 4em; - } - - // Media for Windows High Contrast Mode - @media (forced-colors: $media-forced-colours) { - color: $system-color-link-text; - opacity: 1; - } - } - - li svg.icon { - width: 1em; - height: 1em; - margin-right: 0.5em; - } - - a { - position: relative; - display: block; - width: 100%; - height: 100%; - } - - span { - font-family: $font-sans; - display: block; - font-size: 4em; - line-height: 1em; - font-weight: 300; - - @include media-breakpoint-down(md) { - font-size: 3em; - } - - @include media-breakpoint-down(sm) { - font-size: 2.5em; - } - - @include media-breakpoint-down(xs) { - font-size: 2em; - } - } + @include media-breakpoint-down(sm) { + width: 50%; + } } - .search-bar { - @include clearfix(); - border-top: 1px solid $color-grey-4; - padding: 1em 0 0; + li.icon::before, + li svg.icon { + opacity: 0.2; + font-size: 6em; + float: left; - h2 { - display: inline-block; - margin-right: 1em; - } + @include media-breakpoint-down(md) { + font-size: 5em; + } - .fields { - display: inline-block; - clear: none; - } + @include media-breakpoint-down(sm) { + font-size: 4.5em; + } - .field { - display: inline-block; - } + @include media-breakpoint-down(xs) { + font-size: 4em; + } - label { - display: inline-block; - } - - input { - background-color: $color-white; - } + // Media for Windows High Contrast Mode + @media (forced-colors: $media-forced-colours) { + color: $system-color-link-text; + opacity: 1; + } } + + li svg.icon { + width: 1em; + height: 1em; + margin-right: 0.5em; + } + + a { + position: relative; + display: block; + width: 100%; + height: 100%; + } + + span { + font-family: $font-sans; + display: block; + font-size: 4em; + line-height: 1em; + font-weight: 300; + + @include media-breakpoint-down(md) { + font-size: 3em; + } + + @include media-breakpoint-down(sm) { + font-size: 2.5em; + } + + @include media-breakpoint-down(xs) { + font-size: 2em; + } + } + } + + .search-bar { + @include clearfix(); + border-top: 1px solid $color-grey-4; + padding: 1em 0 0; + + h2 { + display: inline-block; + margin-right: 1em; + } + + .fields { + display: inline-block; + clear: none; + } + + .field { + display: inline-block; + } + + label { + display: inline-block; + } + + input { + background-color: $color-white; + } + } } .object.collapsible .object-layout .title-wrapper::before { - display: none; + display: none; } .object-layout { - // enforce flex display at all screen sizes - display: flex; - flex-flow: row-reverse wrap; + // enforce flex display at all screen sizes + display: flex; + flex-flow: row-reverse wrap; - .listing--push-top { - margin-top: 3em; + .listing--push-top { + margin-top: 3em; - thead { - display: table-row-group; - margin-bottom: 0; - } + thead { + display: table-row-group; + margin-bottom: 0; } + } - .listing { - margin-bottom: 0; - } + .listing { + margin-bottom: 0; + } - .listing tbody { - border-bottom: 0; - } + .listing tbody { + border-bottom: 0; + } } .task .icon { - margin-left: -1.75em; // pull out the icon so it aligns with no-icon text + margin-left: -1.75em; // pull out the icon so it aligns with no-icon text } diff --git a/wagtail/admin/static_src/wagtailadmin/scss/layouts/login.scss b/wagtail/admin/static_src/wagtailadmin/scss/layouts/login.scss index 360d9f4e60..b3aae71623 100644 --- a/wagtail/admin/static_src/wagtailadmin/scss/layouts/login.scss +++ b/wagtail/admin/static_src/wagtailadmin/scss/layouts/login.scss @@ -7,207 +7,207 @@ $desktop-nice-padding: 100px; html, body, .content-wrapper { - background-color: $color-grey-1; - color: $color-grey-3; + background-color: $color-grey-1; + color: $color-grey-3; } html { - height: 100%; + height: 100%; } body { - margin-left: 0; - height: 100%; + margin-left: 0; + height: 100%; } .content-wrapper { - border: 0; + border: 0; } .wrapper { - padding-left: $mobile-nice-padding; - padding-right: $mobile-nice-padding; - margin-left: 0; - max-width: none; + padding-left: $mobile-nice-padding; + padding-right: $mobile-nice-padding; + margin-left: 0; + max-width: none; } h1 { - font-weight: 300; - font-size: 2em; - line-height: 1em; - color: $color-white; - text-transform: none; - white-space: nowrap; + font-weight: 300; + font-size: 2em; + line-height: 1em; + color: $color-white; + text-transform: none; + white-space: nowrap; } form { - width: 100%; + width: 100%; - ul { - @include unlist(); - } + ul { + @include unlist(); + } } label { - width: auto; - color: $color-white; + width: auto; + color: $color-white; } .button, a.button { - line-height: 1.2em; - font-size: 1.5em; - padding: 1.1em 2.4em; - height: 3.5em; + line-height: 1.2em; + font-size: 1.5em; + padding: 1.1em 2.4em; + height: 3.5em; } -input[type=checkbox]:before { - background-color: #333; - color: #555; - border: 1px solid #555; +input[type='checkbox']:before { + background-color: #333; + color: #555; + border: 1px solid #555; } .fields-wrapper { - position: relative; + position: relative; } .fields { - max-width: none; + max-width: none; } .fields li { - padding: 1em 0; + padding: 1em 0; - &.full { - position: relative; - padding: 0; + &.full { + position: relative; + padding: 0; - label { - @include visuallyhidden; - } - - input { - border-top: 1px dashed $color-input-border; - } + label { + @include visuallyhidden; } - &:first-child input { - border: 0; + input { + border-top: 1px dashed $color-input-border; } + } + + &:first-child input { + border: 0; + } } .fields .checkbox { - padding-top: 2em; - padding-bottom: 2em; + padding-top: 2em; + padding-bottom: 2em; } .field { - padding: 0; + padding: 0; } .iconfield .input:before { - display: none; + display: none; } // Special full-width, one-off fields i.e a single text or textarea input .full input { - border-radius: 0; - font-weight: 300; - border: 0; - padding: 1.5em $mobile-nice-padding 1.5em $mobile-nice-padding; - font-size: 1.6em; - line-height: 1.6em; + border-radius: 0; + font-weight: 300; + border: 0; + padding: 1.5em $mobile-nice-padding 1.5em $mobile-nice-padding; + font-size: 1.6em; + line-height: 1.6em; } // Forgotten password link .help { - font-size: 1.3em; - margin-top: 0; - padding: 10px 0; + font-size: 1.3em; + margin-top: 0; + padding: 10px 0; + + @include media-breakpoint-up(sm) { + position: absolute; + top: 139px; + right: 5%; + padding: 0; + } + + &__link { + color: $color-white; @include media-breakpoint-up(sm) { - position: absolute; - top: 139px; - right: 5%; - padding: 0; - } - - &__link { - color: $color-white; - - @include media-breakpoint-up(sm) { - color: $color-link; - } + color: $color-link; } + } } .messages { - margin: 1em 0; - z-index: 5; + margin: 1em 0; + z-index: 5; - ul { - margin: 0; + ul { + margin: 0; - &:before { - display: none; - } - - li { - border-radius: 3px; - } + &:before { + display: none; } + + li { + border-radius: 3px; + } + } } @include media-breakpoint-up(sm) { - .content-wrapper { - float: none; - height: auto; - width: 100%; + .content-wrapper { + float: none; + height: auto; + width: 100%; + display: inline-block; + vertical-align: middle; + } + + // centres login form vertically + .wrapper { + position: relative; + height: 100%; + padding: 0 $desktop-nice-padding; + + &:before { + content: ''; + width: 0; + display: inline-block; + height: 100%; + vertical-align: middle; + margin-left: -0.4em; + } + } + + h1 { + font-size: 4em; + } + + .full { + margin: 0 (-$desktop-nice-padding); + + .iconfield { + .input:before { display: inline-block; - vertical-align: middle; - } - - // centres login form vertically - .wrapper { - position: relative; - height: 100%; - padding: 0 $desktop-nice-padding; - - &:before { - content: ''; - width: 0; - display: inline-block; - height: 100%; - vertical-align: middle; - margin-left: -0.4em; - } - } - - h1 { - font-size: 4em; - } - - .full { - margin: 0 (-$desktop-nice-padding); - - .iconfield { - .input:before { - display: inline-block; - position: absolute; - color: $color-grey-4; - border: 2px solid $color-grey-4; - border-radius: 100%; - width: 1em; - padding: 0.3em; - left: $desktop-nice-padding; - margin-top: -1.1rem; - top: 50%; - font-size: 1.3rem; - } - - input { - padding-left: ($desktop-nice-padding + 50px); - } - } + position: absolute; + color: $color-grey-4; + border: 2px solid $color-grey-4; + border-radius: 100%; + width: 1em; + padding: 0.3em; + left: $desktop-nice-padding; + margin-top: -1.1rem; + top: 50%; + font-size: 1.3rem; + } + + input { + padding-left: ($desktop-nice-padding + 50px); + } } + } } diff --git a/wagtail/admin/static_src/wagtailadmin/scss/layouts/page-editor.scss b/wagtail/admin/static_src/wagtailadmin/scss/layouts/page-editor.scss index f8f3039d98..8a027a7a25 100644 --- a/wagtail/admin/static_src/wagtailadmin/scss/layouts/page-editor.scss +++ b/wagtail/admin/static_src/wagtailadmin/scss/layouts/page-editor.scss @@ -1,695 +1,693 @@ -@use "sass:color"; -@use "sass:map"; -@use "sass:math"; +@use 'sass:color'; +@use 'sass:map'; +@use 'sass:math'; @import '../../../../../../client/scss/settings'; @import '../../../../../../client/scss/tools'; .page-editor { - .content-wrapper { - margin-bottom: 10em; + .content-wrapper { + margin-bottom: 10em; + } + + .breadcrumb { + margin: -1.2em 0 2em; // sass linter complains about $desktop-nice-padding here because of unit mismatch + padding-left: calc(#{$desktop-nice-padding} - 2em); + + @include media-breakpoint-up(sm) { + margin-top: -1.8em; + margin-left: -$desktop-nice-padding; + margin-right: -$desktop-nice-padding; + } + } + + .modal .breadcrumb { + margin: 0; + padding-left: 0.5em; + background-color: transparent; + + .breadcrumb-item { + padding-left: 0; + padding-right: 0; } - .breadcrumb { - margin: -1.2em 0 2em; // sass linter complains about $desktop-nice-padding here because of unit mismatch - padding-left: calc(#{$desktop-nice-padding} - 2em); + a { + color: $color-grey-2; + padding-left: 0.5em; + padding-right: 0.5em; - @include media-breakpoint-up(sm) { - margin-top: -1.8em; - margin-left: -$desktop-nice-padding; - margin-right: -$desktop-nice-padding; - } + &:hover { + color: $color-white; + } } - .modal .breadcrumb { - margin: 0; - padding-left: 0.5em; + li:hover { + background-color: transparent; + } + + .home_icon { + margin-left: 0; + } + + div.c-dropdown__button.u-btn-current { + color: $color-grey-2; + + &:hover { background-color: transparent; - - .breadcrumb-item { - padding-left: 0; - padding-right: 0; - } - - a { - color: $color-grey-2; - padding-left: 0.5em; - padding-right: 0.5em; - - &:hover { - color: $color-white; - } - } - - li:hover { - background-color: transparent; - } - - .home_icon { - margin-left: 0; - } - - div.c-dropdown__button.u-btn-current { - color: $color-grey-2; - - &:hover { - background-color: transparent; - cursor: default; - } - } - - .status-tag { - margin-bottom: 0; - } - - .u-link { - color: $color-white; - } + cursor: default; + } } - h1 { - font-size: 1.915em; // approximately 26px - - &.header-title { - text-transform: initial; - } + .status-tag { + margin-bottom: 0; } - .header-title { - padding-left: 0; + .u-link { + color: $color-white; + } + } + + h1 { + font-size: 1.915em; // approximately 26px + + &.header-title { + text-transform: initial; + } + } + + .header-title { + padding-left: 0; + } + + .modal-body .header-title h1 { + font-size: 1.5em; + } + + .header-meta { + list-style: none; + margin-top: 0; + margin-bottom: 0; + padding: 0; + + li { + border: 0; + float: left; + height: 1.5em; + line-height: 2em; + margin: 1em 0.75em 1.5em 0; + + .icon { + @include svg-icon(1.25em, text-bottom); + + margin-right: 0.2em; + } + + .icon-warning { + @include svg-icon(); + } + + &:first-child .button { + margin-left: -0.8em; + } + + .avatar { + margin-left: 0; + } } - .modal-body .header-title h1 { - font-size: 1.5em; + .button { + font-size: 1em; + font-weight: 600; + margin-top: -0.25em; // Account for the button border + overflow: initial; + height: 2.5em; + line-height: 2.5em; } - .header-meta { - list-style: none; - margin-top: 0; - margin-bottom: 0; - padding: 0; + .action-workflow-status { + font-weight: 600; - li { - border: 0; - float: left; - height: 1.5em; - line-height: 2em; - margin: 1em 0.75em 1.5em 0; - - .icon { - @include svg-icon(1.25em, text-bottom); - - margin-right: 0.2em; - } - - .icon-warning { - @include svg-icon(); - } - - &:first-child .button { - margin-left: -0.8em; - } - - .avatar { - margin-left: 0; - } - } - - .button { - font-size: 1em; - font-weight: 600; - margin-top: -0.25em; // Account for the button border - overflow: initial; - height: 2.5em; - line-height: 2.5em; - } - - .action-workflow-status { - font-weight: 600; - - span { - font-weight: 300; - } - } - - .human-readable-date { - display: inline; - } - - &--status { - padding-right: 0.8em; - } - - &--type { - padding: 0 0.8em; - } + span { + font-weight: 300; + } } + .human-readable-date { + display: inline; + } + + &--status { + padding-right: 0.8em; + } + + &--type { + padding: 0 0.8em; + } + } } // An object is the basic wrapper around any field or group of fields in the editor interface .object { - @include nice-padding(); - position: relative; + @include nice-padding(); + position: relative; - &:first-child { - border: 0; - } + &:first-child { + border: 0; + } - &.focused { - border-color: $color-input-focus-border; - } + &.focused { + border-color: $color-input-focus-border; + } + + fieldset, + .field-row { + padding-top: $object-title-height + 12px; + } + + fieldset { + padding-left: 0; + padding-right: 0; - fieldset, .field-row { - padding-top: $object-title-height + 12px; + padding-top: 0; + } + } + + .object-help { + display: block; + position: relative; + z-index: 1; + top: $object-title-height; + margin-top: 0; + margin-bottom: -1em; + padding: 1em math.div($grid-gutter-width, 2) 1em 3em; + opacity: 1; + + .icon-help { + margin-left: -1.75em; + } + } + + &:hover .object-help { + opacity: 1; + } + + > .title-wrapper { + box-sizing: border-box; + height: $object-title-height; + -webkit-font-smoothing: auto; + background: $color-salmon-light; + color: #200200; + text-transform: uppercase; + padding: 0.9em 0 0.9em 5em; + font-size: 0.95em; + margin: 0; + line-height: 1.5em; + font-weight: normal; + position: absolute; + top: 0; + left: 0; + right: 0; + z-index: 1; + overflow: hidden; + + label { + display: inline; + text-transform: inherit; + font-weight: inherit; + float: none; + width: auto; + color: inherit; + font-size: inherit; } + &:before { + @include font-smoothing; + text-shadow: none; + font-family: $font-wagtail-icons; + text-transform: none; + content: map.get($icons, 'arrow-down'); + text-align: center; + display: block; + position: absolute; + z-index: 2; + font-size: 2em; + top: 0; + line-height: 1.8em; + left: 0; + width: $desktop-nice-padding; + color: $color-white; + padding: 0; + margin: 0; + background-color: $color-salmon; + } + } + + .halloeditor { + padding-top: 1em; // to provide space for editor buttons + padding-bottom: 1em; + + &.expanded { + padding-top: 5em; // to provide space for editor buttons + padding-bottom: 2em; + } + } + + &.required { + > .title-wrapper label:after { + content: '*'; + color: $color-red; + font-weight: bold; + display: inline-block; + margin-left: 0.5em; + line-height: 1em; + font-size: 13px; + } + } + + // Special full-width, one-off fields i.e a single text or textarea input + &.full { fieldset { - padding-left: 0; - padding-right: 0; - - .field-row { - padding-top: 0; - } + display: block; + float: none; } - .object-help { - display: block; - position: relative; - z-index: 1; - top: $object-title-height; - margin-top: 0; - margin-bottom: -1em; - padding: 1em math.div($grid-gutter-width, 2) 1em 3em; - opacity: 1; - - .icon-help { - margin-left: -1.75em; - } - } - - &:hover .object-help { - opacity: 1; - } - - > .title-wrapper { - box-sizing: border-box; - height: $object-title-height; - -webkit-font-smoothing: auto; - background: $color-salmon-light; - color: #200200; - text-transform: uppercase; - padding: 0.9em 0 0.9em 5em; - font-size: 0.95em; - margin: 0; - line-height: 1.5em; - font-weight: normal; - position: absolute; - top: 0; - left: 0; - right: 0; - z-index: 1; - overflow: hidden; - - label { - display: inline; - text-transform: inherit; - font-weight: inherit; - float: none; - width: auto; - color: inherit; - font-size: inherit; - } - - &:before { - @include font-smoothing; - text-shadow: none; - font-family: $font-wagtail-icons; - text-transform: none; - content: map.get($icons, 'arrow-down'); - text-align: center; - display: block; - position: absolute; - z-index: 2; - font-size: 2em; - top: 0; - line-height: 1.8em; - left: 0; - width: $desktop-nice-padding; - color: $color-white; - padding: 0; - margin: 0; - background-color: $color-salmon; - } + li { + padding: 0; } .halloeditor { - padding-top: 1em; // to provide space for editor buttons - padding-bottom: 1em; - - &.expanded { - padding-top: 5em; // to provide space for editor buttons - padding-bottom: 2em; - } + padding-top: 3em; // to provide space for editor buttons + padding-bottom: 3em; + &.expanded { + padding-top: 5em; // to provide space for editor buttons + padding-bottom: 5em; + } } - &.required { - > .title-wrapper label:after { - content: '*'; - color: $color-red; - font-weight: bold; - display: inline-block; - margin-left: 0.5em; - line-height: 1em; - font-size: 13px; - } + .error-message { + @include nice-padding(); + padding-bottom: 2em; } - // Special full-width, one-off fields i.e a single text or textarea input - &.full { - fieldset { - display: block; - float: none; - } + .error, + .error input:not([type='submit']), + .error textarea, + .error .halloeditor { + background-color: $color-input-error-bg; + } + } - li { - padding: 0; - } + // cursory styling for streamfield. Main styling in client/src/components/StreamField/StreamField.scss + &.stream-field { + padding-left: 20px; + padding-right: 20px; - .halloeditor { - padding-top: 3em; // to provide space for editor buttons - padding-bottom: 3em; - - &.expanded { - padding-top: 5em; // to provide space for editor buttons - padding-bottom: 5em; - } - } - - .error-message { - @include nice-padding(); - padding-bottom: 2em; - } - - .error, - .error input:not([type=submit]), - .error textarea, - .error .halloeditor { - background-color: $color-input-error-bg; - } + .object-layout_big-part { + max-width: 100%; } - // cursory styling for streamfield. Main styling in client/src/components/StreamField/StreamField.scss - &.stream-field { - padding-left: 20px; - padding-right: 20px; - - .object-layout_big-part { - max-width: 100%; - } - - fieldset { - padding-bottom: 0; - max-width: unset; - // Workaround to make sure blocks do not overflow horizontally. - min-width: 0; - } - - .block_field > .field-content { - width: 100%; - } + fieldset { + padding-bottom: 0; + max-width: unset; + // Workaround to make sure blocks do not overflow horizontally. + min-width: 0; } - // special panel for the publishing fields, requires a bit more pizzazz - &.publishing { - > .title-wrapper:before { - content: map.get($icons, 'date'); - font-size: 1.8rem; - line-height: 1.4em; - width: 1.4em; - } + .block_field > .field-content { + width: 100%; + } + } + + // special panel for the publishing fields, requires a bit more pizzazz + &.publishing { + > .title-wrapper:before { + content: map.get($icons, 'date'); + font-size: 1.8rem; + line-height: 1.4em; + width: 1.4em; + } + } + + &.privacy { + > .title-wrapper:before { + content: map.get($icons, 'view'); + } + } + + .multiple { + padding: 4.5em 0 0; + + fieldset { + padding-top: 0; + padding-bottom: 0; + } + } + + .fields { + max-width: 100%; + } + + // removes top padding from multiples used within another panel + .fields .multiple { + padding-top: 0; + } + + .add { + padding-top: 1em; + } + + &.empty { + border-bottom: 1px solid $color-white; + + > h3 { + margin: 0; + border-bottom: 1px solid $color-white; } - &.privacy { - > .title-wrapper:before { - content: map.get($icons, 'view'); + // wrapper around add button for multiple objects. Default version is wordless plus button for contracted groups of fields + .add { + @include transition(background-color 0.2s ease); + position: relative; + z-index: 2; + top: 0; + left: 0; + width: 3.3em; + padding: 0; + margin: 0 0 0 -20px; + cursor: pointer; + + .button { + border-radius: 0; + overflow: visible; + background-color: $color-salmon-light; + font-size: 0; // helps fake the effect of t.ext-replace class, which can't be used here. + width: 2em; + + // stylelint-disable max-nesting-depth + &:before { + position: relative; + padding: 0; + line-height: 1.8em; // specific height required as parent 'a' has no height + font-size: 1.4rem; + width: 1.8em; + background-color: $color-salmon; } + + &:hover:before { + background-color: color.adjust($color-salmon, $lightness: -5%); + } + } } .multiple { - padding: 4.5em 0 0; + padding: 0; + } + } - fieldset { - padding-top: 0; - padding-bottom: 0; - } + &.collapsible { + // li.collapsed gets its height from the fieldset only, which is now hidden + // and h2 has position: absolute which doesn't add to it either, so it would be 0 without this + min-height: 41px; + + .title-wrapper { + &:before { + content: map.get($icons, 'collapse-up'); + cursor: pointer; + } } - .fields { - max-width: 100%; - } - - // removes top padding from multiples used within another panel - .fields .multiple { - padding-top: 0; - } - - .add { - padding-top: 1em; - } - - &.empty { - border-bottom: 1px solid $color-white; - - > h3 { - margin: 0; - border-bottom: 1px solid $color-white; - } - - // wrapper around add button for multiple objects. Default version is wordless plus button for contracted groups of fields - .add { - @include transition(background-color 0.2s ease); - position: relative; - z-index: 2; - top: 0; - left: 0; - width: 3.3em; - padding: 0; - margin: 0 0 0 -20px; - cursor: pointer; - - .button { - border-radius: 0; - overflow: visible; - background-color: $color-salmon-light; - font-size: 0; // helps fake the effect of t.ext-replace class, which can't be used here. - width: 2em; - - // stylelint-disable max-nesting-depth - &:before { - position: relative; - padding: 0; - line-height: 1.8em; // specific height required as parent 'a' has no height - font-size: 1.4rem; - width: 1.8em; - background-color: $color-salmon; - } - - &:hover:before { - background-color: color.adjust($color-salmon, $lightness: -5%); - } - } - } - - .multiple { - padding: 0; - } - } - - &.collapsible { - // li.collapsed gets its height from the fieldset only, which is now hidden - // and h2 has position: absolute which doesn't add to it either, so it would be 0 without this - min-height: 41px; - - .title-wrapper { - &:before { - content: map.get($icons, 'collapse-up'); - cursor: pointer; - } - } - - &.collapsed { - .title-wrapper { - &:before { - content: map.get($icons, 'collapse-down'); - } - } + &.collapsed { + .title-wrapper { + &:before { + content: map.get($icons, 'collapse-down'); } + } } + } } // Custom styles that make some fields look more important .full { - input:not([type=submit]), - textarea, - .halloeditor { - @include nice-padding; - border-radius: 0; - padding-top: 1.5em; - padding-bottom: 1.5em; - font-size: 1.2em; - line-height: 1.6em; - } + input:not([type='submit']), + textarea, + .halloeditor { + @include nice-padding; + border-radius: 0; + padding-top: 1.5em; + padding-bottom: 1.5em; + font-size: 1.2em; + line-height: 1.6em; + } } .title { - input:not([type=submit]), - textarea, - .halloeditor { - font-size: 2em; - font-family: $font-sans; - } + input:not([type='submit']), + textarea, + .halloeditor { + font-size: 2em; + font-family: $font-sans; + } } // Footer control bar for performing actions on the page footer .actions { - .button { - font-weight: 600; - text-overflow: ellipsis; - } + .button { + font-weight: 600; + text-overflow: ellipsis; + } } footer .preview { + button, + .button { + padding: 0 1em; + + .icon { + margin-right: 0.5em; + } + + @include media-breakpoint-down(xs) { + width: 100%; + margin-top: 2px; + margin-bottom: 2px; + height: 3em; + } + + background-color: color.adjust($color-grey-2, $lightness: 10%); + border-color: color.adjust($color-grey-2, $lightness: 10%); + + &:hover { + background-color: $color-grey-2; + border-color: $color-grey-2; + } + } + + .dropdown { + input[type='button'], + input[type='submit'], button, .button { - padding: 0 1em; + background-color: color.adjust($color-grey-2, $lightness: 10%); + border-color: color.adjust($color-grey-2, $lightness: 10%); - .icon { - margin-right: 0.5em; - } - - @include media-breakpoint-down(xs) { - width: 100%; - margin-top: 2px; - margin-bottom: 2px; - height: 3em; - } - - background-color: color.adjust($color-grey-2, $lightness: 10%); - border-color: color.adjust($color-grey-2, $lightness: 10%); - - &:hover { - background-color: $color-grey-2; - border-color: $color-grey-2; - } + &:hover { + background-color: $color-grey-2; + border-color: $color-grey-2; + } } - .dropdown { - input[type=button], - input[type=submit], - button, - .button { - background-color: color.adjust($color-grey-2, $lightness: 10%); - border-color: color.adjust($color-grey-2, $lightness: 10%); - - &:hover { - background-color: $color-grey-2; - border-color: $color-grey-2; - } - } - - ul, - .dropdown-toggle { - background-color: color.adjust($color-grey-2, $lightness: 10%); - } - - .dropdown-toggle:hover, - &.open > .button + .dropdown-toggle { - background-color: $color-grey-2; - } + ul, + .dropdown-toggle { + background-color: color.adjust($color-grey-2, $lightness: 10%); } + + .dropdown-toggle:hover, + &.open > .button + .dropdown-toggle { + background-color: $color-grey-2; + } + } } @include media-breakpoint-up(sm) { - .object { - fieldset { - // Override column mixin for column items. - display: block; - // Override column mixin for column items. - float: none; - max-width: 1024px; - padding-left: 0; - padding-right: 0; + .object { + fieldset { + // Override column mixin for column items. + display: block; + // Override column mixin for column items. + float: none; + max-width: 1024px; + padding-left: 0; + padding-right: 0; - fieldset { - width: 100%; - } - } - - .object-layout { - display: flex; - flex-flow: row-reverse wrap; - - &_small-part { - // IE11 requires units on the flex basis. Unitless breaks. - // stylelint-disable-next-line length-zero-no-unit - flex: 1 0 0%; - } - - &_big-part { - // IE11 requires units on the flex basis. Unitless breaks. - // stylelint-disable-next-line length-zero-no-unit - flex: 5 0 0%; - } - } - - .object-help { - padding-bottom: 40px; - margin-left: 10px; - margin-bottom: 0; - opacity: 0; - } - - &.stream-field { - .object-help { - padding-left: 6.4em; - } - } - - &.full { - fieldset { - // Override column mixin for column items. - display: block; - // Override column mixin for column items. - float: none; - margin-left: -51px; - padding: 0; - padding-top: $object-title-height; - } - - input:not([type=submit]), - textarea, - .halloeditor { - border-width: 0 1px; - } - - .field { - padding: 0; - } - - .field-content { - display: block; - float: none; - width: auto; - padding: inherit; - } - } - - .multiple { - @include column(10); - padding-left: 0; - padding-right: 0; - } - - &.empty .add { - margin: 0 0 0 -50px; - } + fieldset { + width: 100%; + } } - // Make room for comments on the right when enabled - .tab-content--comments-enabled .object { - padding-right: 27%; + .object-layout { + display: flex; + flex-flow: row-reverse wrap; - &.full { - padding-right: 36%; - } + &_small-part { + // IE11 requires units on the flex basis. Unitless breaks. + // stylelint-disable-next-line length-zero-no-unit + flex: 1 0 0%; + } - @include media-breakpoint-up(lg) { - padding-right: 30%; - - &.full { - padding-right: 36%; - } - } + &_big-part { + // IE11 requires units on the flex basis. Unitless breaks. + // stylelint-disable-next-line length-zero-no-unit + flex: 5 0 0%; + } } + + .object-help { + padding-bottom: 40px; + margin-left: 10px; + margin-bottom: 0; + opacity: 0; + } + + &.stream-field { + .object-help { + padding-left: 6.4em; + } + } + + &.full { + fieldset { + // Override column mixin for column items. + display: block; + // Override column mixin for column items. + float: none; + margin-left: -51px; + padding: 0; + padding-top: $object-title-height; + } + + input:not([type='submit']), + textarea, + .halloeditor { + border-width: 0 1px; + } + + .field { + padding: 0; + } + + .field-content { + display: block; + float: none; + width: auto; + padding: inherit; + } + } + + .multiple { + @include column(10); + padding-left: 0; + padding-right: 0; + } + + &.empty .add { + margin: 0 0 0 -50px; + } + } + + // Make room for comments on the right when enabled + .tab-content--comments-enabled .object { + padding-right: 27%; + + &.full { + padding-right: 36%; + } + + @include media-breakpoint-up(lg) { + padding-right: 30%; + + &.full { + padding-right: 36%; + } + } + } } .button.button--live { - background-color: $color-white; - color: $color-teal; - border-radius: 2px; - font-size: 14px; - font-weight: 600; - line-height: 2.3em; - padding: 0 0.75em; + background-color: $color-white; + color: $color-teal; + border-radius: 2px; + font-size: 14px; + font-weight: 600; + line-height: 2.3em; + padding: 0 0.75em; - .icon { - @include svg-icon(1.25em); - margin-right: 0.25em; - } + .icon { + @include svg-icon(1.25em); + margin-right: 0.25em; + } - &:hover { - background-color: $color-teal-darker; - color: $color-white; - } + &:hover { + background-color: $color-teal-darker; + color: $color-white; + } } .workflow-timeline { - list-style: none; - padding: 0; + list-style: none; + padding: 0; - li { - margin-bottom: 1.25em; - position: relative; - } + li { + margin-bottom: 1.25em; + position: relative; + } - li:not(:last-child)::after { - content: ''; - color: $color-grey-3; - position: absolute; - top: 1.5em; - left: calc(0.75em - 1px); - height: 100%; - border-left: 2px dotted; - } + li:not(:last-child)::after { + content: ''; + color: $color-grey-3; + position: absolute; + top: 1.5em; + left: calc(0.75em - 1px); + height: 100%; + border-left: 2px dotted; + } + + .icon { + fill: $color-grey-3; + padding-right: 0.5em; + } + + .in_progress { + font-weight: 700; .icon { - fill: $color-grey-3; - padding-right: 0.5em; + fill: $color-text-base; } + } - .in_progress { - font-weight: 700; + .approved .icon { + fill: $color-teal; + } - .icon { - fill: $color-text-base; - } - } + .needs_changes .icon, + .rejected .icon { + fill: $color-orange; + } - .approved .icon { - fill: $color-teal; - } - - .needs_changes .icon, - .rejected .icon { - fill: $color-orange; - } - - .cancelled .icon { - fill: $color-red-dark; - } + .cancelled .icon { + fill: $color-red-dark; + } } // Media for Windows High Contrast @media (forced-colors: $media-forced-colours) { - .object { - border-top: 1px solid GrayText; + .object { + border-top: 1px solid GrayText; - .object-help { - margin-bottom: 0; - } + .object-help { + margin-bottom: 0; } + } } diff --git a/wagtail/admin/static_src/wagtailadmin/scss/layouts/report.scss b/wagtail/admin/static_src/wagtailadmin/scss/layouts/report.scss index 3744aba575..97a15d8a37 100644 --- a/wagtail/admin/static_src/wagtailadmin/scss/layouts/report.scss +++ b/wagtail/admin/static_src/wagtailadmin/scss/layouts/report.scss @@ -2,73 +2,73 @@ @import '../../../../../../client/scss/tools'; .report { - display: grid; - grid-template-columns: auto; - grid-column-gap: 50px; - margin-left: 50px; - margin-right: 50px; + display: grid; + grid-template-columns: auto; + grid-column-gap: 50px; + margin-left: 50px; + margin-right: 50px; - &--has-filters { - grid-template-columns: auto 300px; + &--has-filters { + grid-template-columns: auto 300px; + } + + &__results { + grid-column-start: col-start 1 col-end 2; + + &--text { + margin: 0 0.5em 0.5em 0; + + + .status-tag { + margin-left: 0; + } } - &__results { - grid-column-start: col-start 1 col-end 2; + &--comment { + display: block; + } + } - &--text { - margin: 0 0.5em 0.5em 0; + &__filters { + grid-column-start: col-start -2 col-end -1; - + .status-tag { - margin-left: 0; - } - } + button[type='submit'] { + display: block; + margin-bottom: 20px; + } - &--comment { - display: block; - } + input[type='checkbox'] { + display: block; + width: unset; + height: unset; + margin-bottom: 10px; + } + + // Get rid of Wagtail's overrides + label { + float: unset; + display: block; + width: unset; + padding-top: 1.2em; + } + } + + &__actions > div { + float: right; + display: block; + margin-right: 10px; + } + + @include media-breakpoint-down(sm) { + &--has-filters { + grid-template-columns: auto; } &__filters { - grid-column-start: col-start -2 col-end -1; - - button[type='submit'] { - display: block; - margin-bottom: 20px; - } - - input[type='checkbox'] { - display: block; - width: unset; - height: unset; - margin-bottom: 10px; - } - - // Get rid of Wagtail's overrides - label { - float: unset; - display: block; - width: unset; - padding-top: 1.2em; - } + grid-row: 1; } - &__actions > div { - float: right; - display: block; - margin-right: 10px; - } - - @include media-breakpoint-down(sm) { - &--has-filters { - grid-template-columns: auto; - } - - &__filters { - grid-row: 1; - } - - form { - margin-bottom: 1em; - } + form { + margin-bottom: 1em; } + } } diff --git a/wagtail/admin/static_src/wagtailadmin/scss/layouts/workflow-edit.scss b/wagtail/admin/static_src/wagtailadmin/scss/layouts/workflow-edit.scss index 42dbaeba0f..5222cef81e 100644 --- a/wagtail/admin/static_src/wagtailadmin/scss/layouts/workflow-edit.scss +++ b/wagtail/admin/static_src/wagtailadmin/scss/layouts/workflow-edit.scss @@ -2,30 +2,30 @@ @import '../../../../../../client/scss/settings/variables'; .listing { - .field label { - @include visuallyhidden; - } + .field label { + @include visuallyhidden; + } - input, - select, - textarea { - font-size: 1em; - } + input, + select, + textarea { + font-size: 1em; + } - select + span:after { - // stylelint-disable-next-line declaration-no-important - font-size: 2.5em !important; - } + select + span:after { + // stylelint-disable-next-line declaration-no-important + font-size: 2.5em !important; + } } .workflow-pages-listing { - max-width: 1024px - 50px; + max-width: 1024px - 50px; - .admin_page_chooser .field-content { - width: 100%; // so that 'choose another page' button displays in its entirety - } + .admin_page_chooser .field-content { + width: 100%; // so that 'choose another page' button displays in its entirety + } } .top-padding { - padding-top: $object-title-height + 12px; + padding-top: $object-title-height + 12px; } diff --git a/wagtail/admin/static_src/wagtailadmin/scss/layouts/workflow-progress.scss b/wagtail/admin/static_src/wagtailadmin/scss/layouts/workflow-progress.scss index d618760979..9177e41f12 100644 --- a/wagtail/admin/static_src/wagtailadmin/scss/layouts/workflow-progress.scss +++ b/wagtail/admin/static_src/wagtailadmin/scss/layouts/workflow-progress.scss @@ -4,60 +4,60 @@ */ .workflow-progress-tabs { - &__buttons { - margin-top: 30px; + &__buttons { + margin-top: 30px; + } + + &__button { + background: none; + border: 0; + padding-bottom: 5px; + font-weight: bold; + + &--active { + border-bottom: 3px solid #007d7e; } + } - &__button { - background: none; - border: 0; - padding-bottom: 5px; - font-weight: bold; + &__tab { + display: none; - &--active { - border-bottom: 3px solid #007d7e; - } - } - - &__tab { - display: none; - - &--active { - display: block; - } + &--active { + display: block; } + } } .workflow-progress-table { - width: 100%; - border-top: 1px solid rgb(229, 229, 229); + width: 100%; + border-top: 1px solid rgb(229, 229, 229); + border-bottom: 1px solid rgb(229, 229, 229); + font-size: 0.8em; + + td, + th { + padding: 20px; + } + + th { + font-size: 1.2em; + } + + &__left-column { + font-size: 1.2em; + font-weight: bold; + color: #555; + } + + &--tasks { + background-color: rgb(250, 250, 250); + + .workflow-progress-table__left-column { + background-color: rgb(245, 245, 245); + } + } + + &--timeline tr { border-bottom: 1px solid rgb(229, 229, 229); - font-size: 0.8em; - - td, - th { - padding: 20px; - } - - th { - font-size: 1.2em; - } - - &__left-column { - font-size: 1.2em; - font-weight: bold; - color: #555; - } - - &--tasks { - background-color: rgb(250, 250, 250); - - .workflow-progress-table__left-column { - background-color: rgb(245, 245, 245); - } - } - - &--timeline tr { - border-bottom: 1px solid rgb(229, 229, 229); - } + } } diff --git a/wagtail/admin/static_src/wagtailadmin/scss/userbar.scss b/wagtail/admin/static_src/wagtailadmin/scss/userbar.scss index 4a1bddbd67..e5ea23cf4a 100644 --- a/wagtail/admin/static_src/wagtailadmin/scss/userbar.scss +++ b/wagtail/admin/static_src/wagtailadmin/scss/userbar.scss @@ -1,7 +1,7 @@ -@use "sass:color"; -@use "sass:map"; -@use "sass:math"; -@use "sass:string"; +@use 'sass:color'; +@use 'sass:map'; +@use 'sass:math'; +@use 'sass:string'; @import '../../../../../client/scss/settings'; @import '../../../../../client/scss/tools'; @@ -17,265 +17,256 @@ $box-shadow-props: 0 0 1px 0 rgba(107, 214, 230, 1); $max-items: 12; $userbar-radius: 6px; - // Classnames will start with this parameter, eg .wagtail- $namespace: 'wagtail'; // Possible positions for the userbar to exist in. These are set through the // {% wagtailuserbar 'bottom-left' %} template tag. $positions: ( - 'top-left': ( - 'vertical': 'top', - 'horizontal': 'left', - 'arrow': 'bottom' - ), - 'top-right': ( - 'vertical': 'top', - 'horizontal': 'right', - 'arrow': 'bottom' - ), - 'bottom-left': ( - 'vertical': 'bottom', - 'horizontal': 'left', - 'arrow': 'top' - ), - 'bottom-right': ( - 'vertical': 'bottom', - 'horizontal': 'right', - 'arrow': 'top' - ) + 'top-left': ( + 'vertical': 'top', + 'horizontal': 'left', + 'arrow': 'bottom', + ), + 'top-right': ( + 'vertical': 'top', + 'horizontal': 'right', + 'arrow': 'bottom', + ), + 'bottom-left': ( + 'vertical': 'bottom', + 'horizontal': 'left', + 'arrow': 'top', + ), + 'bottom-right': ( + 'vertical': 'bottom', + 'horizontal': 'right', + 'arrow': 'top', + ), ); // ============================================================================= // Wagtail userbar proper // ============================================================================= .#{$namespace}-userbar-reset { - all: initial; + all: initial; } - .#{$namespace}-userbar { - position: fixed; - z-index: 9999; - // stylelint-disable-next-line declaration-no-important - font-size: initial !important; - line-height: initial; - margin: 0; - padding: 0; - display: block; - border: 0; - width: auto; - height: auto; + position: fixed; + z-index: 9999; + // stylelint-disable-next-line declaration-no-important + font-size: initial !important; + line-height: initial; + margin: 0; + padding: 0; + display: block; + border: 0; + width: auto; + height: auto; - &-icon { - @include svg-icon(2em); - } + &-icon { + @include svg-icon(2em); + } } - @media print { - .#{$namespace}-userbar { - display: none; - } + .#{$namespace}-userbar { + display: none; + } } // stylelint-disable declaration-no-important .#{$namespace}-userbar-trigger { - all: initial; - display: flex; - align-items: center; - justify-content: center; - width: $size-home-button; - height: $size-home-button; - margin: 0 !important; + all: initial; + display: flex; + align-items: center; + justify-content: center; + width: $size-home-button; + height: $size-home-button; + margin: 0 !important; + overflow: hidden; + background-color: $color-white; + border: 2px solid transparent; + border-radius: 50%; + color: $color-black; + padding: 0 !important; + cursor: pointer; + box-shadow: $box-shadow-props, 0 1px 10px 0 rgba(107, 214, 230, 0.7); + transition: all 0.2s ease-in-out; + font-size: 16px; + text-decoration: none !important; + position: relative; + + .#{$namespace}-userbar-help-text { + // Visually hide the help text + clip: rect(0 0 0 0); + clip-path: inset(50%); + height: 1px; overflow: hidden; - background-color: $color-white; - border: 2px solid transparent; - border-radius: 50%; - color: $color-black; - padding: 0 !important; - cursor: pointer; - box-shadow: $box-shadow-props, 0 1px 10px 0 rgba(107, 214, 230, 0.7); - transition: all 0.2s ease-in-out; - font-size: 16px; - text-decoration: none !important; - position: relative; + position: absolute; + white-space: nowrap; + width: 1px; + } - .#{$namespace}-userbar-help-text { - // Visually hide the help text - clip: rect(0 0 0 0); - clip-path: inset(50%); - height: 1px; - overflow: hidden; - position: absolute; - white-space: nowrap; - width: 1px; - } + .#{$namespace}-icon:before { + transition: color 0.2s ease; + font-size: 32px; + width: auto; + margin: 0; + } - .#{$namespace}-icon:before { - transition: color 0.2s ease; - font-size: 32px; - width: auto; - margin: 0; - } - - &:focus { - outline: $color-focus-outline solid 3px; - } + &:focus { + outline: $color-focus-outline solid 3px; + } } .#{$namespace}-userbar-items { - all: revert; - display: block; - list-style: none; - position: absolute; - margin: 0; - min-width: 210px; - visibility: hidden; - font-family: $font-sans; - font-size: 14px; - box-sizing: border-box; - padding-left: 0; - text-decoration: none; + all: revert; + display: block; + list-style: none; + position: absolute; + margin: 0; + min-width: 210px; + visibility: hidden; + font-family: $font-sans; + font-size: 14px; + box-sizing: border-box; + padding-left: 0; + text-decoration: none; - .#{$namespace}-userbar.is-active & { - visibility: visible; - } + .#{$namespace}-userbar.is-active & { + visibility: visible; + } } // Arrow .#{$namespace}-userbar-items:after { - content: ''; - position: absolute; - width: 0; - height: 0; - opacity: 0; - border: solid $width-arrow transparent; - transition-duration: 0.15s; - transition-timing-function: cubic-bezier(0.55, 0, 0.1, 1); + content: ''; + position: absolute; + width: 0; + height: 0; + opacity: 0; + border: solid $width-arrow transparent; + transition-duration: 0.15s; + transition-timing-function: cubic-bezier(0.55, 0, 0.1, 1); - // stylelint-disable-next-line scss/media-feature-value-dollar-variable - @media (prefers-reduced-motion: reduce) { - transition: none !important; - } + // stylelint-disable-next-line scss/media-feature-value-dollar-variable + @media (prefers-reduced-motion: reduce) { + transition: none !important; + } - .#{$namespace}-userbar.is-active & { - opacity: 1; - transform: translateY(0); - transition-delay: 0.3s; - } + .#{$namespace}-userbar.is-active & { + opacity: 1; + transform: translateY(0); + transition-delay: 0.3s; + } } - .#{$namespace}-userbar-nav { - background: transparent !important; - padding: 0; - margin: 0 !important; - display: block !important; + background: transparent !important; + padding: 0; + margin: 0 !important; + display: block !important; - .#{$namespace}-action { - - background: transparent; - } + .#{$namespace}-action { + background: transparent; + } } - - .#{$namespace}-userbar__item { - all: revert; - margin: 0; - background-color: $color-grey-1; - opacity: 0; - overflow: hidden; - transition-duration: 0.125s; - transition-timing-function: cubic-bezier(0.55, 0, 0.1, 1); - font-family: $font-sans; - font-size: 16px !important; + all: revert; + margin: 0; + background-color: $color-grey-1; + opacity: 0; + overflow: hidden; + transition-duration: 0.125s; + transition-timing-function: cubic-bezier(0.55, 0, 0.1, 1); + font-family: $font-sans; + font-size: 16px !important; + text-decoration: none !important; + + // stylelint-disable-next-line scss/media-feature-value-dollar-variable + @media (prefers-reduced-motion: reduce) { + transition: none !important; + + // Force disable transitions for all items + transition-delay: 0s !important; + } + + &:first-child { + border-top-left-radius: $userbar-radius; + border-top-right-radius: $userbar-radius; + } + + &:last-child { + border-bottom-right-radius: $userbar-radius; + border-bottom-left-radius: $userbar-radius; + } + + & + & { + border-top: 1px solid color.adjust($color-grey-1, $lightness: -3%); + } + + a, + .#{$namespace}-action { + color: #aaa; + display: block; text-decoration: none !important; + transform: none !important; + transition: none !important; + margin: 0 !important; + font-size: 14px !important; - // stylelint-disable-next-line scss/media-feature-value-dollar-variable - @media (prefers-reduced-motion: reduce) { - transition: none !important; - - // Force disable transitions for all items - transition-delay: 0s !important; + &:hover, + &:focus { + color: $color-white; + background-color: rgba(100, 100, 100, 0.15); } - &:first-child { - border-top-left-radius: $userbar-radius; - border-top-right-radius: $userbar-radius; + &:focus { + outline: $color-focus-outline solid 3px; } - &:last-child { - border-bottom-right-radius: $userbar-radius; - border-bottom-left-radius: $userbar-radius; + &-icon { + @include svg-icon(1.1em, middle); + margin-right: 0.5em; + fill: currentColor; } + } - & + & { - border-top: 1px solid color.adjust($color-grey-1, $lightness: -3%); + .#{$namespace}-icon { + position: relative; + + &:before { + position: absolute; + top: 50%; + transform: translateY(-50%); + left: 14px; } + } + a, + button { + font-size: 14px !important; + text-align: left; + padding: 0.8em; + } - a, - .#{$namespace}-action { - color: #aaa; - display: block; - text-decoration: none !important; - transform: none !important; - transition: none !important; - margin: 0 !important; - font-size: 14px !important; - - &:hover, - &:focus { - color: $color-white; - background-color: rgba(100, 100, 100, 0.15); - } - - &:focus { - outline: $color-focus-outline solid 3px; - } - - &-icon { - @include svg-icon(1.1em, middle); - margin-right: 0.5em; - fill: currentColor; - } - - } - - .#{$namespace}-icon { - position: relative; - - &:before { - position: absolute; - top: 50%; - transform: translateY(-50%); - left: 14px; - } - } - - a, - button { - font-size: 14px !important; - text-align: left; - padding: 0.8em; - } - - button { - border: 0; - width: 100%; - background-color: transparent; - outline: none; - } + button { + border: 0; + width: 100%; + background-color: transparent; + outline: none; + } } //Media for Windows High Contrast @media (forced-colors: $media-forced-colours) { - .#{$namespace}-userbar-icon { - fill: $system-color-link-text; - } + .#{$namespace}-userbar-icon { + fill: $system-color-link-text; + } } // ============================================================================= @@ -283,61 +274,61 @@ $positions: ( // ============================================================================= @each $pos, $attrs in $positions { - $vertical: map.get($attrs, vertical); - $horizontal: map.get($attrs, horizontal); - $arrow: map.get($attrs, arrow); + $vertical: map.get($attrs, vertical); + $horizontal: map.get($attrs, horizontal); + $arrow: map.get($attrs, arrow); - .#{$namespace}-userbar--#{$pos} { - #{$vertical}: $position; - #{$horizontal}: $position; + .#{$namespace}-userbar--#{$pos} { + #{$vertical}: $position; + #{$horizontal}: $position; - .#{$namespace}-userbar-items { - #{$vertical}: 100%; - #{$horizontal}: 0; - padding-#{$vertical}: $width-arrow * 2; - } - - .#{$namespace}-userbar-nav .#{$namespace}-userbar__item { - @if $vertical == 'bottom' { - transform: translateY(1em); - } @else { - transform: translateY(-1em); - } - } - - .#{$namespace}-userbar-items:after { - #{$vertical}: 2px; - #{$horizontal}: math.div($size-home-button, 2) - math.div($width-arrow, 2); - border-#{$arrow}-color: $color-grey-1; - - @if $vertical == 'bottom' { - transform: translateY(-$width-arrow); - } - @if $vertical == 'top' { - transform: translateY($width-arrow); - } - } - - &.is-active .#{$namespace}-userbar__item { - @for $i from 1 through $max-items { - // stylelint-disable max-nesting-depth - - @if $vertical == 'bottom' { - &:nth-last-child(#{$i}) { - transition-delay: 0.05s * $i; - } - } - - @if $vertical == 'top' { - &:nth-child(#{$i}) { - transition-delay: 0.05s * $i; - } - } - } - } + .#{$namespace}-userbar-items { + #{$vertical}: 100%; + #{$horizontal}: 0; + padding-#{$vertical}: $width-arrow * 2; } -} + .#{$namespace}-userbar-nav .#{$namespace}-userbar__item { + @if $vertical == 'bottom' { + transform: translateY(1em); + } @else { + transform: translateY(-1em); + } + } + + .#{$namespace}-userbar-items:after { + #{$vertical}: 2px; + #{$horizontal}: math.div($size-home-button, 2) - + math.div($width-arrow, 2); + border-#{$arrow}-color: $color-grey-1; + + @if $vertical == 'bottom' { + transform: translateY(-$width-arrow); + } + @if $vertical == 'top' { + transform: translateY($width-arrow); + } + } + + &.is-active .#{$namespace}-userbar__item { + @for $i from 1 through $max-items { + // stylelint-disable max-nesting-depth + + @if $vertical == 'bottom' { + &:nth-last-child(#{$i}) { + transition-delay: 0.05s * $i; + } + } + + @if $vertical == 'top' { + &:nth-child(#{$i}) { + transition-delay: 0.05s * $i; + } + } + } + } + } +} // ============================================================================= // States @@ -345,6 +336,6 @@ $positions: ( // Active state for the list items comes last. .#{$namespace}-userbar.is-active .#{$namespace}-userbar__item { - transform: translateY(0); - opacity: 1; + transform: translateY(0); + opacity: 1; } diff --git a/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/js/prepopulate.js b/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/js/prepopulate.js index 6eaa8889d6..b59101886a 100644 --- a/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/js/prepopulate.js +++ b/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/js/prepopulate.js @@ -1,7 +1,7 @@ /* global URLify */ -(function($) { - $.fn.prepopulate = function(dependencies, maxLength, allowUnicode) { - /* +(function ($) { + $.fn.prepopulate = function (dependencies, maxLength, allowUnicode) { + /* Depends on urlify.js Populates a selected field with the values of the dependent fields, URLifies and shortens the string. @@ -9,50 +9,54 @@ maxLength - maximum length of the URLify'd string allowUnicode - Unicode support of the URLify'd string */ - return this.each(function() { - var prepopulatedField = $(this); + return this.each(function () { + var prepopulatedField = $(this); - var populate = function() { - // Bail if the field's value has been changed by the user - if (prepopulatedField.data('_changed')) { - return; - } + var populate = function () { + // Bail if the field's value has been changed by the user + if (prepopulatedField.data('_changed')) { + return; + } - var values = []; - $.each(dependencies, function(i, field) { - field = $(field); - if (field.val().length > 0) { - values.push(field.val()); - } - }); - prepopulatedField.val(URLify(values.join(' '), maxLength, allowUnicode)); - }; - - prepopulatedField.data('_changed', false); - prepopulatedField.on('change', function() { - prepopulatedField.data('_changed', true); - }); - - if (!prepopulatedField.val()) { - $(dependencies.join(',')).on('keyup change focus', populate); - } + var values = []; + $.each(dependencies, function (i, field) { + field = $(field); + if (field.val().length > 0) { + values.push(field.val()); + } }); - }; -}(jQuery)); + prepopulatedField.val( + URLify(values.join(' '), maxLength, allowUnicode), + ); + }; + + prepopulatedField.data('_changed', false); + prepopulatedField.on('change', function () { + prepopulatedField.data('_changed', true); + }); + + if (!prepopulatedField.val()) { + $(dependencies.join(',')).on('keyup change focus', populate); + } + }); + }; +})(jQuery); (function ($) { - $(function () { - var fields = $('#modeladmin-prepopulated-fields-constants').data('prepopulatedFields'); - $.each(fields, function (index, field) { - $( - '.empty-form .form-row .field-' + - field.name + - ', .empty-form.form-row .field-' + - field.name - ).addClass('prepopulated_field'); - $(field.id).data('dependency_list', field.dependency_list).prepopulate( - field.dependency_ids, field.maxLength, field.allowUnicode - ); - }); + $(function () { + var fields = $('#modeladmin-prepopulated-fields-constants').data( + 'prepopulatedFields', + ); + $.each(fields, function (index, field) { + $( + '.empty-form .form-row .field-' + + field.name + + ', .empty-form.form-row .field-' + + field.name, + ).addClass('prepopulated_field'); + $(field.id) + .data('dependency_list', field.dependency_list) + .prepopulate(field.dependency_ids, field.maxLength, field.allowUnicode); }); -}(jQuery)); + }); +})(jQuery); diff --git a/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/breadcrumbs_page.scss b/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/breadcrumbs_page.scss index 9f85f0be1e..c7ce98fd1b 100644 --- a/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/breadcrumbs_page.scss +++ b/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/breadcrumbs_page.scss @@ -2,11 +2,11 @@ @import '../../../../../../client/scss/tools'; .breadcrumb { - margin: -1.2em 0 2em; + margin: -1.2em 0 2em; } @include media-breakpoint-up(sm) { - .breadcrumb { - margin-top: -1.8em; - } + .breadcrumb { + margin-top: -1.8em; + } } diff --git a/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/choose_parent_page.scss b/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/choose_parent_page.scss index a9b4ee562b..82a011768c 100644 --- a/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/choose_parent_page.scss +++ b/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/choose_parent_page.scss @@ -1,9 +1,9 @@ // stylelint-disable-next-line selector-max-id #id_parent_page li { - margin: 15px 0; + margin: 15px 0; } // stylelint-disable-next-line selector-max-id #id_parent_page li label { - float: none; + float: none; } diff --git a/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/index.scss b/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/index.scss index 9fcf1351c9..ee3c95d579 100644 --- a/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/index.scss +++ b/wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/scss/index.scss @@ -2,206 +2,200 @@ @import '../../../../../../client/scss/tools'; .content header { - margin-bottom: 0; + margin-bottom: 0; } .result-count { - display: block; - font-weight: 500; + display: block; + font-weight: 500; - &:before { - content: '('; - } + &:before { + content: '('; + } - &:after { - content: ')'; - } + &:after { + content: ')'; + } - @include media-breakpoint-up(lg) { - display: inline-block; - margin-left: 0.25em; - } + @include media-breakpoint-up(lg) { + display: inline-block; + margin-left: 0.25em; + } } .result-list { - margin-bottom: 0; + margin-bottom: 0; } .listing { - td, - th { - vertical-align: top; + td, + th { + vertical-align: top; + } + + thead th.sorted a { + color: $color-teal; + } + + tbody { + overflow: auto; + + tr:hover ul.actions { + visibility: visible; } - thead th.sorted a { - color: $color-teal; - } - - tbody { - overflow: auto; - - tr:hover ul.actions { - visibility: visible; - } - - tr > td { - background-color: inherit; - - a.edit-obj { - color: inherit; - font-weight: 600; - } - } - + tr > td { + background-color: inherit; + + a.edit-obj { + color: inherit; + font-weight: 600; + } } + } } - .changelist-filter { - padding: 0 15px; + padding: 0 15px; - h2 { - background-color: #fafafa; - font-size: 13px; - line-height: 31px; - margin-top: 0; - padding-left: 8px; - border-bottom: 1px solid #e6e6e6; + h2 { + background-color: #fafafa; + font-size: 13px; + line-height: 31px; + margin-top: 0; + padding-left: 8px; + border-bottom: 1px solid #e6e6e6; + } + + h3 { + font-size: 12px; + margin-bottom: 0; + } + + ul { + padding-left: 0; + margin-bottom: 25px; + } + + li { + list-style-type: none; + margin: 0 0 4px; + padding-left: 0; + } + + a { + font-family: $font-sans; + border-radius: 3px; + width: auto; + line-height: 1.2em; + padding: 8px 12px; + font-size: 0.9em; + font-weight: normal; + vertical-align: middle; + display: block; + background-color: #fff; + border: 1px solid $color-teal; + color: $color-teal; + text-decoration: none; + text-transform: uppercase; + position: relative; + overflow: hidden; + box-sizing: border-box; + -webkit-font-smoothing: auto; + // stylelint-disable-next-line property-no-vendor-prefix + -moz-appearance: none; + + &:hover { + background-color: $color-teal-dark; + border-color: $color-teal-dark; + color: #fff; } + } - h3 { - font-size: 12px; - margin-bottom: 0; - } - - ul { - padding-left: 0; - margin-bottom: 25px; - } - - li { - list-style-type: none; - margin: 0 0 4px; - padding-left: 0; - } - - a { - font-family: $font-sans; - border-radius: 3px; - width: auto; - line-height: 1.2em; - padding: 8px 12px; - font-size: 0.9em; - font-weight: normal; - vertical-align: middle; - display: block; - background-color: #fff; - border: 1px solid $color-teal; - color: $color-teal; - text-decoration: none; - text-transform: uppercase; - position: relative; - overflow: hidden; - box-sizing: border-box; - -webkit-font-smoothing: auto; - // stylelint-disable-next-line property-no-vendor-prefix - -moz-appearance: none; - - &:hover { - background-color: $color-teal-dark; - border-color: $color-teal-dark; - color: #fff; - } - } - - li.selected a { - // stylelint-disable-next-line declaration-no-important - color: #fff !important; - // stylelint-disable-next-line declaration-no-important - border-color: $color-teal !important; - background-color: $color-teal; - } + li.selected a { + // stylelint-disable-next-line declaration-no-important + color: #fff !important; + // stylelint-disable-next-line declaration-no-important + border-color: $color-teal !important; + background-color: $color-teal; + } } - .no-search-results { - margin-top: 30px; + margin-top: 30px; - h2 { - padding-top: 0.3em; - margin-bottom: 0.3em; - } + h2 { + padding-top: 0.3em; + margin-bottom: 0.3em; + } - img { - float: left; - margin: 0 15px 15px 0; - width: 50px; - } + img { + float: left; + margin: 0 15px 15px 0; + width: 50px; + } } - .pagination { - margin-top: 3em; - border-top: 1px dashed #d9d9d9; - padding: 2em 1em 0; + margin-top: 3em; + border-top: 1px dashed #d9d9d9; + padding: 2em 1em 0; - ul { - margin-top: -1.25em; - } + ul { + margin-top: -1.25em; + } } - p.no-results { - margin: 30px 1em 0; + margin: 30px 1em 0; } - @include media-breakpoint-up(sm) { - .changelist-filter { - float: right; - padding: 0 1.5%; - } + .changelist-filter { + float: right; + padding: 0 1.5%; + } - .result-list { - padding: 0 1.5% 0 0; + .result-list { + padding: 0 1.5% 0 0; - &.col12 { - padding-right: 0; + &.col12 { + padding-right: 0; - tbody td:last-child { - padding-right: 50px; - } - } - - tbody th:first-child { - padding-left: 50px; - } - } - - .pagination { - padding-left: 50px; + tbody td:last-child { padding-right: 50px; + } } - .pagination.col9 { - width: 73.5%; + tbody th:first-child { + padding-left: 50px; } + } - p.no-results { - margin: 30px 50px 0; - } + .pagination { + padding-left: 50px; + padding-right: 50px; + } + + .pagination.col9 { + width: 73.5%; + } + + p.no-results { + margin: 30px 50px 0; + } } @include media-breakpoint-up(lg) { - .result-list.col9 { - width: 79%; - } + .result-list.col9 { + width: 79%; + } - .changelist-filter { - width: 21%; - } + .changelist-filter { + width: 21%; + } - .pagination.col9 { - width: 77.5%; - } + .pagination.col9 { + width: 77.5%; + } } diff --git a/wagtail/contrib/redirects/tests/files/example.json b/wagtail/contrib/redirects/tests/files/example.json index f47092e3f7..1fb5c85568 100644 --- a/wagtail/contrib/redirects/tests/files/example.json +++ b/wagtail/contrib/redirects/tests/files/example.json @@ -1,14 +1,14 @@ [ - { - "from": "/hello-from-json", - "to": "http://hello.com/random/" - }, - { - "from": "/goodbye-from-json", - "to": "http://hello.com/goodbye/" - }, - { - "from": "/goodbye-from-json", - "to": "/goodbye-not-working/" - } + { + "from": "/hello-from-json", + "to": "http://hello.com/random/" + }, + { + "from": "/goodbye-from-json", + "to": "http://hello.com/goodbye/" + }, + { + "from": "/goodbye-from-json", + "to": "/goodbye-not-working/" + } ] diff --git a/wagtail/contrib/settings/static_src/wagtailsettings/js/site-switcher.js b/wagtail/contrib/settings/static_src/wagtailsettings/js/site-switcher.js index 5de3fbc003..f95917cc0e 100644 --- a/wagtail/contrib/settings/static_src/wagtailsettings/js/site-switcher.js +++ b/wagtail/contrib/settings/static_src/wagtailsettings/js/site-switcher.js @@ -1,12 +1,12 @@ -$(function() { - var $switcher = $('form#settings-site-switch select'); - if (!$switcher.length) return; +$(function () { + var $switcher = $('form#settings-site-switch select'); + if (!$switcher.length) return; - var initial = $switcher.val(); - $switcher.on('change', function() { - var url = $switcher.val(); - if (url !== initial) { - window.location = url; - } - }); + var initial = $switcher.val(); + $switcher.on('change', function () { + var url = $switcher.val(); + if (url !== initial) { + window.location = url; + } + }); }); diff --git a/wagtail/contrib/styleguide/static_src/wagtailstyleguide/scss/styleguide.scss b/wagtail/contrib/styleguide/static_src/wagtailstyleguide/scss/styleguide.scss index 42cacc38da..e7dc899d63 100644 --- a/wagtail/contrib/styleguide/static_src/wagtailstyleguide/scss/styleguide.scss +++ b/wagtail/contrib/styleguide/static_src/wagtailstyleguide/scss/styleguide.scss @@ -2,224 +2,224 @@ @import '../../../../../../client/scss/tools'; section { - border-top: 1px solid $color-grey-3; - margin-top: 2em; - padding: 0 0 2em; + border-top: 1px solid $color-grey-3; + margin-top: 2em; + padding: 0 0 2em; - > h2:first-child { - margin: 0; - font-size: 1em; - background: $color-grey-4; - padding: 1em; - margin-bottom: 1em; - } + > h2:first-child { + margin: 0; + font-size: 1em; + background: $color-grey-4; + padding: 1em; + margin-bottom: 1em; + } } .palette { - @include clearfix(); + @include clearfix(); - ul { - @include clearfix(); - @include unlist(); - } + ul { + @include clearfix(); + @include unlist(); + } + + li { + float: left; + width: 100px; + height: 100px; + padding: 10px; + color: $color-black; + } + + .contrast li { + height: 50px; + } + + .contrast-large { + font-size: 18px; li { - float: left; - width: 100px; - height: 100px; - padding: 10px; - color: $color-black; + width: 150px; + height: 55px; } + } - .contrast li { - height: 50px; - } + .color-black-text { + color: $color-black; + } - .contrast-large { - font-size: 18px; + .color-grey-1-text { + color: $color-grey-1; + } - li { - width: 150px; - height: 55px; - } - } + .color-white-text { + color: $color-white; + } - .color-black-text { - color: $color-black; - } + .color-salmon-light-text { + color: $color-salmon-light; + } - .color-grey-1-text { - color: $color-grey-1; - } + .color-green-text { + color: $color-green; + } - .color-white-text { - color: $color-white; - } + .color-green-dark-text { + color: $color-green-dark; + } - .color-salmon-light-text { - color: $color-salmon-light; - } + .color-teal-darker-text { + color: $color-teal-darker; + } - .color-green-text { - color: $color-green; - } + .color-teal-dark-text { + color: $color-teal-dark; + } - .color-green-dark-text { - color: $color-green-dark; - } + .color-grey-2-text { + color: $color-grey-2; + } - .color-teal-darker-text { - color: $color-teal-darker; - } + .color-red-text { + color: $color-red; + } - .color-teal-dark-text { - color: $color-teal-dark; - } + .color-red-dark-text { + color: $color-red-dark; + } - .color-grey-2-text { - color: $color-grey-2; - } + .color-teal-text { + color: $color-teal; + } - .color-red-text { - color: $color-red; - } + .color-orange-text { + color: $color-orange; + } - .color-red-dark-text { - color: $color-red-dark; - } + .color-orange-dark-text { + color: $color-orange-dark; + } - .color-teal-text { - color: $color-teal; - } + .color-blue-text { + color: $color-blue; + } - .color-orange-text { - color: $color-orange; - } + .color-salmon-text { + color: $color-salmon; + } - .color-orange-dark-text { - color: $color-orange-dark; - } + .color-grey-3-text { + color: $color-grey-3; + } - .color-blue-text { - color: $color-blue; - } + .color-grey-4-text { + color: $color-grey-4; + } - .color-salmon-text { - color: $color-salmon; - } + .color-grey-5-text { + color: $color-grey-5; + } - .color-grey-3-text { - color: $color-grey-3; - } + .color-menu-text { + color: $color-menu-text; + } - .color-grey-4-text { - color: $color-grey-4; - } + .color-teal { + background-color: $color-teal; + } - .color-grey-5-text { - color: $color-grey-5; - } + .color-teal-darker { + background-color: $color-teal-darker; + } - .color-menu-text { - color: $color-menu-text; - } + .color-teal-dark { + background-color: $color-teal-dark; + } - .color-teal { - background-color: $color-teal; - } + .color-red { + background-color: $color-red; + } - .color-teal-darker { - background-color: $color-teal-darker; - } + .color-red-dark { + background-color: $color-red-dark; + } - .color-teal-dark { - background-color: $color-teal-dark; - } + .color-orange { + background-color: $color-orange; + } - .color-red { - background-color: $color-red; - } + .color-orange-dark { + background-color: $color-orange-dark; + } - .color-red-dark { - background-color: $color-red-dark; - } + .color-green { + background-color: $color-green; + } - .color-orange { - background-color: $color-orange; - } + .color-green-dark { + background-color: $color-green-dark; + } - .color-orange-dark { - background-color: $color-orange-dark; - } + .color-blue { + background-color: $color-blue; + } - .color-green { - background-color: $color-green; - } + .color-grey-1 { + background-color: $color-grey-1; + } - .color-green-dark { - background-color: $color-green-dark; - } + .color-grey-2 { + background-color: $color-grey-2; + } - .color-blue { - background-color: $color-blue; - } + .color-grey-3 { + background-color: $color-grey-3; + } - .color-grey-1 { - background-color: $color-grey-1; - } + .color-grey-4 { + background-color: $color-grey-4; + } - .color-grey-2 { - background-color: $color-grey-2; - } + .color-grey-5 { + background-color: $color-grey-5; + } - .color-grey-3 { - background-color: $color-grey-3; - } + .color-salmon { + background-color: $color-salmon; + } - .color-grey-4 { - background-color: $color-grey-4; - } - - .color-grey-5 { - background-color: $color-grey-5; - } - - .color-salmon { - background-color: $color-salmon; - } - - .color-salmon-light { - background-color: $color-salmon-light; - } + .color-salmon-light { + background-color: $color-salmon-light; + } } .icons { - :before, - :after { - font-size: 2em; - } + :before, + :after { + font-size: 2em; + } - .icon { - @include svg-icon(1.5em); - } + .icon { + @include svg-icon(1.5em); + } - ul { - column-count: 3; - } + ul { + column-count: 3; + } - li { - margin-bottom: 1em; - } + li { + margin-bottom: 1em; + } - .spinner { - position: relative; - } + .spinner { + position: relative; + } - // .spinner .icon-spinner:after { - // position: absolute; - // } + // .spinner .icon-spinner:after { + // position: absolute; + // } } .timepicker { - height: 150px; + height: 150px; } diff --git a/wagtail/contrib/typed_table_block/static_src/typed_table_block/scss/typed_table_block.scss b/wagtail/contrib/typed_table_block/static_src/typed_table_block/scss/typed_table_block.scss index a177aa83b6..f54f9890bb 100644 --- a/wagtail/contrib/typed_table_block/static_src/typed_table_block/scss/typed_table_block.scss +++ b/wagtail/contrib/typed_table_block/static_src/typed_table_block/scss/typed_table_block.scss @@ -2,91 +2,91 @@ @import '../../../../../../client/scss/tools'; .typed-table-block { - &__wrapper { - overflow-x: auto; - // Reserve space for the add column menu. - min-height: 20rem; + &__wrapper { + overflow-x: auto; + // Reserve space for the add column menu. + min-height: 20rem; + } + + table { + margin: 2.5rem 0 1rem 2.5rem; + } + + th, + td { + padding: 0.25rem; + } + + th { + position: relative; + border: 2px solid $color-grey-2; + + button.prepend-column, + button.append-column { + position: absolute; + left: -0.9rem; + top: -2rem; } - table { - margin: 2.5rem 0 1rem 2.5rem; + button.delete-column { + position: absolute; + right: 0.625rem; + top: 0.875rem; } - th, - td { - padding: 0.25rem; + input.column-heading { + padding-right: 3rem; + font-weight: bold; + } + } + + td { + position: relative; + border-left: 1px solid $color-grey-2; + } + + th:first-child, + th:last-child, + td:first-child { + border-width: 0; + } + + tbody tr, + tfoot tr { + position: relative; + border-top: 1px dotted $color-grey-2; + + button.prepend-row { + left: -2rem; + position: absolute; + top: -0.9rem; } - th { - position: relative; - border: 2px solid $color-grey-2; - - button.prepend-column, - button.append-column { - position: absolute; - left: -0.9rem; - top: -2rem; - } - - button.delete-column { - position: absolute; - right: 0.625rem; - top: 0.875rem; - } - - input.column-heading { - padding-right: 3rem; - font-weight: bold; - } + button.delete-row { + margin-left: 0.25rem; } - td { - position: relative; - border-left: 1px solid $color-grey-2; + td:not(.control-cell) { + vertical-align: top; + min-width: 20rem; } + } - th:first-child, - th:last-child, - td:first-child { - border-width: 0; + ul.add-column-menu { + position: absolute; + top: 0; + left: -0.9rem; + z-index: 100; + min-width: 10rem; + background-color: $color-white; + + button { + width: 100%; + margin: 1px; } + } - tbody tr, - tfoot tr { - position: relative; - border-top: 1px dotted $color-grey-2; - - button.prepend-row { - left: -2rem; - position: absolute; - top: -0.9rem; - } - - button.delete-row { - margin-left: 0.25rem; - } - - td:not(.control-cell) { - vertical-align: top; - min-width: 20rem; - } - } - - ul.add-column-menu { - position: absolute; - top: 0; - left: -0.9rem; - z-index: 100; - min-width: 10rem; - background-color: $color-white; - - button { - width: 100%; - margin: 1px; - } - } - - .control-cell ul.add-column-menu { - top: 0; - } + .control-cell ul.add-column-menu { + top: 0; + } } diff --git a/wagtail/documents/static_src/wagtaildocs/js/add-multiple.js b/wagtail/documents/static_src/wagtaildocs/js/add-multiple.js index 4da1890652..df928c6bcf 100644 --- a/wagtail/documents/static_src/wagtaildocs/js/add-multiple.js +++ b/wagtail/documents/static_src/wagtaildocs/js/add-multiple.js @@ -1,174 +1,192 @@ -$(function() { - // Redirect users that don't support filereader - if (!$('html').hasClass('filereader')) { - document.location.href = window.fileupload_opts.simple_upload_url; +$(function () { + // Redirect users that don't support filereader + if (!$('html').hasClass('filereader')) { + document.location.href = window.fileupload_opts.simple_upload_url; + return false; + } + + // prevents browser default drag/drop + $(document).on('drop dragover', function (e) { + e.preventDefault(); + }); + + $('#fileupload').fileupload({ + dataType: 'html', + sequentialUploads: true, + dropZone: $('.drop-zone'), + add: function (e, data) { + var $this = $(this); + var that = $this.data('blueimp-fileupload') || $this.data('fileupload'); + var li = $($('#upload-list-item').html()).addClass('upload-uploading'); + var options = that.options; + + $('#upload-list').append(li); + data.context = li; + + data + .process(function () { + return $this.fileupload('process', data); + }) + .always(function () { + data.context.removeClass('processing'); + data.context.find('.left').each(function (index, elm) { + $(elm).append(escapeHtml(data.files[index].name)); + }); + }) + .done(function () { + data.context.find('.start').prop('disabled', false); + if ( + that._trigger('added', e, data) !== false && + (options.autoUpload || data.autoUpload) && + data.autoUpload !== false + ) { + data.submit(); + } + }) + .fail(function () { + if (data.files.error) { + data.context.each(function (index) { + var error = data.files[index].error; + if (error) { + $(this).find('.error_messages').text(error); + } + }); + } + }); + }, + + processfail: function (e, data) { + var itemElement = $(data.context); + itemElement.removeClass('upload-uploading').addClass('upload-failure'); + }, + + progress: function (e, data) { + if (e.isDefaultPrevented()) { return false; - } + } - // prevents browser default drag/drop - $(document).on('drop dragover', function(e) { - e.preventDefault(); - }); + var progress = Math.floor((data.loaded / data.total) * 100); + data.context.each(function () { + $(this) + .find('.progress') + .addClass('active') + .attr('aria-valuenow', progress) + .find('.bar') + .css('width', progress + '%') + .html(progress + '%'); + }); + }, - $('#fileupload').fileupload({ - dataType: 'html', - sequentialUploads: true, - dropZone: $('.drop-zone'), - add: function(e, data) { - var $this = $(this); - var that = $this.data('blueimp-fileupload') || $this.data('fileupload'); - var li = $($('#upload-list-item').html()).addClass('upload-uploading'); - var options = that.options; + progressall: function (e, data) { + var progress = parseInt((data.loaded / data.total) * 100, 10); + $('#overall-progress') + .addClass('active') + .attr('aria-valuenow', progress) + .find('.bar') + .css('width', progress + '%') + .html(progress + '%'); - $('#upload-list').append(li); - data.context = li; + if (progress >= 100) { + $('#overall-progress') + .removeClass('active') + .find('.bar') + .css('width', '0%'); + } + }, - data.process(function() { - return $this.fileupload('process', data); - }).always(function() { - data.context.removeClass('processing'); - data.context.find('.left').each(function(index, elm) { - $(elm).append(escapeHtml(data.files[index].name)); - }); - }).done(function() { - data.context.find('.start').prop('disabled', false); - if ((that._trigger('added', e, data) !== false) && - (options.autoUpload || data.autoUpload) && - data.autoUpload !== false) { - data.submit(); - } - }).fail(function() { - if (data.files.error) { - data.context.each(function(index) { - var error = data.files[index].error; - if (error) { - $(this).find('.error_messages').text(error); - } - }); - } - }); - }, + /** + * Allow a custom title to be defined by an event handler for this form. + * If event.preventDefault is called, the original behaviour of using the raw + * filename (with extension) as the title is preserved. + * + * @param {HtmlElement[]} form + * @returns {{name: 'string', value: *}[]} + */ + formData: function (form) { + var filename = this.files[0].name; + var data = { title: filename.replace(/\.[^.]+$/, '') }; + var maxTitleLength = window.fileupload_opts.max_title_length; - processfail: function(e, data) { - var itemElement = $(data.context); - itemElement.removeClass('upload-uploading').addClass('upload-failure'); - }, + var event = form.get(0).dispatchEvent( + new CustomEvent('wagtail:documents-upload', { + bubbles: true, + cancelable: true, + detail: { + data: data, + filename: filename, + maxTitleLength: maxTitleLength, + }, + }), + ); - progress: function(e, data) { - if (e.isDefaultPrevented()) { - return false; - } + // default behaviour (title is just file name) + return event + ? form.serializeArray().concat({ name: 'title', value: data.title }) + : form.serializeArray(); + }, - var progress = Math.floor(data.loaded / data.total * 100); - data.context.each(function() { - $(this).find('.progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css( - 'width', - progress + '%' - ).html(progress + '%'); - }); - }, + done: function (e, data) { + var itemElement = $(data.context); + var response = JSON.parse(data.result); - progressall: function(e, data) { - var progress = parseInt(data.loaded / data.total * 100, 10); - $('#overall-progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css( - 'width', - progress + '%' - ).html(progress + '%'); + if (response.success) { + itemElement.addClass('upload-success'); - if (progress >= 100) { - $('#overall-progress').removeClass('active').find('.bar').css('width', '0%'); - } - }, + $('.right', itemElement).append(response.form); + } else { + itemElement.addClass('upload-failure'); + $('.right .error_messages', itemElement).append(response.error_message); + } + }, - /** - * Allow a custom title to be defined by an event handler for this form. - * If event.preventDefault is called, the original behaviour of using the raw - * filename (with extension) as the title is preserved. - * - * @param {HtmlElement[]} form - * @returns {{name: 'string', value: *}[]} - */ - formData: function(form) { - var filename = this.files[0].name; - var data = { title: filename.replace(/\.[^.]+$/, '') }; - var maxTitleLength = window.fileupload_opts.max_title_length; + fail: function (e, data) { + var itemElement = $(data.context); + itemElement.addClass('upload-failure'); + }, - var event = form - .get(0) - .dispatchEvent( - new CustomEvent('wagtail:documents-upload', { - bubbles: true, - cancelable: true, - detail: { - data: data, - filename: filename, - maxTitleLength: maxTitleLength, - }, - }) - ); + always: function (e, data) { + var itemElement = $(data.context); + itemElement.removeClass('upload-uploading').addClass('upload-complete'); + }, + }); - // default behaviour (title is just file name) - return event ? form.serializeArray().concat({ name:'title', value: data.title }) : form.serializeArray(); - }, + // ajax-enhance forms added on done() + $('#upload-list').on('submit', 'form', function (e) { + var form = $(this); + var itemElement = form.closest('#upload-list > li'); - done: function(e, data) { - var itemElement = $(data.context); - var response = JSON.parse(data.result); + e.preventDefault(); - if (response.success) { - itemElement.addClass('upload-success'); - - $('.right', itemElement).append(response.form); - } else { - itemElement.addClass('upload-failure'); - $('.right .error_messages', itemElement).append(response.error_message); - } - }, - - fail: function(e, data) { - var itemElement = $(data.context); - itemElement.addClass('upload-failure'); - }, - - always: function(e, data) { - var itemElement = $(data.context); - itemElement.removeClass('upload-uploading').addClass('upload-complete'); - } - }); - - // ajax-enhance forms added on done() - $('#upload-list').on('submit', 'form', function(e) { - var form = $(this); - var itemElement = form.closest('#upload-list > li'); - - e.preventDefault(); - - $.post(this.action, form.serialize(), function(data) { - if (data.success) { - var statusText = $('.status-msg.update-success').text(); - addMessage('success', statusText); - itemElement.slideUp(function() { $(this).remove(); }); - } else { - form.replaceWith(data.form); - - // run tagit enhancement on new form - $('.tag_field input', form).tagit(window.tagit_opts); - } + $.post(this.action, form.serialize(), function (data) { + if (data.success) { + var statusText = $('.status-msg.update-success').text(); + addMessage('success', statusText); + itemElement.slideUp(function () { + $(this).remove(); }); + } else { + form.replaceWith(data.form); + + // run tagit enhancement on new form + $('.tag_field input', form).tagit(window.tagit_opts); + } }); + }); - $('#upload-list').on('click', '.delete', function(e) { - var form = $(this).closest('form'); - var itemElement = form.closest('#upload-list > li'); + $('#upload-list').on('click', '.delete', function (e) { + var form = $(this).closest('form'); + var itemElement = form.closest('#upload-list > li'); - e.preventDefault(); + e.preventDefault(); - var CSRFToken = $('input[name="csrfmiddlewaretoken"]', form).val(); + var CSRFToken = $('input[name="csrfmiddlewaretoken"]', form).val(); - $.post(this.href, { csrfmiddlewaretoken: CSRFToken }, function(data) { - if (data.success) { - itemElement.slideUp(function() { $(this).remove(); }); - } + $.post(this.href, { csrfmiddlewaretoken: CSRFToken }, function (data) { + if (data.success) { + itemElement.slideUp(function () { + $(this).remove(); }); + } }); + }); }); diff --git a/wagtail/documents/static_src/wagtaildocs/js/document-chooser-modal.js b/wagtail/documents/static_src/wagtaildocs/js/document-chooser-modal.js index e8b1eda704..44f6a8ac63 100644 --- a/wagtail/documents/static_src/wagtaildocs/js/document-chooser-modal.js +++ b/wagtail/documents/static_src/wagtaildocs/js/document-chooser-modal.js @@ -1,135 +1,146 @@ function ajaxifyDocumentUploadForm(modal) { - $('form.document-upload', modal.body).on('submit', function() { - var formdata = new FormData(this); + $('form.document-upload', modal.body).on('submit', function () { + var formdata = new FormData(this); - $.ajax({ - url: this.action, - data: formdata, - processData: false, - contentType: false, - type: 'POST', - dataType: 'text', - success: modal.loadResponseText, - error: function(response, textStatus, errorThrown) { - var message = jsonData.error_message + '
    ' + errorThrown + ' - ' + response.status; - $('#upload', modal.body).append( - '
    ' + - '' + jsonData.error_label + ': ' + message + '
    '); - } - }); - - return false; + $.ajax({ + url: this.action, + data: formdata, + processData: false, + contentType: false, + type: 'POST', + dataType: 'text', + success: modal.loadResponseText, + error: function (response, textStatus, errorThrown) { + var message = + jsonData.error_message + + '
    ' + + errorThrown + + ' - ' + + response.status; + $('#upload', modal.body).append( + '
    ' + + '' + + jsonData.error_label + + ': ' + + message + + '
    ', + ); + }, }); - var fileWidget = $('#id_document-chooser-upload-file', modal.body); - fileWidget.on('change', function () { - var titleWidget = $('#id_document-chooser-upload-title', modal.body); - var title = titleWidget.val(); - // do not override a title that already exists (from manual editing or previous upload) - if (title === '') { - // The file widget value example: `C:\fakepath\image.jpg` - var parts = fileWidget.val().split('\\'); - var filename = parts[parts.length - 1]; + return false; + }); - // allow event handler to override filename (used for title) & provide maxLength as int to event - var maxTitleLength = parseInt(titleWidget.attr('maxLength') || '0', 10) || null; - var data = { title: filename.replace(/\.[^.]+$/, '') }; + var fileWidget = $('#id_document-chooser-upload-file', modal.body); + fileWidget.on('change', function () { + var titleWidget = $('#id_document-chooser-upload-title', modal.body); + var title = titleWidget.val(); + // do not override a title that already exists (from manual editing or previous upload) + if (title === '') { + // The file widget value example: `C:\fakepath\image.jpg` + var parts = fileWidget.val().split('\\'); + var filename = parts[parts.length - 1]; - // allow an event handler to customise data or call event.preventDefault to stop any title pre-filling - var form = fileWidget.closest('form').get(0); - var event = form.dispatchEvent( - new CustomEvent('wagtail:documents-upload', { - bubbles: true, - cancelable: true, - detail: { - data: data, - filename: filename, - maxTitleLength: maxTitleLength, - }, - }) - ); + // allow event handler to override filename (used for title) & provide maxLength as int to event + var maxTitleLength = + parseInt(titleWidget.attr('maxLength') || '0', 10) || null; + var data = { title: filename.replace(/\.[^.]+$/, '') }; - if (!event) return; // do not set a title if event.preventDefault(); is called by handler + // allow an event handler to customise data or call event.preventDefault to stop any title pre-filling + var form = fileWidget.closest('form').get(0); + var event = form.dispatchEvent( + new CustomEvent('wagtail:documents-upload', { + bubbles: true, + cancelable: true, + detail: { + data: data, + filename: filename, + maxTitleLength: maxTitleLength, + }, + }), + ); - titleWidget.val(data.title); - } - }); + if (!event) return; // do not set a title if event.preventDefault(); is called by handler + + titleWidget.val(data.title); + } + }); } DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS = { - 'chooser': function(modal, jsonData) { - function ajaxifyLinks (context) { - $('a.document-choice', context).on('click', function() { - modal.loadUrl(this.href); - return false; - }); + chooser: function (modal, jsonData) { + function ajaxifyLinks(context) { + $('a.document-choice', context).on('click', function () { + modal.loadUrl(this.href); + return false; + }); - $('.pagination a', context).on('click', function() { - loadResults(this.href); - return false; - }); + $('.pagination a', context).on('click', function () { + loadResults(this.href); + return false; + }); - $('a.upload-one-now').on('click', function(e) { - // Set current collection ID at upload form tab - const collectionId = $('#collection_chooser_collection_id').val(); - if (collectionId) { - $('#id_document-chooser-upload-collection').val(collectionId); - } - - // Select upload form tab - $('a[href="#upload"]').tab('show'); - e.preventDefault(); - }); + $('a.upload-one-now').on('click', function (e) { + // Set current collection ID at upload form tab + const collectionId = $('#collection_chooser_collection_id').val(); + if (collectionId) { + $('#id_document-chooser-upload-collection').val(collectionId); } - var searchForm = $('form.document-search', modal.body); - var searchUrl = searchForm.attr('action'); - var request; - function search() { - loadResults(searchUrl, searchForm.serialize()); - return false; - } - - function loadResults(url, data) { - var opts = { - url: url, - success: function(resultsData, status) { - request = null; - $('#search-results').html(resultsData); - ajaxifyLinks($('#search-results')); - }, - error: function() { - request = null; - } - }; - if (data) { - opts.data = data; - } - request = $.ajax(opts); - } - - ajaxifyLinks(modal.body); - ajaxifyDocumentUploadForm(modal); - - $('form.document-search', modal.body).on('submit', search); - - $('#id_q').on('input', function() { - if (request) { - request.abort(); - } - clearTimeout($.data(this, 'timer')); - var wait = setTimeout(search, 50); - $(this).data('timer', wait); - }); - - $('#collection_chooser_collection_id').on('change', search); - }, - 'document_chosen': function(modal, jsonData) { - modal.respond('documentChosen', jsonData.result); - modal.close(); - }, - 'reshow_upload_form': function(modal, jsonData) { - $('#upload', modal.body).html(jsonData.htmlFragment); - ajaxifyDocumentUploadForm(modal); + // Select upload form tab + $('a[href="#upload"]').tab('show'); + e.preventDefault(); + }); } + + var searchForm = $('form.document-search', modal.body); + var searchUrl = searchForm.attr('action'); + var request; + function search() { + loadResults(searchUrl, searchForm.serialize()); + return false; + } + + function loadResults(url, data) { + var opts = { + url: url, + success: function (resultsData, status) { + request = null; + $('#search-results').html(resultsData); + ajaxifyLinks($('#search-results')); + }, + error: function () { + request = null; + }, + }; + if (data) { + opts.data = data; + } + request = $.ajax(opts); + } + + ajaxifyLinks(modal.body); + ajaxifyDocumentUploadForm(modal); + + $('form.document-search', modal.body).on('submit', search); + + $('#id_q').on('input', function () { + if (request) { + request.abort(); + } + clearTimeout($.data(this, 'timer')); + var wait = setTimeout(search, 50); + $(this).data('timer', wait); + }); + + $('#collection_chooser_collection_id').on('change', search); + }, + document_chosen: function (modal, jsonData) { + modal.respond('documentChosen', jsonData.result); + modal.close(); + }, + reshow_upload_form: function (modal, jsonData) { + $('#upload', modal.body).html(jsonData.htmlFragment); + ajaxifyDocumentUploadForm(modal); + }, }; diff --git a/wagtail/documents/static_src/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js b/wagtail/documents/static_src/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js index 33770745fb..0ae555648e 100644 --- a/wagtail/documents/static_src/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js +++ b/wagtail/documents/static_src/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js @@ -1,53 +1,56 @@ // Generated by CoffeeScript 1.6.2 -(function() { - (function($) { - return $.widget('IKS.hallowagtaildoclink', { - options: { - uuid: '', - editable: null - }, - populateToolbar: function(toolbar) { - var button; - var widget; +(function () { + (function ($) { + return $.widget('IKS.hallowagtaildoclink', { + options: { + uuid: '', + editable: null, + }, + populateToolbar: function (toolbar) { + var button; + var widget; - widget = this; - button = $(''); - button.hallobutton({ - uuid: this.options.uuid, - editable: this.options.editable, - label: 'Documents', - icon: 'icon-doc-full', - command: null - }); - toolbar.append(button); - return button.on('click', function(event) { - var lastSelection; - - lastSelection = widget.options.editable.getSelection(); - return ModalWorkflow({ - url: window.chooserUrls.documentChooser, - onload: DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS, - responses: { - documentChosen: function(docData) { - var a; - - a = document.createElement('a'); - a.setAttribute('href', docData.url); - a.setAttribute('data-id', docData.id); - a.setAttribute('data-linktype', 'document'); - if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) { - lastSelection.surroundContents(a); - } else { - a.appendChild(document.createTextNode(docData.title)); - lastSelection.insertNode(a); - } - - return widget.options.editable.element.trigger('change'); - } - } - }); - }); - } + widget = this; + button = $(''); + button.hallobutton({ + uuid: this.options.uuid, + editable: this.options.editable, + label: 'Documents', + icon: 'icon-doc-full', + command: null, }); - }(jQuery)); -}).call(this); + toolbar.append(button); + return button.on('click', function (event) { + var lastSelection; + + lastSelection = widget.options.editable.getSelection(); + return ModalWorkflow({ + url: window.chooserUrls.documentChooser, + onload: DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS, + responses: { + documentChosen: function (docData) { + var a; + + a = document.createElement('a'); + a.setAttribute('href', docData.url); + a.setAttribute('data-id', docData.id); + a.setAttribute('data-linktype', 'document'); + if ( + !lastSelection.collapsed && + lastSelection.canSurroundContents() + ) { + lastSelection.surroundContents(a); + } else { + a.appendChild(document.createTextNode(docData.title)); + lastSelection.insertNode(a); + } + + return widget.options.editable.element.trigger('change'); + }, + }, + }); + }); + }, + }); + })(jQuery); +}.call(this)); diff --git a/wagtail/documents/static_src/wagtaildocs/scss/add-multiple.scss b/wagtail/documents/static_src/wagtaildocs/scss/add-multiple.scss index 3aa438d273..c55d9e1460 100644 --- a/wagtail/documents/static_src/wagtaildocs/scss/add-multiple.scss +++ b/wagtail/documents/static_src/wagtaildocs/scss/add-multiple.scss @@ -2,90 +2,90 @@ @import '../../../../../client/scss/tools'; .replace-file-input { - display: inline-block; - position: relative; - overflow: hidden; - padding-bottom: 2px; + display: inline-block; + position: relative; + overflow: hidden; + padding-bottom: 2px; - [type=file] { - padding: 0; - opacity: 0; - position: absolute; - top: 0; - right: 0; - direction: ltr; - width: auto; - display: block; - font-size: 5em; - - &:hover { - cursor: pointer; - } - } + [type='file'] { + padding: 0; + opacity: 0; + position: absolute; + top: 0; + right: 0; + direction: ltr; + width: auto; + display: block; + font-size: 5em; &:hover { - cursor: pointer; - - button { - background-color: $color-teal-darker; - } + cursor: pointer; } + } + + &:hover { + cursor: pointer; + + button { + background-color: $color-teal-darker; + } + } } .upload-list { - > li { - padding: 1em; - } + > li { + padding: 1em; + } - .left { - text-align: center; - word-break: break-all; + .left { + text-align: center; + word-break: break-all; + } + + .preview { + width: 150px; + min-height: 150px; + display: block; + position: relative; + text-align: center; + max-width: 100%; + margin: auto; + } + + .progress { + box-shadow: 0 0 5px 2px rgba(255, 255, 255, 0.4); + max-width: 100%; + z-index: 4; + margin-left: 20%; + margin-right: 20%; + width: 60%; + } + + .status-msg { + display: none; + } + + .upload-complete { + .progress { + opacity: 0; } + } + + .upload-success { + .status-msg.success { + display: block; + } + } + + .upload-failure { + border-color: $color-red; .preview { - width: 150px; - min-height: 150px; - display: block; - position: relative; - text-align: center; - max-width: 100%; - margin: auto; + display: none; } - .progress { - box-shadow: 0 0 5px 2px rgba(255, 255, 255, 0.4); - max-width: 100%; - z-index: 4; - margin-left: 20%; - margin-right: 20%; - width: 60%; - } - - .status-msg { - display: none; - } - - .upload-complete { - .progress { - opacity: 0; - } - } - - .upload-success { - .status-msg.success { - display: block; - } - } - - .upload-failure { - border-color: $color-red; - - .preview { - display: none; - } - - .status-msg.failure { - display: block; - } + .status-msg.failure { + display: block; } + } } diff --git a/wagtail/embeds/static_src/wagtailembeds/js/embed-chooser-modal.js b/wagtail/embeds/static_src/wagtailembeds/js/embed-chooser-modal.js index 200c3bf11e..31df839f20 100644 --- a/wagtail/embeds/static_src/wagtailembeds/js/embed-chooser-modal.js +++ b/wagtail/embeds/static_src/wagtailembeds/js/embed-chooser-modal.js @@ -1,23 +1,23 @@ EMBED_CHOOSER_MODAL_ONLOAD_HANDLERS = { - 'chooser': function(modal, jsonData) { - $('form.embed-form', modal.body).on('submit', function() { - var formdata = new FormData(this); + chooser: function (modal, jsonData) { + $('form.embed-form', modal.body).on('submit', function () { + var formdata = new FormData(this); - $.ajax({ - url: this.action, - data: formdata, - processData: false, - contentType: false, - type: 'POST', - dataType: 'text', - success: modal.loadResponseText - }); + $.ajax({ + url: this.action, + data: formdata, + processData: false, + contentType: false, + type: 'POST', + dataType: 'text', + success: modal.loadResponseText, + }); - return false; - }); - }, - 'embed_chosen': function(modal, jsonData) { - modal.respond('embedChosen', jsonData.embed_html, jsonData.embed_data); - modal.close(); - } + return false; + }); + }, + embed_chosen: function (modal, jsonData) { + modal.respond('embedChosen', jsonData.embed_html, jsonData.embed_data); + modal.close(); + }, }; diff --git a/wagtail/embeds/static_src/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js b/wagtail/embeds/static_src/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js index d55647f952..c09ae07482 100644 --- a/wagtail/embeds/static_src/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js +++ b/wagtail/embeds/static_src/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js @@ -1,53 +1,55 @@ // Generated by CoffeeScript 1.6.2 -(function() { - (function($) { - return $.widget('IKS.hallowagtailembeds', { - options: { - uuid: '', - editable: null - }, - populateToolbar: function(toolbar) { - var button; - var widget; +(function () { + (function ($) { + return $.widget('IKS.hallowagtailembeds', { + options: { + uuid: '', + editable: null, + }, + populateToolbar: function (toolbar) { + var button; + var widget; - widget = this; - button = $(''); - button.hallobutton({ - uuid: this.options.uuid, - editable: this.options.editable, - label: 'Embed', - icon: 'icon-media', - command: null - }); - - toolbar.append(button); - - return button.on('click', function(event) { - var insertionPoint; - var lastSelection; - - lastSelection = widget.options.editable.getSelection(); - insertionPoint = $(lastSelection.endContainer).parentsUntil('[data-hallo-editor]').last(); - - return ModalWorkflow({ - url: window.chooserUrls.embedsChooser, - onload: global.EMBED_CHOOSER_MODAL_ONLOAD_HANDLERS, - responses: { - embedChosen: function(embedData) { - var elem; - - elem = $(embedData).get(0); - lastSelection.insertNode(elem); - if (elem.getAttribute('contenteditable') === 'false') { - insertRichTextDeleteControl(elem); - } - - return widget.options.editable.element.trigger('change'); - } - } - }); - }); - } + widget = this; + button = $(''); + button.hallobutton({ + uuid: this.options.uuid, + editable: this.options.editable, + label: 'Embed', + icon: 'icon-media', + command: null, }); - }(jQuery)); -}).call(this); + + toolbar.append(button); + + return button.on('click', function (event) { + var insertionPoint; + var lastSelection; + + lastSelection = widget.options.editable.getSelection(); + insertionPoint = $(lastSelection.endContainer) + .parentsUntil('[data-hallo-editor]') + .last(); + + return ModalWorkflow({ + url: window.chooserUrls.embedsChooser, + onload: global.EMBED_CHOOSER_MODAL_ONLOAD_HANDLERS, + responses: { + embedChosen: function (embedData) { + var elem; + + elem = $(embedData).get(0); + lastSelection.insertNode(elem); + if (elem.getAttribute('contenteditable') === 'false') { + insertRichTextDeleteControl(elem); + } + + return widget.options.editable.element.trigger('change'); + }, + }, + }); + }); + }, + }); + })(jQuery); +}.call(this)); diff --git a/wagtail/images/static_src/wagtailimages/js/add-multiple.js b/wagtail/images/static_src/wagtailimages/js/add-multiple.js index 7d9c9a54cd..30e7bd0bf7 100644 --- a/wagtail/images/static_src/wagtailimages/js/add-multiple.js +++ b/wagtail/images/static_src/wagtailimages/js/add-multiple.js @@ -1,201 +1,219 @@ -$(function() { - // Redirect users that don't support filereader - if (!$('html').hasClass('filereader')) { - document.location.href = window.fileupload_opts.simple_upload_url; +$(function () { + // Redirect users that don't support filereader + if (!$('html').hasClass('filereader')) { + document.location.href = window.fileupload_opts.simple_upload_url; + return false; + } + + // prevents browser default drag/drop + $(document).on('drop dragover', function (e) { + e.preventDefault(); + }); + + $('#fileupload').fileupload({ + dataType: 'html', + sequentialUploads: true, + dropZone: $('.drop-zone'), + acceptFileTypes: window.fileupload_opts.accepted_file_types, + maxFileSize: window.fileupload_opts.max_file_size, + previewMinWidth: 150, + previewMaxWidth: 150, + previewMinHeight: 150, + previewMaxHeight: 150, + messages: { + acceptFileTypes: window.fileupload_opts.errormessages.accepted_file_types, + maxFileSize: window.fileupload_opts.errormessages.max_file_size, + }, + add: function (e, data) { + $('.messages').empty(); + var $this = $(this); + var that = $this.data('blueimp-fileupload') || $this.data('fileupload'); + var li = $($('#upload-list-item').html()).addClass('upload-uploading'); + var options = that.options; + + $('#upload-list').append(li); + data.context = li; + + data + .process(function () { + return $this.fileupload('process', data); + }) + .always(function () { + data.context.removeClass('processing'); + data.context.find('.left').each(function (index, elm) { + $(elm).append(escapeHtml(data.files[index].name)); + }); + + data.context.find('.preview .thumb').each(function (index, elm) { + $(elm).addClass('hasthumb'); + $(elm).append(data.files[index].preview); + }); + }) + .done(function () { + data.context.find('.start').prop('disabled', false); + if ( + that._trigger('added', e, data) !== false && + (options.autoUpload || data.autoUpload) && + data.autoUpload !== false + ) { + data.submit(); + } + }) + .fail(function () { + if (data.files.error) { + data.context.each(function (index) { + var error = data.files[index].error; + if (error) { + $(this).find('.error_messages').html(error); + } + }); + } + }); + }, + + processfail: function (e, data) { + var itemElement = $(data.context); + itemElement.removeClass('upload-uploading').addClass('upload-failure'); + }, + + progress: function (e, data) { + if (e.isDefaultPrevented()) { return false; - } + } - // prevents browser default drag/drop - $(document).on('drop dragover', function(e) { - e.preventDefault(); - }); + var progress = Math.floor((data.loaded / data.total) * 100); + data.context.each(function () { + $(this) + .find('.progress') + .addClass('active') + .attr('aria-valuenow', progress) + .find('.bar') + .css('width', progress + '%') + .html(progress + '%'); + }); + }, - $('#fileupload').fileupload({ - dataType: 'html', - sequentialUploads: true, - dropZone: $('.drop-zone'), - acceptFileTypes: window.fileupload_opts.accepted_file_types, - maxFileSize: window.fileupload_opts.max_file_size, - previewMinWidth:150, - previewMaxWidth:150, - previewMinHeight:150, - previewMaxHeight:150, - messages: { - acceptFileTypes: window.fileupload_opts.errormessages.accepted_file_types, - maxFileSize: window.fileupload_opts.errormessages.max_file_size - }, - add: function(e, data) { - $('.messages').empty(); - var $this = $(this); - var that = $this.data('blueimp-fileupload') || $this.data('fileupload'); - var li = $($('#upload-list-item').html()).addClass('upload-uploading'); - var options = that.options; + progressall: function (e, data) { + var progress = parseInt((data.loaded / data.total) * 100, 10); + $('#overall-progress') + .addClass('active') + .attr('aria-valuenow', progress) + .find('.bar') + .css('width', progress + '%') + .html(progress + '%'); - $('#upload-list').append(li); - data.context = li; + if (progress >= 100) { + $('#overall-progress') + .removeClass('active') + .find('.bar') + .css('width', '0%'); + } + }, - data.process(function() { - return $this.fileupload('process', data); - }).always(function() { - data.context.removeClass('processing'); - data.context.find('.left').each(function(index, elm) { - $(elm).append(escapeHtml(data.files[index].name)); - }); + /** + * Allow a custom title to be defined by an event handler for this form. + * If event.preventDefault is called, the original behaviour of using the raw + * filename (with extension) as the title is preserved. + * + * @example + * document.addEventListener('wagtail:images-upload', function(event) { + * // remove file extension + * var newTitle = (event.detail.data.title || '').replace(/\.[^.]+$/, ''); + * event.detail.data.title = newTitle; + * }); + * + * @param {HtmlElement[]} form + * @returns {{name: 'string', value: *}[]} + */ + formData: function (form) { + var filename = this.files[0].name; + var data = { title: filename.replace(/\.[^.]+$/, '') }; + var maxTitleLength = window.fileupload_opts.max_title_length; - data.context.find('.preview .thumb').each(function(index, elm) { - $(elm).addClass('hasthumb'); - $(elm).append(data.files[index].preview); - }); - }).done(function() { - data.context.find('.start').prop('disabled', false); - if ((that._trigger('added', e, data) !== false) && - (options.autoUpload || data.autoUpload) && - data.autoUpload !== false) { - data.submit(); - } - }).fail(function() { - if (data.files.error) { - data.context.each(function(index) { - var error = data.files[index].error; - if (error) { - $(this).find('.error_messages').html(error); - } - }); - } - }); - }, + var event = form.get(0).dispatchEvent( + new CustomEvent('wagtail:images-upload', { + bubbles: true, + cancelable: true, + detail: { + data: data, + filename: filename, + maxTitleLength: maxTitleLength, + }, + }), + ); - processfail: function(e, data) { - var itemElement = $(data.context); - itemElement.removeClass('upload-uploading').addClass('upload-failure'); - }, + // default behaviour (title is just file name) + return event + ? form.serializeArray().concat({ name: 'title', value: data.title }) + : form.serializeArray(); + }, - progress: function(e, data) { - if (e.isDefaultPrevented()) { - return false; - } + done: function (e, data) { + var itemElement = $(data.context); + var response = JSON.parse(data.result); - var progress = Math.floor(data.loaded / data.total * 100); - data.context.each(function() { - $(this).find('.progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css( - 'width', - progress + '%' - ).html(progress + '%'); - }); - }, + if (response.success) { + itemElement.addClass('upload-success'); - progressall: function(e, data) { - var progress = parseInt(data.loaded / data.total * 100, 10); - $('#overall-progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css( - 'width', - progress + '%' - ).html(progress + '%'); + $('.right', itemElement).append(response.form); + } else { + itemElement.addClass('upload-failure'); + $('.right .error_messages', itemElement).append(response.error_message); + } + }, - if (progress >= 100) { - $('#overall-progress').removeClass('active').find('.bar').css('width', '0%'); - } - }, + fail: function (e, data) { + var itemElement = $(data.context); + var errorMessage = $('.server-error', itemElement); + $('.error-text', errorMessage).text(data.errorThrown); + $('.error-code', errorMessage).text(data.jqXHR.status); - /** - * Allow a custom title to be defined by an event handler for this form. - * If event.preventDefault is called, the original behaviour of using the raw - * filename (with extension) as the title is preserved. - * - * @example - * document.addEventListener('wagtail:images-upload', function(event) { - * // remove file extension - * var newTitle = (event.detail.data.title || '').replace(/\.[^.]+$/, ''); - * event.detail.data.title = newTitle; - * }); - * - * @param {HtmlElement[]} form - * @returns {{name: 'string', value: *}[]} - */ - formData: function(form) { - var filename = this.files[0].name; - var data = { title: filename.replace(/\.[^.]+$/, '') }; - var maxTitleLength = window.fileupload_opts.max_title_length; + itemElement.addClass('upload-server-error'); + }, - var event = form - .get(0) - .dispatchEvent( - new CustomEvent('wagtail:images-upload', { - bubbles: true, - cancelable: true, - detail: { - data: data, - filename: filename, - maxTitleLength: maxTitleLength, - }, - }) - ); + always: function (e, data) { + var itemElement = $(data.context); + itemElement.removeClass('upload-uploading').addClass('upload-complete'); + }, + }); - // default behaviour (title is just file name) - return event ? form.serializeArray().concat({ name:'title', value: data.title }) : form.serializeArray(); - }, + // ajax-enhance forms added on done() + $('#upload-list').on('submit', 'form', function (e) { + var form = $(this); + var itemElement = form.closest('#upload-list > li'); - done: function(e, data) { - var itemElement = $(data.context); - var response = JSON.parse(data.result); + e.preventDefault(); - if (response.success) { - itemElement.addClass('upload-success'); - - $('.right', itemElement).append(response.form); - } else { - itemElement.addClass('upload-failure'); - $('.right .error_messages', itemElement).append(response.error_message); - } - }, - - fail: function(e, data) { - var itemElement = $(data.context); - var errorMessage = $('.server-error', itemElement); - $('.error-text', errorMessage).text(data.errorThrown); - $('.error-code', errorMessage).text(data.jqXHR.status); - - itemElement.addClass('upload-server-error'); - }, - - always: function(e, data) { - var itemElement = $(data.context); - itemElement.removeClass('upload-uploading').addClass('upload-complete'); - } - }); - - // ajax-enhance forms added on done() - $('#upload-list').on('submit', 'form', function(e) { - var form = $(this); - var itemElement = form.closest('#upload-list > li'); - - e.preventDefault(); - - $.post(this.action, form.serialize(), function(data) { - if (data.success) { - var statusText = $('.status-msg.update-success').text(); - addMessage('success', statusText); - itemElement.slideUp(function() { $(this).remove(); }); - } else { - form.replaceWith(data.form); - - // run tagit enhancement on new form - $('.tag_field input', form).tagit(window.tagit_opts); - } + $.post(this.action, form.serialize(), function (data) { + if (data.success) { + var statusText = $('.status-msg.update-success').text(); + addMessage('success', statusText); + itemElement.slideUp(function () { + $(this).remove(); }); + } else { + form.replaceWith(data.form); + + // run tagit enhancement on new form + $('.tag_field input', form).tagit(window.tagit_opts); + } }); + }); - $('#upload-list').on('click', '.delete', function(e) { - var form = $(this).closest('form'); - var itemElement = form.closest('#upload-list > li'); + $('#upload-list').on('click', '.delete', function (e) { + var form = $(this).closest('form'); + var itemElement = form.closest('#upload-list > li'); - e.preventDefault(); + e.preventDefault(); - var CSRFToken = $('input[name="csrfmiddlewaretoken"]', form).val(); + var CSRFToken = $('input[name="csrfmiddlewaretoken"]', form).val(); - $.post(this.href, { csrfmiddlewaretoken: CSRFToken }, function(data) { - if (data.success) { - itemElement.slideUp(function() { $(this).remove(); }); - } + $.post(this.href, { csrfmiddlewaretoken: CSRFToken }, function (data) { + if (data.success) { + itemElement.slideUp(function () { + $(this).remove(); }); + } }); + }); }); diff --git a/wagtail/images/static_src/wagtailimages/js/focal-point-chooser.js b/wagtail/images/static_src/wagtailimages/js/focal-point-chooser.js index 2c699e7665..d4353b439b 100644 --- a/wagtail/images/static_src/wagtailimages/js/focal-point-chooser.js +++ b/wagtail/images/static_src/wagtailimages/js/focal-point-chooser.js @@ -1,93 +1,99 @@ var jcropapi; function setupJcrop(image, original, focalPointOriginal, fields) { - image.Jcrop({ - trueSize: [original.width, original.height], - bgColor: 'rgb(192, 192, 192)', - onSelect: function(box) { - var x = Math.floor((box.x + box.x2) / 2); - var y = Math.floor((box.y + box.y2) / 2); - var w = Math.floor(box.w); - var h = Math.floor(box.h); + image.Jcrop( + { + trueSize: [original.width, original.height], + bgColor: 'rgb(192, 192, 192)', + onSelect: function (box) { + var x = Math.floor((box.x + box.x2) / 2); + var y = Math.floor((box.y + box.y2) / 2); + var w = Math.floor(box.w); + var h = Math.floor(box.h); - fields.x.val(x); - fields.y.val(y); - fields.width.val(w); - fields.height.val(h); - }, + fields.x.val(x); + fields.y.val(y); + fields.width.val(w); + fields.height.val(h); + }, - onRelease: function() { - fields.x.val(focalPointOriginal.x); - fields.y.val(focalPointOriginal.y); - fields.width.val(focalPointOriginal.width); - fields.height.val(focalPointOriginal.height); - } - }, function() { - jcropapi = this; + onRelease: function () { + fields.x.val(focalPointOriginal.x); + fields.y.val(focalPointOriginal.y); + fields.width.val(focalPointOriginal.width); + fields.height.val(focalPointOriginal.height); + }, + }, + function () { + jcropapi = this; - // Set alt="" on the image so its src is not read out loud to screen reader users. - var $holderImage = $('img', jcropapi.ui.holder); - $holderImage.attr('alt', ''); - }); + // Set alt="" on the image so its src is not read out loud to screen reader users. + var $holderImage = $('img', jcropapi.ui.holder); + $holderImage.attr('alt', ''); + }, + ); } -$(function() { - var $chooser = $('div.focal-point-chooser'); - var $indicator = $('.current-focal-point-indicator', $chooser); - var $image = $('img', $chooser); +$(function () { + var $chooser = $('div.focal-point-chooser'); + var $indicator = $('.current-focal-point-indicator', $chooser); + var $image = $('img', $chooser); - var original = { - width: $image.data('originalWidth'), - height: $image.data('originalHeight') - }; + var original = { + width: $image.data('originalWidth'), + height: $image.data('originalHeight'), + }; - var focalPointOriginal = { - x: $chooser.data('focalPointX'), - y: $chooser.data('focalPointY'), - width: $chooser.data('focalPointWidth'), - height: $chooser.data('focalPointHeight') - }; + var focalPointOriginal = { + x: $chooser.data('focalPointX'), + y: $chooser.data('focalPointY'), + width: $chooser.data('focalPointWidth'), + height: $chooser.data('focalPointHeight'), + }; - var fields = { - x: $('input.focal_point_x'), - y: $('input.focal_point_y'), - width: $('input.focal_point_width'), - height: $('input.focal_point_height') - }; + var fields = { + x: $('input.focal_point_x'), + y: $('input.focal_point_y'), + width: $('input.focal_point_width'), + height: $('input.focal_point_height'), + }; - var left = focalPointOriginal.x - focalPointOriginal.width / 2; - var top = focalPointOriginal.y - focalPointOriginal.height / 2; - var width = focalPointOriginal.width; - var height = focalPointOriginal.height; + var left = focalPointOriginal.x - focalPointOriginal.width / 2; + var top = focalPointOriginal.y - focalPointOriginal.height / 2; + var width = focalPointOriginal.width; + var height = focalPointOriginal.height; - $indicator.css('left', (left * 100 / original.width) + '%'); - $indicator.css('top', (top * 100 / original.height) + '%'); - $indicator.css('width', (width * 100 / original.width) + '%'); - $indicator.css('height', (height * 100 / original.height) + '%'); + $indicator.css('left', (left * 100) / original.width + '%'); + $indicator.css('top', (top * 100) / original.height + '%'); + $indicator.css('width', (width * 100) / original.width + '%'); + $indicator.css('height', (height * 100) / original.height + '%'); - var params = [$image, original, focalPointOriginal, fields]; + var params = [$image, original, focalPointOriginal, fields]; + setupJcrop.apply(this, params); + + $(window).on( + 'resize', + $.debounce(300, function () { + // jcrop doesn't support responsive images so to cater for resizing the browser + // we have to destroy() it, which doesn't properly do it, + // so destroy it some more, then re-apply it + jcropapi.destroy(); + $image.removeAttr('style'); + $('.jcrop-holder').remove(); + setupJcrop.apply(this, params); + }), + ); + + $('.remove-focal-point').on('click', function () { + jcropapi.destroy(); + $image.removeAttr('style'); + $('.jcrop-holder').remove(); + $('.current-focal-point-indicator').remove(); + fields.x.val(''); + fields.y.val(''); + fields.width.val(''); + fields.height.val(''); setupJcrop.apply(this, params); - - $(window).on('resize', $.debounce(300, function() { - // jcrop doesn't support responsive images so to cater for resizing the browser - // we have to destroy() it, which doesn't properly do it, - // so destroy it some more, then re-apply it - jcropapi.destroy(); - $image.removeAttr('style'); - $('.jcrop-holder').remove(); - setupJcrop.apply(this, params); - })); - - $('.remove-focal-point').on('click', function() { - jcropapi.destroy(); - $image.removeAttr('style'); - $('.jcrop-holder').remove(); - $('.current-focal-point-indicator').remove(); - fields.x.val(''); - fields.y.val(''); - fields.width.val(''); - fields.height.val(''); - setupJcrop.apply(this, params); - }); + }); }); diff --git a/wagtail/images/static_src/wagtailimages/js/hallo-plugins/hallo-wagtailimage.js b/wagtail/images/static_src/wagtailimages/js/hallo-plugins/hallo-wagtailimage.js index ca05b1289a..4c342e39ac 100644 --- a/wagtail/images/static_src/wagtailimages/js/hallo-plugins/hallo-wagtailimage.js +++ b/wagtail/images/static_src/wagtailimages/js/hallo-plugins/hallo-wagtailimage.js @@ -1,50 +1,52 @@ // Generated by CoffeeScript 1.6.2 -(function() { - (function($) { - return $.widget('IKS.hallowagtailimage', { - options: { - uuid: '', - editable: null - }, - populateToolbar: function(toolbar) { - var button; - var widget; +(function () { + (function ($) { + return $.widget('IKS.hallowagtailimage', { + options: { + uuid: '', + editable: null, + }, + populateToolbar: function (toolbar) { + var button; + var widget; - widget = this; - button = $(''); - button.hallobutton({ - uuid: this.options.uuid, - editable: this.options.editable, - label: 'Images', - icon: 'icon-image', - command: null - }); - toolbar.append(button); - return button.on('click', function(event) { - var insertionPoint; - var lastSelection; - - lastSelection = widget.options.editable.getSelection(); - insertionPoint = $(lastSelection.endContainer).parentsUntil('[data-hallo-editor]').last(); - return ModalWorkflow({ - url: window.chooserUrls.imageChooser + '?select_format=true', - onload: IMAGE_CHOOSER_MODAL_ONLOAD_HANDLERS, - responses: { - imageChosen: function(imageData) { - var elem; - - elem = $(imageData.html).get(0); - lastSelection.insertNode(elem); - if (elem.getAttribute('contenteditable') === 'false') { - insertRichTextDeleteControl(elem); - } - - return widget.options.editable.element.trigger('change'); - } - } - }); - }); - } + widget = this; + button = $(''); + button.hallobutton({ + uuid: this.options.uuid, + editable: this.options.editable, + label: 'Images', + icon: 'icon-image', + command: null, }); - }(jQuery)); -}).call(this); + toolbar.append(button); + return button.on('click', function (event) { + var insertionPoint; + var lastSelection; + + lastSelection = widget.options.editable.getSelection(); + insertionPoint = $(lastSelection.endContainer) + .parentsUntil('[data-hallo-editor]') + .last(); + return ModalWorkflow({ + url: window.chooserUrls.imageChooser + '?select_format=true', + onload: IMAGE_CHOOSER_MODAL_ONLOAD_HANDLERS, + responses: { + imageChosen: function (imageData) { + var elem; + + elem = $(imageData.html).get(0); + lastSelection.insertNode(elem); + if (elem.getAttribute('contenteditable') === 'false') { + insertRichTextDeleteControl(elem); + } + + return widget.options.editable.element.trigger('change'); + }, + }, + }); + }); + }, + }); + })(jQuery); +}.call(this)); diff --git a/wagtail/images/static_src/wagtailimages/js/image-chooser-modal.js b/wagtail/images/static_src/wagtailimages/js/image-chooser-modal.js index 95dbf51698..985cb3e95d 100644 --- a/wagtail/images/static_src/wagtailimages/js/image-chooser-modal.js +++ b/wagtail/images/static_src/wagtailimages/js/image-chooser-modal.js @@ -1,179 +1,196 @@ function ajaxifyImageUploadForm(modal) { - $('form.image-upload', modal.body).on('submit', function() { - var formdata = new FormData(this); + $('form.image-upload', modal.body).on('submit', function () { + var formdata = new FormData(this); - if (!$('#id_image-chooser-upload-title', modal.body).val()) { - var li = $('#id_image-chooser-upload-title', modal.body).closest('li'); - if (!li.hasClass('error')) { - li.addClass('error'); - $('#id_image-chooser-upload-title', modal.body) - .closest('.field-content') - .append( - '

    This field is required.

    ' - ); - } - setTimeout(cancelSpinner, 500); - } else { - $.ajax({ - url: this.action, - data: formdata, - processData: false, - contentType: false, - type: 'POST', - dataType: 'text', - success: modal.loadResponseText, - error: function(response, textStatus, errorThrown) { - var message = jsonData.error_message + '
    ' + errorThrown + ' - ' + response.status; - $('#upload').append( - '
    ' + - '' + jsonData.error_label + ': ' + message + '
    '); - } - }); - } + if (!$('#id_image-chooser-upload-title', modal.body).val()) { + var li = $('#id_image-chooser-upload-title', modal.body).closest('li'); + if (!li.hasClass('error')) { + li.addClass('error'); + $('#id_image-chooser-upload-title', modal.body) + .closest('.field-content') + .append( + '

    This field is required.

    ', + ); + } + setTimeout(cancelSpinner, 500); + } else { + $.ajax({ + url: this.action, + data: formdata, + processData: false, + contentType: false, + type: 'POST', + dataType: 'text', + success: modal.loadResponseText, + error: function (response, textStatus, errorThrown) { + var message = + jsonData.error_message + + '
    ' + + errorThrown + + ' - ' + + response.status; + $('#upload').append( + '
    ' + + '' + + jsonData.error_label + + ': ' + + message + + '
    ', + ); + }, + }); + } - return false; - }); + return false; + }); - var fileWidget = $('#id_image-chooser-upload-file', modal.body); - fileWidget.on('change', function () { - var titleWidget = $('#id_image-chooser-upload-title', modal.body); - var title = titleWidget.val(); - // do not override a title that already exists (from manual editing or previous upload) - if (title === '') { - // The file widget value example: `C:\fakepath\image.jpg` - var parts = fileWidget.val().split('\\'); - var filename = parts[parts.length - 1]; + var fileWidget = $('#id_image-chooser-upload-file', modal.body); + fileWidget.on('change', function () { + var titleWidget = $('#id_image-chooser-upload-title', modal.body); + var title = titleWidget.val(); + // do not override a title that already exists (from manual editing or previous upload) + if (title === '') { + // The file widget value example: `C:\fakepath\image.jpg` + var parts = fileWidget.val().split('\\'); + var filename = parts[parts.length - 1]; - // allow event handler to override filename (used for title) & provide maxLength as int to event - var maxTitleLength = parseInt(titleWidget.attr('maxLength') || '0', 10) || null; - var data = { title: filename.replace(/\.[^.]+$/, '') }; + // allow event handler to override filename (used for title) & provide maxLength as int to event + var maxTitleLength = + parseInt(titleWidget.attr('maxLength') || '0', 10) || null; + var data = { title: filename.replace(/\.[^.]+$/, '') }; - // allow an event handler to customise data or call event.preventDefault to stop any title pre-filling - var form = fileWidget.closest('form').get(0); - var event = form.dispatchEvent( - new CustomEvent('wagtail:images-upload', { - bubbles: true, - cancelable: true, - detail: { - data: data, - filename: filename, - maxTitleLength: maxTitleLength, - }, - }) - ); + // allow an event handler to customise data or call event.preventDefault to stop any title pre-filling + var form = fileWidget.closest('form').get(0); + var event = form.dispatchEvent( + new CustomEvent('wagtail:images-upload', { + bubbles: true, + cancelable: true, + detail: { + data: data, + filename: filename, + maxTitleLength: maxTitleLength, + }, + }), + ); - if (!event) return; // do not set a title if event.preventDefault(); is called by handler + if (!event) return; // do not set a title if event.preventDefault(); is called by handler - titleWidget.val(data.title); - } - }); + titleWidget.val(data.title); + } + }); } IMAGE_CHOOSER_MODAL_ONLOAD_HANDLERS = { - 'chooser': function(modal, jsonData) { - var searchForm = $('form.image-search', modal.body); - var searchUrl = searchForm.attr('action'); + chooser: function (modal, jsonData) { + var searchForm = $('form.image-search', modal.body); + var searchUrl = searchForm.attr('action'); - function ajaxifyLinks (context) { - $('.listing a', context).on('click', function() { - modal.loadUrl(this.href); - return false; - }); + function ajaxifyLinks(context) { + $('.listing a', context).on('click', function () { + modal.loadUrl(this.href); + return false; + }); - $('.pagination a', context).on('click', function() { - fetchResults(this.href); - return false; - }); - } - var request; - - function fetchResults(url, requestData) { - var opts = { - url: url, - success: function(data, status) { - request = null; - $('#image-results').html(data); - ajaxifyLinks($('#image-results')); - }, - error: function() { - request = null; - } - }; - if (requestData) { - opts.data = requestData; - } - request = $.ajax(opts); - } - - function search() { - fetchResults(searchUrl, searchForm.serialize()); - return false; - } - - ajaxifyLinks(modal.body); - ajaxifyImageUploadForm(modal); - - $('form.image-search', modal.body).on('submit', search); - - $('#id_q').on('input', function() { - if (request) { - request.abort(); - } - clearTimeout($.data(this, 'timer')); - var wait = setTimeout(search, 200); - $(this).data('timer', wait); - }); - $('#collection_chooser_collection_id').on('change', search); - $('a.suggested-tag').on('click', function() { - $('#id_q').val(''); - fetchResults(searchUrl, { - 'tag': $(this).text(), - collection_id: $('#collection_chooser_collection_id').val() - }); - return false; - }); - }, - 'image_chosen': function(modal, jsonData) { - modal.respond('imageChosen', jsonData.result); - modal.close(); - }, - 'reshow_upload_form': function(modal, jsonData) { - $('#upload', modal.body).replaceWith(jsonData.htmlFragment); - ajaxifyImageUploadForm(modal); - }, - 'select_format': function(modal) { - var decorativeImage = document.querySelector('#id_image-chooser-insertion-image_is_decorative'); - var altText = document.querySelector('#id_image-chooser-insertion-alt_text'); - var altTextLabel = document.querySelector('[for="id_image-chooser-insertion-alt_text"]'); - - if (decorativeImage.checked) { - disableAltText(); - } else { - enableAltText(); - } - - decorativeImage.addEventListener('change', function(event) { - if (event.target.checked) { - disableAltText(); - } else { - enableAltText(); - } - }); - - function disableAltText() { - altText.setAttribute('disabled', 'disabled'); - altTextLabel.classList.remove('required'); - } - - function enableAltText() { - altText.removeAttribute('disabled'); - altTextLabel.classList.add('required'); - } - - $('form', modal.body).on('submit', function() { - $.post(this.action, $(this).serialize(), modal.loadResponseText, 'text'); - - return false; - }); + $('.pagination a', context).on('click', function () { + fetchResults(this.href); + return false; + }); } + var request; + + function fetchResults(url, requestData) { + var opts = { + url: url, + success: function (data, status) { + request = null; + $('#image-results').html(data); + ajaxifyLinks($('#image-results')); + }, + error: function () { + request = null; + }, + }; + if (requestData) { + opts.data = requestData; + } + request = $.ajax(opts); + } + + function search() { + fetchResults(searchUrl, searchForm.serialize()); + return false; + } + + ajaxifyLinks(modal.body); + ajaxifyImageUploadForm(modal); + + $('form.image-search', modal.body).on('submit', search); + + $('#id_q').on('input', function () { + if (request) { + request.abort(); + } + clearTimeout($.data(this, 'timer')); + var wait = setTimeout(search, 200); + $(this).data('timer', wait); + }); + $('#collection_chooser_collection_id').on('change', search); + $('a.suggested-tag').on('click', function () { + $('#id_q').val(''); + fetchResults(searchUrl, { + tag: $(this).text(), + collection_id: $('#collection_chooser_collection_id').val(), + }); + return false; + }); + }, + image_chosen: function (modal, jsonData) { + modal.respond('imageChosen', jsonData.result); + modal.close(); + }, + reshow_upload_form: function (modal, jsonData) { + $('#upload', modal.body).replaceWith(jsonData.htmlFragment); + ajaxifyImageUploadForm(modal); + }, + select_format: function (modal) { + var decorativeImage = document.querySelector( + '#id_image-chooser-insertion-image_is_decorative', + ); + var altText = document.querySelector( + '#id_image-chooser-insertion-alt_text', + ); + var altTextLabel = document.querySelector( + '[for="id_image-chooser-insertion-alt_text"]', + ); + + if (decorativeImage.checked) { + disableAltText(); + } else { + enableAltText(); + } + + decorativeImage.addEventListener('change', function (event) { + if (event.target.checked) { + disableAltText(); + } else { + enableAltText(); + } + }); + + function disableAltText() { + altText.setAttribute('disabled', 'disabled'); + altTextLabel.classList.remove('required'); + } + + function enableAltText() { + altText.removeAttribute('disabled'); + altTextLabel.classList.add('required'); + } + + $('form', modal.body).on('submit', function () { + $.post(this.action, $(this).serialize(), modal.loadResponseText, 'text'); + + return false; + }); + }, }; diff --git a/wagtail/images/static_src/wagtailimages/js/image-url-generator.js b/wagtail/images/static_src/wagtailimages/js/image-url-generator.js index bf6b2aab57..70ef76702c 100644 --- a/wagtail/images/static_src/wagtailimages/js/image-url-generator.js +++ b/wagtail/images/static_src/wagtailimages/js/image-url-generator.js @@ -1,78 +1,88 @@ -$(function() { - $('.image-url-generator').each(function() { - var $this = $(this); - var $form = $this.find('form'); - var $filterMethodField = $form.find('select#id_filter_method'); - var $widthField = $form.find('input#id_width'); - var $heightField = $form.find('input#id_height'); - var $closenessField = $form.find('input#id_closeness'); - var $result = $this.find('#result-url'); - var $loadingMask = $this.find('.loading-mask'); - var $preview = $this.find('img.preview'); - var $sizeNote = $('#note-size'); +$(function () { + $('.image-url-generator').each(function () { + var $this = $(this); + var $form = $this.find('form'); + var $filterMethodField = $form.find('select#id_filter_method'); + var $widthField = $form.find('input#id_width'); + var $heightField = $form.find('input#id_height'); + var $closenessField = $form.find('input#id_closeness'); + var $result = $this.find('#result-url'); + var $loadingMask = $this.find('.loading-mask'); + var $preview = $this.find('img.preview'); + var $sizeNote = $('#note-size'); - var generatorUrl = $this.data('generatorUrl'); + var generatorUrl = $this.data('generatorUrl'); - function formChangeHandler() { - var filterSpec = $filterMethodField.val(); + function formChangeHandler() { + var filterSpec = $filterMethodField.val(); - $loadingMask.addClass('loading'); + $loadingMask.addClass('loading'); - if (filterSpec === 'original') { - $widthField.prop('disabled', true); - $heightField.prop('disabled', true); - $closenessField.prop('disabled', true); - } else if (filterSpec === 'width') { - $widthField.prop('disabled', false); - $heightField.prop('disabled', true); - $closenessField.prop('disabled', true); - filterSpec += '-' + $widthField.val(); - } else if (filterSpec === 'height') { - $widthField.prop('disabled', true); - $heightField.prop('disabled', false); - $closenessField.prop('disabled', true); - filterSpec += '-' + $heightField.val(); - } else if (filterSpec === 'min' || filterSpec === 'max' || filterSpec === 'fill') { - $widthField.prop('disabled', false); - $heightField.prop('disabled', false); + if (filterSpec === 'original') { + $widthField.prop('disabled', true); + $heightField.prop('disabled', true); + $closenessField.prop('disabled', true); + } else if (filterSpec === 'width') { + $widthField.prop('disabled', false); + $heightField.prop('disabled', true); + $closenessField.prop('disabled', true); + filterSpec += '-' + $widthField.val(); + } else if (filterSpec === 'height') { + $widthField.prop('disabled', true); + $heightField.prop('disabled', false); + $closenessField.prop('disabled', true); + filterSpec += '-' + $heightField.val(); + } else if ( + filterSpec === 'min' || + filterSpec === 'max' || + filterSpec === 'fill' + ) { + $widthField.prop('disabled', false); + $heightField.prop('disabled', false); - if (filterSpec === 'fill') { - $closenessField.prop('disabled', false); - filterSpec += '-' + $widthField.val() + 'x' + $heightField.val() + '-c' + $closenessField.val(); - } else { - $closenessField.prop('disabled', true); - filterSpec += '-' + $widthField.val() + 'x' + $heightField.val(); - } - } - - // Display note about scaled down images if image is large - if ($widthField.val() > $(window).width()) { - $sizeNote.show(); - } else { - $sizeNote.hide(); - } - - // Fields with width and height - $.getJSON(generatorUrl.replace('__filterspec__', filterSpec)) - .done(function(data) { - $result.val(data.url); - $preview.attr('src', data.preview_url); - $loadingMask.removeClass('loading'); - }) - .fail(function(data) { - $result.val(data.responseJSON.error); - $preview.attr('src', ''); - $loadingMask.removeClass('loading'); - }); + if (filterSpec === 'fill') { + $closenessField.prop('disabled', false); + filterSpec += + '-' + + $widthField.val() + + 'x' + + $heightField.val() + + '-c' + + $closenessField.val(); + } else { + $closenessField.prop('disabled', true); + filterSpec += '-' + $widthField.val() + 'x' + $heightField.val(); } + } - $form.on('change', $.debounce(500, formChangeHandler)); - $form.on('keyup', $.debounce(500, formChangeHandler)); - formChangeHandler(); + // Display note about scaled down images if image is large + if ($widthField.val() > $(window).width()) { + $sizeNote.show(); + } else { + $sizeNote.hide(); + } - // When the user clicks the URL, automatically select the whole thing (for easier copying) - $result.on('click', function() { - $(this).trigger('select'); + // Fields with width and height + $.getJSON(generatorUrl.replace('__filterspec__', filterSpec)) + .done(function (data) { + $result.val(data.url); + $preview.attr('src', data.preview_url); + $loadingMask.removeClass('loading'); + }) + .fail(function (data) { + $result.val(data.responseJSON.error); + $preview.attr('src', ''); + $loadingMask.removeClass('loading'); }); + } + + $form.on('change', $.debounce(500, formChangeHandler)); + $form.on('keyup', $.debounce(500, formChangeHandler)); + formChangeHandler(); + + // When the user clicks the URL, automatically select the whole thing (for easier copying) + $result.on('click', function () { + $(this).trigger('select'); }); + }); }); diff --git a/wagtail/images/static_src/wagtailimages/scss/add-multiple.scss b/wagtail/images/static_src/wagtailimages/scss/add-multiple.scss index 348521660a..50c6dbc07f 100644 --- a/wagtail/images/static_src/wagtailimages/scss/add-multiple.scss +++ b/wagtail/images/static_src/wagtailimages/scss/add-multiple.scss @@ -1,153 +1,153 @@ -@use "sass:color"; +@use 'sass:color'; @import '../../../../../client/scss/settings'; @import '../../../../../client/scss/tools'; .replace-file-input { - display: inline-block; - position: relative; - overflow: hidden; - padding-bottom: 2px; + display: inline-block; + position: relative; + overflow: hidden; + padding-bottom: 2px; - [type=file] { - padding: 0; - opacity: 0; - position: absolute; - top: 0; - right: 0; - direction: ltr; - width: auto; - display: block; - font-size: 5em; - - &:hover { - cursor: pointer; - } - } + [type='file'] { + padding: 0; + opacity: 0; + position: absolute; + top: 0; + right: 0; + direction: ltr; + width: auto; + display: block; + font-size: 5em; &:hover { - cursor: pointer; - - button { - background-color: $color-teal-darker; - } + cursor: pointer; } + } + + &:hover { + cursor: pointer; + + button { + background-color: $color-teal-darker; + } + } } .upload-list { - > li { - padding: 1em; - } + > li { + padding: 1em; + } - .left { - text-align: center; - word-break: break-all; + .left { + text-align: center; + word-break: break-all; + } + + .preview { + width: 150px; + min-height: 150px; + display: block; + position: relative; + text-align: center; + max-width: 100%; + margin: auto; + } + + .progress, + .thumb, + .thumb:before, + canvas, + img { + position: absolute; + max-width: 100%; + } + + .progress { + box-shadow: 0 0 5px 2px rgba(255, 255, 255, 0.4); + z-index: 4; + top: 60%; + left: 20%; + right: 20%; + width: 60%; + } + + .thumb { + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1; + width: 100%; + } + + .thumb:before, + canvas, + img { + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; + } + + .thumb:before { + z-index: 2; + top: 0; + width: 1em; + font-size: 10em; + line-height: 1.4em; + color: color.adjust($color-grey-4, $lightness: 4%); + } + + canvas, + img { + z-index: 3; + } + + .hasthumb { + &:before { + display: none; } + } + + .status-msg { + display: none; + } + + .upload-complete { + .progress { + opacity: 0; + } + } + + .upload-success { + .status-msg.success { + display: block; + } + } + + .upload-failure { + border-color: $color-red; .preview { - width: 150px; - min-height: 150px; - display: block; - position: relative; - text-align: center; - max-width: 100%; - margin: auto; + display: none; } - .progress, - .thumb, - .thumb:before, - canvas, - img { - position: absolute; - max-width: 100%; + .status-msg.failure { + display: block; + } + } + + .upload-server-error { + border-color: $color-red; + + .preview { + display: none; } - .progress { - box-shadow: 0 0 5px 2px rgba(255, 255, 255, 0.4); - z-index: 4; - top: 60%; - left: 20%; - right: 20%; - width: 60%; - } - - .thumb { - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1; - width: 100%; - } - - .thumb:before, - canvas, - img { - left: 0; - right: 0; - top: 0; - bottom: 0; - margin: auto; - } - - .thumb:before { - z-index: 2; - top: 0; - width: 1em; - font-size: 10em; - line-height: 1.4em; - color: color.adjust($color-grey-4, $lightness: 4%); - } - - canvas, - img { - z-index: 3; - } - - .hasthumb { - &:before { - display: none; - } - } - - .status-msg { - display: none; - } - - .upload-complete { - .progress { - opacity: 0; - } - } - - .upload-success { - .status-msg.success { - display: block; - } - } - - .upload-failure { - border-color: $color-red; - - .preview { - display: none; - } - - .status-msg.failure { - display: block; - } - } - - .upload-server-error { - border-color: $color-red; - - .preview { - display: none; - } - - .status-msg.server-error { - display: block; - } + .status-msg.server-error { + display: block; } + } } diff --git a/wagtail/images/static_src/wagtailimages/scss/focal-point-chooser.scss b/wagtail/images/static_src/wagtailimages/scss/focal-point-chooser.scss index 507f0d8461..a96232e103 100644 --- a/wagtail/images/static_src/wagtailimages/scss/focal-point-chooser.scss +++ b/wagtail/images/static_src/wagtailimages/scss/focal-point-chooser.scss @@ -2,22 +2,22 @@ @import '../../../../../client/scss/tools'; .focal-point-chooser { - position: relative; - margin-bottom: 20px; + position: relative; + margin-bottom: 20px; - .current-focal-point-indicator { - @include transition(opacity 0.2s ease); - box-shadow: 1px 1px 10px 0 rgba(0, 0, 0, 1); - position: absolute; - border: 3px solid $color-teal; - opacity: 0.7; + .current-focal-point-indicator { + @include transition(opacity 0.2s ease); + box-shadow: 1px 1px 10px 0 rgba(0, 0, 0, 1); + position: absolute; + border: 3px solid $color-teal; + opacity: 0.7; - &.hidden { - display: none; - } + &.hidden { + display: none; } + } - &:hover .current-focal-point-indicator { - opacity: 0; - } + &:hover .current-focal-point-indicator { + opacity: 0; + } } diff --git a/wagtail/search/static_src/wagtailsearch/js/query-chooser-modal.js b/wagtail/search/static_src/wagtailsearch/js/query-chooser-modal.js index 4cc1c79229..275602751b 100644 --- a/wagtail/search/static_src/wagtailsearch/js/query-chooser-modal.js +++ b/wagtail/search/static_src/wagtailsearch/js/query-chooser-modal.js @@ -1,74 +1,74 @@ QUERY_CHOOSER_MODAL_ONLOAD_HANDLERS = { - 'chooser': function(modal, jsonData) { - function ajaxifyLinks (context) { - $('.listing a.choose-query', context).on('click', chooseQuery); + chooser: function (modal, jsonData) { + function ajaxifyLinks(context) { + $('.listing a.choose-query', context).on('click', chooseQuery); - $('.pagination a', context).on('click', function() { - var page = this.getAttribute('data-page'); - setPage(page); - return false; - }); - } - - var searchUrl = $('form.query-search', modal.body).attr('action'); - var request; - - function search() { - request = $.ajax({ - url: searchUrl, - data: { q: $('#id_q').val() }, - success: function(data, status) { - request = null; - $('#query-results').html(data); - ajaxifyLinks($('#query-results')); - }, - error: function() { - request = null; - } - }); - return false; - } - function setPage(page) { - var dataObj; - - if ($('#id_q').val().length) { - dataObj = { q: $('#id_q').val(), p: page }; - } else { - dataObj = { p: page }; - } - - request = $.ajax({ - url: searchUrl, - data: dataObj, - success: function(data, status) { - request = null; - $('#query-results').html(data); - ajaxifyLinks($('#query-results')); - }, - error: function() { - request = null; - } - }); - return false; - } - function chooseQuery() { - modal.respond('queryChosen', $(this).data()); - modal.close(); - - return false; - } - - ajaxifyLinks(modal.body); - - $('form.query-search', modal.body).on('submit', search); - - $('#id_q').on('input', function() { - if (request) { - request.abort(); - } - clearTimeout($.data(this, 'timer')); - var wait = setTimeout(search, 200); - $(this).data('timer', wait); - }); + $('.pagination a', context).on('click', function () { + var page = this.getAttribute('data-page'); + setPage(page); + return false; + }); } + + var searchUrl = $('form.query-search', modal.body).attr('action'); + var request; + + function search() { + request = $.ajax({ + url: searchUrl, + data: { q: $('#id_q').val() }, + success: function (data, status) { + request = null; + $('#query-results').html(data); + ajaxifyLinks($('#query-results')); + }, + error: function () { + request = null; + }, + }); + return false; + } + function setPage(page) { + var dataObj; + + if ($('#id_q').val().length) { + dataObj = { q: $('#id_q').val(), p: page }; + } else { + dataObj = { p: page }; + } + + request = $.ajax({ + url: searchUrl, + data: dataObj, + success: function (data, status) { + request = null; + $('#query-results').html(data); + ajaxifyLinks($('#query-results')); + }, + error: function () { + request = null; + }, + }); + return false; + } + function chooseQuery() { + modal.respond('queryChosen', $(this).data()); + modal.close(); + + return false; + } + + ajaxifyLinks(modal.body); + + $('form.query-search', modal.body).on('submit', search); + + $('#id_q').on('input', function () { + if (request) { + request.abort(); + } + clearTimeout($.data(this, 'timer')); + var wait = setTimeout(search, 200); + $(this).data('timer', wait); + }); + }, }; diff --git a/wagtail/search/templates/wagtailsearch/queries/chooser_field.js b/wagtail/search/templates/wagtailsearch/queries/chooser_field.js index 40ad8283cc..65cbc13d31 100644 --- a/wagtail/search/templates/wagtailsearch/queries/chooser_field.js +++ b/wagtail/search/templates/wagtailsearch/queries/chooser_field.js @@ -1,18 +1,18 @@ function createQueryChooser(id) { - var chooserElement = $('#' + id + '-chooser'); - var input = $('#' + id); + var chooserElement = $('#' + id + '-chooser'); + var input = $('#' + id); - chooserElement.on('click', function() { - var initialUrl = '{% url "wagtailsearch_admin:queries_chooser" %}'; + chooserElement.on('click', function () { + var initialUrl = '{% url "wagtailsearch_admin:queries_chooser" %}'; - ModalWorkflow({ - url: initialUrl, - onload: QUERY_CHOOSER_MODAL_ONLOAD_HANDLERS, - responses: { - queryChosen: function(queryData) { - input.val(queryData.querystring); - } - } - }); + ModalWorkflow({ + url: initialUrl, + onload: QUERY_CHOOSER_MODAL_ONLOAD_HANDLERS, + responses: { + queryChosen: function (queryData) { + input.val(queryData.querystring); + }, + }, }); + }); } diff --git a/wagtail/snippets/static_src/wagtailsnippets/js/snippet-chooser-modal.js b/wagtail/snippets/static_src/wagtailsnippets/js/snippet-chooser-modal.js index 26a7dfb0a0..03723ec681 100644 --- a/wagtail/snippets/static_src/wagtailsnippets/js/snippet-chooser-modal.js +++ b/wagtail/snippets/static_src/wagtailsnippets/js/snippet-chooser-modal.js @@ -1,60 +1,60 @@ SNIPPET_CHOOSER_MODAL_ONLOAD_HANDLERS = { - 'choose': function(modal, jsonData) { - function ajaxifyLinks(context) { - $('a.snippet-choice', modal.body).on('click', function() { - modal.loadUrl(this.href); - return false; - }); + choose: function (modal, jsonData) { + function ajaxifyLinks(context) { + $('a.snippet-choice', modal.body).on('click', function () { + modal.loadUrl(this.href); + return false; + }); - $('.pagination a', context).on('click', function() { - loadResults(this.href); - return false; - }); - } - - var searchForm$ = $('form.snippet-search', modal.body); - var searchUrl = searchForm$.attr('action'); - var request; - - function search() { - loadResults(searchUrl, searchForm$.serialize()); - return false; - } - - function loadResults(url, data) { - var opts = { - url: url, - success: function(resultsData, status) { - request = null; - $('#search-results').html(resultsData); - ajaxifyLinks($('#search-results')); - }, - error: function() { - request = null; - } - }; - if (data) { - opts.data = data; - } - request = $.ajax(opts); - } - - $('form.snippet-search', modal.body).on('submit', search); - $('#snippet-chooser-locale', modal.body).on('change', search); - - $('#id_q').on('input', function() { - if (request) { - request.abort(); - } - clearTimeout($.data(this, 'timer')); - var wait = setTimeout(search, 200); - $(this).data('timer', wait); - }); - - ajaxifyLinks(modal.body); - }, - 'chosen': function(modal, jsonData) { - modal.respond('snippetChosen', jsonData.result); - modal.close(); + $('.pagination a', context).on('click', function () { + loadResults(this.href); + return false; + }); } + + var searchForm$ = $('form.snippet-search', modal.body); + var searchUrl = searchForm$.attr('action'); + var request; + + function search() { + loadResults(searchUrl, searchForm$.serialize()); + return false; + } + + function loadResults(url, data) { + var opts = { + url: url, + success: function (resultsData, status) { + request = null; + $('#search-results').html(resultsData); + ajaxifyLinks($('#search-results')); + }, + error: function () { + request = null; + }, + }; + if (data) { + opts.data = data; + } + request = $.ajax(opts); + } + + $('form.snippet-search', modal.body).on('submit', search); + $('#snippet-chooser-locale', modal.body).on('change', search); + + $('#id_q').on('input', function () { + if (request) { + request.abort(); + } + clearTimeout($.data(this, 'timer')); + var wait = setTimeout(search, 200); + $(this).data('timer', wait); + }); + + ajaxifyLinks(modal.body); + }, + chosen: function (modal, jsonData) { + modal.respond('snippetChosen', jsonData.result); + modal.close(); + }, }; diff --git a/wagtail/snippets/static_src/wagtailsnippets/js/snippet-multiple-select.js b/wagtail/snippets/static_src/wagtailsnippets/js/snippet-multiple-select.js index c1ae7e1f52..ae2c3908c1 100644 --- a/wagtail/snippets/static_src/wagtailsnippets/js/snippet-multiple-select.js +++ b/wagtail/snippets/static_src/wagtailsnippets/js/snippet-multiple-select.js @@ -1,103 +1,111 @@ -var updateRow = function(id, newValue) { - var $row = $('table.listing tr#snippet-row-' + id); - var $checklist = $row.find('input[type=checkbox].toggle-select-row'); - $checklist.prop('checked', newValue); +var updateRow = function (id, newValue) { + var $row = $('table.listing tr#snippet-row-' + id); + var $checklist = $row.find('input[type=checkbox].toggle-select-row'); + $checklist.prop('checked', newValue); + if (newValue) { + $row.addClass('selected'); + } else { + $row.removeClass('selected'); + } +}; + +var updateDeleteButton = function (anySelected, newState) { + var $deleteButton = $('a.button.delete-button'); + var ids = []; + $.each(newState, function (id, newValue) { if (newValue) { - $row.addClass('selected'); - } else { - $row.removeClass('selected'); + ids.push(id); } + }); + if (anySelected) { + // hide button and add url + $deleteButton.removeClass('u-hidden'); + var url = $deleteButton.data('url'); + url = url + $.param({ id: ids }, true); + $deleteButton.attr('href', url); + } else { + // show button and remove url + $deleteButton.addClass('u-hidden'); + $deleteButton.attr('href', null); + } }; -var updateDeleteButton = function(anySelected, newState) { - var $deleteButton = $('a.button.delete-button'); - var ids = []; - $.each(newState, function(id, newValue) { - if (newValue) { - ids.push(id); - } +var updateSelectAllCheckbox = function (value) { + var $selectAllCheckbox = $( + 'table.listing input[type=checkbox].toggle-select-all', + ); + $selectAllCheckbox.prop('checked', value); +}; + +var buildSelectedState = function () { + // prepare the selected state -- {3: true, 4: false} + var state = {}; + var $rows = $( + 'table.listing tbody tr input[type=checkbox].toggle-select-row', + ); + $.each($rows, function (index, row) { + var $row = $(row); + var selected = $row.prop('checked'); + var id = $row.attr('value'); + state[id] = selected; + }); + return state; +}; + +var updateSelectedState = function (state, newValue, idToUpdate) { + if (idToUpdate === null) { + // update all rows + $.each(state, function (id, currentValue) { + state[id] = newValue; }); - if (anySelected) { - // hide button and add url - $deleteButton.removeClass('u-hidden'); - var url = $deleteButton.data('url'); - url = url + $.param({ id: ids }, true); - $deleteButton.attr('href', url); + } else { + // update single row + state[idToUpdate] = newValue; + } + return state; +}; + +var updateView = function (newState) { + var allSelected = true; + var anySelected = false; + var countOfUnselected = 0; + var countOfSelected = 0; + + // update each row with the new value (selected or not) + $.each(newState, function (id, newValue) { + updateRow(id, newValue); + if (newValue === false) { + countOfUnselected += 1; } else { - // show button and remove url - $deleteButton.addClass('u-hidden'); - $deleteButton.attr('href', null); + countOfSelected += 1; } + }); + + // update the main checkbox for select all (if all are true) + if (countOfUnselected >= 1) { + allSelected = false; + } + updateSelectAllCheckbox(allSelected); + + // update the delete button + if (countOfSelected >= 1) { + anySelected = true; + } + updateDeleteButton(anySelected, newState); }; -var updateSelectAllCheckbox = function(value) { - var $selectAllCheckbox = $('table.listing input[type=checkbox].toggle-select-all'); - $selectAllCheckbox.prop('checked', value); -}; - -var buildSelectedState = function() { - // prepare the selected state -- {3: true, 4: false} - var state = {}; - var $rows = $('table.listing tbody tr input[type=checkbox].toggle-select-row'); - $.each($rows, function (index, row) { - var $row = $(row); - var selected = $row.prop('checked'); - var id = $row.attr('value'); - state[id] = selected; - }); - return state; -}; - -var updateSelectedState = function(state, newValue, idToUpdate) { - if (idToUpdate === null) { - // update all rows - $.each(state, function (id, currentValue) { - state[id] = newValue; - }); - } else { - // update single row - state[idToUpdate] = newValue; +var onListingCheckboxClick = function () { + $('table.listing input[type="checkbox"]').on('click', function (event) { + var $target = $(event.target); + var setToValue = $target.prop('checked'); + var currentState = buildSelectedState(); + var id = null; + if ($target.hasClass('toggle-select-row')) { + id = $target.attr('value'); } - return state; -}; - -var updateView = function(newState) { - var allSelected = true; - var anySelected = false; - var countOfUnselected = 0; - var countOfSelected = 0; - - // update each row with the new value (selected or not) - $.each(newState, function (id, newValue) { - updateRow(id, newValue); - if (newValue === false) { - countOfUnselected += 1; - } else { - countOfSelected += 1; - } - }); - - // update the main checkbox for select all (if all are true) - if (countOfUnselected >= 1) { allSelected = false; } - updateSelectAllCheckbox(allSelected); - - // update the delete button - if (countOfSelected >= 1) { anySelected = true; } - updateDeleteButton(anySelected, newState); -}; - -var onListingCheckboxClick = function() { - $('table.listing input[type="checkbox"]').on('click', function(event) { - var $target = $(event.target); - var setToValue = $target.prop('checked'); - var currentState = buildSelectedState(); - var id = null; - if ($target.hasClass('toggle-select-row')) { - id = $target.attr('value'); - } - var newState = updateSelectedState(currentState, setToValue, id); - updateView(newState); - }); + var newState = updateSelectedState(currentState, setToValue, id); + updateView(newState); + }); }; $(document).ready(onListingCheckboxClick); diff --git a/wagtail/tests/customuser/fixtures/test.json b/wagtail/tests/customuser/fixtures/test.json index 4b6f2780eb..cee81dc563 100644 --- a/wagtail/tests/customuser/fixtures/test.json +++ b/wagtail/tests/customuser/fixtures/test.json @@ -1,127 +1,114 @@ [ -{ + { "pk": 1, "model": "customuser.customuser", "fields": { - "username": "superuser", - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": true, - "is_staff": true, - "groups": [ - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "superuser@example.com" + "username": "superuser", + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": true, + "is_staff": true, + "groups": [], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "superuser@example.com" } -}, -{ + }, + { "pk": 2, "model": "customuser.customuser", "fields": { - "username": "eventeditor", - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Event editors"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "eventeditor@example.com" + "username": "eventeditor", + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "groups": [["Event editors"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "eventeditor@example.com" } -}, -{ + }, + { "pk": 3, "model": "customuser.customuser", "fields": { - "username": "eventmoderator", - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Event moderators"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "eventmoderator@example.com" + "username": "eventmoderator", + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "groups": [["Event moderators"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "eventmoderator@example.com" } -}, -{ + }, + { "pk": 4, "model": "customuser.customuser", "fields": { - "username": "inactiveuser", - "first_name": "", - "last_name": "", - "is_active": false, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Event moderators"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "inactiveuser@example.com" + "username": "inactiveuser", + "first_name": "", + "last_name": "", + "is_active": false, + "is_superuser": false, + "is_staff": false, + "groups": [["Event moderators"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "inactiveuser@example.com" } -}, -{ + }, + { "pk": 5, "model": "customuser.customuser", "fields": { - "username": "siteeditor", - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Site-wide editors"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "siteeditor@example.com" + "username": "siteeditor", + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "groups": [["Site-wide editors"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "siteeditor@example.com" } -}, -{ + }, + { "pk": 6, "model": "customuser.customuser", "fields": { - "username": "admin_only_user", - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Admin non-editors"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "admin_only_user@example.com" + "username": "admin_only_user", + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "groups": [["Admin non-editors"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "admin_only_user@example.com" } -}, -{ + }, + { "pk": 7, "model": "customuser.customuser", "fields": { - "username": "corporateeditor", - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Corporate Editor"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "corporateeditor@example.com" + "username": "corporateeditor", + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "groups": [["Corporate Editor"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "corporateeditor@example.com" } -} + } ] diff --git a/wagtail/tests/customuser/fixtures/test_explorable_pages.json b/wagtail/tests/customuser/fixtures/test_explorable_pages.json index 5b96cb9e4d..f72ec76669 100644 --- a/wagtail/tests/customuser/fixtures/test_explorable_pages.json +++ b/wagtail/tests/customuser/fixtures/test_explorable_pages.json @@ -1,112 +1,98 @@ [ -{ + { "pk": 1, "model": "customuser.customuser", "fields": { - "username": "superman", - "first_name": "Clark", - "last_name": "Kent", - "is_active": true, - "is_superuser": true, - "is_staff": true, - "groups": [ - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "superman@example.com" + "username": "superman", + "first_name": "Clark", + "last_name": "Kent", + "is_active": true, + "is_superuser": true, + "is_staff": true, + "groups": [], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "superman@example.com" } -}, -{ + }, + { "pk": 2, "model": "customuser.customuser", "fields": { - "username": "jane", - "first_name": "Jane", - "last_name": "Smith", - "is_active": true, - "is_superuser": false, - "is_staff": true, - "groups": [ - ["Group 1"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "jane@example.com" + "username": "jane", + "first_name": "Jane", + "last_name": "Smith", + "is_active": true, + "is_superuser": false, + "is_staff": true, + "groups": [["Group 1"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "jane@example.com" } -}, -{ + }, + { "pk": 3, "model": "customuser.customuser", "fields": { - "username": "bob", - "first_name": "Bob", - "last_name": "Smith", - "is_active": true, - "is_superuser": false, - "is_staff": true, - "groups": [ - ["Group 2"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "bob@example.com" + "username": "bob", + "first_name": "Bob", + "last_name": "Smith", + "is_active": true, + "is_superuser": false, + "is_staff": true, + "groups": [["Group 2"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "bob@example.com" } -}, -{ + }, + { "pk": 4, "model": "customuser.customuser", "fields": { - "username": "sam", - "first_name": "Sam", - "last_name": "Smith", - "is_active": true, - "is_superuser": false, - "is_staff": true, - "groups": [ - ["Group 1"], - ["Group 2"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "sam@example.com" + "username": "sam", + "first_name": "Sam", + "last_name": "Smith", + "is_active": true, + "is_superuser": false, + "is_staff": true, + "groups": [["Group 1"], ["Group 2"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "sam@example.com" } -}, -{ + }, + { "pk": 5, "model": "customuser.customuser", "fields": { - "username": "mary", - "first_name": "Mary", - "last_name": "Smith", - "is_active": true, - "is_superuser": false, - "is_staff": true, - "groups": [ - ], - "user_permissions": [ - ["access_admin", "wagtailadmin", "admin"] - ], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "mary@example.com" + "username": "mary", + "first_name": "Mary", + "last_name": "Smith", + "is_active": true, + "is_superuser": false, + "is_staff": true, + "groups": [], + "user_permissions": [["access_admin", "wagtailadmin", "admin"]], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "mary@example.com" } -}, -{ + }, + { "pk": 6, "model": "customuser.customuser", "fields": { - "username": "josh", - "first_name": "Josh", - "last_name": "Smith", - "is_active": true, - "is_superuser": false, - "is_staff": true, - "groups": [ - ["Group 2"], - ["Group 3"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "josh@example.com" + "username": "josh", + "first_name": "Josh", + "last_name": "Smith", + "is_active": true, + "is_superuser": false, + "is_staff": true, + "groups": [["Group 2"], ["Group 3"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "josh@example.com" } -} -] \ No newline at end of file + } +] diff --git a/wagtail/tests/customuser/fixtures/test_specific.json b/wagtail/tests/customuser/fixtures/test_specific.json index c74987563a..1221daec87 100644 --- a/wagtail/tests/customuser/fixtures/test_specific.json +++ b/wagtail/tests/customuser/fixtures/test_specific.json @@ -1,19 +1,18 @@ [ - { - "pk": 1, - "model": "customuser.customuser", - "fields": { - "username": "superuser", - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": true, - "is_staff": true, - "groups": [ - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "superuser@example.com" - } + { + "pk": 1, + "model": "customuser.customuser", + "fields": { + "username": "superuser", + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": true, + "is_staff": true, + "groups": [], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "superuser@example.com" } + } ] diff --git a/wagtail/tests/demosite/fixtures/demosite.json b/wagtail/tests/demosite/fixtures/demosite.json index 3e712971c1..64c0ff2de6 100644 --- a/wagtail/tests/demosite/fixtures/demosite.json +++ b/wagtail/tests/demosite/fixtures/demosite.json @@ -1,1170 +1,1110 @@ [ -{ + { "pk": 1, "model": "wagtailcore.page", "fields": { - "title": "Root", - "draft_title": "Root", - "numchild": 1, - "show_in_menus": false, - "live": true, - "seo_title": "", - "depth": 1, - "search_description": "", - "content_type": [ - "wagtailcore", - "page" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001", - "url_path": "/", - "slug": "root" + "title": "Root", + "draft_title": "Root", + "numchild": 1, + "show_in_menus": false, + "live": true, + "seo_title": "", + "depth": 1, + "search_description": "", + "content_type": ["wagtailcore", "page"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001", + "url_path": "/", + "slug": "root" } -}, -{ + }, + { "pk": 2, "model": "wagtailcore.page", "fields": { - "title": "Home page", - "draft_title": "Home page", - "numchild": 5, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 2, - "search_description": "", - "content_type": [ - "demosite", - "homepage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "00010002", - "url_path": "/home-page/", - "slug": "home-page" + "title": "Home page", + "draft_title": "Home page", + "numchild": 5, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 2, + "search_description": "", + "content_type": ["demosite", "homepage"], + "has_unpublished_changes": false, + "owner": null, + "path": "00010002", + "url_path": "/home-page/", + "slug": "home-page" } -}, -{ + }, + { "pk": 4, "model": "wagtailcore.page", "fields": { - "title": "Events index", - "draft_title": "Events index", - "numchild": 2, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 3, - "search_description": "", - "content_type": [ - "demosite", - "eventindexpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "000100020001", - "url_path": "/home-page/events-index/", - "slug": "events-index" + "title": "Events index", + "draft_title": "Events index", + "numchild": 2, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 3, + "search_description": "", + "content_type": ["demosite", "eventindexpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "000100020001", + "url_path": "/home-page/events-index/", + "slug": "events-index" } -}, -{ + }, + { "pk": 5, "model": "wagtailcore.page", "fields": { - "title": "Blog index", - "draft_title": "Blog index", - "numchild": 3, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 3, - "search_description": "", - "content_type": [ - "demosite", - "blogindexpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "000100020002", - "url_path": "/home-page/blog-index/", - "slug": "blog-index" + "title": "Blog index", + "draft_title": "Blog index", + "numchild": 3, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 3, + "search_description": "", + "content_type": ["demosite", "blogindexpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "000100020002", + "url_path": "/home-page/blog-index/", + "slug": "blog-index" } -}, -{ + }, + { "pk": 6, "model": "wagtailcore.page", "fields": { - "title": "Standard index", - "draft_title": "Standard index", - "numchild": 4, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 3, - "search_description": "", - "content_type": [ - "demosite", - "standardindexpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "000100020003", - "url_path": "/home-page/standard-index/", - "slug": "standard-index" + "title": "Standard index", + "draft_title": "Standard index", + "numchild": 4, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 3, + "search_description": "", + "content_type": ["demosite", "standardindexpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "000100020003", + "url_path": "/home-page/standard-index/", + "slug": "standard-index" } -}, -{ + }, + { "pk": 8, "model": "wagtailcore.page", "fields": { - "title": "Event 1", - "draft_title": "Event 1", - "numchild": 0, - "show_in_menus": false, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one", - "content_type": [ - "demosite", - "eventpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200010001", - "url_path": "/home-page/events-index/event-1/", - "slug": "event-1" + "title": "Event 1", + "draft_title": "Event 1", + "numchild": 0, + "show_in_menus": false, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one", + "content_type": ["demosite", "eventpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200010001", + "url_path": "/home-page/events-index/event-1/", + "slug": "event-1" } -}, -{ + }, + { "pk": 9, "model": "wagtailcore.page", "fields": { - "title": "Event 2", - "draft_title": "Event 2", - "numchild": 0, - "show_in_menus": false, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.", - "content_type": [ - "demosite", - "eventpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200010002", - "url_path": "/home-page/events-index/event-2/", - "slug": "event-2" + "title": "Event 2", + "draft_title": "Event 2", + "numchild": 0, + "show_in_menus": false, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.", + "content_type": ["demosite", "eventpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200010002", + "url_path": "/home-page/events-index/event-2/", + "slug": "event-2" } -}, -{ + }, + { "pk": 10, "model": "wagtailcore.page", "fields": { - "title": "Standard page 1", - "draft_title": "Standard page 1", - "numchild": 0, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters.", - "content_type": [ - "demosite", - "standardpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200030001", - "url_path": "/home-page/standard-index/standard-page-1/", - "slug": "standard-page-1" + "title": "Standard page 1", + "draft_title": "Standard page 1", + "numchild": 0, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters.", + "content_type": ["demosite", "standardpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200030001", + "url_path": "/home-page/standard-index/standard-page-1/", + "slug": "standard-page-1" } -}, -{ + }, + { "pk": 12, "model": "wagtailcore.page", "fields": { - "title": "Contact page", - "draft_title": "Contact page", - "numchild": 0, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 3, - "search_description": "The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean...", - "content_type": [ - "demosite", - "contactpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "000100020005", - "url_path": "/home-page/contact-page/", - "slug": "contact-page" + "title": "Contact page", + "draft_title": "Contact page", + "numchild": 0, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 3, + "search_description": "The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean...", + "content_type": ["demosite", "contactpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "000100020005", + "url_path": "/home-page/contact-page/", + "slug": "contact-page" } -}, -{ + }, + { "pk": 13, "model": "wagtailcore.page", "fields": { - "title": "James Joyce", - "draft_title": "James Joyce", - "numchild": 0, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa", - "content_type": [ - "demosite", - "personpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200040001", - "url_path": "/home-page/people/james-joyce/", - "slug": "james-joyce" + "title": "James Joyce", + "draft_title": "James Joyce", + "numchild": 0, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa", + "content_type": ["demosite", "personpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200040001", + "url_path": "/home-page/people/james-joyce/", + "slug": "james-joyce" } -}, -{ + }, + { "pk": 14, "model": "wagtailcore.page", "fields": { - "title": "David Mitchell", - "draft_title": "David Mitchell", - "numchild": 0, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.", - "content_type": [ - "demosite", - "personpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200040002", - "url_path": "/home-page/people/david-mitchell/", - "slug": "david-mitchell" + "title": "David Mitchell", + "draft_title": "David Mitchell", + "numchild": 0, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.", + "content_type": ["demosite", "personpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200040002", + "url_path": "/home-page/people/david-mitchell/", + "slug": "david-mitchell" } -}, -{ + }, + { "pk": 15, "model": "wagtailcore.page", "fields": { - "title": "Standard page 2", - "draft_title": "Standard page 2", - "numchild": 0, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.", - "content_type": [ - "demosite", - "standardpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200030002", - "url_path": "/home-page/standard-index/standard-page-2/", - "slug": "standard-page-2" + "title": "Standard page 2", + "draft_title": "Standard page 2", + "numchild": 0, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.", + "content_type": ["demosite", "standardpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200030002", + "url_path": "/home-page/standard-index/standard-page-2/", + "slug": "standard-page-2" } -}, -{ + }, + { "pk": 16, "model": "wagtailcore.page", "fields": { - "title": "Blog post", - "draft_title": "Blog post", - "numchild": 0, - "show_in_menus": false, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.", - "content_type": [ - "demosite", - "blogentrypage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200020001", - "url_path": "/home-page/blog-index/blog-post/", - "slug": "blog-post" + "title": "Blog post", + "draft_title": "Blog post", + "numchild": 0, + "show_in_menus": false, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.", + "content_type": ["demosite", "blogentrypage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200020001", + "url_path": "/home-page/blog-index/blog-post/", + "slug": "blog-post" } -}, -{ + }, + { "pk": 17, "model": "wagtailcore.page", "fields": { - "title": "Photo credits", - "draft_title": "Photo credits", - "numchild": 0, - "show_in_menus": false, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "", - "content_type": [ - "demosite", - "standardpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200030007", - "url_path": "/home-page/standard-index/photo-credits/", - "slug": "photo-credits" + "title": "Photo credits", + "draft_title": "Photo credits", + "numchild": 0, + "show_in_menus": false, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "", + "content_type": ["demosite", "standardpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200030007", + "url_path": "/home-page/standard-index/photo-credits/", + "slug": "photo-credits" } -}, -{ + }, + { "pk": 18, "model": "wagtailcore.page", "fields": { - "title": "Blog post again", - "draft_title": "Blog post again", - "numchild": 0, - "show_in_menus": false, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.", - "content_type": [ - "demosite", - "blogentrypage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200020002", - "url_path": "/home-page/blog-index/blog-post-again/", - "slug": "blog-post-again" + "title": "Blog post again", + "draft_title": "Blog post again", + "numchild": 0, + "show_in_menus": false, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.", + "content_type": ["demosite", "blogentrypage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200020002", + "url_path": "/home-page/blog-index/blog-post-again/", + "slug": "blog-post-again" } -}, -{ + }, + { "pk": 19, "model": "wagtailcore.page", "fields": { - "title": "Another blog post", - "draft_title": "Another blog post", - "numchild": 0, - "show_in_menus": false, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.", - "content_type": [ - "demosite", - "blogentrypage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200020003", - "url_path": "/home-page/blog-index/another-blog-post/", - "slug": "another-blog-post" + "title": "Another blog post", + "draft_title": "Another blog post", + "numchild": 0, + "show_in_menus": false, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.", + "content_type": ["demosite", "blogentrypage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200020003", + "url_path": "/home-page/blog-index/another-blog-post/", + "slug": "another-blog-post" } -}, -{ + }, + { "pk": 20, "model": "wagtailcore.page", "fields": { - "title": "People", - "draft_title": "People", - "numchild": 2, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 3, - "search_description": "", - "content_type": [ - "demosite", - "standardindexpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "000100020004", - "url_path": "/home-page/people/", - "slug": "people" + "title": "People", + "draft_title": "People", + "numchild": 2, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 3, + "search_description": "", + "content_type": ["demosite", "standardindexpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "000100020004", + "url_path": "/home-page/people/", + "slug": "people" } -}, -{ + }, + { "pk": 21, "model": "wagtailcore.page", "fields": { - "title": "A deeper menu level", - "draft_title": "A deeper menu level", - "numchild": 2, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 4, - "search_description": "", - "content_type": [ - "demosite", - "standardindexpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "0001000200030008", - "url_path": "/home-page/standard-index/a-deeper-menu-level/", - "slug": "a-deeper-menu-level" + "title": "A deeper menu level", + "draft_title": "A deeper menu level", + "numchild": 2, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 4, + "search_description": "", + "content_type": ["demosite", "standardindexpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "0001000200030008", + "url_path": "/home-page/standard-index/a-deeper-menu-level/", + "slug": "a-deeper-menu-level" } -}, -{ + }, + { "pk": 22, "model": "wagtailcore.page", "fields": { - "title": "A grandchild page", - "draft_title": "A grandchild page", - "numchild": 0, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 5, - "search_description": "The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.", - "content_type": [ - "demosite", - "standardpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "00010002000300080001", - "url_path": "/home-page/standard-index/a-deeper-menu-level/a-grandchild-page/", - "slug": "a-grandchild-page" + "title": "A grandchild page", + "draft_title": "A grandchild page", + "numchild": 0, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 5, + "search_description": "The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.", + "content_type": ["demosite", "standardpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "00010002000300080001", + "url_path": "/home-page/standard-index/a-deeper-menu-level/a-grandchild-page/", + "slug": "a-grandchild-page" } -}, -{ + }, + { "pk": 23, "model": "wagtailcore.page", "fields": { - "title": "Another grandchild page", - "draft_title": "Another grandchild page", - "numchild": 0, - "show_in_menus": true, - "live": true, - "seo_title": "", - "depth": 5, - "search_description": "The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.", - "content_type": [ - "demosite", - "standardpage" - ], - "has_unpublished_changes": false, - "owner": null, - "path": "00010002000300080002", - "url_path": "/home-page/standard-index/a-deeper-menu-level/another-grandchild-page/", - "slug": "another-grandchild-page" + "title": "Another grandchild page", + "draft_title": "Another grandchild page", + "numchild": 0, + "show_in_menus": true, + "live": true, + "seo_title": "", + "depth": 5, + "search_description": "The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.", + "content_type": ["demosite", "standardpage"], + "has_unpublished_changes": false, + "owner": null, + "path": "00010002000300080002", + "url_path": "/home-page/standard-index/a-deeper-menu-level/another-grandchild-page/", + "slug": "another-grandchild-page" } -}, -{ + }, + { "pk": 4, "model": "wagtailimages.image", "fields": { - "title": "Wagtail by mark Harkin", - "created_at": "2014-02-06T10:14:47.173Z", - "height": 427, - "width": 640, - "file": "original_images/wagtail_by_markyharky.jpg", - "uploaded_by_user": null + "title": "Wagtail by mark Harkin", + "created_at": "2014-02-06T10:14:47.173Z", + "height": 427, + "width": 640, + "file": "original_images/wagtail_by_markyharky.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 5, "model": "wagtailimages.image", "fields": { - "title": "James Joyce", - "created_at": "2014-02-06T10:37:10.518Z", - "height": 392, - "width": 500, - "file": "original_images/James_Joyce_in_1915.jpg", - "uploaded_by_user": null + "title": "James Joyce", + "created_at": "2014-02-06T10:37:10.518Z", + "height": 392, + "width": 500, + "file": "original_images/James_Joyce_in_1915.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 6, "model": "wagtailimages.image", "fields": { - "title": "David Mitchell", - "created_at": "2014-02-06T10:42:46.536Z", - "height": 282, - "width": 360, - "file": "original_images/David_Mitchell_by_Kubik.JPG", - "uploaded_by_user": null + "title": "David Mitchell", + "created_at": "2014-02-06T10:42:46.536Z", + "height": 282, + "width": 360, + "file": "original_images/David_Mitchell_by_Kubik.JPG", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 7, "model": "wagtailimages.image", "fields": { - "title": "Wagtail by joe Buckingham", - "created_at": "2014-02-06T10:49:29.579Z", - "height": 397, - "width": 640, - "file": "original_images/wagtail_by_joe_buckingham.jpg", - "uploaded_by_user": null + "title": "Wagtail by joe Buckingham", + "created_at": "2014-02-06T10:49:29.579Z", + "height": 397, + "width": 640, + "file": "original_images/wagtail_by_joe_buckingham.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 8, "model": "wagtailimages.image", "fields": { - "title": "Wagtail by fs-phil", - "created_at": "2014-02-06T10:54:29.963Z", - "height": 397, - "width": 640, - "file": "original_images/wagtail_by_fs-phil.jpg", - "uploaded_by_user": null + "title": "Wagtail by fs-phil", + "created_at": "2014-02-06T10:54:29.963Z", + "height": 397, + "width": 640, + "file": "original_images/wagtail_by_fs-phil.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 9, "model": "wagtailimages.image", "fields": { - "title": "White wagtail by Koshy Koshy", - "created_at": "2014-02-06T10:57:05.536Z", - "height": 397, - "width": 640, - "file": "original_images/white_wagtail_by_Koshyk.jpg", - "uploaded_by_user": null + "title": "White wagtail by Koshy Koshy", + "created_at": "2014-02-06T10:57:05.536Z", + "height": 397, + "width": 640, + "file": "original_images/white_wagtail_by_Koshyk.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 10, "model": "wagtailimages.image", "fields": { - "title": "Pied wagtail by Marie Hale", - "created_at": "2014-02-06T11:05:12.370Z", - "height": 397, - "width": 640, - "file": "original_images/pied_wagtail_by_Marie_Hale.jpg", - "uploaded_by_user": null + "title": "Pied wagtail by Marie Hale", + "created_at": "2014-02-06T11:05:12.370Z", + "height": 397, + "width": 640, + "file": "original_images/pied_wagtail_by_Marie_Hale.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 11, "model": "wagtailimages.image", "fields": { - "title": "Wagtail at Borovoye, Kazakhstan by Ken and Nyetta", - "created_at": "2014-02-06T11:08:09.355Z", - "height": 397, - "width": 640, - "file": "original_images/wagtail_at_Borovoye_Kazakhstan_by_Ken_and_Nyetta.jpg", - "uploaded_by_user": null + "title": "Wagtail at Borovoye, Kazakhstan by Ken and Nyetta", + "created_at": "2014-02-06T11:08:09.355Z", + "height": 397, + "width": 640, + "file": "original_images/wagtail_at_Borovoye_Kazakhstan_by_Ken_and_Nyetta.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 12, "model": "wagtailimages.image", "fields": { - "title": "Wagtail sproing by Jim Bendon", - "created_at": "2014-02-06T11:10:01.185Z", - "height": 397, - "width": 640, - "file": "original_images/wagtail_sproing_by_Jim_Bendon.jpg", - "uploaded_by_user": null + "title": "Wagtail sproing by Jim Bendon", + "created_at": "2014-02-06T11:10:01.185Z", + "height": 397, + "width": 640, + "file": "original_images/wagtail_sproing_by_Jim_Bendon.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 13, "model": "wagtailimages.image", "fields": { - "title": "Hopalong wagtail by Ruth Flickr", - "created_at": "2014-02-06T11:15:32.454Z", - "height": 397, - "width": 640, - "file": "original_images/hopalong_wagtail_by_Ruth_Flickr.jpg", - "uploaded_by_user": null + "title": "Hopalong wagtail by Ruth Flickr", + "created_at": "2014-02-06T11:15:32.454Z", + "height": 397, + "width": 640, + "file": "original_images/hopalong_wagtail_by_Ruth_Flickr.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 14, "model": "wagtailimages.image", "fields": { - "title": "Wagtail collects insects by Margrit", - "created_at": "2014-02-06T11:21:13.596Z", - "height": 397, - "width": 640, - "file": "original_images/wagtail_collects_insects_by_Maggi_94.jpg", - "uploaded_by_user": null + "title": "Wagtail collects insects by Margrit", + "created_at": "2014-02-06T11:21:13.596Z", + "height": 397, + "width": 640, + "file": "original_images/wagtail_collects_insects_by_Maggi_94.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 15, "model": "wagtailimages.image", "fields": { - "title": "Grey wagtail by Lip Kee", - "created_at": "2014-02-06T11:23:36.409Z", - "height": 397, - "width": 640, - "file": "original_images/grey_wagtail_by_lip_kee.jpg", - "uploaded_by_user": null + "title": "Grey wagtail by Lip Kee", + "created_at": "2014-02-06T11:23:36.409Z", + "height": 397, + "width": 640, + "file": "original_images/grey_wagtail_by_lip_kee.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 5, "model": "demosite.blogindexpage", "fields": { - "intro": "

    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    " + "intro": "

    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    " } -}, -{ + }, + { "pk": 1, "model": "demosite.blogindexpagerelatedlink", "fields": { - "link_page": 4, - "title": "Events index", - "link_external": "", - "sort_order": 0, - "link_document": null, - "page": 5 + "link_page": 4, + "title": "Events index", + "link_external": "", + "sort_order": 0, + "link_document": null, + "page": 5 } -}, -{ + }, + { "pk": 16, "model": "demosite.blogentrypage", "fields": { - "body": "

    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.


    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.

    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.

    ", - "date": "2013-12-02", - "feed_image": 7 + "body": "

    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.


    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.

    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.

    ", + "date": "2013-12-02", + "feed_image": 7 } -}, -{ + }, + { "pk": 18, "model": "demosite.blogentrypage", "fields": { - "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.




    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.


    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.


    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.


    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.


    Prehistoric wagtails known from fossils are Motacilla humata and Motacilla major.


    See the species accounts for more on individual species' relationships.

    ", - "date": "2014-01-10", - "feed_image": 15 + "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.




    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.


    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.


    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.


    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.


    Prehistoric wagtails known from fossils are Motacilla humata and Motacilla major.


    See the species accounts for more on individual species' relationships.

    ", + "date": "2014-01-10", + "feed_image": 15 } -}, -{ + }, + { "pk": 19, "model": "demosite.blogentrypage", "fields": { - "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.


    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.


    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.


    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.


    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.


    Prehistoric wagtails known from fossils are Motacilla humata and Motacilla major.


    See the species accounts for more on individual species' relationships.

    ", - "date": "2014-02-01", - "feed_image": 14 + "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.


    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.


    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.


    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.


    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.


    Prehistoric wagtails known from fossils are Motacilla humata and Motacilla major.


    See the species accounts for more on individual species' relationships.

    ", + "date": "2014-02-01", + "feed_image": 14 } -}, -{ + }, + { "pk": 1, "model": "demosite.blogentrypagecarouselitem", "fields": { - "link_page": null, - "embed_url": "", - "image": 9, - "link_external": "http://www.flickr.com/photos/kkoshy/", - "caption": "White wagtail by Koshy Koshy", - "sort_order": 0, - "link_document": null, - "page": 16 + "link_page": null, + "embed_url": "", + "image": 9, + "link_external": "http://www.flickr.com/photos/kkoshy/", + "caption": "White wagtail by Koshy Koshy", + "sort_order": 0, + "link_document": null, + "page": 16 } -}, -{ + }, + { "pk": 2, "model": "demosite.blogentrypagecarouselitem", "fields": { - "link_page": null, - "embed_url": "", - "image": 7, - "link_external": "http://www.flickr.com/photos/jim_bendon_1957/", - "caption": "Wagtail by Jim Bendon", - "sort_order": 1, - "link_document": null, - "page": 16 + "link_page": null, + "embed_url": "", + "image": 7, + "link_external": "http://www.flickr.com/photos/jim_bendon_1957/", + "caption": "Wagtail by Jim Bendon", + "sort_order": 1, + "link_document": null, + "page": 16 } -}, -{ + }, + { "pk": 4, "model": "demosite.blogentrypagetag", "fields": { - "content_object": 19, - "tag": 5 + "content_object": 19, + "tag": 5 } -}, -{ + }, + { "pk": 5, "model": "demosite.blogentrypagetag", "fields": { - "content_object": 16, - "tag": 4 + "content_object": 16, + "tag": 4 } -}, -{ + }, + { "pk": 6, "model": "demosite.blogentrypagetag", "fields": { - "content_object": 16, - "tag": 5 + "content_object": 16, + "tag": 5 } -}, -{ + }, + { "pk": 7, "model": "demosite.blogentrypagetag", "fields": { - "content_object": 18, - "tag": 4 + "content_object": 18, + "tag": 4 } -}, -{ + }, + { "pk": 12, "model": "demosite.contactpage", "fields": { - "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.

    ", - "city": "Birdland", - "post_code": "W1A 1AA", - "country": "Birdshire", - "telephone": "012345 123456", - "address_1": "21 Tweety Mansions", - "address_2": "3 Bird Lane", - "email": "foo@example.com", - "feed_image": 7 + "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.

    ", + "city": "Birdland", + "post_code": "W1A 1AA", + "country": "Birdshire", + "telephone": "012345 123456", + "address_1": "21 Tweety Mansions", + "address_2": "3 Bird Lane", + "email": "foo@example.com", + "feed_image": 7 } -}, -{ + }, + { "pk": 4, "model": "demosite.eventindexpage", "fields": { - "intro": "

    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    " + "intro": "

    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    " } -}, -{ + }, + { "pk": 8, "model": "demosite.eventpage", "fields": { - "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.

    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.

    ", - "feed_image": 8, - "date_from": "2018-02-28", - "time_from": "11:30:00", - "audience": "public", - "cost": "\u00a330 per person, \u00a310 concessions", - "location": "Royal Albert Hall", - "date_to": "2018-03-02", - "time_to": "19:00:00", - "signup_link": "http://www.eventbrite.com/" + "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.

    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.

    ", + "feed_image": 8, + "date_from": "2018-02-28", + "time_from": "11:30:00", + "audience": "public", + "cost": "\u00a330 per person, \u00a310 concessions", + "location": "Royal Albert Hall", + "date_to": "2018-03-02", + "time_to": "19:00:00", + "signup_link": "http://www.eventbrite.com/" } -}, -{ + }, + { "pk": 9, "model": "demosite.eventpage", "fields": { - "body": "

    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution

    ", - "feed_image": 10, - "date_from": "2018-04-26", - "time_from": null, - "audience": "private", - "cost": "\u00a350", - "location": "O2 Arena", - "date_to": null, - "time_to": null, - "signup_link": "" + "body": "

    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution

    ", + "feed_image": 10, + "date_from": "2018-04-26", + "time_from": null, + "audience": "private", + "cost": "\u00a350", + "location": "O2 Arena", + "date_to": null, + "time_to": null, + "signup_link": "" } -}, -{ + }, + { "pk": 1, "model": "demosite.eventpagespeaker", "fields": { - "last_name": "Joyce", - "first_name": "James", - "link_page": null, - "image": 5, - "link_external": "", - "sort_order": 0, - "link_document": null, - "page": 8 + "last_name": "Joyce", + "first_name": "James", + "link_page": null, + "image": 5, + "link_external": "", + "sort_order": 0, + "link_document": null, + "page": 8 } -}, -{ + }, + { "pk": 2, "model": "demosite.eventpagespeaker", "fields": { - "last_name": "Mitchell", - "first_name": "David", - "link_page": null, - "image": 6, - "link_external": "", - "sort_order": 1, - "link_document": null, - "page": 8 + "last_name": "Mitchell", + "first_name": "David", + "link_page": null, + "image": 6, + "link_external": "", + "sort_order": 1, + "link_document": null, + "page": 8 } -}, -{ + }, + { "pk": 2, "model": "demosite.homepage", "fields": { - "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.

    " + "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.

    " } -}, -{ + }, + { "pk": 1, "model": "demosite.homepagecarouselitem", "fields": { - "link_page": null, - "embed_url": "", - "image": 15, - "link_external": "http://www.flickr.com/photos/lipkee/", - "caption": "Grey wagtail by Lip Kee", - "sort_order": 0, - "link_document": null, - "page": 2 + "link_page": null, + "embed_url": "", + "image": 15, + "link_external": "http://www.flickr.com/photos/lipkee/", + "caption": "Grey wagtail by Lip Kee", + "sort_order": 0, + "link_document": null, + "page": 2 } -}, -{ + }, + { "pk": 2, "model": "demosite.homepagecarouselitem", "fields": { - "link_page": null, - "embed_url": "", - "image": 12, - "link_external": "http://www.flickr.com/photos/jim_bendon_1957/", - "caption": "Wagtail sproing by Jim Bendon", - "sort_order": 1, - "link_document": null, - "page": 2 + "link_page": null, + "embed_url": "", + "image": 12, + "link_external": "http://www.flickr.com/photos/jim_bendon_1957/", + "caption": "Wagtail sproing by Jim Bendon", + "sort_order": 1, + "link_document": null, + "page": 2 } -}, -{ + }, + { "pk": 3, "model": "demosite.homepagecarouselitem", "fields": { - "link_page": null, - "embed_url": "", - "image": 11, - "link_external": "http://www.flickr.com/photos/kjfnjy/", - "caption": "Wagtail at Borovoye, Kazakhstan by Ken and Nyetta", - "sort_order": 2, - "link_document": null, - "page": 2 + "link_page": null, + "embed_url": "", + "image": 11, + "link_external": "http://www.flickr.com/photos/kjfnjy/", + "caption": "Wagtail at Borovoye, Kazakhstan by Ken and Nyetta", + "sort_order": 2, + "link_document": null, + "page": 2 } -}, -{ + }, + { "pk": 13, "model": "demosite.personpage", "fields": { - "feed_image": 5, - "city": "Birdland", - "first_name": "James", - "post_code": "W1A 1AA", - "country": "Birdshire", - "image": 5, - "telephone": "012345 123456", - "last_name": "Joyce", - "address_1": "21 Tweety Mansions", - "address_2": "3 Bird Lane", - "intro": "

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean

    ", - "email": "foo@example.com", - "biography": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.


    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.

    " + "feed_image": 5, + "city": "Birdland", + "first_name": "James", + "post_code": "W1A 1AA", + "country": "Birdshire", + "image": 5, + "telephone": "012345 123456", + "last_name": "Joyce", + "address_1": "21 Tweety Mansions", + "address_2": "3 Bird Lane", + "intro": "

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean

    ", + "email": "foo@example.com", + "biography": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.


    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.

    " } -}, -{ + }, + { "pk": 14, "model": "demosite.personpage", "fields": { - "feed_image": 6, - "city": "", - "first_name": "David", - "post_code": "W1A 1AA", - "country": "", - "image": 6, - "telephone": "", - "last_name": "Mitchell", - "address_1": "", - "address_2": "", - "intro": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World.

    ", - "email": "foo@example.com", - "biography": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.

    " + "feed_image": 6, + "city": "", + "first_name": "David", + "post_code": "W1A 1AA", + "country": "", + "image": 6, + "telephone": "", + "last_name": "Mitchell", + "address_1": "", + "address_2": "", + "intro": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World.

    ", + "email": "foo@example.com", + "biography": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.

    " } -}, -{ + }, + { "pk": 6, "model": "demosite.standardindexpage", "fields": { - "feed_image": null, - "intro": "

    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    " + "feed_image": null, + "intro": "

    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    " } -}, -{ + }, + { "pk": 20, "model": "demosite.standardindexpage", "fields": { - "feed_image": null, - "intro": "" + "feed_image": null, + "intro": "" } -}, -{ + }, + { "pk": 21, "model": "demosite.standardindexpage", "fields": { - "feed_image": null, - "intro": "

    A listing of pages at the next level down

    " + "feed_image": null, + "intro": "

    A listing of pages at the next level down

    " } -}, -{ + }, + { "pk": 10, "model": "demosite.standardpage", "fields": { - "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.


    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.


    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.


    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.

    ", - "feed_image": 12, - "intro": "

    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.

    " + "body": "

    Wagtails are slender, often colourful, ground-feeding insectivores of open country in the Old World. They are ground nesters, laying up to six speckled eggs at a time. Among their most conspicuous behaviours is a near constant tail wagging, a trait that has given the birds their common name. In spite of the ubiquity of the behaviour and observations of it, the reasons for it are poorly understood. It has been suggested that it may flush up prey, or that it may signal submissiveness to other wagtails. Recent studies have suggested instead that it is a signal of vigilance that may aid to deter potential predators.


    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.


    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.


    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.

    ", + "feed_image": 12, + "intro": "

    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.

    " } -}, -{ + }, + { "pk": 15, "model": "demosite.standardpage", "fields": { - "body": "

    Wagtails are great

    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.


    Wagtails are pretty

    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.


    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.

    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    ", - "feed_image": 10, - "intro": "

    The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.

    " + "body": "

    Wagtails are great

    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours. However, these are not evolutionary lineages; change of belly colour and increase of melanin have occurred independently several times in the wagtails, and the colour patterns which actually indicate relationships are more subtle.


    Wagtails are pretty

    mtDNA cytochrome b and NADH dehydrogenase subunit 2 sequence data (Voelker, 2002) is of limited use: the suspicion that there is a superspecies of probably 3 white-bellied, black-throated wagtails is confirmed. Also, there is another superspecies in sub-Saharan Africa, three white-throated species with a black breast-band. The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.


    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.

    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    ", + "feed_image": 10, + "intro": "

    The remaining five species are highly variable morphologically and their relationships with each other and with the two clades have not yet been satisfactorily explained.

    " } -}, -{ + }, + { "pk": 17, "model": "demosite.standardpage", "fields": { - "body": "

    James Joyce,\u00a01915,\u00a0Cornell Joyce Collection\u00a0by C. Ruf - public domain in the United States

    \n

    David Mitchell (b. 1969), British writer,\u00a0Warsaw (Poland), April 7, 2006, \u00a0Mariusz Kubik, GDFL licence

    Wagtail,\u00a0October 14, 2012\u00a0by Mark Harkin, \u00a0\u00a0Creative Commons

    Wagtail, February 18th 2008, by Joe Buckingham, Creative Commons

    Wagtail, August 4th 2009, by fs-phil, Creative Commons

    White wagtail, February 5th 2012, by Koshy Koshy, Creative Commons

    Pied wagtail, January 20th 2013, by Marie Hale, Creative Commons

    Wagtail at Borovoye, Kazakhstan, June 16th 2012, by Ken and Nyetta,\u00a0Creative Commons

    Wagtail sproing, April 29 2012, by Jim Bendon, Creative Commons

    Hopalong wagtail, June 17th 2008, by Ruth Flickr, Creative Commons

    Wagtail collects insects, June 10th 2010, by Margrit, Creative Commons

    Grey wagtail, March 13th 2009, by Lip Kee, Creative Commons

    ", - "feed_image": 15, - "intro": "

    The following photos have been used in the sample wagtailapi tests database

    " + "body": "

    James Joyce,\u00a01915,\u00a0Cornell Joyce Collection\u00a0by C. Ruf - public domain in the United States

    \n

    David Mitchell (b. 1969), British writer,\u00a0Warsaw (Poland), April 7, 2006, \u00a0Mariusz Kubik, GDFL licence

    Wagtail,\u00a0October 14, 2012\u00a0by Mark Harkin, \u00a0\u00a0Creative Commons

    Wagtail, February 18th 2008, by Joe Buckingham, Creative Commons

    Wagtail, August 4th 2009, by fs-phil, Creative Commons

    White wagtail, February 5th 2012, by Koshy Koshy, Creative Commons

    Pied wagtail, January 20th 2013, by Marie Hale, Creative Commons

    Wagtail at Borovoye, Kazakhstan, June 16th 2012, by Ken and Nyetta,\u00a0Creative Commons

    Wagtail sproing, April 29 2012, by Jim Bendon, Creative Commons

    Hopalong wagtail, June 17th 2008, by Ruth Flickr, Creative Commons

    Wagtail collects insects, June 10th 2010, by Margrit, Creative Commons

    Grey wagtail, March 13th 2009, by Lip Kee, Creative Commons

    ", + "feed_image": 15, + "intro": "

    The following photos have been used in the sample wagtailapi tests database

    " } -}, -{ + }, + { "pk": 22, "model": "demosite.standardpage", "fields": { - "body": "

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.


    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    ", - "feed_image": null, - "intro": "

    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours.

    " + "body": "

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.


    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    ", + "feed_image": null, + "intro": "

    At first glance, the wagtails appear to be divided into a yellow-bellied group and a white-bellied one, or one where the upper head is black and another where it is usually gray, but may be olive, yellow, or other colours.

    " } -}, -{ + }, + { "pk": 23, "model": "demosite.standardpage", "fields": { - "body": "

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.


    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    ", - "feed_image": null, - "intro": "

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.

    " + "body": "

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.


    Three species are poly- or paraphyletic in the present taxonomical arrangement and either subspecies need to be reassigned and/or species split up. The Blue-headed Wagtail (AKA Yellow Wagtail and many other names), especially, has always been a taxonomical nightmare with over a dozen currently accepted subspecies and many more invalid ones. The two remaining \"monochrome\" species, Mekong and African Pied Wagtail may be closely related, or a most striking example of convergent evolution.

    ", + "feed_image": null, + "intro": "

    The origin of the genus appears to be in the general area of Eastern Siberia/Mongolia. Wagtails spread rapidly across Eurasia and dispersed to Africa in the Zanclean (Early Pliocene) where the sub-Saharan lineage was later isolated. The African Pied Wagtail (and possibly the Mekong Wagtail) diverged prior to the massive radiation of the white-bellied black-throated and most yellow-bellied forms, all of which took place during the late Piacenzian (early Late Pliocene), c. 3 mya.

    " } -}, -{ + }, + { "pk": 1, "model": "demosite.standardpagecarouselitem", "fields": { - "link_page": null, - "embed_url": "", - "image": 13, - "link_external": "http://www.flickr.com/photos/ruthhb/", - "caption": "Hopalong wagtail by Ruth Flickr", - "sort_order": 0, - "link_document": null, - "page": 10 + "link_page": null, + "embed_url": "", + "image": 13, + "link_external": "http://www.flickr.com/photos/ruthhb/", + "caption": "Hopalong wagtail by Ruth Flickr", + "sort_order": 0, + "link_document": null, + "page": 10 } -}, -{ + }, + { "pk": 2, "model": "demosite.standardpagecarouselitem", "fields": { - "link_page": null, - "embed_url": "", - "image": 15, - "link_external": "http://www.flickr.com/photos/lipkee/", - "caption": "Grey wagtail by Lip Kee", - "sort_order": 1, - "link_document": null, - "page": 10 + "link_page": null, + "embed_url": "", + "image": 15, + "link_external": "http://www.flickr.com/photos/lipkee/", + "caption": "Grey wagtail by Lip Kee", + "sort_order": 1, + "link_document": null, + "page": 10 } -}, -{ + }, + { "pk": 1, "model": "demosite.standardpagerelatedlink", "fields": { - "link_page": 4, - "title": "Internal link to events", - "link_external": "", - "sort_order": 0, - "link_document": null, - "page": 10 + "link_page": 4, + "title": "Internal link to events", + "link_external": "", + "sort_order": 0, + "link_document": null, + "page": 10 } -}, -{ + }, + { "pk": 2, "model": "demosite.standardpagerelatedlink", "fields": { - "link_page": null, - "title": "External link to google", - "link_external": "http://www.google.com/", - "sort_order": 1, - "link_document": null, - "page": 10 + "link_page": null, + "title": "External link to google", + "link_external": "http://www.google.com/", + "sort_order": 1, + "link_document": null, + "page": 10 } -}, -{ + }, + { "pk": 1, "model": "taggit.tag", "fields": { - "name": "writers", - "slug": "writers" + "name": "writers", + "slug": "writers" } -}, -{ + }, + { "pk": 2, "model": "taggit.tag", "fields": { - "name": "people", - "slug": "people" + "name": "people", + "slug": "people" } -}, -{ + }, + { "pk": 3, "model": "taggit.tag", "fields": { - "name": "person", - "slug": "person" + "name": "person", + "slug": "person" } -}, -{ + }, + { "pk": 4, "model": "taggit.tag", "fields": { - "name": "wagtail", - "slug": "wagtail" + "name": "wagtail", + "slug": "wagtail" } -}, -{ + }, + { "pk": 5, "model": "taggit.tag", "fields": { - "name": "bird", - "slug": "bird" + "name": "bird", + "slug": "bird" } -}, -{ + }, + { "pk": 6, "model": "taggit.tag", "fields": { - "name": "writer", - "slug": "writer" + "name": "writer", + "slug": "writer" } -}, -{ + }, + { "pk": 1, "model": "wagtaildocs.document", "fields": { - "title": "Wagtail by mark Harkin", - "created_at": "2014-02-06T10:14:47.173Z", - "file": "original_images/wagtail_by_markyharky.jpg", - "uploaded_by_user": null + "title": "Wagtail by mark Harkin", + "created_at": "2014-02-06T10:14:47.173Z", + "file": "original_images/wagtail_by_markyharky.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 2, "model": "wagtaildocs.document", "fields": { - "title": "James Joyce", - "created_at": "2014-02-06T10:37:10.518Z", - "file": "original_images/James_Joyce_in_1915.jpg", - "uploaded_by_user": null + "title": "James Joyce", + "created_at": "2014-02-06T10:37:10.518Z", + "file": "original_images/James_Joyce_in_1915.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 3, "model": "wagtaildocs.document", "fields": { - "title": "David Mitchell", - "created_at": "2014-02-06T10:42:46.536Z", - "file": "original_images/David_Mitchell_by_Kubik.JPG", - "uploaded_by_user": null + "title": "David Mitchell", + "created_at": "2014-02-06T10:42:46.536Z", + "file": "original_images/David_Mitchell_by_Kubik.JPG", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 4, "model": "wagtaildocs.document", "fields": { - "title": "Wagtail by joe Buckingham", - "created_at": "2014-02-06T10:49:29.579Z", - "file": "original_images/wagtail_by_joe_buckingham.jpg", - "uploaded_by_user": null + "title": "Wagtail by joe Buckingham", + "created_at": "2014-02-06T10:49:29.579Z", + "file": "original_images/wagtail_by_joe_buckingham.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 5, "model": "wagtaildocs.document", "fields": { - "title": "Wagtail by fs-phil", - "created_at": "2014-02-06T10:54:29.963Z", - "file": "original_images/wagtail_by_fs-phil.jpg", - "uploaded_by_user": null + "title": "Wagtail by fs-phil", + "created_at": "2014-02-06T10:54:29.963Z", + "file": "original_images/wagtail_by_fs-phil.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 6, "model": "wagtaildocs.document", "fields": { - "title": "White wagtail by Koshy Koshy", - "created_at": "2014-02-06T10:57:05.536Z", - "file": "original_images/white_wagtail_by_Koshyk.jpg", - "uploaded_by_user": null + "title": "White wagtail by Koshy Koshy", + "created_at": "2014-02-06T10:57:05.536Z", + "file": "original_images/white_wagtail_by_Koshyk.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 7, "model": "wagtaildocs.document", "fields": { - "title": "Pied wagtail by Marie Hale", - "created_at": "2014-02-06T11:05:12.370Z", - "file": "original_images/pied_wagtail_by_Marie_Hale.jpg", - "uploaded_by_user": null + "title": "Pied wagtail by Marie Hale", + "created_at": "2014-02-06T11:05:12.370Z", + "file": "original_images/pied_wagtail_by_Marie_Hale.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 8, "model": "wagtaildocs.document", "fields": { - "title": "Wagtail at Borovoye, Kazakhstan by Ken and Nyetta", - "created_at": "2014-02-06T11:08:09.355Z", - "file": "original_images/wagtail_at_Borovoye_Kazakhstan_by_Ken_and_Nyetta.jpg", - "uploaded_by_user": null + "title": "Wagtail at Borovoye, Kazakhstan by Ken and Nyetta", + "created_at": "2014-02-06T11:08:09.355Z", + "file": "original_images/wagtail_at_Borovoye_Kazakhstan_by_Ken_and_Nyetta.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 9, "model": "wagtaildocs.document", "fields": { - "title": "Wagtail sproing by Jim Bendon", - "created_at": "2014-02-06T11:10:01.185Z", - "file": "original_images/wagtail_sproing_by_Jim_Bendon.jpg", - "uploaded_by_user": null + "title": "Wagtail sproing by Jim Bendon", + "created_at": "2014-02-06T11:10:01.185Z", + "file": "original_images/wagtail_sproing_by_Jim_Bendon.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 10, "model": "wagtaildocs.document", "fields": { - "title": "Hopalong wagtail by Ruth Flickr", - "created_at": "2014-02-06T11:15:32.454Z", - "file": "original_images/hopalong_wagtail_by_Ruth_Flickr.jpg", - "uploaded_by_user": null + "title": "Hopalong wagtail by Ruth Flickr", + "created_at": "2014-02-06T11:15:32.454Z", + "file": "original_images/hopalong_wagtail_by_Ruth_Flickr.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 11, "model": "wagtaildocs.document", "fields": { - "title": "Wagtail collects insects by Margrit", - "created_at": "2014-02-06T11:21:13.596Z", - "file": "original_images/wagtail_collects_insects_by_Maggi_94.jpg", - "uploaded_by_user": null + "title": "Wagtail collects insects by Margrit", + "created_at": "2014-02-06T11:21:13.596Z", + "file": "original_images/wagtail_collects_insects_by_Maggi_94.jpg", + "uploaded_by_user": null } -}, -{ + }, + { "pk": 12, "model": "wagtaildocs.document", "fields": { - "title": "Grey wagtail by Lip Kee", - "created_at": "2014-02-06T11:23:36.409Z", - "file": "original_images/grey_wagtail_by_lip_kee.jpg", - "uploaded_by_user": null + "title": "Grey wagtail by Lip Kee", + "created_at": "2014-02-06T11:23:36.409Z", + "file": "original_images/grey_wagtail_by_lip_kee.jpg", + "uploaded_by_user": null } -} + } ] diff --git a/wagtail/tests/emailuser/fixtures/test.json b/wagtail/tests/emailuser/fixtures/test.json index 4be543b975..e85bb37b57 100644 --- a/wagtail/tests/emailuser/fixtures/test.json +++ b/wagtail/tests/emailuser/fixtures/test.json @@ -1,120 +1,107 @@ [ - { - "pk": "00000000-0000-0000-0000-000000000001", - "model": "emailuser.emailuser", - "fields": { - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": true, - "is_staff": true, - "groups": [ - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "superuser@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000002", - "model": "emailuser.emailuser", - "fields": { - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Event editors"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "eventeditor@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000003", - "model": "emailuser.emailuser", - "fields": { - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Event moderators"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "eventmoderator@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000004", - "model": "emailuser.emailuser", - "fields": { - "first_name": "", - "last_name": "", - "is_active": false, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Event moderators"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "inactiveuser@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000005", - "model": "emailuser.emailuser", - "fields": { - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Site-wide editors"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "siteeditor@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000006", - "model": "emailuser.emailuser", - "fields": { - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Admin non-editors"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "admin_only_user@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000007", - "model": "emailuser.emailuser", - "fields": { - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": false, - "is_staff": false, - "groups": [ - ["Corporate Editor"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "corporateeditor@example.com" - } + { + "pk": "00000000-0000-0000-0000-000000000001", + "model": "emailuser.emailuser", + "fields": { + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": true, + "is_staff": true, + "groups": [], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "superuser@example.com" } + }, + { + "pk": "00000000-0000-0000-0000-000000000002", + "model": "emailuser.emailuser", + "fields": { + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "groups": [["Event editors"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "eventeditor@example.com" + } + }, + { + "pk": "00000000-0000-0000-0000-000000000003", + "model": "emailuser.emailuser", + "fields": { + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "groups": [["Event moderators"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "eventmoderator@example.com" + } + }, + { + "pk": "00000000-0000-0000-0000-000000000004", + "model": "emailuser.emailuser", + "fields": { + "first_name": "", + "last_name": "", + "is_active": false, + "is_superuser": false, + "is_staff": false, + "groups": [["Event moderators"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "inactiveuser@example.com" + } + }, + { + "pk": "00000000-0000-0000-0000-000000000005", + "model": "emailuser.emailuser", + "fields": { + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "groups": [["Site-wide editors"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "siteeditor@example.com" + } + }, + { + "pk": "00000000-0000-0000-0000-000000000006", + "model": "emailuser.emailuser", + "fields": { + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "groups": [["Admin non-editors"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "admin_only_user@example.com" + } + }, + { + "pk": "00000000-0000-0000-0000-000000000007", + "model": "emailuser.emailuser", + "fields": { + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "groups": [["Corporate Editor"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "corporateeditor@example.com" + } + } ] diff --git a/wagtail/tests/emailuser/fixtures/test_explorable_pages.json b/wagtail/tests/emailuser/fixtures/test_explorable_pages.json index e46c6f630a..80deedb943 100644 --- a/wagtail/tests/emailuser/fixtures/test_explorable_pages.json +++ b/wagtail/tests/emailuser/fixtures/test_explorable_pages.json @@ -1,106 +1,92 @@ [ - { - "pk": "00000000-0000-0000-0000-000000000001", - "model": "emailuser.emailuser", - "fields": { - "first_name": "Clark", - "last_name": "Kent", - "is_active": true, - "is_superuser": true, - "is_staff": true, - "groups": [ - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "superman@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000002", - "model": "emailuser.emailuser", - "fields": { - "first_name": "Jane", - "last_name": "Smith", - "is_active": true, - "is_superuser": false, - "is_staff": true, - "groups": [ - ["Group 1"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "jane@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000003", - "model": "emailuser.emailuser", - "fields": { - "first_name": "Bob", - "last_name": "Smith", - "is_active": true, - "is_superuser": false, - "is_staff": true, - "groups": [ - ["Group 2"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "bob@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000004", - "model": "emailuser.emailuser", - "fields": { - "first_name": "Sam", - "last_name": "Smith", - "is_active": true, - "is_superuser": false, - "is_staff": true, - "groups": [ - ["Group 1"], - ["Group 2"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "sam@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000005", - "model": "emailuser.emailuser", - "fields": { - "first_name": "Mary", - "last_name": "Smith", - "is_active": true, - "is_superuser": false, - "is_staff": true, - "groups": [ - ], - "user_permissions": [ - ["access_admin", "wagtailadmin", "admin"] - ], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "mary@example.com" - } - }, - { - "pk": "00000000-0000-0000-0000-000000000006", - "model": "emailuser.emailuser", - "fields": { - "first_name": "Josh", - "last_name": "Smith", - "is_active": true, - "is_superuser": false, - "is_staff": true, - "groups": [ - ["Group 2"], - ["Group 3"] - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "josh@example.com" - } + { + "pk": "00000000-0000-0000-0000-000000000001", + "model": "emailuser.emailuser", + "fields": { + "first_name": "Clark", + "last_name": "Kent", + "is_active": true, + "is_superuser": true, + "is_staff": true, + "groups": [], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "superman@example.com" } -] \ No newline at end of file + }, + { + "pk": "00000000-0000-0000-0000-000000000002", + "model": "emailuser.emailuser", + "fields": { + "first_name": "Jane", + "last_name": "Smith", + "is_active": true, + "is_superuser": false, + "is_staff": true, + "groups": [["Group 1"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "jane@example.com" + } + }, + { + "pk": "00000000-0000-0000-0000-000000000003", + "model": "emailuser.emailuser", + "fields": { + "first_name": "Bob", + "last_name": "Smith", + "is_active": true, + "is_superuser": false, + "is_staff": true, + "groups": [["Group 2"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "bob@example.com" + } + }, + { + "pk": "00000000-0000-0000-0000-000000000004", + "model": "emailuser.emailuser", + "fields": { + "first_name": "Sam", + "last_name": "Smith", + "is_active": true, + "is_superuser": false, + "is_staff": true, + "groups": [["Group 1"], ["Group 2"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "sam@example.com" + } + }, + { + "pk": "00000000-0000-0000-0000-000000000005", + "model": "emailuser.emailuser", + "fields": { + "first_name": "Mary", + "last_name": "Smith", + "is_active": true, + "is_superuser": false, + "is_staff": true, + "groups": [], + "user_permissions": [["access_admin", "wagtailadmin", "admin"]], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "mary@example.com" + } + }, + { + "pk": "00000000-0000-0000-0000-000000000006", + "model": "emailuser.emailuser", + "fields": { + "first_name": "Josh", + "last_name": "Smith", + "is_active": true, + "is_superuser": false, + "is_staff": true, + "groups": [["Group 2"], ["Group 3"]], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "josh@example.com" + } + } +] diff --git a/wagtail/tests/emailuser/fixtures/test_specific.json b/wagtail/tests/emailuser/fixtures/test_specific.json index 8a4e2cdf6a..a357012d90 100644 --- a/wagtail/tests/emailuser/fixtures/test_specific.json +++ b/wagtail/tests/emailuser/fixtures/test_specific.json @@ -1,18 +1,17 @@ [ - { - "pk": "00000000-0000-0000-0000-000000000001", - "model": "emailuser.emailuser", - "fields": { - "first_name": "", - "last_name": "", - "is_active": true, - "is_superuser": true, - "is_staff": true, - "groups": [ - ], - "user_permissions": [], - "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", - "email": "superuser@example.com" - } + { + "pk": "00000000-0000-0000-0000-000000000001", + "model": "emailuser.emailuser", + "fields": { + "first_name": "", + "last_name": "", + "is_active": true, + "is_superuser": true, + "is_staff": true, + "groups": [], + "user_permissions": [], + "password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22", + "email": "superuser@example.com" } + } ] diff --git a/wagtail/tests/modeladmintest/fixtures/modeladmintest_test.json b/wagtail/tests/modeladmintest/fixtures/modeladmintest_test.json index d167fcf89e..b4e3e9952d 100644 --- a/wagtail/tests/modeladmintest/fixtures/modeladmintest_test.json +++ b/wagtail/tests/modeladmintest/fixtures/modeladmintest_test.json @@ -1,238 +1,238 @@ [ -{ + { "pk": 1, "model": "modeladmintest.author", "fields": { - "name": "J. R. R. Tolkien", - "date_of_birth": "1892-01-03" + "name": "J. R. R. Tolkien", + "date_of_birth": "1892-01-03" } -}, -{ + }, + { "pk": 2, "model": "modeladmintest.author", "fields": { - "name": "Roald Dahl", - "date_of_birth": "1916-09-13" + "name": "Roald Dahl", + "date_of_birth": "1916-09-13" } -}, -{ + }, + { "pk": 3, "model": "modeladmintest.author", "fields": { - "name": "Roald Dahl", - "date_of_birth": "1898-11-29" + "name": "Roald Dahl", + "date_of_birth": "1898-11-29" } -}, -{ + }, + { "pk": 4, "model": "modeladmintest.author", "fields": { - "name": "J. R. Hartley", - "date_of_birth": "1898-11-29" + "name": "J. R. Hartley", + "date_of_birth": "1898-11-29" } -}, -{ + }, + { "pk": 5, "model": "modeladmintest.author", "fields": { - "name": "Harper Lee", - "date_of_birth": "1926-04-28" + "name": "Harper Lee", + "date_of_birth": "1926-04-28" } -}, -{ + }, + { "pk": 1, "model": "modeladmintest.book", "fields": { - "title": "The Lord of the Rings", - "author_id": 1 + "title": "The Lord of the Rings", + "author_id": 1 } -}, -{ + }, + { "pk": 2, "model": "modeladmintest.book", "fields": { - "title": "The Hobbit", - "author_id": 1 + "title": "The Hobbit", + "author_id": 1 } -}, -{ + }, + { "pk": 3, "model": "modeladmintest.book", "fields": { - "title": "Charlie and the Chocolate Factory", - "author_id": 2 + "title": "Charlie and the Chocolate Factory", + "author_id": 2 } -}, -{ + }, + { "pk": 4, "model": "modeladmintest.book", "fields": { - "title": "The Chronicles of Narnia", - "author_id": 3 + "title": "The Chronicles of Narnia", + "author_id": 3 } -}, -{ + }, + { "pk": 4, "model": "modeladmintest.solobook", "fields": { - "title": "To Kill a Mockingbird", - "author_id": 5 + "title": "To Kill a Mockingbird", + "author_id": 5 } -}, -{ + }, + { "pk": "boom", "model": "modeladmintest.token", "fields": { - "key": "boom" + "key": "boom" } -}, -{ + }, + { "pk": 1, "model": "wagtailcore.page", "fields": { - "title": "Root", - "draft_title": "Root", - "numchild": 1, - "show_in_menus": false, - "live": true, - "depth": 1, - "content_type": ["wagtailcore", "page"], - "path": "0001", - "url_path": "/", - "slug": "root" + "title": "Root", + "draft_title": "Root", + "numchild": 1, + "show_in_menus": false, + "live": true, + "depth": 1, + "content_type": ["wagtailcore", "page"], + "path": "0001", + "url_path": "/", + "slug": "root" } -}, + }, -{ + { "pk": 2, "model": "wagtailcore.page", "fields": { - "title": "Welcome to the Wagtail test site!", - "draft_title": "Welcome to the Wagtail test site!", - "numchild": 5, - "show_in_menus": false, - "live": true, - "depth": 2, - "content_type": ["wagtailcore", "page"], - "path": "00010001", - "url_path": "/home/", - "slug": "home" + "title": "Welcome to the Wagtail test site!", + "draft_title": "Welcome to the Wagtail test site!", + "numchild": 5, + "show_in_menus": false, + "live": true, + "depth": 2, + "content_type": ["wagtailcore", "page"], + "path": "00010001", + "url_path": "/home/", + "slug": "home" } -}, + }, -{ + { "pk": 3, "model": "wagtailcore.page", "fields": { - "title": "Events", - "draft_title": "Events", - "numchild": 4, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "eventindex"], - "path": "000100010001", - "url_path": "/home/events/", - "slug": "events" + "title": "Events", + "draft_title": "Events", + "numchild": 4, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "eventindex"], + "path": "000100010001", + "url_path": "/home/events/", + "slug": "events" } -}, -{ + }, + { "pk": 3, "model": "tests.eventindex", "fields": { - "intro": "Look at our lovely events." + "intro": "Look at our lovely events." } -}, + }, -{ + { "pk": 4, "model": "wagtailcore.page", "fields": { - "title": "Christmas", - "draft_title": "Christmas", - "numchild": 3, - "show_in_menus": true, - "live": true, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000100010001", - "url_path": "/home/events/christmas/", - "slug": "christmas" + "title": "Christmas", + "draft_title": "Christmas", + "numchild": 3, + "show_in_menus": true, + "live": true, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000100010001", + "url_path": "/home/events/christmas/", + "slug": "christmas" } -}, -{ + }, + { "pk": 4, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Chestnuts roasting on an open fire

    ", - "cost": "Free" + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Chestnuts roasting on an open fire

    ", + "cost": "Free" } -}, -{ + }, + { "pk": 5, "model": "wagtailcore.page", "fields": { - "title": "Santa's Grotto", - "draft_title": "Santa's Grotto", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 5, - "content_type": ["modeladmintest", "venuepage"], - "path": "00010001000100010001", - "url_path": "/home/events/christmas/santas-grotto/", - "slug": "santas-grotto" + "title": "Santa's Grotto", + "draft_title": "Santa's Grotto", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 5, + "content_type": ["modeladmintest", "venuepage"], + "path": "00010001000100010001", + "url_path": "/home/events/christmas/santas-grotto/", + "slug": "santas-grotto" } -}, -{ + }, + { "pk": 5, "model": "modeladmintest.venuepage", "fields": { - "address": "The North Pole", - "capacity": 3 + "address": "The North Pole", + "capacity": 3 } -}, -{ + }, + { "pk": 6, "model": "wagtailcore.page", "fields": { - "title": "Santa's Workshop", - "draft_title": "Santa's Workshop", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 5, - "content_type": ["modeladmintest", "venuepage"], - "path": "00010001000100010002", - "url_path": "/home/events/christmas/santas-workshop/", - "slug": "santas-workshop" + "title": "Santa's Workshop", + "draft_title": "Santa's Workshop", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 5, + "content_type": ["modeladmintest", "venuepage"], + "path": "00010001000100010002", + "url_path": "/home/events/christmas/santas-workshop/", + "slug": "santas-workshop" } -}, -{ + }, + { "pk": 6, "model": "modeladmintest.venuepage", "fields": { - "address": "The North Pole", - "capacity": 25 + "address": "The North Pole", + "capacity": 25 } -}, -{ + }, + { "pk": 7, "model": "wagtailcore.page", "fields": { - "title": "Claim your free present!", - "draft_title": "Claim your free present!", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 5, - "content_type": ["wagtailcore", "page"], - "path": "00010001000100010003", - "url_path": "/home/events/christmas/claim-free-present/", - "slug": "claim-free-present" + "title": "Claim your free present!", + "draft_title": "Claim your free present!", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 5, + "content_type": ["wagtailcore", "page"], + "path": "00010001000100010003", + "url_path": "/home/events/christmas/claim-free-present/", + "slug": "claim-free-present" } -} + } ] diff --git a/wagtail/tests/testapp/fixtures/test.json b/wagtail/tests/testapp/fixtures/test.json index 71226c31d3..074a0b696f 100644 --- a/wagtail/tests/testapp/fixtures/test.json +++ b/wagtail/tests/testapp/fixtures/test.json @@ -1,960 +1,949 @@ [ -{ + { "pk": 1, "model": "wagtailcore.page", "fields": { - "title": "Root", - "draft_title": "Root", - "numchild": 2, - "show_in_menus": false, - "live": true, - "depth": 1, - "content_type": [ - "wagtailcore", - "page" - ], - "path": "0001", - "url_path": "/", - "slug": "root" + "title": "Root", + "draft_title": "Root", + "numchild": 2, + "show_in_menus": false, + "live": true, + "depth": 1, + "content_type": ["wagtailcore", "page"], + "path": "0001", + "url_path": "/", + "slug": "root" } -}, + }, -{ + { "pk": 2, "model": "wagtailcore.page", "fields": { - "title": "Welcome to the Wagtail test site!", - "draft_title": "Welcome to the Wagtail test site!", - "numchild": 9, - "show_in_menus": false, - "live": true, - "depth": 2, - "content_type": ["wagtailcore", "page"], - "path": "00010001", - "url_path": "/home/", - "slug": "home", - "first_published_at": "2014-01-01T12:00:00.000Z", - "last_published_at": "2014-02-01T12:00:00.000Z" + "title": "Welcome to the Wagtail test site!", + "draft_title": "Welcome to the Wagtail test site!", + "numchild": 9, + "show_in_menus": false, + "live": true, + "depth": 2, + "content_type": ["wagtailcore", "page"], + "path": "00010001", + "url_path": "/home/", + "slug": "home", + "first_published_at": "2014-01-01T12:00:00.000Z", + "last_published_at": "2014-02-01T12:00:00.000Z" } -}, -{ + }, + { "pk": 3, "model": "wagtailcore.page", "fields": { - "title": "Events", - "draft_title": "Events", - "numchild": 6, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "eventindex"], - "path": "000100010001", - "url_path": "/home/events/", - "slug": "events" + "title": "Events", + "draft_title": "Events", + "numchild": 6, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "eventindex"], + "path": "000100010001", + "url_path": "/home/events/", + "slug": "events" } -}, -{ + }, + { "pk": 3, "model": "tests.eventindex", "fields": { - "intro": "Look at our lovely events." + "intro": "Look at our lovely events." } -}, + }, -{ + { "pk": 4, "model": "wagtailcore.page", "fields": { - "title": "Christmas", - "draft_title": "Christmas", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000100010001", - "url_path": "/home/events/christmas/", - "slug": "christmas", - "owner": 2 + "title": "Christmas", + "draft_title": "Christmas", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000100010001", + "url_path": "/home/events/christmas/", + "slug": "christmas", + "owner": 2 } -}, -{ + }, + { "pk": 4, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Chestnuts roasting on an open fire

    ", - "cost": "Free", - "feed_image": 1 + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Chestnuts roasting on an open fire

    ", + "cost": "Free", + "feed_image": 1 } -}, + }, -{ + { "pk": 13, "model": "wagtailcore.page", "fields": { - "title": "Saint Patrick", - "draft_title": "Saint Patrick", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 4, - "content_type": ["tests", "singleeventpage"], - "path": "0001000100010005", - "url_path": "/home/events/saint-patrick/", - "slug": "saint-patrick", - "owner": 2 + "title": "Saint Patrick", + "draft_title": "Saint Patrick", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 4, + "content_type": ["tests", "singleeventpage"], + "path": "0001000100010005", + "url_path": "/home/events/saint-patrick/", + "slug": "saint-patrick", + "owner": 2 } -}, -{ + }, + { "pk": 13, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "private", - "location": "Wellington", - "body": "

    The day when nothing makes sense.

    ", - "cost": "Semi-free" + "date_from": "2014-12-25", + "audience": "private", + "location": "Wellington", + "body": "

    The day when nothing makes sense.

    ", + "cost": "Semi-free" } -}, -{ + }, + { "pk": 13, "model": "tests.singleeventpage", "fields": { - "excerpt": "A little tiny excerpt for Saint Patrick." + "excerpt": "A little tiny excerpt for Saint Patrick." } -}, + }, -{ + { "pk": 1, "model": "tests.eventpagespeaker", "fields": { - "page": 4, - "first_name": "Father", - "last_name": "Christmas", - "sort_order": 0 + "page": 4, + "first_name": "Father", + "last_name": "Christmas", + "sort_order": 0 } -}, + }, -{ + { "pk": 5, "model": "wagtailcore.page", "fields": { - "title": "Tentative Unpublished Event", - "draft_title": "Tentative Unpublished Event", - "numchild": 0, - "show_in_menus": true, - "live": false, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000100010002", - "url_path": "/home/events/tentative-unpublished-event/", - "slug": "tentative-unpublished-event", - "owner": 2 + "title": "Tentative Unpublished Event", + "draft_title": "Tentative Unpublished Event", + "numchild": 0, + "show_in_menus": true, + "live": false, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000100010002", + "url_path": "/home/events/tentative-unpublished-event/", + "slug": "tentative-unpublished-event", + "owner": 2 } -}, -{ + }, + { "pk": 5, "model": "tests.eventpage", "fields": { - "date_from": "2015-07-04", - "audience": "public", - "location": "The moon", - "body": "

    I haven't worked out the details yet, but it's going to have cake and ponies

    ", - "cost": "Free" + "date_from": "2015-07-04", + "audience": "public", + "location": "The moon", + "body": "

    I haven't worked out the details yet, but it's going to have cake and ponies

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 6, "model": "wagtailcore.page", "fields": { - "title": "Someone Else's Event", - "draft_title": "Someone Else's Event", - "numchild": 0, - "show_in_menus": true, - "live": false, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000100010003", - "url_path": "/home/events/someone-elses-event/", - "slug": "someone-elses-event", - "owner": 3 + "title": "Someone Else's Event", + "draft_title": "Someone Else's Event", + "numchild": 0, + "show_in_menus": true, + "live": false, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000100010003", + "url_path": "/home/events/someone-elses-event/", + "slug": "someone-elses-event", + "owner": 3 } -}, -{ + }, + { "pk": 6, "model": "tests.eventpage", "fields": { - "date_from": "2015-07-04", - "audience": "private", - "location": "The moon", - "body": "

    your name's not down, you're not coming in

    ", - "cost": "Free (but not for you)" + "date_from": "2015-07-04", + "audience": "private", + "location": "The moon", + "body": "

    your name's not down, you're not coming in

    ", + "cost": "Free (but not for you)" } -}, + }, -{ + { "pk": 7, "model": "wagtailcore.page", "fields": { - "title": "About us", - "draft_title": "About us", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "simplepage"], - "path": "000100010002", - "url_path": "/home/about-us/", - "slug": "about-us", - "first_published_at": "2014-01-01T12:00:00.000Z", - "last_published_at": "2014-02-01T12:00:00.000Z" + "title": "About us", + "draft_title": "About us", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "simplepage"], + "path": "000100010002", + "url_path": "/home/about-us/", + "slug": "about-us", + "first_published_at": "2014-01-01T12:00:00.000Z", + "last_published_at": "2014-02-01T12:00:00.000Z" } -}, -{ + }, + { "pk": 7, "model": "tests.simplepage", "fields": { - "content": "

    We are really good.

    " + "content": "

    We are really good.

    " } -}, + }, -{ + { "pk": 8, "model": "wagtailcore.page", "fields": { - "title": "Contact us", - "draft_title": "Contact us", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "formpage"], - "path": "000100010003", - "url_path": "/home/contact-us/", - "slug": "contact-us" + "title": "Contact us", + "draft_title": "Contact us", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "formpage"], + "path": "000100010003", + "url_path": "/home/contact-us/", + "slug": "contact-us" } -}, -{ + }, + { "pk": 8, "model": "tests.formpage", "fields": { - "to_address": "to@email.com", - "from_address": "from@email.com", - "subject": "The subject" + "to_address": "to@email.com", + "from_address": "from@email.com", + "subject": "The subject" } -}, + }, -{ + { "pk": 9, "model": "wagtailcore.page", "fields": { - "title": "Ameristralia Day", - "draft_title": "Ameristralia Day", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000100010004", - "url_path": "/home/events/final-event/", - "slug": "final-event", - "owner": 3 + "title": "Ameristralia Day", + "draft_title": "Ameristralia Day", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000100010004", + "url_path": "/home/events/final-event/", + "slug": "final-event", + "owner": 3 } -}, -{ + }, + { "pk": 9, "model": "tests.eventpage", "fields": { - "date_from": "2015-04-22", - "audience": "public", - "location": "Ameristralia", - "body": "

    come celebrate the independence of Ameristralia

    ", - "cost": "Free" + "date_from": "2015-04-22", + "audience": "public", + "location": "Ameristralia", + "body": "

    come celebrate the independence of Ameristralia

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 1, "model": "tests.formfield", "fields": { - "clean_name": "your_email", - "sort_order": 1, - "label": "Your email", - "field_type": "email", - "required": true, - "choices": "", - "default_value": "", - "help_text": "", - "page": 8 + "clean_name": "your_email", + "sort_order": 1, + "label": "Your email", + "field_type": "email", + "required": true, + "choices": "", + "default_value": "", + "help_text": "", + "page": 8 } -}, -{ + }, + { "pk": 2, "model": "tests.formfield", "fields": { - "clean_name": "your_message", - "sort_order": 2, - "label": "Your message", - "field_type": "multiline", - "required": true, - "choices": "", - "default_value": "", - "help_text": "", - "page": 8 + "clean_name": "your_message", + "sort_order": 2, + "label": "Your message", + "field_type": "multiline", + "required": true, + "choices": "", + "default_value": "", + "help_text": "", + "page": 8 } -}, -{ + }, + { "pk": 3, "model": "tests.formfield", "fields": { - "clean_name": "your_choices", - "sort_order": 3, - "label": "Your choices", - "field_type": "checkboxes", - "required": false, - "choices": "foo,bar,baz", - "default_value": "", - "help_text": "", - "page": 8 + "clean_name": "your_choices", + "sort_order": 3, + "label": "Your choices", + "field_type": "checkboxes", + "required": false, + "choices": "foo,bar,baz", + "default_value": "", + "help_text": "", + "page": 8 } -}, + }, -{ + { "pk": 10, "model": "wagtailcore.page", "fields": { - "title": "Old style route method", - "draft_title": "Old style route method", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "pagewitholdstyleroutemethod"], - "path": "000100010004", - "url_path": "/home/old-style-route/", - "slug": "old-style-route" + "title": "Old style route method", + "draft_title": "Old style route method", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "pagewitholdstyleroutemethod"], + "path": "000100010004", + "url_path": "/home/old-style-route/", + "slug": "old-style-route" } -}, -{ + }, + { "pk": 10, "model": "tests.pagewitholdstyleroutemethod", "fields": { - "content": "

    Test with old style route method

    " + "content": "

    Test with old style route method

    " } -}, + }, -{ + { "pk": 11, "model": "wagtailcore.page", "fields": { - "title": "Secret plans", - "draft_title": "Secret plans", - "numchild": 1, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "simplepage"], - "path": "000100010005", - "url_path": "/home/secret-plans/", - "slug": "secret-plans" + "title": "Secret plans", + "draft_title": "Secret plans", + "numchild": 1, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "simplepage"], + "path": "000100010005", + "url_path": "/home/secret-plans/", + "slug": "secret-plans" } -}, -{ + }, + { "pk": 11, "model": "tests.simplepage", "fields": { - "content": "

    muahahahaha

    " + "content": "

    muahahahaha

    " } -}, + }, -{ + { "pk": 12, "model": "wagtailcore.page", "fields": { - "title": "Steal underpants", - "draft_title": "Steal underpants", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000100050001", - "url_path": "/home/secret-plans/steal-underpants/", - "slug": "steal-underpants" + "title": "Steal underpants", + "draft_title": "Steal underpants", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000100050001", + "url_path": "/home/secret-plans/steal-underpants/", + "slug": "steal-underpants" } -}, -{ + }, + { "pk": 12, "model": "tests.eventpage", "fields": { - "date_from": "2015-07-04", - "audience": "private", - "location": "Marks and Spencer", - "body": "

    meet in the menswear department at noon

    ", - "cost": "free" + "date_from": "2015-07-04", + "audience": "private", + "location": "Marks and Spencer", + "body": "

    meet in the menswear department at noon

    ", + "cost": "free" } -}, -{ + }, + { "pk": 14, "model": "wagtailcore.page", "fields": { - "title": "My locked page", - "draft_title": "My locked page", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["wagtailcore", "page"], - "path": "000100010006", - "url_path": "/home/my-locked-page/", - "slug": "my-locked-page", - "locked": true + "title": "My locked page", + "draft_title": "My locked page", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["wagtailcore", "page"], + "path": "000100010006", + "url_path": "/home/my-locked-page/", + "slug": "my-locked-page", + "locked": true } -}, -{ + }, + { "pk": 15, "model": "wagtailcore.page", "fields": { - "title": "Businessy events", - "draft_title": "Businessy events", - "numchild": 1, - "show_in_menus": true, - "live": false, - "depth": 4, - "content_type": ["tests", "businessindex"], - "path": "0001000100010006", - "url_path": "/home/events/businessy-events/", - "slug": "businessy-events", - "owner": 2 + "title": "Businessy events", + "draft_title": "Businessy events", + "numchild": 1, + "show_in_menus": true, + "live": false, + "depth": 4, + "content_type": ["tests", "businessindex"], + "path": "0001000100010006", + "url_path": "/home/events/businessy-events/", + "slug": "businessy-events", + "owner": 2 } -}, -{ + }, + { "pk": 15, "model": "tests.businessindex", - "fields": { - } -}, + "fields": {} + }, -{ + { "pk": 16, "model": "wagtailcore.page", "fields": { - "title": "Board meetings", - "draft_title": "Board meetings", - "numchild": 0, - "show_in_menus": true, - "live": false, - "depth": 5, - "content_type": ["tests", "businesssubindex"], - "path": "00010001000100060001", - "url_path": "/home/events/businessy-events/board-meetings/", - "slug": "board-meetings", - "owner": 2 + "title": "Board meetings", + "draft_title": "Board meetings", + "numchild": 0, + "show_in_menus": true, + "live": false, + "depth": 5, + "content_type": ["tests", "businesssubindex"], + "path": "00010001000100060001", + "url_path": "/home/events/businessy-events/board-meetings/", + "slug": "board-meetings", + "owner": 2 } -}, -{ + }, + { "pk": 16, "model": "tests.businesssubindex", - "fields": { - } -}, + "fields": {} + }, -{ + { "pk": 17, "model": "wagtailcore.page", "fields": { - "title": "Contact us one more time", - "draft_title": "Contact us one more time", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "formpagewithcustomsubmission"], - "path": "000100010007", - "url_path": "/home/contact-us-one-more-time/", - "slug": "contact-us-one-more-time" + "title": "Contact us one more time", + "draft_title": "Contact us one more time", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "formpagewithcustomsubmission"], + "path": "000100010007", + "url_path": "/home/contact-us-one-more-time/", + "slug": "contact-us-one-more-time" } -}, -{ + }, + { "pk": 17, "model": "tests.formpagewithcustomsubmission", "fields": { - "to_address": "to@email.com", - "from_address": "from@email.com", - "subject": "The subject" + "to_address": "to@email.com", + "from_address": "from@email.com", + "subject": "The subject" } -}, -{ + }, + { "pk": 1, "model": "tests.formfieldwithcustomsubmission", "fields": { - "clean_name": "", - "sort_order": 1, - "label": "Your email", - "field_type": "email", - "required": true, - "choices": "", - "default_value": "", - "help_text": "", - "page": 17 + "clean_name": "", + "sort_order": 1, + "label": "Your email", + "field_type": "email", + "required": true, + "choices": "", + "default_value": "", + "help_text": "", + "page": 17 } -}, -{ + }, + { "pk": 2, "model": "tests.formfieldwithcustomsubmission", "fields": { - "clean_name": "", - "sort_order": 2, - "label": "Your message", - "field_type": "multiline", - "required": true, - "choices": "", - "default_value": "", - "help_text": "", - "page": 17 + "clean_name": "", + "sort_order": 2, + "label": "Your message", + "field_type": "multiline", + "required": true, + "choices": "", + "default_value": "", + "help_text": "", + "page": 17 } -}, -{ + }, + { "pk": 3, "model": "tests.formfieldwithcustomsubmission", "fields": { - "clean_name": "", - "sort_order": 3, - "label": "Your choices", - "field_type": "checkboxes", - "required": false, - "choices": "foo,bar,baz", - "default_value": "", - "help_text": "", - "page": 17 + "clean_name": "", + "sort_order": 3, + "label": "Your choices", + "field_type": "checkboxes", + "required": false, + "choices": "foo,bar,baz", + "default_value": "", + "help_text": "", + "page": 17 } -}, -{ + }, + { "pk": 1, "model": "tests.customformpagesubmission", "fields": { - "form_data": "{\"your-email\": \"old@example.com\", \"your-message\": \"this is a really old message\"}", - "user": 2, - "page": 17, - "submit_time": "2013-01-01T12:00:00.000Z" + "form_data": "{\"your-email\": \"old@example.com\", \"your-message\": \"this is a really old message\"}", + "user": 2, + "page": 17, + "submit_time": "2013-01-01T12:00:00.000Z" } -}, -{ + }, + { "pk": 2, "model": "tests.customformpagesubmission", "fields": { - "form_data": "{\"your-email\": \"new@example.com\", \"your-message\": \"this is a fairly new message\"}", - "user": 5, - "page": 17, - "submit_time": "2014-01-01T12:00:00.000Z" + "form_data": "{\"your-email\": \"new@example.com\", \"your-message\": \"this is a fairly new message\"}", + "user": 5, + "page": 17, + "submit_time": "2014-01-01T12:00:00.000Z" } -}, -{ + }, + { "pk": 18, "model": "wagtailcore.page", "fields": { - "title": "Secret event editor plans", - "draft_title": "Secret event editor plans", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "simplepage"], - "path": "000100010008", - "url_path": "/home/secret-event-editor-plans/", - "slug": "secret-event-editor-plans" + "title": "Secret event editor plans", + "draft_title": "Secret event editor plans", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "simplepage"], + "path": "000100010008", + "url_path": "/home/secret-event-editor-plans/", + "slug": "secret-event-editor-plans" } -}, -{ + }, + { "pk": 18, "model": "tests.simplepage", "fields": { - "content": "

    let's move Easter to Christmas

    " + "content": "

    let's move Easter to Christmas

    " } -}, -{ + }, + { "pk": 19, "model": "wagtailcore.page", "fields": { - "title": "Secret login plans", - "draft_title": "Secret login plans", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "simplepage"], - "path": "000100010009", - "url_path": "/home/secret-login-plans/", - "slug": "secret-login-plans" + "title": "Secret login plans", + "draft_title": "Secret login plans", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "simplepage"], + "path": "000100010009", + "url_path": "/home/secret-login-plans/", + "slug": "secret-login-plans" } -}, -{ + }, + { "pk": 19, "model": "tests.simplepage", "fields": { - "content": "

    collect logs

    " + "content": "

    collect logs

    " } -}, + }, -{ + { "pk": 20, "model": "wagtailcore.page", "fields": { - "title": "This page doesn't get served", - "draft_title": "This page doesn't get served", - "numchild": 0, - "show_in_menus": false, - "live": true, - "depth": 2, - "content_type": ["wagtailcore", "page"], - "path": "00010002", - "url_path": "/does-not-exist/", - "slug": "does-not-exist" + "title": "This page doesn't get served", + "draft_title": "This page doesn't get served", + "numchild": 0, + "show_in_menus": false, + "live": true, + "depth": 2, + "content_type": ["wagtailcore", "page"], + "path": "00010002", + "url_path": "/does-not-exist/", + "slug": "does-not-exist" } -}, + }, -{ + { "pk": 1, "model": "wagtailcore.site", "fields": { - "root_page": 2, - "hostname": "localhost", - "port": 80, - "is_default_site": true + "root_page": 2, + "hostname": "localhost", + "port": 80, + "is_default_site": true } -}, + }, -{ + { "pk": 3, "model": "auth.group", "fields": { - "name": "Event editors", - "permissions": [ - ["access_admin", "wagtailadmin", "admin"], - ["add_image", "wagtailimages", "image"], - ["change_image", "wagtailimages", "image"], - ["delete_image", "wagtailimages", "image"] - ] + "name": "Event editors", + "permissions": [ + ["access_admin", "wagtailadmin", "admin"], + ["add_image", "wagtailimages", "image"], + ["change_image", "wagtailimages", "image"], + ["delete_image", "wagtailimages", "image"] + ] } -}, -{ + }, + { "pk": 4, "model": "auth.group", "fields": { - "name": "Event moderators", - "permissions": [ - ["access_admin", "wagtailadmin", "admin"], - ["add_image", "wagtailimages", "image"], - ["change_image", "wagtailimages", "image"], - ["delete_image", "wagtailimages", "image"] - ] + "name": "Event moderators", + "permissions": [ + ["access_admin", "wagtailadmin", "admin"], + ["add_image", "wagtailimages", "image"], + ["change_image", "wagtailimages", "image"], + ["delete_image", "wagtailimages", "image"] + ] } -}, -{ + }, + { "pk": 5, "model": "auth.group", "fields": { - "name": "Site-wide editors", - "permissions": [ - ["access_admin", "wagtailadmin", "admin"], - ["add_image", "wagtailimages", "image"], - ["change_image", "wagtailimages", "image"], - ["delete_image", "wagtailimages", "image"] - ] + "name": "Site-wide editors", + "permissions": [ + ["access_admin", "wagtailadmin", "admin"], + ["add_image", "wagtailimages", "image"], + ["change_image", "wagtailimages", "image"], + ["delete_image", "wagtailimages", "image"] + ] } -}, -{ + }, + { "pk": 6, "model": "auth.group", "fields": { - "name": "Admin non-editors", - "permissions": [ - ["access_admin", "wagtailadmin", "admin"] - ] + "name": "Admin non-editors", + "permissions": [["access_admin", "wagtailadmin", "admin"]] } -}, -{ + }, + { "pk": 7, "model": "auth.group", "fields": { - "name": "Corporate Editor", - "permissions": [ - ["access_admin", "wagtailadmin", "admin"], - ["add_image", "wagtailimages", "image"], - ["change_image", "wagtailimages", "image"], - ["delete_image", "wagtailimages", "image"] - ] + "name": "Corporate Editor", + "permissions": [ + ["access_admin", "wagtailadmin", "admin"], + ["add_image", "wagtailimages", "image"], + ["change_image", "wagtailimages", "image"], + ["delete_image", "wagtailimages", "image"] + ] } -}, -{ + }, + { "pk": 1, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Event editors"], - "page": 3, - "permission_type": "add" + "group": ["Event editors"], + "page": 3, + "permission_type": "add" } -}, -{ + }, + { "pk": 2, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Event moderators"], - "page": 3, - "permission_type": "add" + "group": ["Event moderators"], + "page": 3, + "permission_type": "add" } -}, -{ + }, + { "pk": 3, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Event moderators"], - "page": 3, - "permission_type": "edit" + "group": ["Event moderators"], + "page": 3, + "permission_type": "edit" } -}, -{ + }, + { "pk": 4, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Event moderators"], - "page": 3, - "permission_type": "publish" + "group": ["Event moderators"], + "page": 3, + "permission_type": "publish" } -}, -{ + }, + { "pk": 5, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Site-wide editors"], - "page": 2, - "permission_type": "edit" + "group": ["Site-wide editors"], + "page": 2, + "permission_type": "edit" } -}, -{ + }, + { "pk": 6, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Event moderators"], - "page": 3, - "permission_type": "lock" + "group": ["Event moderators"], + "page": 3, + "permission_type": "lock" } -}, -{ + }, + { "pk": 7, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Corporate Editor"], - "page": 7, - "permission_type": "edit" + "group": ["Corporate Editor"], + "page": 7, + "permission_type": "edit" } -}, -{ + }, + { "pk": 8, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Corporate Editor"], - "page": 15, - "permission_type": "add" + "group": ["Corporate Editor"], + "page": 15, + "permission_type": "add" } -}, -{ + }, + { "pk": 9, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Event moderators"], - "page": 3, - "permission_type": "unlock" + "group": ["Event moderators"], + "page": 3, + "permission_type": "unlock" } -}, + }, -{ + { "pk": 1, "model": "wagtailforms.formsubmission", "fields": { - "form_data": "{\"your_email\": \"old@example.com\", \"your_message\": \"this is a really old message\"}", - "page": 8, - "submit_time": "2013-01-01T12:00:00.000Z" + "form_data": "{\"your_email\": \"old@example.com\", \"your_message\": \"this is a really old message\"}", + "page": 8, + "submit_time": "2013-01-01T12:00:00.000Z" } -}, -{ + }, + { "pk": 2, "model": "wagtailforms.formsubmission", "fields": { - "form_data": "{\"your_email\": \"new@example.com\", \"your_message\": \"this is a fairly new message\"}", - "page": 8, - "submit_time": "2014-01-01T12:00:00.000Z" + "form_data": "{\"your_email\": \"new@example.com\", \"your_message\": \"this is a fairly new message\"}", + "page": 8, + "submit_time": "2014-01-01T12:00:00.000Z" } -}, -{ + }, + { "pk": 1, "model": "tests.AdvertPlacement", "fields": { - "page": 2, - "advert": 1, - "colour": "yellow" - } -}, -{ + "page": 2, + "advert": 1, + "colour": "yellow" + } + }, + { "pk": 2, "model": "tests.AdvertPlacement", "fields": { - "page": 4, - "advert": 1, - "colour": "greener than a Christmas tree" - } -}, -{ + "page": 4, + "advert": 1, + "colour": "greener than a Christmas tree" + } + }, + { "pk": 1, "model": "tests.advert", "fields": { - "text": "test_advert", - "url": "http://www.example.com" - } -}, -{ + "text": "test_advert", + "url": "http://www.example.com" + } + }, + { "pk": 1, "model": "tests.advertwithtabbedinterface", "fields": { - "text": "test_advert", - "url": "http://www.example.com", - "something_else": "Model with tabbed interface" + "text": "test_advert", + "url": "http://www.example.com", + "something_else": "Model with tabbed interface" } -}, -{ + }, + { "pk": 1, "model": "wagtaildocs.Document", "fields": { - "title": "test document", - "created_at": "2014-01-01T12:00:00.000Z", - "file": "documents/test.pdf" + "title": "test document", + "created_at": "2014-01-01T12:00:00.000Z", + "file": "documents/test.pdf" } -}, -{ + }, + { "pk": 1, "model": "wagtailcore.pageviewrestriction", "fields": { - "page": 11, - "restriction_type": "password", - "password": "swordfish" + "page": 11, + "restriction_type": "password", + "password": "swordfish" } -}, -{ + }, + { "pk": 2, "model": "wagtailcore.pageviewrestriction", "fields": { - "page": 18, - "restriction_type": "groups", - "groups": [ - ["Event editors"] - ] + "page": 18, + "restriction_type": "groups", + "groups": [["Event editors"]] } -}, -{ + }, + { "pk": 3, "model": "wagtailcore.pageviewrestriction", "fields": { - "page": 19, - "restriction_type": "login" + "page": 19, + "restriction_type": "login" } -}, -{ + }, + { "pk": 1, "model": "wagtailimages.image", "fields": { - "title": "A missing image", - "file": "original_images/missing.jpg", - "width": 1000, - "height": 1000, - "created_at": "2014-01-01T12:00:00.000Z" + "title": "A missing image", + "file": "original_images/missing.jpg", + "width": 1000, + "height": 1000, + "created_at": "2014-01-01T12:00:00.000Z" } -}, -{ + }, + { "model": "wagtailcore.collectionviewrestriction", "pk": 1, "fields": { - "restriction_type": "password", - "password": "swordfish", - "collection": 2 + "restriction_type": "password", + "password": "swordfish", + "collection": 2 } -}, -{ + }, + { "model": "wagtailcore.collectionviewrestriction", "pk": 2, "fields": { - "restriction_type": "login", - "collection": 3 + "restriction_type": "login", + "collection": 3 } -}, -{ + }, + { "model": "wagtailcore.collectionviewrestriction", "pk": 3, "fields": { - "restriction_type": "groups", - "collection": 4, - "groups": [ - ["Event editors"] - ] + "restriction_type": "groups", + "collection": 4, + "groups": [["Event editors"]] } -}, -{ + }, + { "model": "wagtailcore.collection", "pk": 1, "fields": { - "path": "0001", - "depth": 1, - "numchild": 3, - "name": "Root" + "path": "0001", + "depth": 1, + "numchild": 3, + "name": "Root" } -}, -{ + }, + { "model": "wagtailcore.collection", "pk": 2, "fields": { - "path": "00010001", - "depth": 2, - "numchild": 0, - "name": "Password protected" + "path": "00010001", + "depth": 2, + "numchild": 0, + "name": "Password protected" } -}, -{ + }, + { "model": "wagtailcore.collection", "pk": 3, "fields": { - "path": "00010002", - "depth": 2, - "numchild": 0, - "name": "Login protected" + "path": "00010002", + "depth": 2, + "numchild": 0, + "name": "Login protected" } -}, -{ + }, + { "model": "wagtailcore.collection", "pk": 4, "fields": { - "path": "00010003", - "depth": 2, - "numchild": 0, - "name": "Group protected" + "path": "00010003", + "depth": 2, + "numchild": 0, + "name": "Group protected" } -}, -{ - "pk": "advert/01", - "model": "tests.advertwithcustomprimarykey", - "fields": { + }, + { + "pk": "advert/01", + "model": "tests.advertwithcustomprimarykey", + "fields": { "text": "test_advert", "url": "http://www.example.com" - } -}, -{ - "pk": "2dbe9aa7-1f4a-428a-8cca-b929ee5bff5b", - "model": "tests.advertwithcustomuuidprimarykey", - "fields": { + } + }, + { + "pk": "2dbe9aa7-1f4a-428a-8cca-b929ee5bff5b", + "model": "tests.advertwithcustomuuidprimarykey", + "fields": { "text": "test_advert", "url": "http://www.example.com" - } -} + } + } ] diff --git a/wagtail/tests/testapp/fixtures/test_explorable_pages.json b/wagtail/tests/testapp/fixtures/test_explorable_pages.json index 0f1df85a63..1c65395b2d 100644 --- a/wagtail/tests/testapp/fixtures/test_explorable_pages.json +++ b/wagtail/tests/testapp/fixtures/test_explorable_pages.json @@ -1,410 +1,404 @@ [ -{ + { "pk": 1, "model": "wagtailcore.page", "fields": { - "title": "Root", - "draft_title": "Root", - "numchild": 1, - "show_in_menus": false, - "live": true, - "depth": 1, - "content_type": ["wagtailcore", "page"], - "path": "0001", - "url_path": "/", - "slug": "root" + "title": "Root", + "draft_title": "Root", + "numchild": 1, + "show_in_menus": false, + "live": true, + "depth": 1, + "content_type": ["wagtailcore", "page"], + "path": "0001", + "url_path": "/", + "slug": "root" } -}, + }, -{ + { "pk": 2, "model": "wagtailcore.page", "fields": { - "title": "Welcome to testserver!", - "draft_title": "Welcome to testserver!", - "numchild": 1, - "show_in_menus": false, - "live": true, - "depth": 2, - "content_type": ["tests", "eventpage"], - "path": "00010001", - "url_path": "/home/", - "slug": "home" + "title": "Welcome to testserver!", + "draft_title": "Welcome to testserver!", + "numchild": 1, + "show_in_menus": false, + "live": true, + "depth": 2, + "content_type": ["tests", "eventpage"], + "path": "00010001", + "url_path": "/home/", + "slug": "home" } -}, -{ + }, + { "pk": 2, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Welcome!

    ", - "cost": "Free" + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Welcome!

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 3, "model": "wagtailcore.page", "fields": { - "title": "About us", - "draft_title": "About us", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "eventpage"], - "path": "000100010001", - "url_path": "/home/about-us/", - "slug": "about-us" + "title": "About us", + "draft_title": "About us", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "eventpage"], + "path": "000100010001", + "url_path": "/home/about-us/", + "slug": "about-us" } -}, -{ + }, + { "pk": 3, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Welcome!

    ", - "cost": "Free" + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Welcome!

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 4, "model": "wagtailcore.page", "fields": { - "title": "Welcome to example.com!", - "draft_title": "Welcome to example.com!", - "numchild": 1, - "show_in_menus": false, - "live": true, - "depth": 2, - "content_type": ["tests", "eventpage"], - "path": "00010002", - "url_path": "/example-home/", - "slug": "example-home" + "title": "Welcome to example.com!", + "draft_title": "Welcome to example.com!", + "numchild": 1, + "show_in_menus": false, + "live": true, + "depth": 2, + "content_type": ["tests", "eventpage"], + "path": "00010002", + "url_path": "/example-home/", + "slug": "example-home" } -}, -{ + }, + { "pk": 4, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Welcome!

    ", - "cost": "Free" + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Welcome!

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 5, "model": "wagtailcore.page", "fields": { - "title": "Content", - "draft_title": "Content", - "numchild": 2, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "eventpage"], - "path": "000100020001", - "url_path": "/example-home/content/", - "slug": "content", - "owner": 1 + "title": "Content", + "draft_title": "Content", + "numchild": 2, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "eventpage"], + "path": "000100020001", + "url_path": "/example-home/content/", + "slug": "content", + "owner": 1 } -}, -{ + }, + { "pk": 5, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Welcome!

    ", - "cost": "Free" + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Welcome!

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 6, "model": "wagtailcore.page", "fields": { - "title": "Page 1", - "draft_title": "Page 1", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000200010001", - "url_path": "/example-home/content/page-1/", - "slug": "page-1", - "owner": 1 + "title": "Page 1", + "draft_title": "Page 1", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000200010001", + "url_path": "/example-home/content/page-1/", + "slug": "page-1", + "owner": 1 } -}, -{ + }, + { "pk": 6, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Welcome!

    ", - "cost": "Free" + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Welcome!

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 7, "model": "wagtailcore.page", "fields": { - "title": "Page 2", - "draft_title": "Page 2", - "numchild": 1, - "show_in_menus": true, - "live": true, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000200010002", - "url_path": "/example-home/content/page-2/", - "slug": "page-2", - "owner": 1 + "title": "Page 2", + "draft_title": "Page 2", + "numchild": 1, + "show_in_menus": true, + "live": true, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000200010002", + "url_path": "/example-home/content/page-2/", + "slug": "page-2", + "owner": 1 } -}, -{ + }, + { "pk": 7, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Welcome!

    ", - "cost": "Free" + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Welcome!

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 8, "model": "wagtailcore.page", "fields": { - "title": "Other Content", - "draft_title": "Other Content", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "eventpage"], - "path": "000100020002", - "url_path": "/example-home/other-content/", - "slug": "other-content", - "owner": 1 + "title": "Other Content", + "draft_title": "Other Content", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "eventpage"], + "path": "000100020002", + "url_path": "/example-home/other-content/", + "slug": "other-content", + "owner": 1 } -}, -{ + }, + { "pk": 8, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Welcome!

    ", - "cost": "Free" + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Welcome!

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 9, "model": "wagtailcore.page", "fields": { - "title": "Child 1 of Page 2", - "draft_title": "Child 1 of Page 2", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 5, - "content_type": ["tests", "eventpage"], - "path": "00010002000100020001", - "url_path": "/example-home/content/page-2/child-1/", - "slug": "child-1", - "owner": 1 + "title": "Child 1 of Page 2", + "draft_title": "Child 1 of Page 2", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 5, + "content_type": ["tests", "eventpage"], + "path": "00010002000100020001", + "url_path": "/example-home/content/page-2/child-1/", + "slug": "child-1", + "owner": 1 } -}, -{ + }, + { "pk": 9, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Welcome!

    ", - "cost": "Free" + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Welcome!

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 10, "model": "wagtailcore.page", "fields": { - "title": "Welcome to example2.com!", - "draft_title": "Welcome to example2.com!", - "numchild": 0, - "show_in_menus": false, - "live": true, - "depth": 2, - "content_type": ["tests", "eventpage"], - "path": "00010003", - "url_path": "/home-2/", - "slug": "home-2" + "title": "Welcome to example2.com!", + "draft_title": "Welcome to example2.com!", + "numchild": 0, + "show_in_menus": false, + "live": true, + "depth": 2, + "content_type": ["tests", "eventpage"], + "path": "00010003", + "url_path": "/home-2/", + "slug": "home-2" } -}, -{ + }, + { "pk": 10, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "private", - "location": "The North Pole", - "body": "

    Welcome!

    ", - "cost": "Free" + "date_from": "2014-12-25", + "audience": "private", + "location": "The North Pole", + "body": "

    Welcome!

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 1, "model": "wagtailcore.site", "fields": { - "root_page": 2, - "hostname": "testserver", - "port": 80, - "is_default_site": true + "root_page": 2, + "hostname": "testserver", + "port": 80, + "is_default_site": true } -}, -{ + }, + { "pk": 2, "model": "wagtailcore.site", "fields": { - "root_page": 4, - "hostname": "example.com", - "port": 80, - "is_default_site": false + "root_page": 4, + "hostname": "example.com", + "port": 80, + "is_default_site": false } -}, -{ + }, + { "pk": 3, "model": "wagtailcore.site", "fields": { - "root_page": 10, - "hostname": "example2.com", - "port": 80, - "is_default_site": false + "root_page": 10, + "hostname": "example2.com", + "port": 80, + "is_default_site": false } -}, + }, -{ + { "pk": 3, "model": "auth.group", "fields": { - "name": "Group 1", - "permissions": [ - ["access_admin", "wagtailadmin", "admin"] - ] + "name": "Group 1", + "permissions": [["access_admin", "wagtailadmin", "admin"]] } -}, -{ + }, + { "pk": 4, "model": "auth.group", "fields": { - "name": "Group 2", - "permissions": [ - ["access_admin", "wagtailadmin", "admin"] - ] + "name": "Group 2", + "permissions": [["access_admin", "wagtailadmin", "admin"]] } -}, -{ + }, + { "pk": 5, "model": "auth.group", "fields": { - "name": "Group 3", - "permissions": [ - ["access_admin", "wagtailadmin", "admin"] - ] + "name": "Group 3", + "permissions": [["access_admin", "wagtailadmin", "admin"]] } -}, + }, -{ + { "pk": 1, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Group 1"], - "page": 2, - "permission_type": "add" + "group": ["Group 1"], + "page": 2, + "permission_type": "add" } -}, -{ + }, + { "pk": 2, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Group 1"], - "page": 2, - "permission_type": "edit" + "group": ["Group 1"], + "page": 2, + "permission_type": "edit" } -}, -{ + }, + { "pk": 3, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Group 1"], - "page": 2, - "permission_type": "publish" + "group": ["Group 1"], + "page": 2, + "permission_type": "publish" } -}, -{ + }, + { "pk": 3, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Group 1"], - "page": 2, - "permission_type": "choose" + "group": ["Group 1"], + "page": 2, + "permission_type": "choose" } -}, -{ + }, + { "pk": 5, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Group 2"], - "page": 6, - "permission_type": "edit" + "group": ["Group 2"], + "page": 6, + "permission_type": "edit" } -}, -{ + }, + { "pk": 6, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Group 2"], - "page": 6, - "permission_type": "choose" + "group": ["Group 2"], + "page": 6, + "permission_type": "choose" } -}, -{ + }, + { "pk": 7, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Group 3"], - "page": 8, - "permission_type": "edit" + "group": ["Group 3"], + "page": 8, + "permission_type": "edit" } -}, -{ + }, + { "pk": 8, "model": "wagtailcore.grouppagepermission", "fields": { - "group": ["Group 3"], - "page": 8, - "permission_type": "choose" + "group": ["Group 3"], + "page": 8, + "permission_type": "choose" } -} + } ] diff --git a/wagtail/tests/testapp/fixtures/test_specific.json b/wagtail/tests/testapp/fixtures/test_specific.json index d903beb71f..73d1a4c3c1 100644 --- a/wagtail/tests/testapp/fixtures/test_specific.json +++ b/wagtail/tests/testapp/fixtures/test_specific.json @@ -1,246 +1,246 @@ [ -{ + { "pk": 1, "model": "wagtailcore.page", "fields": { - "title": "Root", - "draft_title": "Root", - "numchild": 1, - "show_in_menus": false, - "live": true, - "depth": 1, - "content_type": ["wagtailcore", "page"], - "path": "0001", - "url_path": "/", - "slug": "root" + "title": "Root", + "draft_title": "Root", + "numchild": 1, + "show_in_menus": false, + "live": true, + "depth": 1, + "content_type": ["wagtailcore", "page"], + "path": "0001", + "url_path": "/", + "slug": "root" } -}, + }, -{ + { "pk": 2, "model": "wagtailcore.page", "fields": { - "title": "Welcome to the Wagtail test site!", - "draft_title": "Welcome to the Wagtail test site!", - "numchild": 5, - "show_in_menus": false, - "live": true, - "depth": 2, - "content_type": ["wagtailcore", "page"], - "path": "00010001", - "url_path": "/home/", - "slug": "home" + "title": "Welcome to the Wagtail test site!", + "draft_title": "Welcome to the Wagtail test site!", + "numchild": 5, + "show_in_menus": false, + "live": true, + "depth": 2, + "content_type": ["wagtailcore", "page"], + "path": "00010001", + "url_path": "/home/", + "slug": "home" } -}, + }, -{ + { "pk": 3, "model": "wagtailcore.page", "fields": { - "title": "Events", - "draft_title": "Events", - "numchild": 4, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "eventindex"], - "path": "000100010001", - "url_path": "/home/events/", - "slug": "events" + "title": "Events", + "draft_title": "Events", + "numchild": 4, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "eventindex"], + "path": "000100010001", + "url_path": "/home/events/", + "slug": "events" } -}, -{ + }, + { "pk": 3, "model": "tests.eventindex", "fields": { - "intro": "Look at our lovely events." + "intro": "Look at our lovely events." } -}, + }, -{ + { "pk": 4, "model": "wagtailcore.page", "fields": { - "title": "Christmas", - "draft_title": "Christmas", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000100010001", - "url_path": "/home/events/christmas/", - "slug": "christmas", - "owner": 1 + "title": "Christmas", + "draft_title": "Christmas", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000100010001", + "url_path": "/home/events/christmas/", + "slug": "christmas", + "owner": 1 } -}, -{ + }, + { "pk": 4, "model": "tests.eventpage", "fields": { - "date_from": "2014-12-25", - "audience": "public", - "location": "The North Pole", - "body": "

    Chestnuts roasting on an open fire

    ", - "cost": "Free", - "feed_image": 1 + "date_from": "2014-12-25", + "audience": "public", + "location": "The North Pole", + "body": "

    Chestnuts roasting on an open fire

    ", + "cost": "Free", + "feed_image": 1 } -}, + }, -{ + { "pk": 1, "model": "wagtailimages.image", "fields": { - "title": "A missing image", - "file": "original_images/missing.jpg", - "width": 1000, - "height": 1000, - "created_at": "2014-01-01T12:00:00.000Z" + "title": "A missing image", + "file": "original_images/missing.jpg", + "width": 1000, + "height": 1000, + "created_at": "2014-01-01T12:00:00.000Z" } -}, + }, -{ + { "pk": 5, "model": "wagtailcore.page", "fields": { - "title": "Tentative Unpublished Event", - "draft_title": "Tentative Unpublished Event", - "numchild": 0, - "show_in_menus": true, - "live": false, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000100010002", - "url_path": "/home/events/tentative-unpublished-event/", - "slug": "tentative-unpublished-event", - "owner": 1 + "title": "Tentative Unpublished Event", + "draft_title": "Tentative Unpublished Event", + "numchild": 0, + "show_in_menus": true, + "live": false, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000100010002", + "url_path": "/home/events/tentative-unpublished-event/", + "slug": "tentative-unpublished-event", + "owner": 1 } -}, -{ + }, + { "pk": 5, "model": "tests.eventpage", "fields": { - "date_from": "2015-07-04", - "audience": "public", - "location": "The moon", - "body": "

    I haven't worked out the details yet, but it's going to have cake and ponies

    ", - "cost": "Free" + "date_from": "2015-07-04", + "audience": "public", + "location": "The moon", + "body": "

    I haven't worked out the details yet, but it's going to have cake and ponies

    ", + "cost": "Free" } -}, + }, -{ + { "pk": 6, "model": "wagtailcore.page", "fields": { - "title": "Someone Else's Event", - "draft_title": "Someone Else's Event", - "numchild": 0, - "show_in_menus": true, - "live": false, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000100010003", - "url_path": "/home/events/someone-elses-event/", - "slug": "someone-elses-event", - "owner": 1 + "title": "Someone Else's Event", + "draft_title": "Someone Else's Event", + "numchild": 0, + "show_in_menus": true, + "live": false, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000100010003", + "url_path": "/home/events/someone-elses-event/", + "slug": "someone-elses-event", + "owner": 1 } -}, -{ + }, + { "pk": 6, "model": "tests.eventpage", "fields": { - "date_from": "2015-07-04", - "audience": "private", - "location": "The moon", - "body": "

    your name's not down, you're not coming in

    ", - "cost": "Free (but not for you)" + "date_from": "2015-07-04", + "audience": "private", + "location": "The moon", + "body": "

    your name's not down, you're not coming in

    ", + "cost": "Free (but not for you)" } -}, + }, -{ + { "pk": 7, "model": "wagtailcore.page", "fields": { - "title": "About us", - "draft_title": "About us", - "numchild": 0, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "simplepage"], - "path": "000100010002", - "url_path": "/home/about-us/", - "slug": "about-us" + "title": "About us", + "draft_title": "About us", + "numchild": 0, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "simplepage"], + "path": "000100010002", + "url_path": "/home/about-us/", + "slug": "about-us" } -}, -{ + }, + { "pk": 7, "model": "tests.simplepage", "fields": { - "content": "

    We are really good.

    " + "content": "

    We are really good.

    " } -}, + }, -{ + { "pk": 11, "model": "wagtailcore.page", "fields": { - "title": "Other events", - "draft_title": "Other events", - "numchild": 1, - "show_in_menus": true, - "live": true, - "depth": 3, - "content_type": ["tests", "simplepage"], - "path": "000100010005", - "url_path": "/home/other/", - "slug": "other" + "title": "Other events", + "draft_title": "Other events", + "numchild": 1, + "show_in_menus": true, + "live": true, + "depth": 3, + "content_type": ["tests", "simplepage"], + "path": "000100010005", + "url_path": "/home/other/", + "slug": "other" } -}, -{ + }, + { "pk": 11, "model": "tests.simplepage", "fields": { - "content": "

    Other events

    " + "content": "

    Other events

    " } -}, + }, -{ + { "pk": 12, "model": "wagtailcore.page", "fields": { - "title": "Special event", - "draft_title": "Special event", - "numchild": 0, - "show_in_menus": false, - "live": true, - "depth": 4, - "content_type": ["tests", "eventpage"], - "path": "0001000100050001", - "url_path": "/home/other/special-event/", - "slug": "special-event" + "title": "Special event", + "draft_title": "Special event", + "numchild": 0, + "show_in_menus": false, + "live": true, + "depth": 4, + "content_type": ["tests", "eventpage"], + "path": "0001000100050001", + "url_path": "/home/other/special-event/", + "slug": "special-event" } -}, -{ + }, + { "pk": 12, "model": "tests.eventpage", "fields": { - "date_from": "2015-07-04", - "audience": "public", - "location": "Hobart", - "body": "

    Party time

    ", - "cost": "free" + "date_from": "2015-07-04", + "audience": "public", + "location": "Hobart", + "body": "

    Party time

    ", + "cost": "free" } -}, + }, -{ + { "pk": 1, "model": "wagtailcore.site", "fields": { - "root_page": 2, - "hostname": "localhost", - "port": 80, - "is_default_site": true + "root_page": 2, + "hostname": "localhost", + "port": 80, + "is_default_site": true } -} + } ] diff --git a/wagtail/users/static_src/wagtailusers/js/group-form.js b/wagtail/users/static_src/wagtailusers/js/group-form.js index 5879ba282c..e539a32bec 100644 --- a/wagtail/users/static_src/wagtailusers/js/group-form.js +++ b/wagtail/users/static_src/wagtailusers/js/group-form.js @@ -1,13 +1,13 @@ -$(function() { - buildExpandingFormset('id_page_permissions', { - onInit: function(index) { - var deleteInputId = 'id_page_permissions-' + index + '-DELETE'; - var childId = 'inline_child_page_permissions-' + index; - $('#' + deleteInputId + '-button').on('click', function() { - /* set 'deleted' form field to true */ - $('#' + deleteInputId).val('1'); - $('#' + childId).fadeOut(); - }); - } - }); +$(function () { + buildExpandingFormset('id_page_permissions', { + onInit: function (index) { + var deleteInputId = 'id_page_permissions-' + index + '-DELETE'; + var childId = 'inline_child_page_permissions-' + index; + $('#' + deleteInputId + '-button').on('click', function () { + /* set 'deleted' form field to true */ + $('#' + deleteInputId).val('1'); + $('#' + childId).fadeOut(); + }); + }, + }); }); diff --git a/wagtail/users/static_src/wagtailusers/scss/groups_edit.scss b/wagtail/users/static_src/wagtailusers/scss/groups_edit.scss index f78cc22912..9c5af96697 100644 --- a/wagtail/users/static_src/wagtailusers/scss/groups_edit.scss +++ b/wagtail/users/static_src/wagtailusers/scss/groups_edit.scss @@ -1,34 +1,33 @@ @import '../../../../../client/scss/tools/mixins.general'; .listing { - .field label { - @include visuallyhidden; - } + .field label { + @include visuallyhidden; + } - input, - select, + input, + select, + textarea { + font-size: 1em; + } - textarea { - font-size: 1em; - } + select + span:after { + // stylelint-disable-next-line declaration-no-important + font-size: 2.5em !important; + } - select + span:after { - // stylelint-disable-next-line declaration-no-important - font-size: 2.5em !important; - } + .custom-permissions { + padding-bottom: 0; + } - .custom-permissions { - padding-bottom: 0; - } - - .custom-permissions-item { - font-weight: inherit; - width: 100%; - } + .custom-permissions-item { + font-weight: inherit; + width: 100%; + } } .page-permissions-listing { - .admin_page_chooser .field-content { - width: 100%; // so that 'choose another page' button displays in its entirety - } + .admin_page_chooser .field-content { + width: 100%; // so that 'choose another page' button displays in its entirety + } }