Skip to content

Commit

Permalink
Stop displaying attachment filename.
Browse files Browse the repository at this point in the history
We had a problem with long attachment filenames (without spaces) not
wrapping. Rather than fix the word wrapping problem, we decided to
no longer display the filename because, since we now have attachment
titles, it isn't very useful any more.
  • Loading branch information
floehopper committed Feb 3, 2012
1 parent 9365827 commit 68ca123
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion app/views/documents/_attachments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

<ul class="attachment_meta">
<li><strong>Title:</strong> <span class="attachment_title"><%= attachment.title %></span></li>
<li><strong>Name:</strong> <span class="filename"><%= attachment.filename %></span></li>
<li><strong>Type:</strong> <span class="type"><%= humanized_content_type(attachment.file_extension) %></span></li>
<% if attachment.number_of_pages.present? %>
<li><strong>No. of pages:</strong> <span class="number_of_pages"><%= pluralize(attachment.number_of_pages, "page") %></span></li>
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/consultation_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
select_date "Opening Date", with: 1.day.ago.to_s
select_date "Closing Date", with: 6.days.from_now.to_s
within ".attachments" do
fill_in "Title", with: "Home of the blizzard"
fill_in "Title", with: "Attachment Title"
attach_file "File", Rails.root.join("features/fixtures/attachment.pdf")
end
check "Wales"
Expand Down
14 changes: 7 additions & 7 deletions features/step_definitions/publication_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
end

Given /^a draft publication "([^"]*)" with a PDF attachment$/ do |title|
attachment = build(:attachment, file: pdf_attachment)
attachment = build(:attachment, file: pdf_attachment, title: "Attachment Title")
create(:draft_publication, title: title, attachments: [attachment])
end

Given /^a submitted publication "([^"]*)" with a PDF attachment$/ do |title|
attachment = build(:attachment, file: pdf_attachment)
attachment = build(:attachment, file: pdf_attachment, title: "Attachment Title")
create(:submitted_publication, title: title, attachments: [attachment])
end

Given /^a published publication "([^"]*)" with a PDF attachment$/ do |title|
attachment = build(:attachment, file: pdf_attachment)
attachment = build(:attachment, file: pdf_attachment, title: "Attachment Title")
create(:published_publication, title: title, attachments: [attachment])
end

Expand All @@ -23,7 +23,7 @@
select_date "Publication date", with: "2010-01-01"
file = pdf_attachment
within ".attachments" do
fill_in "Title", with: "There and back again"
fill_in "Title", with: "Attachment Title"
attach_file "File", file.path
end
click_button "Save"
Expand All @@ -34,7 +34,7 @@
begin_drafting_document type: 'publication', title: title
fill_in_publication_fields
within ".attachments" do
fill_in "Title", with: "The worst journey in the world"
fill_in "Title", with: "Attachment Title"
attach_file "File", Rails.root.join("features/fixtures/attachment.pdf")
end
check "Wales"
Expand Down Expand Up @@ -108,12 +108,12 @@
end

Then /^I should not see a link to the PDF attachment$/ do
assert page.has_no_css?(".attachment .filename", text: "attachment.pdf")
assert page.has_no_css?(".attachment .attachment_title", text: "Attachment Title")
assert page.has_no_css?(".attachment a[href*='attachment.pdf']", text: "Download attachment")
end

Then /^I should see a link to the PDF attachment$/ do
assert page.has_css?(".attachment .filename", text: "attachment.pdf")
assert page.has_css?(".attachment .attachment_title", text: "Attachment Title")
assert page.has_css?(".attachment a[href*='attachment.pdf']", text: "Download attachment")
end

Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/supporting_page_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
fill_in "Title", with: title
fill_in "Body", with: "Some supporting information"
within ".attachments" do
fill_in "Title", with: "Much ado about nothing"
fill_in "Title", with: "Attachment Title"
attach_file "File", Rails.root.join("features/fixtures/attachment.pdf")
end
click_button "Save"
Expand Down Expand Up @@ -89,7 +89,7 @@
Then /^I should see that the "([^"]*)" policy's "([^"]*)" supporting page has an attachment$/ do |title, supporting_title|
visit_document_preview title
click_link supporting_title
assert page.has_css?(".attachment .filename", text: "attachment.pdf")
assert page.has_css?(".attachment .attachment_title", text: "Attachment Title")
assert page.has_css?(".attachment a[href*='attachment.pdf']", text: "Download attachment")
end

Expand Down
4 changes: 2 additions & 2 deletions test/support/document_controller_test_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def should_display_attachments_for(document_type)
get :show, id: document.document_identity

assert_select_object(attachment_1) do
assert_select '.attachment .filename', text: attachment_1.filename
assert_select '.attachment .attachment_title', text: attachment_1.title
end
assert_select_object(attachment_2) do
assert_select '.attachment .filename', text: attachment_2.filename
assert_select '.attachment .attachment_title', text: attachment_2.title
end
end

Expand Down

0 comments on commit 68ca123

Please sign in to comment.