##// END OF EJS Templates
Fixed: Login page should not show projects link and search box if authentication is required (#3715)....
Jean-Philippe Lang -
r4887:e41b76b45953
parent child
Show More
@@ -1,79 +1,81
1 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
3 3 <head>
4 4 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5 5 <title><%=h html_title %></title>
6 6 <meta name="description" content="<%= Redmine::Info.app_name %>" />
7 7 <meta name="keywords" content="issue,bug,tracker" />
8 8 <%= favicon %>
9 9 <%= stylesheet_link_tag 'application', :media => 'all' %>
10 10 <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
11 11 <%= javascript_heads %>
12 12 <%= heads_for_theme %>
13 13 <%= heads_for_wiki_formatter %>
14 14 <!--[if IE 6]>
15 15 <style type="text/css">
16 16 * html body{ width: expression( document.documentElement.clientWidth < 900 ? '900px' : '100%' ); }
17 17 body {behavior: url(<%= stylesheet_path "csshover.htc" %>);}
18 18 </style>
19 19 <![endif]-->
20 20 <%= call_hook :view_layouts_base_html_head %>
21 21 <!-- page specific tags -->
22 22 <%= yield :header_tags -%>
23 23 </head>
24 24 <body class="<%=h body_css_classes %>">
25 25 <div id="wrapper">
26 26 <div id="wrapper2">
27 27 <div id="top-menu">
28 28 <div id="account">
29 29 <%= render_menu :account_menu -%>
30 30 </div>
31 31 <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}", :id => 'loggedas') if User.current.logged? %>
32 <%= render_menu :top_menu -%>
32 <%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
33 33 </div>
34 34
35 35 <div id="header">
36 <% if User.current.logged? || !Setting.login_required? %>
36 37 <div id="quick-search">
37 38 <% form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %>
38 39 <%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %>
39 40 <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>:
40 41 <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %>
41 42 <% end %>
42 43 <%= render_project_jump_box %>
43 44 </div>
45 <% end %>
44 46
45 47 <h1><%= page_header_title %></h1>
46 48
47 49 <% if display_main_menu?(@project) %>
48 50 <div id="main-menu">
49 51 <%= render_main_menu(@project) %>
50 52 </div>
51 53 <% end %>
52 54 </div>
53 55
54 56 <%= tag('div', {:id => 'main', :class => (has_content?(:sidebar) ? '' : 'nosidebar')}, true) %>
55 57 <div id="sidebar">
56 58 <%= yield :sidebar %>
57 59 <%= call_hook :view_layouts_base_sidebar %>
58 60 </div>
59 61
60 62 <div id="content">
61 63 <%= render_flash_messages %>
62 64 <%= yield %>
63 65 <%= call_hook :view_layouts_base_content %>
64 66 <div style="clear:both;"></div>
65 67 </div>
66 68 </div>
67 69
68 70 <div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
69 71
70 72 <div id="footer">
71 73 <div class="bgl"><div class="bgr">
72 74 Powered by <%= link_to Redmine::Info.app_name, Redmine::Info.url %> &copy; 2006-2011 Jean-Philippe Lang
73 75 </div></div>
74 76 </div>
75 77 </div>
76 78 </div>
77 79 <%= call_hook :view_layouts_base_body_bottom %>
78 80 </body>
79 81 </html>
@@ -1,24 +1,40
1 1 require File.expand_path('../../test_helper', __FILE__)
2 2
3 3 class LayoutTest < ActionController::IntegrationTest
4 4 fixtures :all
5 5
6 6 test "browsing to a missing page should render the base layout" do
7 7 get "/users/100000000"
8 8
9 9 assert_response :not_found
10 10
11 11 # UsersController uses the admin layout by default
12 12 assert_select "#admin-menu", :count => 0
13 13 end
14 14
15 15 test "browsing to an unauthorized page should render the base layout" do
16 16 change_user_password('miscuser9', 'test')
17 17
18 18 log_user('miscuser9','test')
19 19
20 20 get "/admin"
21 21 assert_response :forbidden
22 22 assert_select "#admin-menu", :count => 0
23 23 end
24
25 def test_top_menu_and_search_not_visible_when_login_required
26 with_settings :login_required => '1' do
27 get '/'
28 assert_select "#top-menu > ul", 0
29 assert_select "#quick-search", 0
30 end
31 end
32
33 def test_top_menu_and_search_visible_when_login_not_required
34 with_settings :login_required => '0' do
35 get '/'
36 assert_select "#top-menu > ul"
37 assert_select "#quick-search"
38 end
39 end
24 40 end
General Comments 0
You need to be logged in to leave comments. Login now