Commit 685e99136b15e2d7e5a2d90267f80a80a8d8b373
1 parent
ff4e90f8
Exists in
master
and in
23 other branches
Displaying image title at <title> tag
ActionItem1416 (fixed live at Noosfero fisl11 talk)
Showing
6 changed files
with
26 additions
and
3 deletions
Show diff stats
app/helpers/application_helper.rb
| ... | ... | @@ -901,7 +901,7 @@ module ApplicationHelper |
| 901 | 901 | end |
| 902 | 902 | |
| 903 | 903 | def page_title |
| 904 | - (@page ? @page.name + ' - ' : '') + | |
| 904 | + (@page ? @page.title + ' - ' : '') + | |
| 905 | 905 | (profile ? profile.short_name + ' - ' : '') + |
| 906 | 906 | (@topic ? @topic.title + ' - ' : '') + |
| 907 | 907 | (@section ? @section.title + ' - ' : '') + | ... | ... |
app/helpers/content_viewer_helper.rb
app/models/uploaded_file.rb
| ... | ... | @@ -5,6 +5,11 @@ |
| 5 | 5 | class UploadedFile < Article |
| 6 | 6 | |
| 7 | 7 | settings_items :title, :type => 'string' |
| 8 | + def title_with_default | |
| 9 | + title_without_default || name | |
| 10 | + end | |
| 11 | + alias_method_chain :title, :default | |
| 12 | + | |
| 8 | 13 | validates_size_of :title, :maximum => 60, :if => (lambda { |file| !file.title.blank? }) |
| 9 | 14 | |
| 10 | 15 | def display_title | ... | ... |
features/gallery_navigation.feature
| ... | ... | @@ -63,3 +63,12 @@ Feature: gallery_navigation |
| 63 | 63 | Then I should see "Go back to my-gallery" |
| 64 | 64 | When I follow "Go back to my-gallery" |
| 65 | 65 | Then I should be on /marciopunk/my-gallery |
| 66 | + | |
| 67 | + Scenario: image title in window title | |
| 68 | + Given I am logged in as "marciopunk" | |
| 69 | + And I go to /marciopunk/my-gallery/rails.png?view=true | |
| 70 | + When I follow "Edit" | |
| 71 | + And I fill in "Title" with "Rails is cool" | |
| 72 | + And I press "Save" | |
| 73 | + And I go to /marciopunk/my-gallery/rails.png?view=true | |
| 74 | + And The page title should contain "Rails is cool" | ... | ... |
features/step_definitions/noosfero_steps.rb
test/unit/uploaded_file_test.rb
| ... | ... | @@ -143,4 +143,11 @@ class UploadedFileTest < Test::Unit::TestCase |
| 143 | 143 | assert_equal 'test.txt', upload.display_title |
| 144 | 144 | end |
| 145 | 145 | |
| 146 | + should 'use name as title by default' do | |
| 147 | + upload = UploadedFile.new | |
| 148 | + upload.stubs(:name).returns('test.txt') | |
| 149 | + | |
| 150 | + assert_equal 'test.txt', upload.title | |
| 151 | + end | |
| 152 | + | |
| 146 | 153 | end | ... | ... |