6846: Streamline Workbench 404 page.
authorBrett Smith <brett@curoverse.com>
Wed, 18 Nov 2015 16:36:04 +0000 (11:36 -0500)
committerBrett Smith <brett@curoverse.com>
Wed, 18 Nov 2015 16:36:04 +0000 (11:36 -0500)
* Prompt the user to log in with a prominent button.
* Make the page text less verbose.
* DRY up the code in the _report_error partial.

Refs #6846.

apps/workbench/app/views/application/404.html.erb
apps/workbench/app/views/application/_report_error.html.erb
apps/workbench/test/controllers/projects_controller_test.rb

index aa1ffda017120bb085997e130074e1bd799dace9..ea6e7033cb23c113fecfebfbb3dad8e6a7c01533 100644 (file)
 <% if !current_user %>
 
   <p>
-    (I notice you are not logged in. If you're looking for a private
-    page, you'll need to <%=link_to 'log in', arvados_api_client.arvados_login_url(return_to: strip_token_from_path(request.url))%> first.)
+    <%= link_to(arvados_api_client.arvados_login_url(return_to: strip_token_from_path(request.url)),
+                {class: "btn btn-primary report-issue-modal-window"}) do %>
+      <i class="fa fa-fw fa-sign-in"></i> Log in
+    <% end %>
+    to view private data.
   </p>
 
 <% elsif class_name %>
index 2e449b79d718ef53d7c7e507f46509867447ee2d..d9573a210bfcc6c06b0a9546eb6214fb5ddd13bf 100644 (file)
@@ -1,21 +1,31 @@
+<%
+   popup_params = {
+     popup_type: 'report',
+     current_location: request.url,
+     current_path: request.fullpath,
+     action_method: 'post',
+   }
+   if error_type == "api"
+     popup_params.merge!(
+       api_error_request_url: api_error.andand.request_url || "",
+       api_error_response: api_error.andand.api_response || "",
+     )
+   else
+     popup_params.merge!(error_message: error_message)
+   end
+%>
+
 <p>
-<br/><strong>If you suspect this is a bug, you can help us fix it by sending us a problem report:</strong><br/><br/>
-<% if error_type == 'api' %>
-  <%
-    api_request_url = api_error.andand.request_url ? api_error.request_url : ''
-    api_error_response = api_error.andand.api_response ? api_error.api_response : ''
-  %>
-  Send a problem report right here. <%= link_to report_issue_popup_path(popup_type: 'report', current_location: request.url, current_path: request.fullpath, action_method: 'post', api_error_request_url: api_request_url, api_error_response: api_error_response),
-        {class: 'btn btn-primary report-issue-modal-window', :remote => true, return_to: request.url} do %>
-        <i class="fa fa-fw fa-support"></i> Report problem
-  <% end %>
-<% else %>
-  Send a problem report right here. <%= link_to report_issue_popup_path(popup_type: 'report', current_location: request.url, current_path: request.fullpath, action_method: 'post', error_message: error_message),
-        {class: 'btn btn-primary report-issue-modal-window', :remote => true, return_to: request.url} do %>
-        <i class="fa fa-fw fa-support"></i> Report problem
-  <% end %>
+<%= link_to(report_issue_popup_path(popup_params),
+            {class: 'btn btn-primary report-issue-modal-window', :remote => true, return_to: request.url}) do %>
+  <i class="fa fa-fw fa-support"></i> Report problem
 <% end %>
-<% support_email = Rails.configuration.support_email_address%>
-<br/><br/>
-  If you prefer, send email to: <a href="mailto:<%=support_email%>?subject=Workbench problem report&amp;body=Problem while viewing page <%=request.url%>"><%=support_email%></a>
+
+or
+
+<%= mail_to(Rails.configuration.support_email_address, "email us",
+            subject: "Workbench problem report",
+            body: "Problem while viewing page #{request.url}") %>
+
+if you suspect this is a bug.
 </p>
index 3416cc0e61026c9ef5d4e7caee3baf4289095ca2..8fa9fe9a817e7f2e3b6494099b85afc53c05ac57 100644 (file)
@@ -239,7 +239,7 @@ class ProjectsControllerTest < ActionController::TestCase
     Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
     get(:show, {id: api_fixture('groups')['aproject']['uuid']})
     assert_response 404
-    assert_includes @response.inspect, 'you are not logged in'
+    assert_match(/log ?in/i, @response.body)
   end
 
   test "visit home page as anonymous when anonymous browsing is enabled and expect login" do