mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-30 13:58:49 +01:00
fix #584 where the date at the top did not use the users timezone, but the servers timezone
also remove confusing user_time helper
This commit is contained in:
parent
183523f45a
commit
dd5b479c5d
6 changed files with 10 additions and 14 deletions
|
|
@ -2,10 +2,6 @@
|
|||
# application.
|
||||
module ApplicationHelper
|
||||
|
||||
def user_time
|
||||
Time.zone.now
|
||||
end
|
||||
|
||||
# Replicates the link_to method but also checks request.request_uri to find
|
||||
# current page. If that matches the url, the link is marked id = "current"
|
||||
#
|
||||
|
|
@ -24,7 +20,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def days_from_today(date)
|
||||
date.in_time_zone.to_date - user_time.to_date
|
||||
date.in_time_zone.to_date - current_user.time.to_date
|
||||
end
|
||||
|
||||
# Check due date in comparison to today's date Flag up date appropriately with
|
||||
|
|
|
|||
|
|
@ -161,11 +161,11 @@ module TodosHelper
|
|||
def staleness_class(item)
|
||||
if item.due || item.completed?
|
||||
return ""
|
||||
elsif item.created_at < user_time - (prefs.staleness_starts * 3).days
|
||||
elsif item.created_at < current_user.time - (prefs.staleness_starts * 3).days
|
||||
return " stale_l3"
|
||||
elsif item.created_at < user_time - (prefs.staleness_starts * 2).days
|
||||
elsif item.created_at < current_user.time - (prefs.staleness_starts * 2).days
|
||||
return " stale_l2"
|
||||
elsif item.created_at < user_time - (prefs.staleness_starts).days
|
||||
elsif item.created_at < current_user.time - (prefs.staleness_starts).days
|
||||
return " stale_l1"
|
||||
else
|
||||
return ""
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<% if !(@new_mobile || @edit_mobile)
|
||||
if !@prefs.nil? -%>
|
||||
<h1><span class="count"><%= @down_count %></span> <%=
|
||||
user_time.strftime(@prefs.title_date_format) -%></h1>
|
||||
current_user.time.strftime(@prefs.title_date_format) -%></h1>
|
||||
<div class="nav">
|
||||
<%= (link_to("0-New action", formatted_new_todo_path(:m, new_todo_params))+" | ") unless @new_mobile -%>
|
||||
<%= (link_to("1-Home", formatted_todos_path(:m))+" | ") unless @home -%>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<% if @count -%>
|
||||
<span id="badge_count" class="badge"><%= @count %></span>
|
||||
<% end -%>
|
||||
<%= user_time.strftime(@prefs.title_date_format) %>
|
||||
<%= current_user.time.strftime(@prefs.title_date_format) %>
|
||||
</h1>
|
||||
</div>
|
||||
<div id="minilinks">
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
<ul id="prefs">
|
||||
<li>First name: <span class="highlight"><%= current_user.first_name %></span></li>
|
||||
<li>Last name: <span class="highlight"><%= current_user.last_name %></span></li>
|
||||
<li>Date format: <span class="highlight"><%= prefs.date_format %></span> Your current date: <%= format_date(user_time) %></li>
|
||||
<li>Title date format: <span class="highlight"><%= prefs.title_date_format %></span> Your current title date: <%= user_time.strftime(prefs.title_date_format) %></li>
|
||||
<li>Time zone: <span class="highlight"><%= prefs.time_zone %></span> Your current time: <%= user_time.strftime('%I:%M %p') %></li>
|
||||
<li>Date format: <span class="highlight"><%= prefs.date_format %></span> Your current date: <%= format_date(current_user.time) %></li>
|
||||
<li>Title date format: <span class="highlight"><%= prefs.title_date_format %></span> Your current title date: <%= current_user.time.strftime(prefs.title_date_format) %></li>
|
||||
<li>Time zone: <span class="highlight"><%= prefs.time_zone %></span> Your current time: <%= current_user.time.strftime('%I:%M %p') %></li>
|
||||
<li>Week starts on: <span class="highlight"><%= Preference.day_number_to_name_map[prefs.week_starts] %></span></li>
|
||||
<li>Show the last <span class="highlight"><%= prefs.show_number_completed %></span> completed items</li>
|
||||
<li>Show completed projects in sidebar: <span class="highlight"><%= prefs.show_completed_projects_in_sidebar %></span></li>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<span class="errors">
|
||||
<%= error_messages_for("todo") %>
|
||||
</span>
|
||||
<% this_year = user_time.to_date.strftime("%Y").to_i
|
||||
<% this_year = current_user.time.to_date.strftime("%Y").to_i
|
||||
if parent_container_type == 'show_mobile' -%>
|
||||
<p><label for="todo_done">Done?</label> <%= check_box_tag("done", 1, @todo && @todo.completed?, "tabindex" => 1) %></p>
|
||||
<% end -%>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue