From 420d7f40ee64d2b9041947de46fdf05f37cc5ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20Norl=C3=A9n?= Date: Mon, 7 Sep 2020 13:57:39 +0200 Subject: [PATCH] Autoselect first if only one layout available (#1932) --- app/views/alchemy/admin/pages/_new_page_form.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/alchemy/admin/pages/_new_page_form.html.erb b/app/views/alchemy/admin/pages/_new_page_form.html.erb index f717ae233e..d0b73db65d 100644 --- a/app/views/alchemy/admin/pages/_new_page_form.html.erb +++ b/app/views/alchemy/admin/pages/_new_page_form.html.erb @@ -5,8 +5,9 @@ <%= f.input :page_layout, collection: @page_layouts, label: Alchemy.t(:page_type), - include_blank: Alchemy.t('Please choose'), + include_blank: @page_layouts.length == 1 ? nil : Alchemy.t('Please choose'), required: true, + selected: @page_layouts.length == 1 ? @page_layouts.first : nil, input_html: {class: 'alchemy_selectbox'} %> <%= f.input :name %> <%= f.submit Alchemy.t(:create) %>