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

Add What's New page #2103

Merged
merged 10 commits into from
Jul 21, 2023
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ gem "govspeak"
gem "govuk_admin_template"
gem "govuk_app_config"
gem "govuk_frontend_toolkit"
gem "govuk_publishing_components"
gem "govuk_sidekiq"
gem "mongoid"
gem "plek"
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ DEPENDENCIES
govuk_admin_template
govuk_app_config
govuk_frontend_toolkit
govuk_publishing_components
govuk_schemas
govuk_sidekiq
govuk_test
Expand Down
4 changes: 3 additions & 1 deletion app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
//= link application.js
//= link application-legacy.js
//= link application-legacy.css
//= link application.css
//= link application.js
21 changes: 21 additions & 0 deletions app/assets/javascripts/application-legacy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* global pasteHtmlToGovspeak */
//= require vendor/jquery-1.11.0.min
//= require vendor/jquery-ui.min.js

//= require govuk_toolkit
//= require ajax_setup
//= require length_counter
//= require markdown_preview
//= require toggle_display_with_checked_input
//= require paste-html-to-govspeak
jQuery(function ($) {
$('.js-length-counter').each(function () {
new GOVUK.LengthCounter({ $el: $(this) }) // eslint-disable-line no-new
})

$('.js-paste-html-to-govspeak').each(function () {
this.addEventListener('paste', pasteHtmlToGovspeak.pasteListener)
})

$('.reorderable-document-list').sortable()
})
25 changes: 4 additions & 21 deletions app/assets/javascripts/application.js
kevindew marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
/* global pasteHtmlToGovspeak */
//= require vendor/jquery-1.11.0.min
//= require vendor/jquery-ui.min.js

//= require govuk_toolkit
//= require ajax_setup
//= require length_counter
//= require markdown_preview
//= require toggle_display_with_checked_input
//= require paste-html-to-govspeak
jQuery(function ($) {
$('.js-length-counter').each(function () {
new GOVUK.LengthCounter({ $el: $(this) }) // eslint-disable-line no-new
})

$('.js-paste-html-to-govspeak').each(function () {
this.addEventListener('paste', pasteHtmlToGovspeak.pasteListener)
})

$('.reorderable-document-list').sortable()
})
//= require govuk_publishing_components/dependencies
//= require govuk_publishing_components/lib
//= require govuk_publishing_components/components/layout-header
//= require govuk_publishing_components/components/skip-link
59 changes: 59 additions & 0 deletions app/assets/stylesheets/application-legacy.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// govuk_admin_template
@import "govuk_admin_template";

// govuk_frontend_toolkit
@import "colours";
@import "typography";
@import "measurements";
@import "css3";

// app styles
@import "document-list";
@import "forms";
@import "govspeak";
@import "navbar";
@import "header";
@import "ordered_lists";
@import "broken-links-report";

p.no-content-message { // stylelint-disable-line selector-no-qualifying-type
@include core-19;
color: $grey-1;
}

.metadata-list {
width: 100%;

dt {
float: left;
clear: both;
width: 30%;
}

dd {
float: right;
width: 70%;
}
}

.collapsable-heading a {
color: inherit;

small {
color: $link-color;
}
}

.action-link {
@include core-19;
}

.body-pre {
max-height: 500px;
overflow: scroll;
word-break: break-word;
}

.navbar-bullet + .navbar-bullet:before {
content: "• ";
}
60 changes: 6 additions & 54 deletions app/assets/stylesheets/application.scss
kevindew marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,55 +1,7 @@
// govuk_admin_template
@import "govuk_admin_template";
@import "govuk_publishing_components/govuk_frontend_support";
@import "govuk_publishing_components/component_support";

// govuk_frontend_toolkit
@import "colours";
@import "typography";
@import "measurements";
@import "css3";

// app styles
@import "document-list";
@import "forms";
@import "govspeak";
@import "navbar";
@import "header";
@import "ordered_lists";
@import "broken-links-report";

p.no-content-message { // stylelint-disable-line selector-no-qualifying-type
@include core-19;
color: $grey-1;
}

.metadata-list {
width: 100%;

dt {
float: left;
clear: both;
width: 30%;
}

dd {
float: right;
width: 70%;
}
}

.collapsable-heading a {
color: inherit;

small {
color: $link-color;
}
}

.action-link {
@include core-19;
}

.body-pre {
max-height: 500px;
overflow: scroll;
word-break: break-word;
}
@import "govuk_publishing_components/components/layout-footer";
@import "govuk_publishing_components/components/layout-header";
@import "govuk_publishing_components/components/skip-link";
@import "govuk_publishing_components/components/title";
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class ApplicationController < ActionController::Base
include GDS::SSO::ControllerMethods
extend Forwardable

layout "legacy" # predating design system via govuk_publishing_components

protect_from_forgery with: :exception

before_action :authenticate_user!
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/whats_new_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class WhatsNewController < ApplicationController
layout "design_system"
def index; end
end
4 changes: 0 additions & 4 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ def publication_task_state(task)
output.html_safe
end

def nav_link_to(text, href)
link_to(text, href)
end
mtaylorgds marked this conversation as resolved.
Show resolved Hide resolved

def bootstrap_class_for(flash_type)
case flash_type
when :success
Expand Down
18 changes: 18 additions & 0 deletions app/helpers/navigation_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module NavigationHelper
kevindew marked this conversation as resolved.
Show resolved Hide resolved
def navigation_links_internal
kevindew marked this conversation as resolved.
Show resolved Hide resolved
links = [
{ text: "Manuals", href: manuals_path, active: request.path == manuals_path },
]
if Time.zone.today < Date.new(2023, 11, 1)
links << { text: "What's new", href: whats_new_path, active: request.path == whats_new_path }
end
links
end

def navigation_links_auth
[
{ text: current_user.name, href: Plek.external_url_for("signon") },
{ text: "Log out", href: gds_sign_out_path },
]
end
end
43 changes: 43 additions & 0 deletions app/views/layouts/design_system.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<% product_name = "Manuals Publisher" %>
<% environment = GovukPublishingComponents::AppHelpers::Environment.current_acceptance_environment %>

<%= render "govuk_publishing_components/components/layout_for_admin", {
environment: environment,
product_name: product_name,
browser_title: yield(:title)
} do %>
<%= render "govuk_publishing_components/components/skip_link", {
} %>

<%= render "govuk_publishing_components/components/layout_header", {
environment: environment,
product_name: product_name,
navigation_items: navigation_links_internal + navigation_links_auth,
} %>

<div class="govuk-width-container">
<main class="govuk-main-wrapper" id="main-content" role="main">
<%= yield %>
</main>
</div>

<%= render "govuk_publishing_components/components/layout_footer", {
navigation: [
{
title: "Support and feedback",
items: [
{
href: Plek.external_url_for("support"),
text: "Raise a support request"
},
{
href: "https://www.gov.uk/government/content-publishing",
text: "How to write, publish, and improve content"
}
]
}
]
} %>


<% end %>
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
<% content_for :head do %>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag 'application' %>
<%= stylesheet_link_tag "application-legacy", :media => "all" %>
<%= javascript_include_tag 'application-legacy' %>
<% end %>

<% content_for :page_title, " | Manuals Publisher" %>
<% content_for :app_title, "GOV.UK Manuals Publisher" %>

<% content_for :navbar_items do %>
<li><%= nav_link_to 'Manuals', '/manuals' %></li>
<% navigation_links_internal.map { |link| %>
<li><%= link_to(link[:text], link[:href]) %></li>
<% } %>
<% end %>

<% content_for :navbar_right do %>
Hello, <%= link_to current_user.name, Plek.external_url_for('signon') %>
&bull; <%= link_to 'Sign out', gds_sign_out_path %>
<% navigation_links_auth.map { |link| %>
<span class="navbar-bullet"><%= link_to(link[:text], link[:href]) %></span>
<% } %>
<% end %>

<% content_for :content do %>
Expand Down
43 changes: 43 additions & 0 deletions app/views/whats_new/index.html.erb
mtaylorgds marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<% page_name = "What's new" %>
<% content_for :title, page_name %>
<%= render "govuk_publishing_components/components/title", { title: page_name } %>

<h2 class="govuk-heading-l">New Manuals Publisher features</h2>

<p class="govuk-body">Last updated 18 Jul 2023</p>

<p class="govuk-body">We are delivering some enhancements for Manuals Publisher over the next couple of months.</p>

<p class="govuk-body">We’re doing this because we did user research earlier this year and discovered that Manuals users are lacking some
of the features that other publishing apps like Whitehall already have.</p>

<p class="govuk-body">If you have any questions or feedback about publishing, you can reach us on
<a href="mailto:[email protected]" class="govuk-link">[email protected]</a>.
For any other type of support, you can <a href="https://support.publishing.service.gov.uk/" class="govuk-link">submit a request via
Zendesk</a>.</p>

<h2 class="govuk-heading-l">Recent changes</h2>

<h3 class="govuk-heading-m">Added Paste to Govspeak</h3>

<p class="govuk-body">13 Jul 2023</p>

<p class="govuk-body">You can now paste formatted text into the body field and Manuals publisher will try to convert it into GOV.UK’s
version of <a href="https://www.gov.uk/guidance/how-to-publish-on-gov-uk/markdown" class="govuk-link">Markdown</a>, Govspeak. We hope
this feature will save you time when editing content.</p>

<p class="govuk-body">This works best when copying and pasting from text editing software like Word or Google Docs. It is less likely to
recognise formatting from PDFs.</p>

<p class="govuk-body">It will convert:</p>

<ul class="govuk-list govuk-list--bullet">
<li>headings</li>
<li>bullets</li>
<li>numbered lists</li>
<li>links</li>
<li>email links</li>
</ul>

<p class="govuk-body">Other formatting, such as tables, will be removed and only plain text pasted. You’ll need to write the Markdown for
these separately.</p>
4 changes: 4 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@
GovukHealthcheck::Mongoid,
GovukHealthcheck::SidekiqRedis,
)

get "/whats-new" => "whats_new#index", as: :whats_new
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we're installing govuk_publishing_components for the first time we should also add the component guide:

mount GovukPublishingComponents::Engine, at: "/component-guide" if Rails.env.development?

We may need an initializer too: https://github.com/alphagov/govuk_publishing_components/blob/main/docs/install-and-use.md#3-configure-the-gem

It'd be valuable to have a read of the documentation on GovukPublishingComponents, it explains various conventions and approaches that should be valuable for the work to convert to design system: https://github.com/alphagov/govuk_publishing_components#technical-documentation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep makes sense. seems like following this documentation on migration in govuk-frontend has caused a lot of confusion up to now.


mount GovukPublishingComponents::Engine, at: "/component-guide" if Rails.env.development?
end
6 changes: 6 additions & 0 deletions features/documentation.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Feature: Documentation within Manuals Publisher
Scenario: What's new page
Given I am logged in as an editor
When I visit the homepage before November 2023
And I click on "What's new"
Then I can see what is new in Manuals Publisher
12 changes: 12 additions & 0 deletions features/step_definitions/documentation_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
When(/^I visit the homepage before November 2023$/) do
travel_to(Date.new(2023, 10, 31))
visit "/"
end

When(/^I click on "(.*)"$/) do |link|
click_on link
end

Then(/^I can see what is new in Manuals Publisher$/) do
expect(page).to have_content("New Manuals Publisher features")
end
3 changes: 3 additions & 0 deletions features/support/world_setup.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
World(ActiveSupport::Testing::TimeHelpers) if respond_to?(:World)

After do
log_out
travel_back
end

Before do
Expand Down
Loading