Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #23 from fofr/specialist
Browse files Browse the repository at this point in the history
Create a specialist workflow for MHRA
  • Loading branch information
fofr committed Feb 20, 2018
2 parents cbd43fd + e12d644 commit a6ba3f8
Show file tree
Hide file tree
Showing 9 changed files with 287 additions and 82 deletions.
4 changes: 3 additions & 1 deletion app/assets/javascripts/modules/slug-from-title.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@

GOVUK.Modules.SlugFromTitle = function () {
this.start = function (element) {
var prefix = element.data('prefix') || 'government';

element.on('change keyup click paste', '#title', updateSlug);
$('#title').trigger('keyup');

function updateSlug(evt) {
var title = $(this).val(),
slug = title.replace(/ +/g, '-').toLowerCase().replace(/[^a-z0-9]+/g, '-');

element.find('.js-dynamic-slug').text(slug);
element.find('.js-dynamic-slug').text(prefix + '/' + slug);

if (slug.length > 0) {
element.find('.js-slug-parent').show();
Expand Down
9 changes: 8 additions & 1 deletion app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ router.get('/', function (req, res) {
res.render('index')
})

router.get('/dashboard', function(req, res) {
req.session.destroy();
res.render('dashboard');
});

router.get('/intent', function(req, res) {
req.session.destroy();
res.render('intent');
Expand All @@ -26,7 +31,9 @@ router.get('/patterns/content-checker', function(req, res) {
})

router.get('/document-type', function(req, res) {
if (req.session.data['format'] == 'News article' || req.session.data['format'] == 'Speech') {
if (req.session.data['format'] == 'News article'
|| req.session.data['format'] == 'Speech'
|| req.session.data['format'] == 'Medical safety alert') {
res.render('document-type', req.params);
} else {
res.redirect('/title-summary-body');
Expand Down
57 changes: 57 additions & 0 deletions app/views/about-content.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,53 @@ <h1 class="form-title govuk-heading-xl">
</h1>
</div>
</div>

{% if data['format'] == 'Drug safety update' %}
<div class="govuk-o-grid govuk-!-mb-r6">
<div class="govuk-o-grid__item govuk-o-grid__item--two-thirds">
<h2 class="govuk-heading-l">About this update</h2>

<label class="govuk-c-label" for="therapeutic-area">Therapeutic area</label>
<input type="text" name="therapeutic-area" class="govuk-c-input" id="therapeutic-area" value="{{data['therapeutic-area']}}">
</div>
</div>
{% endif %}

{% if data['format'] == 'Medical safety alert' %}
<div class="govuk-o-grid govuk-!-mb-r6">
<div class="govuk-o-grid__item govuk-o-grid__item--two-thirds">
<h2 class="govuk-heading-l">About this alert</h2>

<label class="govuk-c-label" for="medical-specialism">Medical specialism</label>
<input type="text" name="medical-specialism" class="govuk-c-input" id="medical-specialism" value="{{data['medical-specialism']}}">

{{ govukDateInput({
fieldset: {
legendText: 'Issue date',
legendHintText: 'For example, 31 3 2017'
},
id: 'issue-date',
name: 'issue-date',
items:[
{
name: 'day',
value: data['issue-date-day']
},
{
name: 'month',
value: data['issue-date-month']
},
{
name: 'year',
value: data['issue-date-year']
}
]
})
}}
</div>
</div>
{% endif %}

<div class="govuk-o-grid">
<div class="govuk-o-grid__item govuk-o-grid__item--two-thirds">
<h2 class="govuk-heading-l">Monitoring</h2>
Expand Down Expand Up @@ -70,12 +117,15 @@ <h2 class="govuk-heading-l">Monitoring</h2>
</div>
</div>
</div>

{% if not data['specialist'] %}
<div class="govuk-o-grid">
<div class="govuk-o-grid__item govuk-o-grid__item--two-thirds">
<h2 class="govuk-heading-l">Tag on GOV.UK</h2>
<p class="govuk-body">Tags help position this content in <a href="">GOV.UK</a>, they make it easier to find by relating it to existing content that is similar to it.</p>
</div>
</div>

<div class="govuk-o-grid govuk-!-mb-r7" data-module="select-tags">
{% if data['tag-count'] %}
{% set tag_count = (data['tag-count'] | int) %}
Expand Down Expand Up @@ -169,11 +219,17 @@ <h3 class="govuk-heading-s">Selected tags</h3>
<a href="" class="inline button button-link govuk-body js-add-tag">Select tag</a>
</div>
</div>
{% endif %}

<div class="govuk-o-grid">
<div class="govuk-o-grid__item govuk-o-grid__item--two-thirds">
<div class="govuk-!-mb-r6 is-input">
<h2 class="govuk-heading-l">Associations</h2>

{% if data['specialist'] %}
<label class="govuk-c-label" for="lead-organisation">Lead organisation</label>
<p class="govuk-body">{{ data['lead-organisation'] }}</p>
{% else %}
<label class="govuk-c-label" for="lead-organisation">Lead organisation</label>
<select id="lead-organisation" name="lead-organisation">
{% include "includes/organisation-select-options.html" %}
Expand All @@ -198,6 +254,7 @@ <h2 class="govuk-heading-l">Associations</h2>

<label class="govuk-c-label" for="world-locations">World locations</label>
<input type="text" name="world-location" class="govuk-c-input" id="world-locations" value="{{data['world-location']}}">
{% endif %}
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions app/views/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ <h1 class="form-title govuk-heading-xl">
<p class="add-bottom-margin">
<a href="/intent" class="govuk-c-button">New document</a>
</p>
<p>
<a href="/specialist-format" class="govuk-c-button">New specialist document</a>
</p>
<!-- <div class="govuk-o-grid">
<div class="govuk-o-grid__item govuk-o-grid__item--one-third">
<div style="border: 5px solid #dee0e2; padding: 15px">
Expand Down
185 changes: 121 additions & 64 deletions app/views/document-tasks.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1 class="form-title govuk-heading-xl">
<dt>Created by</dt>
<dd>Kamala Khan</dd>
<dt>Last updated</dt>
<dd>20 January 2018</dd>
<dd>20 February 2018</dd>
<dt>Status</dt>
<dd>Draft</dd>
</dl>
Expand All @@ -41,7 +41,9 @@ <h3 class="document-task">
</div>
<div>
<h3 class="govuk-heading-s">{{ data['document-type'] }}</h3>
Unedited press releases as sent to the media, and official statements from the organisation or a minister.
{% if data['document-type'] == 'Press release' %}
Unedited press releases as sent to the media, and official statements from the organisation or a minister.
{% endif %}
</div>
</li>
{% endif %}
Expand Down Expand Up @@ -97,12 +99,14 @@ <h3 class="document-task">
</div>
</dl>
</li>
<li class="document-list-item">
<h3 class="document-task">
Images
</h3>
<a href="#" class="document-task-action">Add</a>
</li>
{% if not data['specialist'] %}
<li class="document-list-item">
<h3 class="document-task">
Images
</h3>
<a href="#" class="document-task-action">Add</a>
</li>
{% endif %}
<li class="document-list-item">
<div style="overflow: hidden">
<h3 class="document-task">
Expand Down Expand Up @@ -134,61 +138,107 @@ <h3 class="document-task">
</h3>
<a href="/about-content" class="document-task-action">Change</a>
<dl class="document-task-part">

<div>
<dt class="document-part-label">
Tags
</dt>
{% set tag_count = data['tag-count'] | int %}
{% if tag_count > 0 %}
<dd class="document-part-value">
<ul>
{% for i in range(0, tag_count) %}
<li class="govuk-!-mb-r1">
{{ data['selected-tag-' + (i + 1)] }}
</li>
{% endfor %}
</ul>
</dd>
{% else %}
<dd class="document-part-value document-part-value--empty">
This field is empty
</dd>
{% endif %}
</div>

{%
set dtags = [
{
name: 'Review frequency',
key: 'review-frequency'
},
{
name: 'Expected audience',
key: 'expected-audience'
},
{
name: 'Lead organisations',
key: 'lead-organisation'
},
{
name: 'Supporting organisations',
key: 'supporting-organisation'
},
{
name: 'Ministers',
key: 'minister'
},
{
name: 'Topical events',
key: 'topical-event'
},
{
name: 'World locations',
key: 'world-location'
}
]
%}
{% if not data['specialist'] %}
<div>
<dt class="document-part-label">
Tags
</dt>
{% set tag_count = data['tag-count'] | int %}
{% if tag_count > 0 %}
<dd class="document-part-value">
<ul>
{% for i in range(0, tag_count) %}
<li class="govuk-!-mb-r1">
{{ data['selected-tag-' + (i + 1)] }}
</li>
{% endfor %}
</ul>
</dd>
{% else %}
<dd class="document-part-value document-part-value--empty">
This field is empty
</dd>
{% endif %}
</div>
{%
set dtags = [
{
name: 'Review frequency',
key: 'review-frequency'
},
{
name: 'Expected audience',
key: 'expected-audience'
},
{
name: 'Lead organisations',
key: 'lead-organisation'
},
{
name: 'Supporting organisations',
key: 'supporting-organisation'
},
{
name: 'Ministers',
key: 'minister'
},
{
name: 'Topical events',
key: 'topical-event'
},
{
name: 'World locations',
key: 'world-location'
}
]
%}
{% elseif data['format'] == 'Drug safety update' %}
{%
set dtags = [
{
name: 'Therapeutic area',
key: 'therapeutic-area'
},
{
name: 'Review frequency',
key: 'review-frequency'
},
{
name: 'Expected audience',
key: 'expected-audience'
},
{
name: 'Lead organisation',
key: 'lead-organisation'
}
]
%}
{% else %}
{%
set dtags = [
{
name: 'Medical specialism',
key: 'medical-specialism'
},
{
name: 'Issue date',
key: 'issue-date-year'
},
{
name: 'Review frequency',
key: 'review-frequency'
},
{
name: 'Expected audience',
key: 'expected-audience'
},
{
name: 'Lead organisation',
key: 'lead-organisation'
}
]
%}
{% endif %}

{% for dtag in dtags %}
<div>
Expand All @@ -197,7 +247,11 @@ <h3 class="document-task">
</dt>
{% if data[dtag.key] %}
<dd class="document-part-value">
{{ data[dtag.key] }}
{% if dtag.key == 'issue-date-year' %}
{{ data[dtag.key] }}-{{ data['issue-date-month'] }}-{{ data['issue-date-day'] }}
{% else %}
{{ data[dtag.key] }}
{% endif %}
</dd>
{% else %}
<dd class="document-part-value document-part-value--empty">
Expand All @@ -208,6 +262,8 @@ <h3 class="document-task">
{% endfor %}
</dl>
</li>

{% if not data['specialist'] %}
<li class="document-list-item">
<h3 class="document-task">
Publish settings
Expand All @@ -220,6 +276,7 @@ <h3 class="document-task">
</h3>
<a href="#" class="document-task-action">Add</a>
</li>
{% endif %}
</ul>
</li>
</ol>
Expand Down
Loading

0 comments on commit a6ba3f8

Please sign in to comment.