Commit 7e4611ad authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Removed @html_title assignments in controllers.

Views can now set the header title using set_htmh_title(title) method.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@715 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent fdf842a4
...@@ -123,14 +123,12 @@ class ApplicationController < ActionController::Base ...@@ -123,14 +123,12 @@ class ApplicationController < ActionController::Base
end end
def render_403 def render_403
@html_title = "403"
@project = nil @project = nil
render :template => "common/403", :layout => true, :status => 403 render :template => "common/403", :layout => true, :status => 403
return false return false
end end
def render_404 def render_404
@html_title = "404"
render :template => "common/404", :layout => true, :status => 404 render :template => "common/404", :layout => true, :status => 404
return false return false
end end
......
...@@ -169,7 +169,6 @@ private ...@@ -169,7 +169,6 @@ private
def find_project def find_project
@issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category]) @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category])
@project = @issue.project @project = @issue.project
@html_title = "#{@project.name} - #{@issue.tracker.name} ##{@issue.id}"
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end
......
...@@ -631,7 +631,6 @@ private ...@@ -631,7 +631,6 @@ private
# Used as a before_filter # Used as a before_filter
def find_project def find_project
@project = Project.find(params[:id]) @project = Project.find(params[:id])
@html_title = @project.name
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end
......
...@@ -78,7 +78,6 @@ class SearchController < ApplicationController ...@@ -78,7 +78,6 @@ class SearchController < ApplicationController
private private
def find_project def find_project
@project = Project.find(params[:id]) @project = Project.find(params[:id])
@html_title = @project.name
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end
......
...@@ -101,6 +101,18 @@ module ApplicationHelper ...@@ -101,6 +101,18 @@ module ApplicationHelper
html html
end end
def set_html_title(text)
@html_header_title = text
end
def html_title
title = []
title << @project.name if @project
title << @html_header_title
title << Setting.app_title
title.compact.join(' - ')
end
# format text according to system settings # format text according to system settings
def textilizable(text, options = {}) def textilizable(text, options = {})
return "" if text.blank? return "" if text.blank?
......
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
<p><%= l(:notice_not_authorized) %></p> <p><%= l(:notice_not_authorized) %></p>
<p><a href="javascript:history.back()">Back</a></p> <p><a href="javascript:history.back()">Back</a></p>
<% set_html_title '403' %>
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
<p><%= l(:notice_file_not_found) %></p> <p><%= l(:notice_file_not_found) %></p>
<p><a href="javascript:history.back()">Back</a></p> <p><a href="javascript:history.back()">Back</a></p>
<% set_html_title '404' %>
...@@ -109,3 +109,5 @@ end %> ...@@ -109,3 +109,5 @@ end %>
<%= l(:label_export_to) %><%= link_to 'PDF', {:action => 'export_pdf', :id => @issue}, :class => 'icon icon-pdf' %> <%= l(:label_export_to) %><%= link_to 'PDF', {:action => 'export_pdf', :id => @issue}, :class => 'icon icon-pdf' %>
</div> </div>
&nbsp; &nbsp;
<% set_html_title "#{@issue.tracker.name} ##{@issue.id}" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <head>
<title><%= Setting.app_title + (@html_title ? ": #{@html_title}" : "") %></title> <title><%=h html_title %></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="<%= Redmine::Info.app_name %>" /> <meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<% if authorize_for('projects', 'add_issue') %>| <%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %> <% if authorize_for('projects', 'add_issue') %>| <%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %>
</div> </div>
<h2><%=l(:label_issue_plural)%></h2> <h2><%=l(:label_issue_plural)%></h2>
<% set_html_title l(:label_issue_plural) %>
<% form_tag({:action => 'list_issues'}, :id => 'query_form') do %> <% form_tag({:action => 'list_issues'}, :id => 'query_form') do %>
<%= render :partial => 'queries/filters', :locals => {:query => @query} %> <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
...@@ -37,6 +38,7 @@ ...@@ -37,6 +38,7 @@
<% if authorize_for('projects', 'add_issue') %>| <%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %> <% if authorize_for('projects', 'add_issue') %>| <%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %>
</div> </div>
<h2><%= @query.name %></h2> <h2><%= @query.name %></h2>
<% set_html_title @query.name %>
<% end %> <% end %>
<%= error_messages_for 'query' %> <%= error_messages_for 'query' %>
<% if @query.valid? %> <% if @query.valid? %>
......
...@@ -31,3 +31,5 @@ ...@@ -31,3 +31,5 @@
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %> <%= stylesheet_link_tag 'scm' %>
<% end %> <% end %>
<% set_html_title @page.pretty_title %>
...@@ -41,3 +41,5 @@ ...@@ -41,3 +41,5 @@
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %> <%= stylesheet_link_tag 'scm' %>
<% end %> <% end %>
<% set_html_title @page.pretty_title %>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment