3642: display search box in topnav only to active users
authorradhika <radhika@curoverse.com>
Mon, 25 Aug 2014 18:32:46 +0000 (14:32 -0400)
committerradhika <radhika@curoverse.com>
Mon, 25 Aug 2014 18:32:46 +0000 (14:32 -0400)
apps/workbench/app/views/layouts/body.html.erb
apps/workbench/test/integration/search_box_test.rb

index 3f95be35de925582c7de0b33083baf3bae44db42..8645e599ddd2d44aae01e983d342fc4b714f8981 100644 (file)
@@ -18,6 +18,7 @@
           </li>
 
           <% if current_user %>
+          <% if current_user.is_active %>
           <li>
             <form class="navbar-form" role="search"
                        data-search-modal=
@@ -36,6 +37,7 @@
               </div>
             </form>
           </li>
+          <% end %>
 
           <li class="dropdown notification-menu">
             <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="notifications-menu">
index dcdce155fc2c48709cff260b080e4ad3927a9b8c..663e3f118f05b375c9314d963fbef2fb7ce42cc3 100644 (file)
@@ -14,6 +14,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     if user && user['is_active']
       # let's search for a valid uuid
       within('.navbar-fixed-top') do
+        page.has_field?('search')
         page.find_field('search').set user['uuid']
         page.find('.glyphicon-search').click
       end
@@ -78,10 +79,17 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       # seeing "Unrestricted public data" now
       assert page.has_text?(publicly_accessible_project['name']), 'No text - publicly accessible project name'
       assert page.has_text?(publicly_accessible_project['description']), 'No text - publicly accessible project description'
+    else
+      within('.navbar-fixed-top') do
+        page.has_no_field?('search')
+      end
     end
   end
 
   [
+    [nil, nil],
+    ['inactive', api_fixture('users')['inactive']],
+    ['inactive_uninvited', api_fixture('users')['inactive_uninvited']],
     ['active', api_fixture('users')['active']],
     ['admin', api_fixture('users')['admin']],
   ].each do |token, user|