Commit 8c2a15631a0af09273e2061376dd0111243990a1
Committed by
Antonio Terceiro
1 parent
747e360f
Exists in
master
and in
29 other branches
ActionItem907: put name of profile and title of article on page title
Showing
2 changed files
with
26 additions
and
6 deletions
Show diff stats
app/views/layouts/application.rhtml
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="<%= html_language %>" lang="<%= html_language %>"> |
3 | 3 | <head> |
4 | - <title> | |
5 | - <%= @environment.name() %> | |
6 | - <%- if @category -%> | |
7 | - → <%= @category.full_name -%> | |
8 | - <%- end -%> | |
9 | - </title> | |
4 | + <title><%= | |
5 | + (@page ? @page.name + ' - ' : '') + | |
6 | + (@profile ? @profile.name + ' - ' : '') + | |
7 | + @environment.name + | |
8 | + (@category ? "→ #{@category.full_name}" : '') | |
9 | + %></title> | |
10 | 10 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
11 | 11 | <meta name="description" content="FIXME: Descriptions of Noosfero" /> |
12 | 12 | <meta name="keywords" content="Noosfero, Community, Open Source" /> | ... | ... |
test/functional/application_controller_test.rb
... | ... | @@ -388,4 +388,24 @@ class ApplicationControllerTest < Test::Unit::TestCase |
388 | 388 | assert_no_tag :tag => 'a', :content => /Category 2/ |
389 | 389 | end |
390 | 390 | |
391 | + should 'show name of article as title of page' do | |
392 | + p = create_user('test_user').person | |
393 | + a = p.articles.create!(:name => 'test article') | |
394 | + | |
395 | + @controller.instance_variable_set('@profile', p) | |
396 | + @controller.instance_variable_set('@page', a) | |
397 | + | |
398 | + get :index | |
399 | + assert_tag 'title', :content => 'test article - ' + p.name + ' - ' + p.environment.name | |
400 | + end | |
401 | + | |
402 | + should 'diplay name of profile in the title' do | |
403 | + p = create_user('test_user').person | |
404 | + p.name = 'Some Test User' | |
405 | + p.save! | |
406 | + @controller.instance_variable_set('@profile', p) | |
407 | + | |
408 | + get :index, :profile => p.identifier | |
409 | + assert_tag 'title', :content => p.name + ' - ' + p.environment.name | |
410 | + end | |
391 | 411 | end | ... | ... |