Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve table of publications design #268

Merged
merged 8 commits into from Oct 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions 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;
Expand Down
4 changes: 0 additions & 4 deletions app/views/root/_amends_needed.html.erb
Expand Up @@ -3,13 +3,9 @@
<tr class="table-header">
<th scope="col"><%= sortable "_type", "Format" %></th>
<th scope="col"><%= sortable "title" %></th>
<th scope="col"><%= sortable "slug" %></th>
<th scope="col"><%= sortable "updated_at", "Updated" %></th>
<th scope="col"><%= sortable "assignee", "Assigned to" %></th>
<th scope="col"><%= sortable "creator", "Created by" %></th>
<th scope="col"><%= sortable "section" %></th>
<th scope="col">Edit</th>
<th scope="col">Preview</th>
</tr>
</thead>
<tbody>
Expand Down
7 changes: 1 addition & 6 deletions app/views/root/_archived.html.erb
Expand Up @@ -3,16 +3,11 @@
<tr class="table-header">
<th scope="col"><%= sortable "_type", "Format" %></th>
<th scope="col"><%= sortable "title" %></th>
<th scope="col"><%= sortable "slug" %></th>
<th scope="col"><%= sortable "updated_at", "Updated" %></th>
<th scope="col"><%= sortable "assignee", "Assigned to" %></th>
<th scope="col"><%= sortable "creator", "Created by" %></th>
<th scope="col"><%= sortable "section" %></th>
<th scope="col"><%= sortable "archiver", "Archived by" %></th>
<th scope="col">View</th>
<th scope="col">Edit</th>
<th scope="col">New</th>
<th scope="col">Preview</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 0 additions & 4 deletions app/views/root/_drafts.html.erb
Expand Up @@ -3,13 +3,9 @@
<tr class="table-header">
<th scope="col"><%= sortable "_type", "Format" %></th>
<th scope="col"><%= sortable "title" %></th>
<th scope="col"><%= sortable "slug" %></th>
<th scope="col"><%= sortable "updated_at", "Updated" %></th>
<th scope="col"><%= sortable "assignee", "Assigned to" %></th>
<th scope="col"><%= sortable "creator", "Created by" %></th>
<th scope="col"><%= sortable "section" %></th>
<th scope="col">Edit</th>
<th scope="col">Preview</th>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 0 additions & 4 deletions app/views/root/_fact_check_received.html.erb
Expand Up @@ -3,13 +3,9 @@
<tr class="table-header">
<th scope="col"><%= sortable "_type", "Format" %></th>
<th scope="col"><%= sortable "title" %></th>
<th scope="col"><%= sortable "slug" %></th>
<th scope="col"><%= sortable "updated_at", "Updated" %></th>
<th scope="col"><%= sortable "assignee", "Assigned to" %></th>
<th scope="col"><%= sortable "creator", "Created by" %></th>
<th scope="col"><%= sortable "section" %></th>
<th scope="col">Edit</th>
<th scope="col">Preview</th>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 0 additions & 4 deletions app/views/root/_in_review.html.erb
Expand Up @@ -3,13 +3,9 @@
<tr class="table-header">
<th scope="col"><%= sortable "_type", "Format" %></th>
<th scope="col"><%= sortable "title" %></th>
<th scope="col"><%= sortable "slug" %></th>
<th scope="col"><%= sortable "updated_at", "Updated" %></th>
<th scope="col"><%= sortable "assignee", "Assigned to" %></th>
<th scope="col"><%= sortable "creator", "Created by" %></th>
<th scope="col"><%= sortable "section", "Section" %></th>
<th scope="col">Edit</th>
<th scope="col">Preview</th>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 0 additions & 4 deletions app/views/root/_out_for_fact_check.html.erb
Expand Up @@ -3,14 +3,10 @@
<tr class="table-header">
<th scope="col"><%= sortable "format" %></th>
<th scope="col"><%= sortable "title" %></th>
<th scope="col"><%= sortable "slug" %></th>
<th scope="col"><%= sortable "updated_at", "Updated" %></th>
<th scope="col"><%= sortable "last_fact_checked_at", "Sent Out" %></th>
<th scope="col"><%= sortable "assignee", "Assigned to" %></th>
<th scope="col"><%= sortable "creator", "Created by" %></th>
<th scope="col"><%= sortable "section" %></th>
<th scope="col">Edit</th>
<th scope="col">Preview</th>
</tr>
</thead>
<tbody>
Expand Down
80 changes: 30 additions & 50 deletions app/views/root/_publication.html.erb
Expand Up @@ -3,15 +3,20 @@
<%= publication.format.underscore.humanize %>
</td>
<td class="title">
<%= publication.admin_list_title %>
<h4 class="publication-table-title">
<%= link_to publication.admin_list_title, edition_path(publication), title: "Edit edition #{publication.version_number}" %>
</h4>

<% 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 %>)
<span class="text-muted"><%= publication.slug %></span>
<% end %>

<span class="text-muted"> &middot; <span data-toggle="tooltip" title="Edition <%= publication.version_number %>">#<%= publication.version_number %></span></span>
<% if tab && (tab == :published || tab == :archived) && publication.subsequent_siblings.first.present? %>
<span class="text-muted"> – #<%= publication.subsequent_siblings.first.version_number %> in <%= publication.subsequent_siblings.first.state.humanize.downcase %>
</span>
<% end %>

<% if publication.has_video? %>
Expand All @@ -23,65 +28,40 @@
<% end %>
</td>
<td>
<%= publication.slug %>
</td>
<td>
<%= timestamp(publication.updated_at) %>
<time class="publication-table-date" data-toggle="tooltip" datetime="<%= publication.updated_at %>" title="<%= publication.updated_at.to_s(:govuk_date) %>">
<%= publication.updated_at.to_date.to_s(:govuk_date_short) %>
</time>
</td>
<% if tab && tab == :fact_check %>
<td>
<%= timestamp(publication.last_fact_checked_at) %>
<time class="publication-table-date" data-toggle="tooltip" datetime="<%= publication.last_fact_checked_at %>" title="<%= publication.last_fact_checked_at.to_s(:govuk_date) %>">
<%= publication.last_fact_checked_at.to_date.to_s(:govuk_date_short) %>
</time>
</td>
<% end %>
<% if tab && tab == :scheduled_for_publishing %>
<td>
<%= timestamp(publication.publish_at) %>
<time class="publication-table-date" datetime="<%= publication.publish_at %>">
<%= publication.publish_at.to_s(:govuk_date_short) %>
</time>
</td>
<% end %>
<td>
<%= publication.assignee %>
</td>
<td>
<%= publication.creator %>
</td>
<td>
<%= publication.artefact.section %>
</td>
<% if tab && tab == :archived %>
<td>
<%= publication.creator %>
</td>
<% if tab && tab == :archived %>
<td>
<%= publication.archiver %>
</td>
<td class="icon">
<%= link_to publication_front_end_path(publication) do %>
<i class="glyphicon glyphicon-share-alt" title="View this publication"></i>
<% end %>
</td>
<% end %>
<% if tab && [:archived, :scheduled_for_publishing].include?(tab) %>
<td class="icon">
<%= link_to edition_path(publication) do %>
<i class="glyphicon glyphicon-lock" title="Locked view for this publication"></i>
<td>
<% 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 %>
</td>
<% end %>
<% if tab && tab != :scheduled_for_publishing %>
<td class="icon">
<% 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 %>
<i class="glyphicon glyphicon-edit" title="Edit this publication"></i>
<% end %>
<% end %>
</td>
<% end %>
<td class="icon">
<% if publication.safe_to_preview? %>
<%= link_to preview_edition_path(publication), {:class => 'preview'} do %>
<i class="glyphicon glyphicon-eye-open" title="Preview this publication"></i>
<% end %>
<% else %>
<i class="glyphicon glyphicon-ban-circle" title="Preview disabled for this publication"></i>
<% end %>
</td>
</tr>
7 changes: 1 addition & 6 deletions app/views/root/_published.html.erb
Expand Up @@ -3,16 +3,11 @@
<tr class="table-header">
<th scope="col"><%= sortable "_type", "Format" %></th>
<th scope="col"><%= sortable "title" %></th>
<th scope="col"><%= sortable "slug" %></th>
<th scope="col"><%= sortable "updated_at", "Updated" %></th>
<th scope="col"><%= sortable "assignee", "Assigned to" %></th>
<th scope="col"><%= sortable "creator", "Created by" %></th>
<th scope="col"><%= sortable "section" %></th>
<th scope="col"><%= sortable "publisher", "Published by" %></th>
<th scope="col">View</th>
<th scope="col">Edit</th>
<th scope="col">New</th>
<th scope="col">Preview</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
Expand Down
60 changes: 21 additions & 39 deletions app/views/root/_published_edition.html.erb
Expand Up @@ -3,62 +3,44 @@
<%= publication.format.underscore.humanize %>
</td>
<td>
<p>
<%= publication.admin_list_title %>
<h4 class="publication-table-title">
<%= link_to publication.admin_list_title, "/editions/#{publication.id}", title: "Locked view for this publication" %>
</h4>

&mdash; 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? %>
<i class="glyphicon glyphicon-film" alt="Has video"></i>
<% end %>
<span class="text-muted"> &middot; <span data-toggle="tooltip" title="Edition <%= publication.version_number %>">#<%= publication.version_number %></span></span>
<% unless publication.can_create_new_edition? %>
<span class="text-muted"> – <%= link_to "##{publication.sibling_in_progress} in draft", edition_path(publication.in_progress_sibling), class: 'link-inherit' %></span>
<% end %>

<% if publication.in_beta? %>
<span class="badge badge-beta">beta</span>
<% end %>
</p>
</td>
<td>
<%= publication.slug %>
<% if publication.has_video? %>
<i class="glyphicon glyphicon-film" alt="Has video"></i>
<% end %>

<% if publication.in_beta? %>
<span class="badge badge-beta">beta</span>
<% end %>
</td>
<td>
<%= timestamp(publication.updated_at) %>
<time class="publication-table-date" data-toggle="tooltip" datetime="<%= publication.updated_at %>" title="<%= publication.updated_at.to_s(:govuk_date) %>">
<%= publication.updated_at.to_date.to_s(:govuk_date_short) %>
</time>
</td>
<td>
<%= publication.assignee %>
</td>
<td>
<%= publication.creator %>
</td>
<td>
<%= publication.artefact.section %>
</td>
<td>
<%= publication.publisher %>
</td>
<td class="icon">
<%= link_to publication_front_end_path(publication) do %>
<i class="glyphicon glyphicon-share-alt" title="View this publication"></i>
<% end %>
</td>
<td class="icon">
<%#edition_path(publication) %>
<%= link_to "/editions/#{publication.id}" do %>
<i class="glyphicon glyphicon-lock" title="Locked view for this publication"></i>
<% end %>
</td>
<td class="duplicate icon">
<td>
<% 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 %>
</td>
<td class="icon">
<%= link_to preview_edition_path(publication) do %>
<i class="glyphicon glyphicon-eye-open" title="Preview this publication"></i>
<%= link_to 'Edit newer edition', edition_path(publication.in_progress_sibling), html_options = { "class" => "btn btn-info"} %>
<% end %>
</td>
</tr>
4 changes: 0 additions & 4 deletions app/views/root/_ready.html.erb
Expand Up @@ -3,13 +3,9 @@
<tr class="table-header">
<th scope="col"><%= sortable "_type", "Format" %></th>
<th scope="col"><%= sortable "title" %></th>
<th scope="col"><%= sortable "slug" %></th>
<th scope="col"><%= sortable "updated_at", "Updated" %></th>
<th scope="col"><%= sortable "assignee", "Assigned to" %></th>
<th scope="col"><%= sortable "creator", "Created by" %></th>
<th scope="col"><%= sortable "section" %></th>
<th scope="col">Edit</th>
<th scope="col">Preview</th>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 0 additions & 4 deletions app/views/root/_scheduled_for_publishing.html.erb
Expand Up @@ -3,14 +3,10 @@
<tr class="table-header">
<th scope="col"><%= sortable "_type", "Format" %></th>
<th scope="col"><%= sortable "title" %></th>
<th scope="col"><%= sortable "slug" %></th>
<th scope="col"><%= sortable "updated_at", "Updated" %></th>
<th scope="col"><%= sortable "publish_at", "Scheduled" %></th>
<th scope="col"><%= sortable "assignee", "Assigned to" %></th>
<th scope="col"><%= sortable "creator", "Created by" %></th>
<th scope="col"><%= sortable "section" %></th>
<th scope="col">Edit</th>
<th scope="col">Preview</th>
</tr>
</thead>
<tbody>
Expand Down
5 changes: 4 additions & 1 deletion app/views/shared/_metadata.html.erb
@@ -1,9 +1,12 @@
<div class="row">
<div class="col-md-7">
<% 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' %>
</div>
</div>
<%= link_to "Edit in Panopticon", panopticon_edit_url(publication), :class => "btn btn-primary" %>
2 changes: 1 addition & 1 deletion test/integration/edition_scheduled_publishing_test.rb
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/integration/edition_workflow_test.rb
Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand Down