Skip to content

Add admin management for landing page content and social links#24

Merged
vgalitsky merged 7 commits into
landing-managefrom
copilot/refactor-landing-page-for-admin
Nov 25, 2025
Merged

Add admin management for landing page content and social links#24
vgalitsky merged 7 commits into
landing-managefrom
copilot/refactor-landing-page-for-admin

Conversation

Copilot AI commented Nov 25, 2025

Copy link
Copy Markdown
Contributor
  • Create backup of home.phtml and home/episodes.phtml as *.phtml.backup files
  • Create database migration for landing_page_content table
  • Create Model for LandingPageContent
  • Create Admin Controller for Landing Page management
  • Create Admin Controller for Landing Page update with image upload
  • Create Admin View for Landing Page form with image field support
  • Update nav.phtml to enable "Landing Page" menu item
  • Update Index.php (home controller) to use database content
  • Update home.phtml to use dynamic content from database
  • Update home/episodes.phtml to use dynamic content from database
  • Update schema.sql with new table definition (including image field type)
  • Extract existing content for migration seed data
  • Fix migration "no active transaction" error - removed transaction for DDL statements
  • Add About section image as uploadable field
  • Create SocialLink model
  • Create Admin Social controller and CRUD actions (Add, Update, Put, Delete)
  • Create Admin Social views (list and form)
  • Update footer to display social links from database
  • Add socialLinks to Index controller
  • Fix count() TypeError - Collection doesn't implement Countable, use isEmpty() method instead
Original prompt

Refactor landing page (home) so it is managable in admin ("Landing Page" menuitem):
Home section:

  • .hero-subtitle is managable (string)
  • .hero-description is editable (rich editor)
    About section:
  • title (string)
  • about text (rich editor)
    Episodes section:
  • title (string)
  • subtitle (rich editor)
    Heroes section:
  • title (string)
  • subtitle (rich editor)
    Channel section:
  • title (string)
  • subtitle (rich editor)

Additionally

  • backup current files as *.phtml.backup
  • create db migration according core functionality
  • get all existing data for migration from existing content

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 25, 2025 11:15
Co-authored-by: vgalitsky <1241206+vgalitsky@users.noreply.github.com>
…methods

Co-authored-by: vgalitsky <1241206+vgalitsky@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor landing page for administration management Add admin management for landing page content Nov 25, 2025
Copilot AI requested a review from vgalitsky November 25, 2025 11:20
@vgalitsky

Copy link
Copy Markdown
Contributor

@copilot

  • no need default values at landing page, take only from db;
  • error while trying to do migration:
    $ />./bin/cli db:migrate
    Checking for pending migrations...
    Found 1 pending migration(s):
    • 1.0.3: migration-1.0.3.sql

Executing migration: 1.0.3
Error: Migration 1.0.3 failed: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''

A New Chapter in the Skibidi Universe

Welcome to Sk...' at line 4 Error: Migration failed: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''

A New Chapter in the Skibidi Universe

Welcome to Sk...' at line 4

Co-authored-by: vgalitsky <1241206+vgalitsky@users.noreply.github.com>

Copilot AI commented Nov 25, 2025

Copy link
Copy Markdown
Contributor Author

@copilot

  • no need default values at landing page, take only from db;
  • error while trying to do migration:
    ...

Fixed in b67944b:

  1. Converted migration from SQL to PHP (migration-1.0.3.php) using prepared statements to properly handle multi-line HTML content
  2. Removed all default fallback values - content now comes exclusively from the database

Co-authored-by: vgalitsky <1241206+vgalitsky@users.noreply.github.com>
@vgalitsky

Copy link
Copy Markdown
Contributor

@copilot 1. getting the error while trying to do migration:
$ />./bin/cli db:migrate
Checking for pending migrations...
Found 1 pending migration(s):
1.0.3: migration-1.0.3.php

Executing migration: 1.0.3
Error: Migration 1.0.3 failed: There is no active transaction
Error: Migration failed: There is no active transaction

  1. Admin : in "About" section image ".about-image" should be uploadable + show uploaded image on front instead static one;
  2. Footer section: add ability to manage Social media links
  3. changes should be reflected in migration where it need

…inks management

Co-authored-by: vgalitsky <1241206+vgalitsky@users.noreply.github.com>

Copilot AI commented Nov 25, 2025

Copy link
Copy Markdown
Contributor Author

@copilot 1. getting the error while trying to do migration:
$ />./bin/cli db:migrate
Checking for pending migrations......

Fixed in 5da94d7:

  1. Migration error: Removed transaction wrapper for DDL (CREATE TABLE) - MySQL/MariaDB doesn't support DDL in transactions
  2. About section image: Added image field type to landing_page_content, with upload support in admin. Image now shows from database on front-end
  3. Footer Social Links: Created SocialLink model and full admin CRUD (Admin > Social Links). Footer now displays enabled social links from social_links table with icon support

Copilot AI changed the title Add admin management for landing page content Add admin management for landing page content and social links Nov 25, 2025
@vgalitsky

Copy link
Copy Markdown
Contributor

@copilot an errors has occured on front and admin (social links):
TypeError: count(): Argument #1 ($value) must be of type Countable|array, App\Core\Model\Collection given in /var/www/fsx/htdocs/views/layout/footer.phtml:26
Stack trace:
#0 /var/www/fsx/htdocs/views/layout/page.phtml(4): include()
#1 /var/www/fsx/htdocs/src/Core/View.php(100): include('...')
#2 /var/www/fsx/htdocs/src/Core/Controller.php(201): App\Core\View->render()
#3 /var/www/fsx/htdocs/src/Controller/Index.php(14): App\Core\Controller->render()
#4 /var/www/fsx/htdocs/src/Core/Router.php(106): App\Controller\Index->handle()
#5 /var/www/fsx/htdocs/src/Core/Controller.php(89): App\Core\Router->{closure:App\Core\Router::dispatchV2():105}()
#6 /var/www/fsx/htdocs/src/Core/Router.php(105): App\Core\Controller->executeWithMiddleware()
#7 /var/www/fsx/htdocs/src/Core/Router.php(35): App\Core\Router->dispatchV2()
#8 /var/www/fsx/htdocs/src/Core/Router.php(24): App\Core\Router->dispatch()
#9 /var/www/fsx/htdocs/src/Core/Middleware/MiddlewarePipeline.php(70): App\Core\Router->handle()
#10 /var/www/fsx/htdocs/src/Core/Middleware/MiddlewarePipeline.php(55): App\Core\Middleware\MiddlewarePipeline->processMiddleware()
#11 /var/www/fsx/htdocs/src/Core/App.php(56): App\Core\Middleware\MiddlewarePipeline->handle()
#12 /var/www/fsx/htdocs/src/Core/App.php(41): App\Core\App->handleRequest()
#13 /var/www/fsx/htdocs/public/index.php(13): App\Core\App->run()
#14 {main}
#0 /var/www/fsx/htdocs/public/index.php(13): App\Core\App->run()
#1 {main}

Co-authored-by: vgalitsky <1241206+vgalitsky@users.noreply.github.com>

Copilot AI commented Nov 25, 2025

Copy link
Copy Markdown
Contributor Author

@copilot an errors has occured on front and admin (social links):
TypeError: count(): Argument #1 ($value) must be of type Countable|array, App\Core\Model\Collection given in /var/www/fsx/htdocs/views...

Fixed in 8d9be16: The Collection class doesn't implement PHP's Countable interface, so count() fails. Changed to use $socialLinks->isEmpty() method instead which is available on the Collection class.

@vgalitsky vgalitsky marked this pull request as ready for review November 25, 2025 12:25
@vgalitsky vgalitsky merged commit cc0d28c into landing-manage Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants