Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/admin/photo_spots_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 11 additions & 0 deletions app/views/admin/photo_spots/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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" %>
</div>
</div>
<div>
<%= 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" } %>
</div>
<div>
<%= 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" } %>
</div>
<div>
<%= 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" } %>
<%# 緯度・経度の入力フィールド %>
<div class="flex flex-col sm:flex-row gap-4">
<div class="flex-1">
Expand Down
20 changes: 20 additions & 0 deletions app/views/admin/photo_spots/_photo_spot.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@
<dd><%= photo_spot.detail %></dd>
<dt class="font-semibold">タグ</dt>
<dd><%= photo_spot.tags %></dd>
<dt class="font-semibold">時間帯</dt>
<dd>
<%= photo_spot.timestart ? photo_spot.timestart.strftime("%H:%M") : "未設定" %> 〜
<%= photo_spot.timeend ? photo_spot.timeend.strftime("%H:%M") : "未設定" %>
</dd>
<dt class="font-semibold">おすすめの季節</dt>
<dd>
<% case photo_spot.season %>
<% when 'spring' %>
<% when 'summer' %>
<% when 'autumn' %>
<% when 'winter' %>
<% else %>
未設定
<% end %>
</dd>
</dl>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading