diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-07 20:52:45 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-07 20:52:45 +0000 |
commit | 7e4611ad318092457a16e5197957f3e77d0dc337 (patch) | |
tree | cd9f83f173dce14a62dd88dbc9fb29c63b798937 | |
parent | fdf842a4c458b9f40c233bda221ff241df8eb108 (diff) | |
download | redmine-7e4611ad318092457a16e5197957f3e77d0dc337.tar.gz redmine-7e4611ad318092457a16e5197957f3e77d0dc337.zip |
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
-rw-r--r-- | app/controllers/application.rb | 2 | ||||
-rw-r--r-- | app/controllers/issues_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/search_controller.rb | 1 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 12 | ||||
-rw-r--r-- | app/views/common/403.rhtml | 2 | ||||
-rw-r--r-- | app/views/common/404.rhtml | 2 | ||||
-rw-r--r-- | app/views/issues/show.rhtml | 2 | ||||
-rw-r--r-- | app/views/layouts/base.rhtml | 2 | ||||
-rw-r--r-- | app/views/projects/list_issues.rhtml | 2 | ||||
-rw-r--r-- | app/views/wiki/edit.rhtml | 2 | ||||
-rw-r--r-- | app/views/wiki/show.rhtml | 2 |
12 files changed, 25 insertions, 6 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 9a7096728..7d4a8950f 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -123,14 +123,12 @@ class ApplicationController < ActionController::Base end def render_403 - @html_title = "403" @project = nil render :template => "common/403", :layout => true, :status => 403 return false end def render_404 - @html_title = "404" render :template => "common/404", :layout => true, :status => 404 return false end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b83d950ea..4bd359c89 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -169,7 +169,6 @@ private def find_project @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category]) @project = @issue.project - @html_title = "#{@project.name} - #{@issue.tracker.name} ##{@issue.id}" rescue ActiveRecord::RecordNotFound render_404 end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 63cf8a0d1..0acd64009 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -631,7 +631,6 @@ private # Used as a before_filter def find_project @project = Project.find(params[:id]) - @html_title = @project.name rescue ActiveRecord::RecordNotFound render_404 end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 2a3fe4f7c..01e78dc02 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -78,7 +78,6 @@ class SearchController < ApplicationController private def find_project @project = Project.find(params[:id]) - @html_title = @project.name rescue ActiveRecord::RecordNotFound render_404 end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 91594529b..794c6a63c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -101,6 +101,18 @@ module ApplicationHelper html 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 def textilizable(text, options = {}) return "" if text.blank? diff --git a/app/views/common/403.rhtml b/app/views/common/403.rhtml index 138c1a2f9..d2d03f811 100644 --- a/app/views/common/403.rhtml +++ b/app/views/common/403.rhtml @@ -2,3 +2,5 @@ <p><%= l(:notice_not_authorized) %></p> <p><a href="javascript:history.back()">Back</a></p> + +<% set_html_title '403' %> diff --git a/app/views/common/404.rhtml b/app/views/common/404.rhtml index a1a11c32c..080b04842 100644 --- a/app/views/common/404.rhtml +++ b/app/views/common/404.rhtml @@ -2,3 +2,5 @@ <p><%= l(:notice_file_not_found) %></p> <p><a href="javascript:history.back()">Back</a></p> + +<% set_html_title '404' %> diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index 3df53e288..59bf9eaed 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -109,3 +109,5 @@ end %> <%= l(:label_export_to) %><%= link_to 'PDF', {:action => 'export_pdf', :id => @issue}, :class => 'icon icon-pdf' %> </div> + +<% set_html_title "#{@issue.tracker.name} ##{@issue.id}" %> diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index acce89d44..eae5cf570 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -1,7 +1,7 @@ <!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"> <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 name="description" content="<%= Redmine::Info.app_name %>" /> <meta name="keywords" content="issue,bug,tracker" /> diff --git a/app/views/projects/list_issues.rhtml b/app/views/projects/list_issues.rhtml index d85cca4a9..8d6a91bcc 100644 --- a/app/views/projects/list_issues.rhtml +++ b/app/views/projects/list_issues.rhtml @@ -4,6 +4,7 @@ <% if authorize_for('projects', 'add_issue') %>| <%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %> </div> <h2><%=l(:label_issue_plural)%></h2> + <% set_html_title l(:label_issue_plural) %> <% form_tag({:action => 'list_issues'}, :id => 'query_form') do %> <%= render :partial => 'queries/filters', :locals => {:query => @query} %> @@ -37,6 +38,7 @@ <% if authorize_for('projects', 'add_issue') %>| <%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %> </div> <h2><%= @query.name %></h2> + <% set_html_title @query.name %> <% end %> <%= error_messages_for 'query' %> <% if @query.valid? %> diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml index 7579527c8..8ebd98693 100644 --- a/app/views/wiki/edit.rhtml +++ b/app/views/wiki/edit.rhtml @@ -31,3 +31,5 @@ <% content_for :header_tags do %> <%= stylesheet_link_tag 'scm' %> <% end %> + +<% set_html_title @page.pretty_title %> diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml index 31c4b60ce..4041ec018 100644 --- a/app/views/wiki/show.rhtml +++ b/app/views/wiki/show.rhtml @@ -41,3 +41,5 @@ <% content_for :header_tags do %> <%= stylesheet_link_tag 'scm' %> <% end %> + +<% set_html_title @page.pretty_title %> |