From 0243e3d04934fa8cf39168e26a7b913be8cee1f1 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY Date: Fri, 5 Jan 2024 18:10:41 +0700 Subject: [PATCH] Makes error condition more explicit --- .template/variants/web/app/template.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.template/variants/web/app/template.rb b/.template/variants/web/app/template.rb index abc1ffdb..658d8574 100644 --- a/.template/variants/web/app/template.rb +++ b/.template/variants/web/app/template.rb @@ -8,6 +8,7 @@ erb_layout_exists = File.exist?(erb_layout_file) slim_layout_exists = File.exist?(slim_layout_file) +layout_not_found = !erb_layout_exists && !slim_layout_exists if erb_layout_exists insert_into_file erb_layout_file, before: %r{} do @@ -15,8 +16,9 @@ <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> ERB end -# The slim layout (CRUD addon) already has the javascript include tag -elsif !slim_layout_exists +end + +if layout_not_found @template_errors.add <<~ERROR Cannot include javascript into `app/views/layouts/application.html.erb` Content: <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> @@ -44,8 +46,9 @@ gsub_file erb_layout_file, // do "" end -# The slim layout (CRUD addon) already has the lang attribute -elsif !erb_layout_exists +end + +if layout_not_found @template_errors.add <<~ERROR Cannot insert the lang attribute into html tag into `app/views/layouts/application.html.erb` Content: