Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #2

Closed
wants to merge 65 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
854f4e8
fix (YALB-1579): fixing theme form errors
nJim Oct 5, 2023
7dc480b
fix (YALB-1577): fix time format on condenced events
nJim Oct 5, 2023
0877512
chore: add default values for theme settings
nJim Oct 5, 2023
449677a
feat(YALB-1563): WIP Header settings form
codechefmarc Oct 6, 2023
3db4f94
refactor(YALB-1563): Refactor to allow styles and JS to be used on bo…
codechefmarc Oct 7, 2023
78686c9
fix (YALB-863): set default callbacks for all dials
nJim Oct 7, 2023
77838ce
chore(YALB-1565): set ga cookie_domain to subdomain scope (#451)
vinmassaro Oct 10, 2023
0d0b2f2
feat(YALB-1674): Add more items to the header settings form and start…
codechefmarc Oct 12, 2023
f77f97b
feat(YALB-1574): WIP start validation code for SVG
codechefmarc Oct 12, 2023
61eaded
feat(YALB-1574): Refactor some existing classes to use in header sett…
codechefmarc Oct 13, 2023
f3155b9
YALB-1443: Bug: Disable links in quicklink content field (#431)
dblanken-yale Oct 17, 2023
462d36b
Merge branch 'develop' into YALB-1579-errors
dblanken-yale Oct 18, 2023
75fa6d4
Merge branch 'develop' into YALB-1577-event-date-bug
dblanken-yale Oct 18, 2023
aa0b7e3
Merge branch 'develop' into YALB-863-defaults
dblanken-yale Oct 18, 2023
9fd2692
Merge pull request #458 from yalesites-org/YALB-863-defaults
nJim Oct 18, 2023
3e5eedc
Merge pull request #453 from yalesites-org/YALB-1577-event-date-bug
nJim Oct 18, 2023
d27f2ea
Merge pull request #452 from yalesites-org/YALB-1579-errors
nJim Oct 18, 2023
9727383
feat(YALB-1242): allow localdev to use pantheon secrets
vinmassaro Oct 19, 2023
77670d3
docs(YALB-1204): updating all custom module readme files
nJim Oct 19, 2023
5513986
docs(YALB-1155): Add data model best practices do developer Readme file
nJim Oct 19, 2023
d772d58
ci: add YALESITES_BUILD_TOKEN to semantic release action
vinmassaro Oct 20, 2023
cf08000
YALB-1472: Bug: Image generation failures (#423)
dblanken-yale Oct 23, 2023
49e6f97
YALB-1593: Bug: FE: Views pagination not showing on front end (#462)
dblanken-yale Oct 24, 2023
87e7758
Merge branch 'develop' into YALB-1563-simple-header
codechefmarc Oct 26, 2023
d77b471
feat(YALB-1574): WIP add dynamic title tag to uploaded SVG
codechefmarc Oct 27, 2023
f46dd4e
feat(YALB-1574): Move SVG logic into mediaManager
codechefmarc Oct 27, 2023
d29f3df
feat(YALB-1563): Wiring of new header settings and migration of confi…
codechefmarc Oct 28, 2023
8df0bd5
feat(YALB-1574): Wire site name as image and move SVG title to an on-…
codechefmarc Oct 30, 2023
3178f9b
docs(YALB-1574): fix linting and comments
codechefmarc Oct 30, 2023
d1c9ff7
fix(YALB-1574): Fix linting error
codechefmarc Oct 30, 2023
c3bb69c
fix(YALB-1563): Remove unused use statement
codechefmarc Oct 30, 2023
ffe6590
feat(YALB-1574): Update old footer theme setting four to one as four …
codechefmarc Oct 31, 2023
bfaa364
YALB-1387: WYSIWYG: Clarity on maxlength (#474)
dblanken-yale Nov 14, 2023
07e8343
fix(YALB-1593): add new image sizes and responsive image styles for 1…
joetower Nov 14, 2023
76e0b62
Update develop from master (#482)
vinmassaro Nov 17, 2023
b49afee
Merge branch 'develop' into YALB-1563-simple-header
nJim Nov 17, 2023
bdb0fdf
feat(YALB-656): enable email matcher in default linkit profile (#485)
hectorlj Nov 17, 2023
b9e28e9
fix(YALB-1578): use full pager on search page
joetower Nov 17, 2023
4a0c90a
feat(YALB-1537): install and enable multiple_fields_remove_button mod…
hectorlj Nov 18, 2023
5193ce7
fix (YALB-1584): update dashboard content (#488)
nJim Nov 20, 2023
c7e9906
feat(YALB-1574): Update alt text for header settings icons
codechefmarc Nov 21, 2023
22b1ddb
fix(YALB-1574): Fix linkit new id key
codechefmarc Nov 21, 2023
5a3e09c
Merge pull request #469 from yalesites-org/YALB-1563-simple-header
codechefmarc Nov 21, 2023
6b344c5
YALB-1574: Branding: Header Variation Backend Front Page Alias Fix (#…
dblanken-yale Nov 22, 2023
26df4b3
feat(YALB-578): enable the linkit phone matcher (#489)
hectorlj Nov 27, 2023
bbe04f5
feat (YALB-1573): allow admins to manage affiliation terms (#487)
nJim Nov 27, 2023
7ca4bb9
fix(YALB-1648): check if $footerLogoMedia exists and is not null (#494)
vinmassaro Nov 28, 2023
654a0b0
feat(YALB-1654): Temporarily hide the blocks overview page from site …
codechefmarc Nov 30, 2023
d52c33a
fix(YALB-1602): paragraph references cloned (#496)
dblanken-yale Nov 30, 2023
4c7a488
Merge branch 'develop' into YALB-1654--block-library
codechefmarc Nov 30, 2023
606fa5e
Merge pull request #498 from yalesites-org/YALB-1654--block-library
codechefmarc Dec 5, 2023
c139403
YALB-1586: Add Dependabot to project repo (#461)
vinmassaro Dec 7, 2023
d758e34
fix(YALB-1564): Add permission back in to allow custom block library …
codechefmarc Dec 11, 2023
78b6a1a
fix(YALB-1654): Fix linting error
codechefmarc Dec 11, 2023
3ab576e
fix: yalb-1629 fix for node access error
laura-johnson Dec 12, 2023
5eb8473
Merge branch 'develop' into YALB-1629-bug-node-access-error
laura-johnson Dec 13, 2023
b70c936
Merge pull request #505 from yalesites-org/YALB-1654--bug-fix
codechefmarc Dec 14, 2023
197a707
Merge pull request #507 from yalesites-org/YALB-1629-bug-node-access-…
laura-johnson Dec 15, 2023
1264671
fix(YALB: 1429): wysiwyg growing indefinitely (#509)
laura-johnson Dec 21, 2023
4c395f6
feat(YALB-1306): add variation to emphasized text component (#508)
joetower Dec 21, 2023
070784f
feat(YALB-1402): update media library to use image by default (#504)
hectorlj Dec 21, 2023
55397e4
fix(YALB-1660): Quality of profile page media image in responsive des…
joetower Dec 21, 2023
4bb5957
fix(YALB-1644): Dial: Center-align callout with content-width content…
joetower Dec 21, 2023
29b939e
resolve conflicts
vinmassaro Dec 21, 2023
6016572
Merge pull request #1 from vinmassaro/merge-master-into-develop
vinmassaro Dec 21, 2023
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
35 changes: 35 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 2
updates:
# Update root composer.json and drupal/core only.
- package-ecosystem: "composer"
open-pull-requests-limit: 5
target-branch: "develop"
schedule:
interval: "monthly"
directory: "/"
versioning-strategy: increase
commit-message:
prefix: "chore"
include: "scope"
allow:
- dependency-name: "drupal/core-*"
groups:
drupal-core:
patterns:
- "drupal/core-*"

# Update yalesites_profile composer.json.
- package-ecosystem: "composer"
open-pull-requests-limit: 5
target-branch: "develop"
schedule:
interval: "monthly"
directory: "/web/profiles/custom/yalesites_profile"
versioning-strategy: increase
commit-message:
prefix: "chore"
include: "scope"
groups:
yalesites-profile:
patterns:
- "*"
6 changes: 6 additions & 0 deletions .github/workflows/build_deploy_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ jobs:
if [ -n "$contrib_check" ]; then
echo "::error::$contrib_check found in /composer.json and should be moved to /web/profiles/custom/yalesites_profile/composer.json" && exit 1
fi
- name: Check for unpinned dependencies
run: |
unpinned_dependencies=$(jq -r '.require | to_entries | map(select(.value | test("\\^|\\~|\\>|\\<")) | "\(.key): \(.value)") | join(", ")' ./web/profiles/custom/yalesites_profile/composer.json)
if [ -n "$unpinned_dependencies" ]; then
echo "::error::$unpinned_dependencies found in /web/profiles/custom/yalesites_profile/composer.json. Please switch to pinned versions." && exit 1
fi

- name: run static tests
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches: master
env:
GH_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }}
YALESITES_BUILD_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -15,8 +16,6 @@ jobs:
uses: actions/setup-node@v3

- name: Install
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: npm install

- name: Release
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# Ignore SimpleTest multi-site environment.
/web/sites/simpletest


# Ignore custom modules managed by Composer.
#
# When a development team creates one or more custom modules that
Expand Down Expand Up @@ -130,3 +129,6 @@ web/profiles/custom/yalesites_profile/vendor/
/atomic
/component-library-twig
/tokens

# Secrets for local use
secrets.json
1 change: 1 addition & 0 deletions .lando.local.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ services:
overrides:
environment:
COMPOSER_PROCESS_TIMEOUT: 1800
CUSTOMER_SECRETS_FAKE_FILE: /app/secrets.json
# This is needed to expose the reverse proxy to the xdebug port (9003)
xdebug: true
22 changes: 22 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,25 @@ lando drush migrate-rollback --group ys_starterkit
# Update partial configuration if altering the migration configuration.
lando drush cim --partial --source=/app/web/profiles/custom/yalesites_profile/modules/custom/ys_starterkit/config/install -y
```

## Data model best practices

A well-structured data model ensures efficiency, maintainability, and scalability within the YaleSites platform. Below are some guiding principles adopted by the platform maintainers:

- **Documentation Maintenance**: Keep the data model documentation up to date. This Teams document includes entity definitions, text formats, display mode definitions, and other content settings. Whenever there's a change to a content type, block, paragraph, taxonomy, or any other entity, make it a priority to update this central documentation source. Maintaining accurate documentation is crucial for team collaboration and project continuity.
- **Normalize Data**: Follow established principles of database normalization to minimize data redundancy and enhance data integrity. Leverage reference fields and relationships to establish connections between related content instead of duplicating data. This approach ensures that the data remains consistent and predictable.
- **Reuse Fields**: Reduce the proliferation of field definitions by reusing fields across multiple content bundles, as long as they serve a similar business purpose. For instance, if several content types (e.g., pull quote, video description, banner intro) require a 'field_text' storage, consider reusing this field definition to maintain consistency and simplify content management.
- **Avoid Single-Purpose Fields or Entities**: When adding fields or entities, strive to make them versatile enough to fulfill multiple purposes across YaleSites. For example, while a dedicated 'Speaker' field might seem useful for an event content type, evaluate whether this feature could be addressed using a content-spotlight block. Add new fields only when they contribute to sorting, filtering, or theming content in specific ways.
- **Build with Blocks**: Embrace the power of the layout builder by utilizing blocks to define new components. YaleSites relies on blocks for editorial controls and mapping content to the component library. This includes both custom blocks (content entities) and programmatically defined blocks (plugins).
- **Use Paragraphs for Nested Content**: Paragraphs remain a valuable tool, particularly when dealing with components that contain an indeterminate number of children, such as accordion items, tab items, or gallery items. The Paragraphs module provides intuitive widgets that offer an effective editorial interface for managing reference content within these complex components.

## Adding a 'dial' for theming a component

This project features custom fields for block theming. For example, the divider block includes settings for position, width, and animation style. In contrast to traditional Drupal projects using predefined list-field options in the configuration file, we've chosen a distinct approach. Our approach prioritizes the ability to add, remove, and dynamically adjust these options in future YaleSites themes and platform iterations, ensuring enduring flexibility. This system accommodates unique values for each field instance and supports changes over time, avoiding database integrity concerns. To add a dial:

1. Begin by adding the desired style field to the custom block using the standard field UI. Whenever feasible, utilize an existing field like field_style_position, field_style_width, or field_style_variation.
2. Configure the display of this field using the Field UI. Ensure that the style field is presented without a label and employs the 'key' formatter.
3. Export the site configuration to generate all the associated field YAML files.
4. In the event that this is a newly created field, update the field storage configuration file. Specify the callback function for values using `allowed_values_function: ys_themes_allowed_values_function`.
5. Proceed to update the key-value pairs within `ys_themes.component_overrides.yml`. Remember to make these updates in two locations: the config/sync directory and the module/install directory.
6. With these adjustments in place, you can now connect these values to components within the theme templates, achieving the desired styling and functionality.
10 changes: 1 addition & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"files": [
"web/profiles/custom/yalesites_profile/yalesites_profile.info.yml"
],
"from": "version: .*",
"from": "#version:",
"to": "version: ${nextRelease.version}",
"results": [
{
Expand All @@ -76,14 +76,6 @@
]
}
],
[
"@semantic-release/git",
{
"assets": [
"web/profiles/custom/yalesites_profile/yalesites_profile.info.yml"
]
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
Expand Down
49 changes: 49 additions & 0 deletions scripts/local/images/calculateMB.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

# This script is used to check the possible memory
# allocation ImageMagick would need to convert a base image
# into our currently largest resolution of a file.
#
# Usage: ./calculateMB.sh <image>
# - image: The image to check the memory usage for
#
# Example: ./calculateMB.sh ~/Pictures/IMG_0001.JPG
# - This will return the memory usage for IMG_0001.JPG in megabytes

getMB() {
local resolution
resolution=$(getResolutionFromImage "$1")
calculateMemoryUsage "$(retrieveWidth "$resolution")" "$(retrieveHeight "$resolution")"
}

getResolutionFromImage() {
local image="$1"
local resolution

# Use double quotes around "$image" to handle spaces in the filename
resolution=$(identify -format "%wx%h" "$image")

echo "$resolution"
}

retrieveWidth() {
echo "${1%x*}"
}

retrieveHeight() {
echo "${1#*x}"
}

calculateMemoryUsage() {
local bitsPerPixel=3
local tweakFactor=1.8
local width="$1"
local height="$2"

local largestWidth=2400
local largestHeight=1600

echo "($largestWidth * $largestHeight * $bitsPerPixel + $width * $height * $bitsPerPixel) * $tweakFactor / 1024 / 1024" | bc
}

getMB "$1"
11 changes: 11 additions & 0 deletions scripts/local/images/doItAll.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

# Check arguments
if [[ $# -ne 3 ]]; then
echo "Usage: ./doItAll.sh <sftpServer> <localDirectoryToSaveFiles> <remoteImageLocation>"
exit 1
fi

./get_images.sh "$1" "$2" &&
./convert_images.sh "$2" 3840 2160 &&
./put_images.sh "$1" "$3" "$2"
120 changes: 120 additions & 0 deletions scripts/local/images/fix_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/usr/bin/env bash

# This script will attempt to convert any images that are greater than the
# desired width and height into the desired width and height.
#
# Requirements:
# - ImageMagick
# - bc
#
# Usage: ./fix_images.sh <path_to_where_images_are> <desired_max_width> <desired_max_height>
# - path_to_where_images_are: The path to where the images are
# - desired_max_width: The desired maximum width of the images
# - desired_max_height: The desired maximum height of the images
#
# Example: ./fix_images.sh ~/Pictures 3840 2160
# - This will convert any images in ~/Pictures that are greater than 3840x2160
# to 3840x2160 or close to it.
# - This will also print out the memory usage for each image (before and after)
# - This will also print out the command that will be used to convert the image
# (in case you want to copy and paste it to run it yourself)

getImages() {
local dirsToExclude=("library-definitions" "media-icons" "private" "styles" "js" "oembed_thumbnails" "paragraphs_type_icon" "css")
local dirToLook="$1"

# Get rid of excluded directories--will make find easier
for dir in "${dirsToExclude[@]}"; do
rm -rf "$dirToLook/$dir"
done

find "$dirToLook" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.JPEG" -o -name "*.JPG" \)
}

convertImages() {
local desiredWidth=$2
local desiredHeight=$3
local height
local width
local resolution
local directory="$1"

local red='\033[0;31m'
local green='\033[0;32m'
local yellow='\033[0;33m'
local noColor='\033[0m'

# Use an array to store file paths and prevent splitting
local files=()
IFS=$'\n' # Set the Internal Field Separator to newline

# Use the getImages function to populate the array
readarray -t files <<< "$(getImages "$directory")"

for file in "${files[@]}"; do
resolution=$(getResolutionFromImage "$file")
width=$(retrieveWidth "$resolution")
height=$(retrieveHeight "$resolution")

if [[ $height -gt $desiredHeight ]]; then
echo -e "$red [Will Convert] $file has a resolution of $resolution: w: $width, h: $height (Target: $desiredWidth x $desiredHeight, Current memory usage: $(calculateMemoryUsage "$width" "$height") MB) $noColor"
echo convert -resize 3840x2160\> -quality 100 "$file" "$file"
echo -e "$yellow" convert "$file" -resize 3840x2160\> -quality 100 "$file" "$noColor"
convert "$file" -resize 3840x2160\> -quality 100 "$file"

# Retrieve the new resolution, width, and height to recalculate the new memory usage
resolution=$(getResolutionFromImage "$file")
width=$(retrieveWidth "$resolution")
height=$(retrieveHeight "$resolution")
echo -e "$green [Converted] $file has been converted to $(getResolutionFromImage "$file") : Current memory usage: $(calculateMemoryUsage "$width" "$height") MB $noColor"
else
echo -e "$green [Will Not Convert] $file has a resolution of $resolution: w: $width, h: $height, Current memory usage: $(calculateMemoryUsage "$width" "$height") MB) $noColor"
fi
done
}

getResolutionFromImage() {
local image="$1"
local resolution

# Use double quotes around "$image" to handle spaces in the filename
resolution=$(identify -format "%wx%h" "$image")

echo "$resolution"
}

retrieveWidth() {
echo "${1%x*}"
}

retrieveHeight() {
echo "${1#*x}"
}

calculateMemoryUsage() {
local bitsPerPixel=3
local tweakFactor=1.8
local width="$1"
local height="$2"

# This is currently our largest generated image resolution
# Should we ever update this, we will need to update this script
local largestWidth=2400
local largestHeight=1600

echo "($largestWidth * $largestHeight * $bitsPerPixel + $width * $height * $bitsPerPixel) * $tweakFactor / 1024 / 1024" | bc
}

# Ensure that they pass the right parameters
if [ $# -ne 3 ]; then
echo "Usage: ./fix_images.sh <path_to_where_images_are> <desired_max_width> <desired_max_height>"
exit 1
fi

# Ensure directory exists
if [ ! -d "$1" ]; then
echo "Directory $1 does not exist"
exit 2
fi

convertImages "$1" "$2" "$3"
39 changes: 39 additions & 0 deletions scripts/local/images/get_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

# This will attempt to retrieve all files under the /files
# directory on a remote Pantheon server.
#
# The motivation for this script is to convert all images to a smaller format.

getFiles() {
local port=2222

sftp -o Port="$port" "$1" <<EOF
get -R /files/. "$2"
bye
EOF

if [ $? -eq 0 ]; then
echo "Success"echo "Download completed successfully. Files are located at $2"
else
echo "Something went wrong"
fi
}

# Ensure they passed arguments
if [ $# -lt 2 ]; then
echo "Usage: $0 <server> <destination>"
exit 1
fi

# Test if destination exists
if [ ! -d "$2" ]; then
echo "Destination $2 does not exist; attempting to make directory"

if ! mkdir -p "$2"; then
echo "Could not create directory $2"
exit 2
fi
fi

getFiles "$1" "$2"
35 changes: 35 additions & 0 deletions scripts/local/images/put_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

# This will upload images processed to a destination Pantheon server
#
# The motivation for this script is to convert all images to a smaller format.

uploadImages() {
local destinationServer="$1"
local destinationDirectory="$2"
local sourceDirectory="$3"
local port=2222

echo "Uploading images to $destinationServer:$destinationDirectory"
sftp -o Port="$port" "$destinationServer" <<EOF
cd "$destinationDirectory"
put -r "$sourceDirectory"
bye
EOF

echo "Done uploading images"
}

# Argument check
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <destinationServer> <destinationDirectory> <sourceDirectory>"
exit 1
fi

# Directory check
if [ ! -d "$3" ]; then
echo "Source directory $3 does not exist"
exit 2
fi

uploadImages "$1" "$2" "$3"
Loading