Merge remote-tracking branch 'origin' into 1678-new-active-user-orientation
authorPeter Amstutz <peter.amstutz@clinicalfuture.com>
Thu, 26 Dec 2013 18:19:00 +0000 (13:19 -0500)
committerPeter Amstutz <peter.amstutz@clinicalfuture.com>
Thu, 26 Dec 2013 18:19:00 +0000 (13:19 -0500)
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/controllers/users_controller.rb
apps/workbench/app/views/layouts/application.html.erb
apps/workbench/app/views/users/_quick_links.html.erb [new file with mode: 0644]
apps/workbench/app/views/users/_request_activation.html.erb [deleted file]
apps/workbench/app/views/users/home.html.erb
apps/workbench/app/views/users/welcome.html.erb [new file with mode: 0644]
doc/user/getting_started/workbench.textile

index 57ba0cf7a1879413cab628d6e5206fc14d6268c5..5b8276a9e01f9fca39f22ca60510a88879b82960 100644 (file)
@@ -142,7 +142,7 @@ class ApplicationController < ActionController::Base
     yield
   end
 
-  def thread_with_api_token
+  def thread_with_api_token(login_optional = false)
     begin
       try_redirect_to_login = true
       if params[:api_token]
@@ -180,19 +180,25 @@ class ApplicationController < ActionController::Base
         logger.debug "No token received, session is #{session.inspect}"
       end
       if try_redirect_to_login
-        respond_to do |f|
-          f.html {
-            if request.method == 'GET'
-              redirect_to $arvados_api_client.arvados_login_url(return_to: request.url)
-            else
-              flash[:error] = "Either you are not logged in, or your session has timed out. I can't automatically log you in and re-attempt this request."
-              redirect_to :back
-            end
-          }
-          f.json {
-            @errors = ['You do not seem to be logged in. You did not supply an API token with this request, and your session (if any) has timed out.']
-            self.render_error status: 422
-          }
+        unless login_optional
+          respond_to do |f|
+            f.html {
+              if request.method == 'GET'
+                redirect_to $arvados_api_client.arvados_login_url(return_to: request.url)
+              else
+                flash[:error] = "Either you are not logged in, or your session has timed out. I can't automatically log you in and re-attempt this request."
+                redirect_to :back
+              end
+            }
+            f.json {
+              @errors = ['You do not seem to be logged in. You did not supply an API token with this request, and your session (if any) has timed out.']
+              self.render_error status: 422
+            }
+          end
+        else
+          # login is optional for this route so go on to the regular controller
+          Thread.current[:arvados_api_token] = nil
+          yield
         end
       end
     ensure
@@ -201,6 +207,12 @@ class ApplicationController < ActionController::Base
     end
   end
 
+  def thread_with_optional_api_token 
+    thread_with_api_token(true) do 
+      yield
+    end
+  end
+
   def verify_api_token
     begin
       Link.where(uuid: 'just-verifying-my-api-token')
index 77844270c83aaa0b493e7a3e14894e2c4bc2c9fe..f48d3b2b92b923ad7b52316fcdb587a6dc927b18 100644 (file)
@@ -1,11 +1,11 @@
 class UsersController < ApplicationController
   skip_before_filter :find_object_by_uuid, :only => :welcome
+  skip_around_filter :thread_with_api_token, :only => :welcome
+  around_filter :thread_with_optional_api_token, :only => :welcome
 
   def welcome
     if current_user
       redirect_to home_user_path(current_user.uuid)
-    else
-      redirect_to $arvados_api_client.arvados_login_url(return_to: request.url)
     end
   end
 
index 54c9b94aa05080f39f94e6d39cb9f15548a7f8a4..921588a14be7d9f79ca0a471dc55fa5c147cd123 100644 (file)
@@ -92,7 +92,7 @@
             <li><span class="badge badge-info" style="margin: 10px auto 10px; padding-top: 4px; padding-bottom: 4px"><%= current_user.email %></span></li>
             <li><a href="<%= logout_path %>">Log out</a></li>
       <% else -%>
-            <li><a href="<%= root_path %>">Log in</a></li>
+            <li><a href="<%= $arvados_api_client.arvados_login_url(return_to: root_url) %>">Log in</a></li>
       <% end -%>
           </ul>
         </div><!--/.nav-collapse -->
diff --git a/apps/workbench/app/views/users/_quick_links.html.erb b/apps/workbench/app/views/users/_quick_links.html.erb
new file mode 100644 (file)
index 0000000..9ed1aa9
--- /dev/null
@@ -0,0 +1,10 @@
+<div class="clearfix">
+  <h4>Quick links</h4>
+  <div class="well dash-list">
+    <ul class="nav nav-list">
+      <li><%= link_to "Introduction to Arvados", "https://arvados.org/projects/arvados/wiki/Introduction_to_Arvados" %></li>
+      <li><%= link_to "User Guide and Tutorials", "http://doc.arvados.org/user/" %></li>
+      <li><%= link_to "API Reference", "http://doc.arvados.org/api/" %></li>
+    </ul>
+  </div>
+</div>
diff --git a/apps/workbench/app/views/users/_request_activation.html.erb b/apps/workbench/app/views/users/_request_activation.html.erb
deleted file mode 100644 (file)
index d214827..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<h4>Your account</h4>
-<div class="well clearfix">
-  <div>
-    Status: <strong>New / inactive</strong>
-  </div>
-  <br />
-  We will send you an email when your account is activated. If this
-  hasn&rsquo;t happened after 24 hours, please let us know.
-  <br />
-  <%= link_to raw('Contact us &#x2709;'), Rails.configuration.activation_contact_link, class: "pull-right btn btn-primary" %>
-</div>
index e67772f7f92625e2b88ed1649d2ab7bfec693c14..8a211c848557c80f6b70f07ed5a66debf31cefb2 100644 (file)
           <br />
           <%= raw(aclass.to_s.pluralize.underscore.gsub '_', '&nbsp;') %>
         </div>
-        <% end %>
+       <% end %>
       </div>
     </div>
   </div>
 </div>
-<% end %>
 
 <div class="row-fluid">
   <div class="col span3">
     <div class="clearfix">
-      <% if not current_user.andand.is_active %>
-      <%= render partial: 'request_activation' %>
-      <% else %>
       <h4>Configuration</h4>
       <div class="well dash-list">
         <ul class="nav nav-list">
           </li>
         </ul>
       </div>
-      <% end %>
     </div>
   </div>
   <div class="col span4">
-    <div class="clearfix">
-      <h4>Quick links</h4>
-      <div class="well dash-list">
-        <ul class="nav nav-list">
-          <li><%= link_to "Introduction to Arvados", "https://arvados.org/projects/arvados/wiki/Introduction_to_Arvados" %></li>
-          <li><%= link_to "API Reference", "http://doc.arvados.org/api/" %></li>
-          <li><%= link_to "User Guide", "http://doc.arvados.org/api/" %></li>
-          <li><%= link_to "Tutorial 1: Your first job", "http://doc.arvados.org/user/tutorial-job1.html" %></li>
-          <li><%= link_to "Tutorial 2: GATK VariantFiltration", "http://doc.arvados.org/user/tutorial-gatk-variantfiltration.html" %></li>
-          <li><%= link_to "Tutorial 3: Search PGP data by trait", "http://doc.arvados.org/user/tutorial-trait-search.html" %></li>
-          <li><%= link_to "Tutorial 4: Create a new pipeline", "http://doc.arvados.org/user/tutorial-new-pipeline.html" %></li>
-        </ul>
-      </div>
-    </div>
+    <%= render partial: 'quick_links' %>
   </div>
   <div class="col span5">
     <div class="clearfix">
     </div>
   </div>
 </div>
+
+<% elsif current_user %>
+  <%= image_tag "dax.png", style: "float: right; max-width: 25%; margin-left: 2em" %>
+  <h1>Welcome to Arvados, <%= current_user.first_name %>!</h1>
+  <div class="row-fluid">
+    <div class="col span8">
+      <h4>Your account status</h4>
+      <div class="well clearfix">
+       <p><strong>New / inactive</strong></p>
+       <p>
+         Your account must be activated by an Arvados administrator.  If this
+         is your first time accessing Arvados and would like to request
+         access, or you believe you are seeing the page in error, please 
+         <%= link_to "contact us", Rails.configuration.activation_contact_link %>.  
+         You should receive an email at the address you used to log in when
+         your account is activated.  In the mean time, you can 
+         <%= link_to "learn more about Arvados", "https://arvados.org/projects/arvados/wiki/Introduction_to_Arvados" %>,
+         and <%= link_to "read the Arvados user guide", "http://doc.arvados.org/user" %>.
+       </p>
+       <p>
+         <%= link_to raw('Contact us &#x2709;'),
+             Rails.configuration.activation_contact_link, class: "pull-right btn btn-primary" %></p>
+      </div>
+    </div>
+  </div>
+<% end %>
diff --git a/apps/workbench/app/views/users/welcome.html.erb b/apps/workbench/app/views/users/welcome.html.erb
new file mode 100644 (file)
index 0000000..ced69c4
--- /dev/null
@@ -0,0 +1,20 @@
+<%= image_tag "dax.png", style: "float: right; max-width: 25%; margin-left: 2em" %>
+<h1>Hi there!  Please log in to use Arvados Workbench.</h1>
+<div class="row-fluid">
+  <div class="col span8" style="margin-top: 1em">
+    <div class="well clearfix">
+      <p>When you click on the button below you will be taken to a Google sign-in page.
+       After entering your information, you will be redirected back to the Arvados
+       Workbench.  If you have never used Arvados before, logging in for the first
+       time will also create a new user account.  Arvados uses your your name and
+       email address from Google services only for identification, and will never
+       access any personal information.</p>
+      <p>
+       <a  class="pull-right btn btn-primary" href="<%= $arvados_api_client.arvados_login_url(return_to: request.url) %>">
+         Click here to log in to Arvados Workbench with a Google account</a>
+      </p>
+    </div>
+  </div>
+</div>
+
+
index c463cfd14fe9cf2264f5e7708406f233b66de044..d9352a66c3d6b87a3de89b946b43fee3301f3f34 100644 (file)
@@ -10,7 +10,7 @@ Access the Arvados beta test instance available using this link:
 
 "https://workbench.{{ site.arvados_api_host }}/":https://workbench.{{ site.arvados_api_host }}/
 
-If you are accessing Arvados for the first time, you will be asked to log in using a Google account.  Arvados only uses Google services for identification, and will never access any personal information.  Once you are logged in, the Workbench page may indicate your account status is *New / inactive*.  If this is the case, contact the administrator of the Arvados instance to activate your account.
+If you are accessing Arvados for the first time, you will be asked to log in using a Google account.  Arvados uses Google services only for identification, and will never access any personal information.  Once you are logged in, the Workbench page may indicate your account status is *New / inactive*.  If this is the case, contact the administrator of the Arvados instance to activate your account.
 
 Once your account is active, logging in to the Workbench will present you with a system status dashboard.  This gives a summary of data, configuration, and activity in the Arvados instance.