From 1fbad12200a4353f773655cf9cb7fa6f779da15d Mon Sep 17 00:00:00 2001 From: yamat47 Date: Mon, 12 Aug 2024 18:07:35 +0900 Subject: [PATCH] Add form help text. --- app/app/assets/stylesheets/admin/form.css | 11 ++++++++ .../views/admin/game_fields/_form.html.haml | 28 +++++++++++++++++++ .../game_schedules/game_results/new.html.haml | 2 +- .../media_hero_images/_form.html.haml | 8 ++++++ app/app/views/admin/seasons/_form.html.haml | 10 +++++++ app/app/views/admin/teams/_form.html.haml | 4 +++ .../views/admin/teams/logos/_form.html.haml | 6 ++++ app/config/locales/ja.yml | 3 ++ 8 files changed, 71 insertions(+), 1 deletion(-) diff --git a/app/app/assets/stylesheets/admin/form.css b/app/app/assets/stylesheets/admin/form.css index e394903..2e21d71 100644 --- a/app/app/assets/stylesheets/admin/form.css +++ b/app/app/assets/stylesheets/admin/form.css @@ -135,3 +135,14 @@ .admin-form-radio-button { appearance: auto; } + +.admin-form-help_text { + & * { + font-size: 0.875rem; + color: var(--color-gray-500); + } + + & > p:not(:last-child) { + margin-bottom: 0.25rem; + } +} diff --git a/app/app/views/admin/game_fields/_form.html.haml b/app/app/views/admin/game_fields/_form.html.haml index 0a9519f..8d37ea0 100644 --- a/app/app/views/admin/game_fields/_form.html.haml +++ b/app/app/views/admin/game_fields/_form.html.haml @@ -15,6 +15,10 @@ = GameField.human_attribute_name(:name) .admin-field__value = form.text_field :name, class: 'admin-form-text_field is-long', required: true + .admin-field__help + .admin-form-help_text + %p + 例:東洋大学 川越キャンパス Hグラウンド .admin-fields__field .admin-field .admin-field__label @@ -27,12 +31,36 @@ = GameField.human_attribute_name(:google_maps_url) .admin-field__value = form.url_field :google_maps_url, class: 'admin-form-text_field is-long', required: true + .admin-field__help + .admin-form-help_text + %p + https://maps.app.goo.gl/ ではじまるURLを入力してください。 + %br + 詳しくは + = link_to 'こちらのドキュメント', + admin_document_path(:get_google_map_urls), + class: 'common-text-link', + target: '_blank', + rel: 'noopener noreferrer' + をご覧ください。 .admin-fields__field .admin-field .admin-field__label = GameField.human_attribute_name(:google_maps_embed_src_url) .admin-field__value = form.url_field :google_maps_embed_src_url, class: 'admin-form-text_field is-long', required: true + .admin-field__help + .admin-form-help_text + %p + https://www.google.com/maps/embed ではじまる埋め込み用のURLを入力してください。 + %br + 詳しくは + = link_to 'こちらのドキュメント', + admin_document_path(:get_google_map_urls), + class: 'common-text-link', + target: '_blank', + rel: 'noopener noreferrer' + をご覧ください。 - if game_field.errors.any? .admin-fields__field .admin-form-errors diff --git a/app/app/views/admin/game_schedules/game_results/new.html.haml b/app/app/views/admin/game_schedules/game_results/new.html.haml index 2ae7055..9a2fac7 100644 --- a/app/app/views/admin/game_schedules/game_results/new.html.haml +++ b/app/app/views/admin/game_schedules/game_results/new.html.haml @@ -1,7 +1,7 @@ :ruby add_breadcrumb t('view.admin.breadcrumbs.game_schedules.index'), admin_game_schedules_path add_breadcrumb @game_schedule.name, admin_game_schedule_path(@game_schedule) - add_breadcrumb t('view.admin.breadcrumbs.game_schedules.game_results.edit') + add_breadcrumb t('view.admin.breadcrumbs.game_schedules.game_results.new') .admin-content .admin-content__title diff --git a/app/app/views/admin/media_page_settings/media_hero_images/_form.html.haml b/app/app/views/admin/media_page_settings/media_hero_images/_form.html.haml index 2e3a356..9e47188 100644 --- a/app/app/views/admin/media_page_settings/media_hero_images/_form.html.haml +++ b/app/app/views/admin/media_page_settings/media_hero_images/_form.html.haml @@ -8,6 +8,14 @@ .admin-form-file_field__wrapper = form.file_field :image, class: 'admin-form-file_field__field', accept: 'image/*', required: true = image_tag media_hero_image.image.url, class: 'admin-field-value-image' if media_hero_image.image.attached? + .admin-field__help + .admin-form-help_text + %p + 画像はJPEGまたはPNG形式にしてアップロードをしてください。 + %p + モバイルでは正方形、PC では 3:1 の横長の画像比で表示されます。 + %br + PC での画面表示のために 3:1 の横長の画像を登録してください。推奨サイズは 1200px x 400px です。 - if media_hero_image.errors.any? .admin-fields__field .admin-form-errors diff --git a/app/app/views/admin/seasons/_form.html.haml b/app/app/views/admin/seasons/_form.html.haml index 0ebc156..3b0d3ec 100644 --- a/app/app/views/admin/seasons/_form.html.haml +++ b/app/app/views/admin/seasons/_form.html.haml @@ -15,12 +15,22 @@ = Season.human_attribute_name(:full_name) .admin-field__value = form.text_field :full_name, class: 'admin-form-text_field is-long', required: true + .admin-field__help + .admin-form-help_text + %p + 例:2024年度 .admin-fields__field .admin-field .admin-field__label = Season.human_attribute_name(:short_name) .admin-field__value = form.text_field :short_name, class: 'admin-form-text_field is-long', required: true + .admin-field__help + .admin-form-help_text + %p + 例:2024 + %p + URLの一部として使用されます。 - if season.errors.any? .admin-fields__field .admin-form-errors diff --git a/app/app/views/admin/teams/_form.html.haml b/app/app/views/admin/teams/_form.html.haml index 65968fb..9d1322a 100644 --- a/app/app/views/admin/teams/_form.html.haml +++ b/app/app/views/admin/teams/_form.html.haml @@ -15,6 +15,10 @@ = Team.human_attribute_name(:name) .admin-field__value = form.text_field :name, class: 'admin-form-text_field', required: true + .admin-field__help + .admin-form-help_text + %p + 例:慶應大学ダックス - if team.errors.any? .admin-fields__field .admin-form-errors diff --git a/app/app/views/admin/teams/logos/_form.html.haml b/app/app/views/admin/teams/logos/_form.html.haml index 401ca5b..973e6d1 100644 --- a/app/app/views/admin/teams/logos/_form.html.haml +++ b/app/app/views/admin/teams/logos/_form.html.haml @@ -8,6 +8,12 @@ .admin-form-file_field__wrapper = form.file_field :logo, class: 'admin-form-file_field__field', accept: 'image/*' = image_tag team.logo.url, class: 'admin-field-value-image' if team.logo.attached? + .admin-field__help + .admin-form-help_text + %p + 画像はJPEGまたはPNG形式にしてアップロードをしてください。 + %p + 正方形の画像を登録してください。推奨サイズは 300px x 300px です。 - if team.errors.any? .admin-fields__field .admin-form-errors diff --git a/app/config/locales/ja.yml b/app/config/locales/ja.yml index d54e72c..0b98293 100644 --- a/app/config/locales/ja.yml +++ b/app/config/locales/ja.yml @@ -278,6 +278,9 @@ ja: index: 試合会場 game_schedules: index: 試合 + game_results: + new: 試合結果登録 + edit: 試合結果更新 tournaments: index: 大会 teams: