Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Stop displaying attachment filename.

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...
commit 68ca1230f6dbc3eaf05357a320e5a40fb159b819 1 parent 9365827
@floehopper floehopper authored
View
1  app/views/documents/_attachments.html.erb
@@ -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>
View
2  features/step_definitions/consultation_steps.rb
@@ -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"
View
14 features/step_definitions/publication_steps.rb
@@ -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
@@ -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"
@@ -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"
@@ -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
View
4 features/step_definitions/supporting_page_steps.rb
@@ -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"
@@ -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
View
4 test/support/document_controller_test_helpers.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.