Commit 32a41dd
Changed files (3)
app
models
views
training_sessions
app/models/user.rb
@@ -19,8 +19,8 @@ class User < ActiveRecord::Base
@time_zone ||= ActiveSupport::TimeZone[profile.read_attribute(:time_zone)]
end
- def chosen_time_zone?
- time_zone.name != "Etc/UTC"
+ def default_time_zone?
+ "Etc/UTC" == time_zone.name
end
def first_training_session
app/views/training_sessions/_import_address_modal.html.erb
@@ -0,0 +1,21 @@
+<div id="sendToStrongLiftsModal" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
+ <h2 id="modalTitle">Send-to-Stronglifters.</h2>
+ <p class="lead">Your custom email address.</p>
+
+ <p>This is your custom email address for sending CSV exports to from the StrongLifts 5x5 mobile application.</p>
+ <div class="row">
+ <div class="large-8 columns">
+ <p><%= text_field_tag :import_address, current_user.import_address %></p>
+ </div>
+ <div class="large-4 columns">
+ <button class="button" data-clipboard-target="#import_address"><i class="fa fa-copy"></i></button>
+ </div>
+ </div>
+ <p class="text-center"><%= mail_to(current_user.import_address, User.human_attribute_name(:import_address)) %></p>
+ <a class="close-reveal-modal" aria-label="Close">×</a>
+ <% if current_user.default_time_zone? %>
+ <div class="panel">
+ <p>To ensure your workouts are imported correctly we suggest that you update your timezone <%= link_to "here", edit_profile_path(current_user.profile) %>.</p>
+ </div>
+ <% end %>
+</div>
app/views/training_sessions/index.html.erb
@@ -1,12 +1,7 @@
<% if @training_sessions.any? %>
- <div class="row">
- <% if current_user.chosen_time_zone? %>
- <p class="text-center"> <a href="#" data-reveal-id="sendToStrongLiftsModal"><%= User.human_attribute_name(:import_address) %></a> </p>
- <% end %>
- </div>
-
<div class="row">
<div class="large-12 columns">
+ <p class="text-center"> <a href="#" data-reveal-id="sendToStrongLiftsModal"><%= User.human_attribute_name(:import_address) %></a> </p>
<table>
<thead>
<tr>
@@ -30,27 +25,10 @@
<% else %>
<div class="row">
<div class="large-12 columns">
- <% if current_user.chosen_time_zone? %>
- <p class="text-center"> <a href="#" data-reveal-id="sendToStrongLiftsModal"><%= User.human_attribute_name(:import_address) %></a> </p>
- <% end %>
+ <p class="text-center"> <a href="#" data-reveal-id="sendToStrongLiftsModal"><%= User.human_attribute_name(:import_address) %></a> </p>
<%= random_video %>
</div>
</div>
<% end %>
-<div id="sendToStrongLiftsModal" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
- <h2 id="modalTitle">Send-to-Stronglifters.</h2>
- <p class="lead">Your custom email address.</p>
-
- <p>This is your custom email address for sending CSV exports to from the StrongLifts 5x5 mobile application.</p>
- <div class="row">
- <div class="large-8 columns">
- <p><%= text_field_tag :import_address, current_user.import_address %></p>
- </div>
- <div class="large-4 columns">
- <button class="button" data-clipboard-target="#import_address"><i class="fa fa-copy"></i></button>
- </div>
- </div>
- <p class="text-center"><%= mail_to(current_user.import_address, User.human_attribute_name(:import_address)) %></p>
- <a class="close-reveal-modal" aria-label="Close">×</a>
-</div>
+<%= render partial: 'import_address_modal' %>