Skip to content

Commit 5151fbf

Browse files
committed
chore: Clean up repository and expand LocalGov Drupal walkthrough
Cleanup: - Remove legacy sample-content directory (replaced by AI generator) - Remove redundant .gitkeep files from directories with content - Add cdk.context.json to .gitignore (account-specific cache) - Update Dockerfile to remove sample-content COPY - Remove import_sample_content() from init-drupal.sh LocalGov Drupal walkthrough: - Add steps 6-8 for Text-to-Speech, cleanup, and evidence collection - Add TTS block configuration to init-drupal.sh - Add optional block config for Listen to Page feature - Add walkthrough screenshots for AWS console and Drupal UI - Update step content and navigation - Rename phase-config.yaml to phaseConfig.yaml Dependency updates: - Update yarn.lock with current dependencies
1 parent c765fca commit 5151fbf

58 files changed

Lines changed: 7681 additions & 11782 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cloudformation/scenarios/localgov-drupal/cdk/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ dist/
99
# CDK output
1010
cdk.out/
1111

12+
# CDK context cache (account-specific, regenerated on deploy)
13+
cdk.context.json
14+
1215
# IDE
1316
.idea/
1417
*.swp

cloudformation/scenarios/localgov-drupal/cdk/cdk.context.json

Lines changed: 0 additions & 73 deletions
This file was deleted.

cloudformation/scenarios/localgov-drupal/cdk/lib/constructs/.gitkeep

Whitespace-only changes.

cloudformation/scenarios/localgov-drupal/docker/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ RUN apk add --no-cache \
104104
# Copy Drupal from builder
105105
COPY --from=builder /var/www/drupal /var/www/drupal
106106

107-
# Copy sample content for initial import
108-
COPY drupal/sample-content /var/www/drupal/sample-content
109-
110107
# Copy Drush from builder (if exists)
111108
RUN if [ -f /var/www/drupal/vendor/bin/drush ]; then \
112109
ln -s /var/www/drupal/vendor/bin/drush /usr/local/bin/drush; \

cloudformation/scenarios/localgov-drupal/docker/config/.gitkeep

Whitespace-only changes.

cloudformation/scenarios/localgov-drupal/docker/scripts/.gitkeep

Whitespace-only changes.

cloudformation/scenarios/localgov-drupal/docker/scripts/init-drupal.sh

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -393,29 +393,6 @@ clear_caches() {
393393
return 0
394394
}
395395

396-
import_sample_content() {
397-
log "Importing sample content..."
398-
update_status "Content" "Importing sample content..." 70
399-
400-
cd "$DRUPAL_ROOT"
401-
402-
# Check if sample content directory and import script exist
403-
if [ -f "$DRUPAL_ROOT/sample-content/import.php" ]; then
404-
log "Running sample content import script..."
405-
local import_output
406-
import_output=$(./vendor/bin/drush scr "$DRUPAL_ROOT/sample-content/import.php" 2>&1) || true
407-
if [ -n "$import_output" ]; then
408-
echo "$import_output" | while IFS= read -r line; do
409-
log " $line"
410-
done
411-
fi
412-
else
413-
log "Sample content import script not found, skipping"
414-
fi
415-
416-
return 0
417-
}
418-
419396
enable_localgov_modules() {
420397
log "Enabling LocalGov modules..."
421398
update_status "Modules" "Enabling LocalGov modules..." 72
@@ -574,6 +551,65 @@ enable_custom_modules() {
574551
return 0
575552
}
576553

554+
configure_tts_block() {
555+
log "Configuring Text-to-Speech block..."
556+
update_status "TTS Block" "Configuring Listen to Page block..." 75
557+
558+
cd "$DRUPAL_ROOT"
559+
560+
# Check if the block already exists
561+
local block_exists
562+
block_exists=$(./vendor/bin/drush config:get block.block.ndx_listen_to_page_scarfolk id 2>/dev/null || echo "")
563+
564+
if [ -z "$block_exists" ]; then
565+
log " TTS block not found, creating..."
566+
567+
# Import the optional config from the module
568+
# This uses drush to create the block with proper settings
569+
./vendor/bin/drush php:eval "
570+
\$block_config = [
571+
'id' => 'ndx_listen_to_page_scarfolk',
572+
'theme' => 'localgov_scarfolk',
573+
'region' => 'content_top',
574+
'weight' => 0,
575+
'plugin' => 'ndx_listen_to_page',
576+
'settings' => [
577+
'id' => 'ndx_listen_to_page',
578+
'label' => 'Listen to this Page',
579+
'provider' => 'ndx_aws_ai',
580+
'label_display' => 'visible',
581+
'default_language' => 'en-GB',
582+
'show_speed_control' => TRUE,
583+
'sticky_position' => TRUE,
584+
],
585+
'visibility' => [
586+
'entity_bundle:node' => [
587+
'id' => 'entity_bundle:node',
588+
'bundles' => [
589+
'localgov_guides_overview' => 'localgov_guides_overview',
590+
'localgov_guides_page' => 'localgov_guides_page',
591+
'localgov_news_article' => 'localgov_news_article',
592+
'localgov_services_landing' => 'localgov_services_landing',
593+
'localgov_services_page' => 'localgov_services_page',
594+
],
595+
'negate' => FALSE,
596+
'context_mapping' => ['node' => '@node.node_route_context:node'],
597+
],
598+
],
599+
];
600+
\$block = \Drupal\block\Entity\Block::create(\$block_config);
601+
\$block->save();
602+
echo 'TTS block created successfully';
603+
" 2>&1 || log " Warning: Could not create TTS block programmatically"
604+
605+
log " TTS block configuration complete"
606+
else
607+
log " TTS block already exists, skipping"
608+
fi
609+
610+
return 0
611+
}
612+
577613
generate_council_content() {
578614
log "Generating AI council content..."
579615
update_status "AI Content" "Generating council content with AI..." 80
@@ -817,9 +853,6 @@ main() {
817853

818854
# Install LocalGov themes (must be done before modules that depend on them)
819855
install_themes
820-
821-
# Sample content import disabled - using AI-generated council content instead
822-
# import_sample_content
823856
else
824857
log "Existing installation detected, skipping install"
825858
update_status "Reconnecting" "Connecting to existing database..." 50
@@ -833,6 +866,9 @@ main() {
833866
# Enable custom NDX modules (Story 1.10) - always run to ensure new modules are enabled
834867
enable_custom_modules
835868

869+
# Configure TTS block (must be after ndx_aws_ai module is enabled)
870+
configure_tts_block
871+
836872
# Generate AI council content (Epic 5) - only on fresh install or when requested
837873
if [ ! -f "$INIT_MARKER" ]; then
838874
generate_council_content

0 commit comments

Comments
 (0)