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

ORPD-31 - document details page #12

Merged
merged 4 commits into from
Oct 14, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions orp/config/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""orp URL configuration."""

import orp_search.views as orp_views
import orp_search.views as orp_search_views

from django.conf import settings
from django.contrib import admin
Expand All @@ -9,9 +9,10 @@
import core.views as core_views

urlpatterns = [
path("", orp_views.search, name="search"),
path("", orp_search_views.search, name="search"),
# If we choose to have a start page with green button, this is it:
# path("", core_views.home, name="home"),
path("details/", orp_search_views.details, name="details"),
path("healthcheck/", core_views.health_check, name="healthcheck"),
path(
"accessibility-statement/",
Expand Down
6 changes: 3 additions & 3 deletions orp/core/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class RegulationSearchForm(forms.Form):
document_type = forms.MultipleChoiceField(
required=False,
choices=[
("employment-tribunal", "Legislation"),
("MOD", "Guidance"),
("DfT", "Statutory guidance"),
("legislation", "Legislation"),
("guidance", "Guidance"),
("standard", "British Standard"),
],
widget=forms.CheckboxSelectMultiple(
attrs={
Expand Down
8 changes: 0 additions & 8 deletions orp/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
from .healthcheck import application_service_health


def hello_world(request: HttpRequest) -> HttpResponse:
"""Hello world.

Returns a simple hello world message.
"""
return HttpResponse("Hello, world!")


@require_http_methods(["GET"])
def home(request: HttpRequest) -> HttpResponse:
"""Home.
Expand Down
55 changes: 55 additions & 0 deletions orp/orp_search/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Generated by Django 4.2.15 on 2024-10-11 11:13

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = []

operations = [
migrations.CreateModel(
name="PublicGatewayCache",
fields=[
(
"id",
models.CharField(
max_length=2048, primary_key=True, serialize=False
),
),
("title", models.CharField(max_length=2048)),
("identifier", models.CharField(max_length=2048)),
("publisher", models.CharField(max_length=2048)),
("language", models.CharField(max_length=2048)),
("format", models.CharField(max_length=2048)),
("description", models.TextField()),
("date_issued", models.CharField(max_length=2048)),
("date_modified", models.DateTimeField()),
("date_valid", models.DateTimeField()),
("audience", models.CharField(max_length=2048)),
("coverage", models.CharField(max_length=2048)),
("subject", models.CharField(max_length=2048)),
("type", models.CharField(max_length=2048)),
("license", models.CharField(max_length=2048)),
("regulatory_topics", models.CharField(max_length=2048)),
("status", models.CharField(max_length=2048)),
("date_uploaded_to_orp", models.CharField(max_length=2048)),
("has_format", models.CharField(max_length=2048)),
("is_format_of", models.CharField(max_length=2048)),
("has_version", models.CharField(max_length=2048)),
("is_version_of", models.CharField(max_length=2048)),
("references", models.CharField(max_length=2048)),
("is_referenced_by", models.CharField(max_length=2048)),
("has_part", models.CharField(max_length=2048)),
("is_part_of", models.CharField(max_length=2048)),
("is_replaced_by", models.CharField(max_length=2048)),
("replaces", models.CharField(max_length=2048)),
("related_legislation", models.CharField(max_length=2048)),
("search_terms", models.CharField(max_length=2048)),
("document_types", models.CharField(max_length=2048)),
("created_at", models.DateTimeField(auto_now_add=True)),
],
),
]
98 changes: 98 additions & 0 deletions orp/orp_search/templates/details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{% extends "base.html" %}

{% block head_title %}{{service_name}}{% endblock %}
{% block service_name %}{{service_name}}{% endblock %}

{% block body_content %}
<div class="govuk-width-container">
<nav class="govuk-breadcrumbs" aria-label="Breadcrumb">
<ol class="govuk-breadcrumbs__list">
<li class="govuk-breadcrumbs__list-item">
<a class="govuk-breadcrumbs__link" href="#">Search results</a>
</li>
<li class="govuk-breadcrumbs__list-item">
<a class="govuk-breadcrumbs__link" href="#">SR2015 No 39: use of waste in a deposit for recovery operations</a>
</li>
</ol>
</nav>
<main class="govuk-main-wrapper govuk-main-wrapper--l" id="main-content" role="main">
<div class="govuk-grid-row govuk-!-margin-bottom-4">
<div class="govuk-grid-column-three-quarters">
<h1 class="govuk-heading-xl">SR2015 No 39: use of waste in a deposit for recovery operations</h1>
</div>
</div>
<div class="govuk-grid-row govuk-body">
<div class="govuk-grid-column-three-quarters">
<p class="govuk-body">
These standard rules allow you to store and use waste in a deposit for recovery activities involving
construction, reclamation, restoration or improvement of land other than by mobile plant.
</p>
<p class="govuk-body">
These standard rules are for the recovery of waste only and do not apply to any activities involving disposal.
</p>
<h2 class="govuk-heading-m">Document details</h2>
<dl class="govuk-summary-list">
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Link to document on publisher’s website
</dt>
<dd class="govuk-summary-list__value">
<a class="govuk-link" href="#">SR2015 No 39: use of waste in a deposit for recovery operations</a>
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Document type
</dt>
<dd class="govuk-summary-list__value">
Guidance
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Date published
</dt>
<dd class="govuk-summary-list__value">
2 February 2016
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Last updated
</dt>
<dd class="govuk-summary-list__value">
3 April 2019
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Published by
</dt>
<dd class="govuk-summary-list__value">
Environment Agency
</dd>
</div>
</dl>
<h2 class="govuk-heading-m">Related content on legislation.gov.uk</h2>
<p class="govuk-body">
<a class="govuk-link" href="#">Wildlife and Countryside Act 1981</a>
</p>
<p class="govuk-body">
<a class="govuk-link" href="#">Countryside and Rights of Way Act 2000</a>
</p>

<h2 class="govuk-heading-m">Regulatory topics</h2>
<ul class="govuk-list orp-topics-list">
<li class="govuk-body-s orp-secondary-text-colour">
Waste
</li>
<li class="govuk-body-s orp-secondary-text-colour">
Recycling
</li>
</ul>

</div>
</div>
</main>
</div>
{% endblock %}
111 changes: 33 additions & 78 deletions orp/orp_search/templates/orp.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ <h2 class="govuk-fieldset__heading">
<div class="govuk-checkboxes govuk-checkboxes--small" data-module="govuk-checkboxes">
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" id="document_type" name="document_type" type="checkbox"
value="employment-tribunal">
value="legislation">
<label class="govuk-label govuk-checkboxes__label" for="document_type">
Legislation
</label>
</div>
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" id="document_type-2" name="document_type" type="checkbox"
value="MOD">
value="guidance">
<label class="govuk-label govuk-checkboxes__label" for="document_type-2">
Guidance
</label>
</div>
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" id="document_type-3" name="document_type" type="checkbox"
value="DfT">
value="standard">
<label class="govuk-label govuk-checkboxes__label" for="document_type-3">
British Standards
</label>
Expand All @@ -98,10 +98,11 @@ <h2 class="govuk-fieldset__heading">
<label class="govuk-label govuk-visually-hidden" for="{{ form.query.id_for_label }}">
Search by publisher
</label>
<div class="search-input-button search-input-button--black orp-publisher-search">
<!-- The below will be added as a JavaScript enhancement -->
<!-- <div class="search-input-button search-input-button--black orp-publisher-search">
<input class="govuk-input orp-publisher-search__input app-site-search__input--default"
name="input-autocomplete" placeholder="Search" type="text" role="combobox">
</div>
</div> -->
</div>
<div class="govuk-checkboxes govuk-checkboxes--small orp-max-height-250" data-module="govuk-checkboxes">
<div class="govuk-checkboxes__item">
Expand Down Expand Up @@ -188,13 +189,23 @@ <h2 class="govuk-fieldset__heading">

<div class="govuk-grid-column-two-thirds">
<div class="orp-flex orp-flex--space-between">
<p class="govuk-body govuk-!-font-weight-bold govuk-!-margin-bottom-0">4,123 documents</p>
<p class="govuk-body govuk-!-font-weight-bold govuk-!-margin-bottom-0">
{% if results %}
{{ results_count }} documents
{% else %}
{% if form.is_bound %}
No documents found
{% endif %}
{% endif %}
</p>
<p class="govuk-body govuk-!-margin-bottom-0">
<a href="#" class="govuk-link govuk-link--no-visited-state
">Clear all filters</a>
</p>
</div>
<ul class="orp-applied-filters-container">

<!-- Commenting out applied filters for now to avoid confusion -->
<!-- <ul class="orp-applied-filters-container">
<li class="orp-applied-filter-tag">
<a href="#delete">
<span class="govuk-visually-hidden">Remove filter:</span>
Expand All @@ -207,7 +218,7 @@ <h2 class="govuk-fieldset__heading">
<span class="govuk-body-s">Accreditation Service</span>
</a>
</li>
</ul>
</ul> -->

<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">
<div class="govuk-grid-row">
Expand All @@ -226,93 +237,37 @@ <h2 class="govuk-fieldset__heading">
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">

{% if results %}
<div class="govuk-summary-list orp-search-results">

<!-- first search result -->
<div class="govuk-summary-list__row--no-border">
<span class="govuk-caption-m">Guidance</span>
<h2 class="govuk-heading-m">
<a href="/document/{{ result.document_id }}/details" class="govuk-link orp-link-text-decoration-none">
Introduction to asbestos safety
</a>
</h2>
<p class="govuk-body-m">
Guidance on complying with the law on asbestos safety including detection, management, controls and
training.
</p>
<p class="govuk-body-s orp-secondary-text-colour govuk-!-margin-bottom-2">
Published by: Health and Safety Executive
</p>
<p class="govuk-body-s orp-secondary-text-colour">
Last updated: 24 January 2024
</p>
<ul class="govuk-list orp-topics-list">
<li class="govuk-body-s orp-secondary-text-colour">
COSHH
</li>
<li class="govuk-body-s orp-secondary-text-colour">
Substances hazardous to health
</li>
<li class="govuk-body-s orp-secondary-text-colour">
Code of practice
</li>
</ul>
</div>
<!-- /first search result -->
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">
<!-- second search result -->
{% for result in results %}
<div class="govuk-summary-list__row--no-border">
<span class="govuk-caption-m">Guidance</span>
<span class="govuk-caption-m">{{ result.document_type }}</span>
<h2 class="govuk-heading-m">
<a href="/document/{{ result.document_id }}/details" class="govuk-link orp-link-text-decoration-none">
Waste and Mining Operations Installations Water Discharge and Groundwater Activities Medium
<a href="/document/{{ result.id }}" class="govuk-link">
{{result.title}}
</a>
</h2>
<p class="govuk-body-m">
The Environment Agency consults the public on certain applications for: waste and mining waste
operations installations water discharge
{{result.description}}
</p>

<p class="govuk-body-s orp-secondary-text-colour govuk-!-margin-bottom-2">
Published by: Environment Agency
Published by: {{ result.publisher}}
</p>
<p class="govuk-body-s orp-secondary-text-colour">
Last updated: 30 December 2023
Last updated: {{ result.date_modified | date:"j F Y" }}
</p>
<ul class="govuk-list orp-topics-list">
<!-- <li class="govuk-body-s orp-secondary-text-colour">
{{ result.subject }}
</li> -->
<li class="govuk-body-s orp-secondary-text-colour">
Mining
</li>
<li class="govuk-body-s orp-secondary-text-colour">
Groundwater
</li>
<li class="govuk-body-s orp-secondary-text-colour">
Waste
{{ result.regulatory_topics }}

</li>
</ul>
</div>
<!-- /second search result -->
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">

</div>

{% if results %}
<div class="govuk-summary-list">
<p class="govuk-body-m">
{{ results_count }} matches found.
</p>
{% for result in results %}
<div class="govuk-summary-list__row--no-border">
<h2 class="govuk-heading-m">
<a href="/document/{{ result.document_id }}/details" class="govuk-link">
{{result.title}}
</a>
{{result.published_date}}
</h2>
<p class="govuk-body-m">
Regulation: {{ result.document_type }} <br> {{ result.last_updated }}
</p>
</div>
{% endfor %}
</div>
{% else %}
Expand Down
Loading