Skip to content

Commit

Permalink
Add helper copy to admin attachments interface
Browse files Browse the repository at this point in the history
Attachments don't work consistently across all formats. While
experienced publishers know this, we sometimes get support requests from
users confused as to why their attachments are not displaying.

This commit aims to improve the situation ever so slightly with some
copy.

Relevant Trello ticket (2ndline):
https://trello.com/c/XeE6aw32/156-improve-whitehall-publisher-attachment-copy
  • Loading branch information
Theodor Vararu committed May 24, 2016
1 parent a43d220 commit e044301
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/views/admin/attachments/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<% page_title "Attachments for #{attachment.attachable_model_name}" %>
<% page_class "attachments index" %>
<% is_publication = attachment.attachable_model_name == 'publication' %>

<div class="row">
<section class="col-md-8">
<h1>Attachments for <%= attachment.attachable_model_name %></h1>

<%= attachable_editing_tabs(attachable) do %>
<p class="qa-helper-copy">
<strong>Note:</strong>
<% if is_publication %>
Attachments added to a publication will appear automatically.
<% else %>
Attachments need to be referenced in the body markdown to appear in your document.
<% end %>
<p>
<ul class="actions list-unstyled">
<li>
<%= link_to 'Upload new file attachment', new_polymorphic_path([:admin, typecast_for_attachable_routing(attachable), Attachment]) %>
Expand Down
28 changes: 28 additions & 0 deletions test/integration/attachments_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'test_helper'
require 'capybara/rails'

class AttachmentsTest < ActionDispatch::IntegrationTest
include Capybara::DSL

setup do
login_as_admin
end

test 'displays attachment helper copy for non-publications' do
edition = create(:edition)
visit "/government/admin/editions/#{edition.id}/attachments"

within ".qa-helper-copy" do
assert_text "need to be referenced"
end
end

test 'displays different helper copy for publications' do
publication = create(:publication)
visit "/government/admin/editions/#{publication.id}/attachments"

within ".qa-helper-copy" do
assert_text "will appear automatically"
end
end
end

0 comments on commit e044301

Please sign in to comment.