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

Allow components to link to the Design System #401

Merged
merged 1 commit into from
Jul 10, 2018
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
## Unreleased

* Add the [GOV.UK Frontend](https://design-system.service.gov.uk/) library to the gem (PR #398)
* Allow linking to the Design System on component pages (PR #401)

## 9.3.6

4 changes: 4 additions & 0 deletions app/models/govuk_publishing_components/component_doc.rb
Original file line number Diff line number Diff line change
@@ -62,6 +62,10 @@ def partial_path
end
end

def govuk_frontend_components
component[:govuk_frontend_components].to_a
end

def github_search_url
params = { q: "org:alphagov #{partial_path}", type: "Code" }
"https://github.com/search?#{params.to_query}"
Original file line number Diff line number Diff line change
@@ -28,6 +28,19 @@

<%= render "govuk_publishing_components/component_guide/component_doc/preview", component_doc: @component_doc, example: @component_doc.example %>

<% if @component_doc.govuk_frontend_components.any? %>
<h2 class="component-doc-h2">GOV.UK Design System</h2>
<%= render 'govuk_publishing_components/components/govspeak' do %>
<p>This component incorporates components from the <%= link_to "GOV.UK Design System", "https://design-system.service.gov.uk" %>:</p>

<ul>
<% @component_doc.govuk_frontend_components.each do |component| %>
<li><%= link_to component.humanize, "https://design-system.service.gov.uk/components/#{component}" %></li>
<% end %>
</ul>
<% end %>
<% end %>

<% if @component_doc.accessibility_criteria.present? %>
<div class="grid-row component-accessibility-criteria">
<div class="column-two-thirds">