diff --git a/app/assets/stylesheets/sortable_table.scss b/app/assets/stylesheets/sortable_table.scss index bd4641d1c..9ecc76312 100644 --- a/app/assets/stylesheets/sortable_table.scss +++ b/app/assets/stylesheets/sortable_table.scss @@ -1,5 +1,16 @@ /* table sorting styles */ +.publication-table-title { + margin-bottom: 0; + margin-top: 0; + line-height: 1.3; + font-size: 16px; +} + +.publication-table-date { + white-space: nowrap; +} + th .sortable { background-image: url("/assets/bg.gif"); cursor: pointer; diff --git a/app/views/root/_amends_needed.html.erb b/app/views/root/_amends_needed.html.erb index 0f1ce68c1..966cc9de1 100644 --- a/app/views/root/_amends_needed.html.erb +++ b/app/views/root/_amends_needed.html.erb @@ -3,13 +3,9 @@ <%= sortable "_type", "Format" %> <%= sortable "title" %> - <%= sortable "slug" %> <%= sortable "updated_at", "Updated" %> <%= sortable "assignee", "Assigned to" %> <%= sortable "creator", "Created by" %> - <%= sortable "section" %> - Edit - Preview diff --git a/app/views/root/_archived.html.erb b/app/views/root/_archived.html.erb index b8e416cfe..0fdde6aae 100644 --- a/app/views/root/_archived.html.erb +++ b/app/views/root/_archived.html.erb @@ -3,16 +3,11 @@ <%= sortable "_type", "Format" %> <%= sortable "title" %> - <%= sortable "slug" %> <%= sortable "updated_at", "Updated" %> <%= sortable "assignee", "Assigned to" %> <%= sortable "creator", "Created by" %> - <%= sortable "section" %> <%= sortable "archiver", "Archived by" %> - View - Edit - New - Preview + Actions diff --git a/app/views/root/_drafts.html.erb b/app/views/root/_drafts.html.erb index 078c5d28d..57711cb66 100644 --- a/app/views/root/_drafts.html.erb +++ b/app/views/root/_drafts.html.erb @@ -3,13 +3,9 @@ <%= sortable "_type", "Format" %> <%= sortable "title" %> - <%= sortable "slug" %> <%= sortable "updated_at", "Updated" %> <%= sortable "assignee", "Assigned to" %> <%= sortable "creator", "Created by" %> - <%= sortable "section" %> - Edit - Preview diff --git a/app/views/root/_fact_check_received.html.erb b/app/views/root/_fact_check_received.html.erb index c70a6fa1d..90de1b6c8 100644 --- a/app/views/root/_fact_check_received.html.erb +++ b/app/views/root/_fact_check_received.html.erb @@ -3,13 +3,9 @@ <%= sortable "_type", "Format" %> <%= sortable "title" %> - <%= sortable "slug" %> <%= sortable "updated_at", "Updated" %> <%= sortable "assignee", "Assigned to" %> <%= sortable "creator", "Created by" %> - <%= sortable "section" %> - Edit - Preview diff --git a/app/views/root/_in_review.html.erb b/app/views/root/_in_review.html.erb index 9205d0330..0e2f4c6d5 100644 --- a/app/views/root/_in_review.html.erb +++ b/app/views/root/_in_review.html.erb @@ -3,13 +3,9 @@ <%= sortable "_type", "Format" %> <%= sortable "title" %> - <%= sortable "slug" %> <%= sortable "updated_at", "Updated" %> <%= sortable "assignee", "Assigned to" %> <%= sortable "creator", "Created by" %> - <%= sortable "section", "Section" %> - Edit - Preview diff --git a/app/views/root/_out_for_fact_check.html.erb b/app/views/root/_out_for_fact_check.html.erb index 65106bd3f..329eb228f 100644 --- a/app/views/root/_out_for_fact_check.html.erb +++ b/app/views/root/_out_for_fact_check.html.erb @@ -3,14 +3,10 @@ <%= sortable "format" %> <%= sortable "title" %> - <%= sortable "slug" %> <%= sortable "updated_at", "Updated" %> <%= sortable "last_fact_checked_at", "Sent Out" %> <%= sortable "assignee", "Assigned to" %> <%= sortable "creator", "Created by" %> - <%= sortable "section" %> - Edit - Preview diff --git a/app/views/root/_publication.html.erb b/app/views/root/_publication.html.erb index e6cd076e2..eb6015697 100644 --- a/app/views/root/_publication.html.erb +++ b/app/views/root/_publication.html.erb @@ -3,15 +3,20 @@ <%= publication.format.underscore.humanize %> - <%= publication.admin_list_title %> +

+ <%= link_to publication.admin_list_title, edition_path(publication), title: "Edit edition #{publication.version_number}" %> +

- <% if tab && (tab == :published || tab == :archived) %> - (Ed.<%= publication.version_number %>) - <% if publication.subsequent_siblings.first.present? %> - (Ed.<%= publication.subsequent_siblings.first.version_number %> in <%= publication.subsequent_siblings.first.state.humanize.downcase %>) - <% end%> + <% if publication.safe_to_preview? %> + <%= link_to "/#{publication.slug}", preview_edition_path(publication), class: 'link-muted' %> <% else %> - (Ed. <%= publication.version_number %>) + <%= publication.slug %> + <% end %> + + · #<%= publication.version_number %> + <% if tab && (tab == :published || tab == :archived) && publication.subsequent_siblings.first.present? %> + – #<%= publication.subsequent_siblings.first.version_number %> in <%= publication.subsequent_siblings.first.state.humanize.downcase %> + <% end %> <% if publication.has_video? %> @@ -23,65 +28,40 @@ <% end %> - <%= publication.slug %> - - - <%= timestamp(publication.updated_at) %> + <% if tab && tab == :fact_check %> - <%= timestamp(publication.last_fact_checked_at) %> + <% end %> <% if tab && tab == :scheduled_for_publishing %> - <%= timestamp(publication.publish_at) %> + <% end %> <%= publication.assignee %> - - <%= publication.creator %> - - - <%= publication.artefact.section %> - - <% if tab && tab == :archived %> + + <%= publication.creator %> + + <% if tab && tab == :archived %> <%= publication.archiver %> - - <%= link_to publication_front_end_path(publication) do %> - - <% end %> - - <% end %> - <% if tab && [:archived, :scheduled_for_publishing].include?(tab) %> - - <%= link_to edition_path(publication) do %> - + + <% if publication.can_create_new_edition? %> + <%= link_to 'Create new edition', duplicate_edition_path(publication), class: 'btn btn-default', method: :post %> + <% else %> + <%= link_to 'Edit newer edition', edition_path(publication.in_progress_sibling), html_options = { "class" => "btn btn-info"} %> <% end %> - <% end %> - <% if tab && tab != :scheduled_for_publishing %> - - <% if tab and tab == :archived and publication.can_create_new_edition? %> - <%= link_to 'Create new edition of this publication', duplicate_edition_path(publication), class: 'btn btn-default btn-sm', method: :post %> - <% else %> - <%= link_to edition_path(publication) do %> - - <% end %> - <% end %> - <% end %> - - <% if publication.safe_to_preview? %> - <%= link_to preview_edition_path(publication), {:class => 'preview'} do %> - - <% end %> - <% else %> - - <% end %> - diff --git a/app/views/root/_published.html.erb b/app/views/root/_published.html.erb index ee4d066b9..23876bd0e 100644 --- a/app/views/root/_published.html.erb +++ b/app/views/root/_published.html.erb @@ -3,16 +3,11 @@ <%= sortable "_type", "Format" %> <%= sortable "title" %> - <%= sortable "slug" %> <%= sortable "updated_at", "Updated" %> <%= sortable "assignee", "Assigned to" %> <%= sortable "creator", "Created by" %> - <%= sortable "section" %> <%= sortable "publisher", "Published by" %> - View - Edit - New - Preview + Actions diff --git a/app/views/root/_published_edition.html.erb b/app/views/root/_published_edition.html.erb index 941cf4704..8c1197e33 100644 --- a/app/views/root/_published_edition.html.erb +++ b/app/views/root/_published_edition.html.erb @@ -3,28 +3,29 @@ <%= publication.format.underscore.humanize %> -

- <%= publication.admin_list_title %> +

+ <%= link_to publication.admin_list_title, "/editions/#{publication.id}", title: "Locked view for this publication" %> +

- — Ed. <%= publication.version_number %> - <% unless publication.can_create_new_edition? %> - (Ed. <%= publication.sibling_in_progress %> in draft) - <% end %> + <%= link_to "/#{publication.slug}", publication_front_end_path(publication), class: 'link-muted', title: 'View this publication' %> - <% if publication.has_video? %> - - <% end %> + · #<%= publication.version_number %> + <% unless publication.can_create_new_edition? %> + – <%= link_to "##{publication.sibling_in_progress} in draft", edition_path(publication.in_progress_sibling), class: 'link-inherit' %> + <% end %> - <% if publication.in_beta? %> - beta - <% end %> -

- - - <%= publication.slug %> + <% if publication.has_video? %> + + <% end %> + + <% if publication.in_beta? %> + beta + <% end %> - <%= timestamp(publication.updated_at) %> + <%= publication.assignee %> @@ -32,33 +33,14 @@ <%= publication.creator %> - - <%= publication.artefact.section %> - <%= publication.publisher %> - - <%= link_to publication_front_end_path(publication) do %> - - <% end %> - - - <%#edition_path(publication) %> - <%= link_to "/editions/#{publication.id}" do %> - - <% end %> - - + <% if publication.can_create_new_edition? %> - <%= link_to 'Create new edition of this publication', duplicate_edition_path(publication), class: 'btn btn-default btn-sm', method: :post %> + <%= link_to 'Create new edition', duplicate_edition_path(publication), class: 'btn btn-default', method: :post %> <% else %> - <%= link_to 'Edit existing newer edition', edition_path(publication.in_progress_sibling), html_options = { "class" => ""} %> - <% end %> - - - <%= link_to preview_edition_path(publication) do %> - + <%= link_to 'Edit newer edition', edition_path(publication.in_progress_sibling), html_options = { "class" => "btn btn-info"} %> <% end %> diff --git a/app/views/root/_ready.html.erb b/app/views/root/_ready.html.erb index bd12e3ac4..edf315b02 100644 --- a/app/views/root/_ready.html.erb +++ b/app/views/root/_ready.html.erb @@ -3,13 +3,9 @@ <%= sortable "_type", "Format" %> <%= sortable "title" %> - <%= sortable "slug" %> <%= sortable "updated_at", "Updated" %> <%= sortable "assignee", "Assigned to" %> <%= sortable "creator", "Created by" %> - <%= sortable "section" %> - Edit - Preview diff --git a/app/views/root/_scheduled_for_publishing.html.erb b/app/views/root/_scheduled_for_publishing.html.erb index 4bd7597f2..83856025a 100644 --- a/app/views/root/_scheduled_for_publishing.html.erb +++ b/app/views/root/_scheduled_for_publishing.html.erb @@ -3,14 +3,10 @@ <%= sortable "_type", "Format" %> <%= sortable "title" %> - <%= sortable "slug" %> <%= sortable "updated_at", "Updated" %> <%= sortable "publish_at", "Scheduled" %> <%= sortable "assignee", "Assigned to" %> <%= sortable "creator", "Created by" %> - <%= sortable "section" %> - Edit - Preview diff --git a/app/views/shared/_metadata.html.erb b/app/views/shared/_metadata.html.erb index 2f677c3c2..801ecf282 100644 --- a/app/views/shared/_metadata.html.erb +++ b/app/views/shared/_metadata.html.erb @@ -1,9 +1,12 @@
- <% publication.attributes.slice('slug', 'section', 'department', 'kind').each do |key, value| %> + <% publication.attributes.slice('slug', 'department', 'kind').each do |key, value| %> <%= content_tag :label, key.humanize, for: key %> <%= text_field_tag key, value, class: "form-control add-bottom-margin", disabled: 'disabled' %> <% end %> + + <%= content_tag :label, 'Section', for: 'section' %> + <%= text_field_tag 'section', publication.artefact.section, class: "form-control add-bottom-margin", disabled: 'disabled' %>
<%= link_to "Edit in Panopticon", panopticon_edit_url(publication), :class => "btn btn-primary" %> diff --git a/test/integration/edition_scheduled_publishing_test.rb b/test/integration/edition_scheduled_publishing_test.rb index 4359594c9..132ecfb11 100644 --- a/test/integration/edition_scheduled_publishing_test.rb +++ b/test/integration/edition_scheduled_publishing_test.rb @@ -43,7 +43,7 @@ def teardown edition.reload assert page.has_content? edition.title - assert page.has_content? edition.publish_at.strftime('%d/%m/%Y %H:%M') + assert page.has_content? edition.publish_at.to_s(:govuk_date_short) end test "should allow a scheduled edition to be published now" do diff --git a/test/integration/edition_workflow_test.rb b/test/integration/edition_workflow_test.rb index dd7644712..d3b8cf5d8 100644 --- a/test/integration/edition_workflow_test.rb +++ b/test/integration/edition_workflow_test.rb @@ -286,7 +286,7 @@ def get_to_fact_check(guide, owner) guide = FactoryGirl.create(:guide_edition, state: 'published') filter_for "All" view_filtered_list "Published" - click_on "Create new edition of this publication" + click_on "Create new edition" assert page.has_content? "New edition created" end @@ -316,13 +316,13 @@ def get_to_fact_check(guide, owner) filter_for "All" view_filtered_list "Published" - # Simulate that someone has clicked on 'Create new edition of this publication' + # Simulate that someone has clicked on 'Create new edition' # while current user has been viewing the list of published editions new_edition = guide.build_clone(GuideEdition) new_edition.save # Current user now decides to click the button - click_on "Create new edition of this publication" + click_on "Create new edition" assert page.has_content?("Another person has created a newer edition") assert page.has_content?("Status: Published") diff --git a/test/integration/mark_edition_in_beta_test.rb b/test/integration/mark_edition_in_beta_test.rb index 8aa605f59..c188de475 100644 --- a/test/integration/mark_edition_in_beta_test.rb +++ b/test/integration/mark_edition_in_beta_test.rb @@ -17,7 +17,9 @@ class MarkEditionInBetaTest < JavascriptIntegrationTest assert find('#edition_in_beta').checked? visit "/?user_filter=all" - assert page.has_text?("#{edition.title} (Ed. 1) beta") + assert page.has_text?("#{edition.title}") + assert page.has_text?('#1 beta') + assert page.has_css? "#publication-list-container table tbody tr", count: 1 end should "allow marking an edition as not in beta" do