Skip to content

Commit

Permalink
Add form help text.
Browse files Browse the repository at this point in the history
  • Loading branch information
yamat47 committed Aug 12, 2024
1 parent dfe8612 commit 1fbad12
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 1 deletion.
11 changes: 11 additions & 0 deletions app/app/assets/stylesheets/admin/form.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
28 changes: 28 additions & 0 deletions app/app/views/admin/game_fields/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions app/app/views/admin/seasons/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/app/views/admin/teams/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions app/app/views/admin/teams/logos/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions app/config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ ja:
index: 試合会場
game_schedules:
index: 試合
game_results:
new: 試合結果登録
edit: 試合結果更新
tournaments:
index: 大会
teams:
Expand Down

0 comments on commit 1fbad12

Please sign in to comment.