Commit 57bb0ee

mo khan <mo@mokhan.ca>
2016-05-26 01:54:15
add static page to show how to export csv.
add help icon and link. remove extra method call. feature toggle csv import.
1 parent 471251f
app/assets/images/sl5x5-android-compose.png
Binary file
app/assets/images/sl5x5-android-export.png
Binary file
app/assets/images/sl5x5-android-send.png
Binary file
app/assets/images/sl5x5-android-settings.png
Binary file
app/controllers/static_pages_controller.rb
@@ -1,4 +1,7 @@
 class StaticPagesController < ApplicationController
   def terms
   end
+
+  def export
+  end
 end
app/models/user.rb
@@ -12,7 +12,7 @@ class User < ActiveRecord::Base
   validates :email, presence: true, email: true, uniqueness: true
   validates_acceptance_of :terms_and_conditions
 
-  after_create :create_profile
+  after_create :create_profile!
   before_validation :lowercase_account_fields
 
   def time_zone
@@ -90,10 +90,6 @@ class User < ActiveRecord::Base
 
   private
 
-  def create_profile
-    self.create_profile!
-  end
-
   def lowercase_account_fields
     username.downcase! if username.present?
     email.downcase! if email.present?
app/views/static_pages/export.html.erb
@@ -0,0 +1,30 @@
+<div class="row">
+  <div class="small-12 columns">
+    <ul data-orbit>
+      <li data-orbit-slide="headline-1">
+      <div>
+        <h2>Step 1: Go to Settings</h2>
+        <p> <%= image_tag "sl5x5-android-settings.png" %> </p>
+      </div>
+      </li>
+      <li data-orbit-slide="headline-2">
+      <div>
+        <h2>Step 2: Choose Export</h2>
+        <p> <%= image_tag "sl5x5-android-export.png" %> </p>
+      </div>
+      </li>
+      <li data-orbit-slide="headline-3">
+      <div>
+        <h2>Step 3: Choose Send</h2>
+        <p> <%= image_tag "sl5x5-android-send.png" %> </p>
+      </div>
+      </li>
+      <li data-orbit-slide="headline-4">
+      <div>
+        <h2>Step 4: Paste the email address provided</h2>
+        <p> <%= image_tag "sl5x5-android-compose.png" %> </p>
+      </div>
+      </li>
+    </ul>
+  </div>
+</div>
app/views/training_sessions/_import_address_modal.html.erb
@@ -2,16 +2,22 @@
   <h2 id="modalTitle"><%= t('.title') %></h2>
   <p class="lead"><%= t('.lead') %></p>
 
-  <p><%= t('.blurb') %></p>
+  <p><%= raw t('.blurb') %></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 clipboard-button" data-clipboard-target="#import_address"><i class="fa fa-copy"></i></button>
+      <button class="button clipboard-button" data-clipboard-target="#import_address">
+        <i class="fa fa-copy"></i> <%= t('.copy') %>
+      </button>
     </div>
   </div>
   <p class="text-center"><%= mail_to(current_user.import_address, User.human_attribute_name(:import_address)) %></p>
+  <p class="text-center">
+    <%= link_to t('.help'), stronglifts_export_path %>
+    <i class="fa fa-question-circle"></i>
+  </p>
   <a class="close-reveal-modal" aria-label="Close">&#215;</a>
   <% if current_user.default_time_zone? %>
     <div class="panel">
app/views/training_sessions/index.html.erb
@@ -1,7 +1,9 @@
 <% if @training_sessions.any? %>
   <div class="row">
     <div class="large-12 columns">
+      <% if feature_available?(:csv_import) %>
       <p class="text-center"> <a href="#" data-reveal-id="sendToStrongLiftsModal"><%= User.human_attribute_name(:import_address) %></a> </p>
+      <% end %>
       <table>
         <thead>
           <tr>
@@ -25,7 +27,9 @@
 <% else %>
   <div class="row">
     <div class="large-12 columns">
+      <% if feature_available?(:csv_import) %>
       <p class="text-center"> <a href="#" data-reveal-id="sendToStrongLiftsModal"><%= User.human_attribute_name(:import_address) %></a> </p>
+      <% end %>
       <%= random_video %>
     </div>
   </div>
config/locales/en.yml
@@ -35,7 +35,7 @@ en:
         transgender: Transgender
         social_tolerance: Social Tolerance
       user:
-        import_address: Send-to-Stronglifters e-mail address
+        import_address: Send-to-Stronglifters
   time:
     formats:
       short: "%a, %d %b %Y"
@@ -91,7 +91,9 @@ en:
     drive_upload:
       success: 'Our minions have been summoned to fetch your backup.'
     import_address_modal:
-      blurb: This is your custom email address for sending CSV exports from the StrongLifts 5x5 mobile application.
+      blurb: This is your custom email address for sending CSV exports from the <a href="http://stronglifts.com/apps/">StrongLifts 5x5 mobile application</a>.
+      copy: Copy
+      help: I need help.
       lead: Your custom email address.
       title: Send-to-Stronglifters.
       warning: To ensure your workouts are imported correctly we suggest that you update your timezone.
config/routes.rb
@@ -14,6 +14,7 @@ Rails.application.routes.draw do
   get "/u/:id" => "profiles#show", constraints: { id: /[^\/]+/ }
   get "/dashboard" => "training_sessions#index", as: :dashboard
   get "/terms" => "static_pages#terms"
+  get "/stronglifts/export" => "static_pages#export"
 
   get "/email/incoming", to: proc { [200, {}, ["OK"]] }
   post "/email/incoming" => "griddler/emails#create"