From 5e4a0a25540c44761f6f1b1a90b4ae38fd451f87 Mon Sep 17 00:00:00 2001 From: Joel Hawksley Date: Tue, 7 Apr 2020 16:20:25 -0600 Subject: [PATCH 1/2] All ViewComponents have an :html format For now, we need to set the format of ViewComponents to :html, as there are other latent assumptions in the library that we will only use it to build HTML. This change unblocks better support for template annotations in Rails. --- lib/view_component/base.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/view_component/base.rb b/lib/view_component/base.rb index d97f99207..1ad59c73e 100644 --- a/lib/view_component/base.rb +++ b/lib/view_component/base.rb @@ -220,6 +220,10 @@ def type "text/html" end + def format + :html + end + def identifier source_location end From 96ed40b537322f323bd5b8a3d75aea5ca64ac04a Mon Sep 17 00:00:00 2001 From: Joel Hawksley Date: Tue, 7 Apr 2020 16:24:36 -0600 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62404f8ac..e937370d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # master +* Add `Base.format` for better compatibility with `ActionView::Template`. + + *Joel Hawksley* + # v2.2.1 * Fix bug where template could not be found if `inherited` was redefined.