Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 84 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,110 @@
name: Test LocalGov Drupal Alert Banner
name: Test LocalGov Drupal Theme

on:
push:
branches: [ master ]
branches:
- '1.x'
pull_request:
branches: [ master ]
branches:
- '1.x'

jobs:

build:
name: Install LocalGov Drupal
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- localgov-version: "1.x"
drupal-version: "~8.9"
php-version: "7.4"
- localgov-version: "2.x"
drupal-version: "~9.1"
php-version: "7.4"

steps:

- name: Save git branch and git repo names to env if this is not a pull request
if: github.event_name != 'pull_request'
run: |
echo "GIT_BASE=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_REPO=${GITHUB_REPOSITORY}" >> $GITHUB_ENV

- name: Save git branch and git repo names to env if this is a pull request
if: github.event_name == 'pull_request'
run: |
echo "GIT_BASE=${GITHUB_BASE_REF}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV

- name: Set composer branch reference for version branches
if: endsWith(github.ref, '.x')
run: echo "COMPOSER_REF=${GIT_BRANCH}-dev" >> $GITHUB_ENV

- name: Set composer branch reference for non-version branches
if: endsWith(github.ref, '.x') == false
run: echo "COMPOSER_REF=dev-${GIT_BRANCH}" >> $GITHUB_ENV

- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: ${{ runner.os }}-localgov-build-${{ github.run_id }}
key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: ${{ matrix.php-version }}

- name: Clone drupal_container
uses: actions/checkout@v2
with:
repository: localgovdrupal/drupal-container
ref: master
ref: php${{ matrix.php-version }}

- name: Create LocalGov Drupal project
run: composer create-project --stability dev localgovdrupal/localgov-project ./html

- name: Save git branch and git repo names to env if this is not a pull request
if: github.event_name != 'pull_request'
run: |
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_REPO=${GITHUB_REPOSITORY}" >> $GITHUB_ENV

- name: Save git branch and git repo names to env if this is a pull request
if: github.event_name == 'pull_request'
run: |
echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV
composer create-project --stability dev --no-install localgovdrupal/localgov-project ./html "${{ matrix.localgov-version }}"
composer require --no-install drupal/core-recommended:${{ matrix.drupal-version }} drupal/core-composer-scaffold:${{ matrix.drupal-version }} drupal/core-project-message:${{ matrix.drupal-version }} drupal/core-dev:${{ matrix.drupal-version }}
composer install

- name: Setup package source and authentication for the test target
run: |
composer --working-dir=html config repositories.1 vcs git@github.com:${GIT_REPO}.git
composer global config github-oauth.github.com ${{ github.token }}

- name: Obtain the test target from the repo that triggered this workflow
run: composer --working-dir=html require --with-all-dependencies localgovdrupal/${{ github.event.repository.name }}:"dev-${GIT_BRANCH} as 1.0.x-dev"
run: composer --working-dir=html require --with-all-dependencies localgovdrupal/${{ github.event.repository.name }}:"${COMPOSER_REF} as ${GIT_BASE%'.x'}"

phpcs:
name: Coding standards checks
needs: build
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- localgov-version: "1.x"
drupal-version: "~8.9"
php-version: "7.4"
- localgov-version: "2.x"
drupal-version: "~9.1"
php-version: "7.4"

steps:

- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: ${{ runner.os }}-localgov-build-${{ github.run_id }}
key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }}
restore-keys: |
${{ runner.os }}-localgov-build-
localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -84,15 +121,26 @@ jobs:
needs: build
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- localgov-version: "1.x"
drupal-version: "~8.9"
php-version: "7.4"
- localgov-version: "2.x"
drupal-version: "~9.1"
php-version: "7.4"

steps:

- name: Cached workspace
uses: actions/cache@v2
with:
path: ./html
key: ${{ runner.os }}-localgov-build-${{ github.run_id }}
key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }}
restore-keys: |
${{ runner.os }}-localgov-build-
localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -109,6 +157,17 @@ jobs:
needs: build
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- localgov-version: "1.x"
drupal-version: "~8.9"
php-version: "7.4"
- localgov-version: "2.x"
drupal-version: "~9.1"
php-version: "7.4"

steps:

- name: Clone drupal_container
Expand All @@ -121,9 +180,9 @@ jobs:
uses: actions/cache@v2
with:
path: ./html
key: ${{ runner.os }}-localgov-build-${{ github.run_id }}
key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }}
restore-keys: |
${{ runner.os }}-localgov-build-
localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-

- name: Start Docker environment
run: docker-compose -f docker-compose.yml up -d
Expand Down
2 changes: 1 addition & 1 deletion assets/css/lib/main.css

Large diffs are not rendered by default.

125 changes: 125 additions & 0 deletions assets/scss/lib/partials/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,128 @@
display: none;
}
}

// Sitewide search page.
.view-localgov-sitewide-search {

// Search page form.
.views-exposed-form {
max-width: 48em;
padding: 1em 2em 2em 2em;

.form-actions {
padding-left: 0;
}

@include media-breakpoint-up(md) {
.form-text {
float: left;
width: 80%;
height: 3em;
margin: 0;
padding: 0.5em 1em;
}

.form-actions {
clear: none;
float: right;
height: 3em;
width: 20%;
margin: 0;

.button {
margin-top: 0 !important;
padding-top: 0.45em;
padding-bottom: 0.4em;

&:after {
top: 0.5em;
}
}
}
}
}

// Search results.
.search-results {
padding: 0;
list-style-type: none;
}

.search-result {
margin-top: 0;
margin-bottom: 1em;
}

.search-result__title {
margin-top: 1em;
}
}

// Sitewide search block.
.block-localgov-sitewide-search-block {
position: relative;
background: none;

label {
display: none;
}

button {
background: $gray-bs;
}

.form-text {
height: 3em;
margin: 0;
padding: 0.5em 1em;
}

.form-actions {
margin-top: 0.5em;
padding-left: 0;
}

.button {
height: 2.3em;
margin-top: -0.03em !important;
padding-top: 0.3em;

&:after {
top: 0.3em;
}
}

@include media-breakpoint-up(md) {
.form-text {
float: left;
width: 80%;
}

.form-actions {
clear: none;
float: right;
width: 20%;
margin-top: 0;
}
}

@include media-breakpoint-up(lg) {
width: 21em;

.form-text {
width: 80%;
}

.form-actions {
width: 20%;
}

button {
span:nth-child(2) {
display: none;
}
}
}
}

26 changes: 26 additions & 0 deletions localgov_theme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,29 @@ function localgov_theme_preprocess_paragraph(&$variables) {
}
}
}

/**
* Implements hook_preprocess_file_link().
*
* Changes:
* - Inserts file *type* and size into the theme variable.
* - Reformats file size. Example: 123.4KB.
* - Appends file metadata to the file link text.
*
* @see template_preprocess_file_link()
*/
function localgov_theme_preprocess_file_link(&$variables) {

$file = $variables['file'];
$filename = $file->getFilename();
$file_extension = pathinfo($filename, PATHINFO_EXTENSION);

$variables['file_type'] = strtoupper($file_extension);

// 123.45 KB -> 123.45KB
$variables['file_size'] = strtr($variables['file_size'], [' ' => '']);

$variables['link']['#title'] = [
'#markup' => "{$variables['link']['#title']} <span class=\"file-meta\">(<span class=\"file-type\">{$variables['file_type']}</span>, <span class=\"file-size\">{$variables['file_size']}</span>)</span>",
];
}
Loading