From fbb62816b2c63d0897c22e6766261a069ed1814c Mon Sep 17 00:00:00 2001 From: Andrew Duthie <1779930+aduth@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:32:46 -0500 Subject: [PATCH] Add breadcrumbs to articles (#628) --- Gemfile | 5 +- Gemfile.lock | 73 +++++++++++++++-- _components/breadcrumb_component.html.erb | 5 ++ _components/breadcrumb_component.rb | 1 + .../breadcrumb_item_component.html.erb | 3 + _components/breadcrumb_item_component.rb | 9 ++ _layouts/article.html | 10 +++ _layouts/category.html | 6 ++ _plugins/view_component.rb | 82 +++++++++++++++++++ 9 files changed, 186 insertions(+), 8 deletions(-) create mode 100644 _components/breadcrumb_component.html.erb create mode 100644 _components/breadcrumb_component.rb create mode 100644 _components/breadcrumb_item_component.html.erb create mode 100644 _components/breadcrumb_item_component.rb create mode 100644 _plugins/view_component.rb diff --git a/Gemfile b/Gemfile index 466d12bf..09b5c1c7 100644 --- a/Gemfile +++ b/Gemfile @@ -2,8 +2,12 @@ source "https://rubygems.org" ruby '~> 3.2.2' +gem "actionpack", "~> 8.0.0" +gem "activesupport", "~> 8.0.0" +gem "actionview", "~> 8.0.0" gem "jekyll", "~> 4" gem "kramdown", ">= 2.3.0" +gem "view_component", "~> 3.20.0" group :jekyll_plugins do gem "jekyll-redirect-from" @@ -12,7 +16,6 @@ group :jekyll_plugins do end group :test do - gem 'activesupport', '~> 7.0.7' gem 'html-proofer', '~> 4.4.3' gem 'nokogiri', '~> 1.16.5' gem 'rspec', '~> 3.9.0' diff --git a/Gemfile.lock b/Gemfile.lock index df6dec4c..680a049d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,19 +1,51 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.0.7.1) - concurrent-ruby (~> 1.0, >= 1.0.2) + actionpack (8.0.0) + actionview (= 8.0.0) + activesupport (= 8.0.0) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actionview (8.0.0) + activesupport (= 8.0.0) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activesupport (8.0.0) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.8) + builder (3.3.0) colorator (1.1.0) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + crass (1.0.6) diff-lcs (1.5.0) + drb (2.2.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) + erubi (1.13.0) ethon (0.16.0) ffi (>= 1.15.0) eventmachine (1.2.7) @@ -30,7 +62,7 @@ GEM yell (~> 2.0) zeitwerk (~> 2.5) http_parser.rb (0.8.0) - i18n (1.14.1) + i18n (1.14.6) concurrent-ruby (~> 1.0) jekyll (4.3.2) addressable (~> 2.4) @@ -67,9 +99,14 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.2) + loofah (2.23.1) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) mercenary (0.4.0) + method_source (1.1.0) mini_portile2 (2.8.6) - minitest (5.19.0) + minitest (5.25.4) nokogiri (1.16.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) @@ -79,6 +116,18 @@ GEM posix-spawn (0.3.15) public_suffix (5.0.1) racc (1.7.3) + rack (3.1.8) + rack-session (2.0.0) + rack (>= 3.0.0) + rack-test (2.1.0) + rack (>= 1.3) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) rainbow (3.1.1) rake (13.0.6) rb-fsevent (0.11.2) @@ -103,6 +152,7 @@ GEM sass-embedded (1.63.2) google-protobuf (~> 3.23) rake (>= 10.0.0) + securerandom (0.4.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) typhoeus (1.4.0) @@ -110,6 +160,12 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.4.2) + uri (1.0.2) + useragent (0.16.11) + view_component (3.20.0) + activesupport (>= 5.2.0, < 8.1) + concurrent-ruby (~> 1.0) + method_source (~> 1.0) webrick (1.8.2) yell (2.2.2) zeitwerk (2.6.7) @@ -118,7 +174,9 @@ PLATFORMS ruby DEPENDENCIES - activesupport (~> 7.0.7) + actionpack (~> 8.0.0) + actionview (~> 8.0.0) + activesupport (~> 8.0.0) html-proofer (~> 4.4.3) jekyll (~> 4) jekyll-environment-variables @@ -127,6 +185,7 @@ DEPENDENCIES kramdown (>= 2.3.0) nokogiri (~> 1.16.5) rspec (~> 3.9.0) + view_component (~> 3.20.0) RUBY VERSION ruby 3.2.2p53 diff --git a/_components/breadcrumb_component.html.erb b/_components/breadcrumb_component.html.erb new file mode 100644 index 00000000..4f562f76 --- /dev/null +++ b/_components/breadcrumb_component.html.erb @@ -0,0 +1,5 @@ + diff --git a/_components/breadcrumb_component.rb b/_components/breadcrumb_component.rb new file mode 100644 index 00000000..dc1162bf --- /dev/null +++ b/_components/breadcrumb_component.rb @@ -0,0 +1 @@ +class BreadcrumbComponent < ViewComponent::Base; end diff --git a/_components/breadcrumb_item_component.html.erb b/_components/breadcrumb_item_component.html.erb new file mode 100644 index 00000000..f8817ca4 --- /dev/null +++ b/_components/breadcrumb_item_component.html.erb @@ -0,0 +1,3 @@ +