]> source.dussan.org Git - redmine.git/commitdiff
Fixed: Login page should not show projects link and search box if authentication...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 4 Mar 2011 15:14:24 +0000 (15:14 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 4 Mar 2011 15:14:24 +0000 (15:14 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5007 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/layouts/base.rhtml
test/integration/layout_test.rb

index 017fcc1739b0f1c5612893d9413b80865103ec24..fda4e2954c4b39a7ba06fc77612c6a23b273a30e 100644 (file)
         <%= render_menu :account_menu -%>
     </div>
     <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}", :id => 'loggedas') if User.current.logged? %>
-    <%= render_menu :top_menu -%>
+    <%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
 </div>
       
 <div id="header">
+    <% if User.current.logged? || !Setting.login_required? %>
     <div id="quick-search">
         <% form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %>
         <%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %>
@@ -41,6 +42,7 @@
         <% end %>
         <%= render_project_jump_box %>
     </div>
+    <% end %>
     
     <h1><%= page_header_title %></h1>
     
index cb63716016844eeab9e868b55fdd8f2f79712a18..4e6f3d4d4a9766c651012b70cd18a285bb53deab 100644 (file)
@@ -21,4 +21,20 @@ class LayoutTest < ActionController::IntegrationTest
     assert_response :forbidden
     assert_select "#admin-menu", :count => 0
   end
+
+  def test_top_menu_and_search_not_visible_when_login_required
+    with_settings :login_required => '1' do
+      get '/'
+      assert_select "#top-menu > ul", 0
+      assert_select "#quick-search", 0
+    end
+  end
+
+  def test_top_menu_and_search_visible_when_login_not_required
+    with_settings :login_required => '0' do
+      get '/'
+      assert_select "#top-menu > ul"
+      assert_select "#quick-search"
+    end
+  end
 end