diff --git a/app/controllers/admin/photo_spots_controller.rb b/app/controllers/admin/photo_spots_controller.rb
index b252b96..c20071c 100644
--- a/app/controllers/admin/photo_spots_controller.rb
+++ b/app/controllers/admin/photo_spots_controller.rb
@@ -72,6 +72,6 @@ def set_photo_spot
def photo_spot_params
params.require(:photo_spot).permit(:name, :address, :detail, :parking_flag, :tags, { images: [] },
- :latitude, :longitude, :timestart, :timeend)
+ :latitude, :longitude, :timestart, :timeend, :season,)
end
end
diff --git a/app/views/admin/photo_spots/_form.html.erb b/app/views/admin/photo_spots/_form.html.erb
index 519913e..741ca3c 100644
--- a/app/views/admin/photo_spots/_form.html.erb
+++ b/app/views/admin/photo_spots/_form.html.erb
@@ -19,6 +19,17 @@
<%= form.text_field :address, class: "block shadow-sm rounded-md border px-3 py-2 w-full border-gray-300 focus:outline-blue-600" %>
+
+ <%= form.label :timestart, '時間帯(開始)', class: 'block font-semibold mb-1' %>
+ <%= form.select :timestart, options_for_select((0..23).map { |h| ["#{h}:00", "#{h}:00"] } , selected: photo_spot.timestart&.strftime("%H:%M")), { include_blank: '選択してください' }, { class: "block shadow-sm rounded-md border px-3 py-2 w-full border-gray-300 focus:outline-blue-600" } %>
+
+
+ <%= form.label :timeend, '時間帯(終了)', class: 'block font-semibold mb-1' %>
+ <%= form.select :timeend, options_for_select((0..23).map { |h| ["#{h}:00", "#{h}:00"] } , selected: photo_spot.timestart&.strftime("%H:%M")), { include_blank: '選択してください' }, { class: "block shadow-sm rounded-md border px-3 py-2 w-full border-gray-300 focus:outline-blue-600" } %>
+
+
+ <%= form.label :season, 'おすすめの季節', class: 'block font-semibold mb-1' %>
+ <%= form.select :season, options_for_select([['春', 'spring'], ['夏', 'summer'], ['秋', 'autumn'], ['冬', 'winter']], selected: photo_spot.season), { include_blank: '選択してください' }, { class: "block shadow-sm rounded-md border px-3 py-2 w-full border-gray-300 focus:outline-blue-600" } %>
<%# 緯度・経度の入力フィールド %>
diff --git a/app/views/admin/photo_spots/_photo_spot.html.erb b/app/views/admin/photo_spots/_photo_spot.html.erb
index 47a1c3e..bcf2f1e 100644
--- a/app/views/admin/photo_spots/_photo_spot.html.erb
+++ b/app/views/admin/photo_spots/_photo_spot.html.erb
@@ -25,6 +25,26 @@
<%= photo_spot.detail %>
タグ
<%= photo_spot.tags %>
+ 時間帯
+
+ <%= photo_spot.timestart ? photo_spot.timestart.strftime("%H:%M") : "未設定" %> 〜
+ <%= photo_spot.timeend ? photo_spot.timeend.strftime("%H:%M") : "未設定" %>
+
+ おすすめの季節
+
+ <% case photo_spot.season %>
+ <% when 'spring' %>
+ 春
+ <% when 'summer' %>
+ 夏
+ <% when 'autumn' %>
+ 秋
+ <% when 'winter' %>
+ 冬
+ <% else %>
+ 未設定
+ <% end %>
+
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index f9a7dc5..2384f0f 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -21,8 +21,8 @@ ja:
blank: "を入力してください"
time:
formats:
- short: "%Y/%m/%d %H:%M"
- long: "%Y/%m/%d %H:%M:%S"
+ short: "%H:%M"
+ long: "%H:%M"
datetime:
distance_in_words:
about_x_hours: