mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
Merge pull request #138 from tetebueno/feature-default-to-today
Default to today in maps page
This commit is contained in:
commit
3c6d93f969
2 changed files with 6 additions and 6 deletions
|
|
@ -20,7 +20,7 @@ class MapController < ApplicationController
|
||||||
private
|
private
|
||||||
|
|
||||||
def start_at
|
def start_at
|
||||||
return 1.month.ago.beginning_of_day.to_i if params[:start_at].nil?
|
return Time.zone.today.beginning_of_day.to_i if params[:start_at].nil?
|
||||||
|
|
||||||
Time.zone.parse(params[:start_at]).to_i
|
Time.zone.parse(params[:start_at]).to_i
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,6 @@
|
||||||
<%= f.submit "Search", class: "px-4 py-2 bg-blue-500 text-white rounded-md" %>
|
<%= f.submit "Search", class: "px-4 py-2 bg-blue-500 text-white rounded-md" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full md:w-2/12">
|
|
||||||
<div class="flex flex-col space-y-2 text-center">
|
|
||||||
<%= link_to "Today", map_path(start_at: Time.current.beginning_of_day, end_at: Time.current.end_of_day), class: "px-4 py-2 bg-gray-500 text-white rounded-md" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="w-full md:w-2/12">
|
<div class="w-full md:w-2/12">
|
||||||
<div class="flex flex-col space-y-2 text-center">
|
<div class="flex flex-col space-y-2 text-center">
|
||||||
<%= link_to "Yesterday", map_path(start_at: Date.yesterday.beginning_of_day, end_at: Date.yesterday.end_of_day), class: "px-4 py-2 bg-gray-500 text-white rounded-md" %>
|
<%= link_to "Yesterday", map_path(start_at: Date.yesterday.beginning_of_day, end_at: Date.yesterday.end_of_day), class: "px-4 py-2 bg-gray-500 text-white rounded-md" %>
|
||||||
|
|
@ -36,6 +31,11 @@
|
||||||
<%= link_to "Last 7 days", map_path(start_at: 1.week.ago.beginning_of_day, end_at: Time.current.end_of_day), class: "px-4 py-2 bg-gray-500 text-white rounded-md" %>
|
<%= link_to "Last 7 days", map_path(start_at: 1.week.ago.beginning_of_day, end_at: Time.current.end_of_day), class: "px-4 py-2 bg-gray-500 text-white rounded-md" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="w-full md:w-2/12">
|
||||||
|
<div class="flex flex-col space-y-2 text-center">
|
||||||
|
<%= link_to "Last month", map_path(start_at: 1.month.ago.beginning_of_day, end_at: Time.current.end_of_day), class: "px-4 py-2 bg-gray-500 text-white rounded-md" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue