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

Create demo app and move documentation to sub-app #244

Merged
merged 12 commits into from
Oct 13, 2016
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
12 changes: 12 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ module.exports = function (grunt) {
src: ['*.scss'],
dest: 'public/stylesheets/',
ext: '.css'
},
{
expand: true,
cwd: 'docs/assets/sass',
src: ['*.scss'],
dest: 'public/stylesheets/',
ext: '.css'
}]
}
},
Expand All @@ -31,6 +38,11 @@ module.exports = function (grunt) {
cwd: 'app/assets/',
src: ['**/*', '!sass/**'],
dest: 'public/'
}, {
expand: true,
cwd: 'docs/assets/',
src: ['**/*', '!sass/**'],
dest: 'public/'
}],
ignoreInDest: '**/stylesheets/**',
updateAndDelete: true
Expand Down
3 changes: 3 additions & 0 deletions app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module.exports = {
// Enable or disable password protection on production
useAuth: 'true',

// Enable or disable built-in docs and examples.
useDocumentation: 'true',

// Force HTTP to redirect to HTTPs on production
useHttps: 'true',

Expand Down
24 changes: 1 addition & 23 deletions app/routes.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
var express = require('express')
var router = express.Router()

// Route index page
router.get('/', function (req, res) {
res.render('index')
})

// Example routes - feel free to delete these

// Passing data into a page

router.get('/examples/template-data', function (req, res) {
res.render('examples/template-data', { 'name': 'Foo' })
})

// Branching

router.get('/examples/over-18', function (req, res) {
// get the answer from the query string (eg. ?over18=false)
var over18 = req.query.over18

if (over18 === 'false') {
// redirect to the relevant page
res.redirect('/examples/under-18')
} else {
// if over18 is any other value (or is missing) render the page requested
res.render('examples/over-18')
}
})

// add your routes here

module.exports = router
121 changes: 0 additions & 121 deletions app/views/examples/index.html

This file was deleted.

7 changes: 3 additions & 4 deletions app/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<h1 class="heading-xlarge">
The GOV.UK prototype kit
<span class="heading-secondary">{{releaseVersion}}</span>
</h1>
</h1>{{releaseVersion | log }}
<p>
This kit lets you rapidly create HTML prototypes of GOV.UK services.
</p>
Expand All @@ -31,9 +31,8 @@ <h2 class="heading-medium">About this page</h2>
<h2 class="heading-medium">Examples and documentation</h2>

<ul class="list list-bullet">
<li><a href="/examples">Example pages and patterns</a></li>
<li><a href="https://github.com/alphagov/govuk_prototype_kit/tree/master/docs">
Read the full documentation</a></li>
<li><a href="/docs/tutorials-and-examples">Example pages and documentation</a></li>
<li><a href="https://github.com/alphagov/govuk_prototype_kit">GitHub</a></li>
</ul>

<h2 class="heading-medium">Other resources</h2>
Expand Down
28 changes: 28 additions & 0 deletions docs/assets/javascripts/docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* global $ */
/* global GOVUK */

// Warn about using the kit in production
if (
window.sessionStorage && window.sessionStorage.getItem('prototypeWarning') !== 'false' &&
window.console && window.console.info
) {
window.console.info('GOV.UK Prototype Kit - do not use for production')
window.sessionStorage.setItem('prototypeWarning', true)
}

$(document).ready(function () {
// Use GOV.UK selection-buttons.js to set selected
// and focused states for block labels
var $blockLabels = $(".block-label input[type='radio'], .block-label input[type='checkbox']")
new GOVUK.SelectionButtons($blockLabels) // eslint-disable-line

// Use GOV.UK shim-links-with-button-role.js to trigger a link styled to look like a button,
// with role="button" when the space key is pressed.
GOVUK.shimLinksWithButtonRole.init()

// Show and hide toggled content
// Where .block-label uses the data-target attribute
// to toggle hidden content
var showHideContent = new GOVUK.ShowHideContent()
showHideContent.init()
})
52 changes: 52 additions & 0 deletions docs/assets/sass/docs.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@import "govuk-elements";

.markdown {
h1 {
@extend .heading-xlarge;
}

h2 {
@extend .heading-large;
}

h3 {
@extend .heading-medium;
}

h4 {
@extend .heading-small;
}

code {
Copy link
Contributor

@joelanman joelanman Aug 22, 2016

Choose a reason for hiding this comment

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

can't remember who wrote this originally, but why isnt the code block just @extend .code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, but you need the other things for it to display correctly I think. I'm still not happy with the code styling though.

background: $grey-4;
padding: 3px;
font-size: 1em;
}

pre > code {
@extend .code;
display: block;
@extend .panel;
@extend .panel-border-wide;
margin-bottom: 15px;
}

img {
max-width: 100%;
}

ul {
@extend .list;
@extend .list-bullet;
}

blockquote {
@extend .panel;
@extend .panel-border-wide;
}

strong {
font-weight: 700;
}
}

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ We recommend keeping all your prototypes in one folder called `projects`.

Create a folder called `projects` in your home folder. You can open your home folder by opening a new finder window, and selecting `go > home` from the top menu.

![Screenshot of a 'projects' folder in the mac home folder](../assets/images/mac-home-folder-projects.png)
![Screenshot of a 'projects' folder in the mac home folder](/public/images/docs/mac-home-folder-projects.png)

#### Windows users

Expand Down Expand Up @@ -87,10 +87,4 @@ npm install
```
The install may take up to a minute. Whilst installing it may `WARN` about some items - this is ok. As long as there are no `ERROR`s you can continue.

---
[Previous page (requirements)](requirements.md)

[Next page (run the kit)](run-the-kit.md)

---
[Documentation index](../README.md)
<a href="run-the-kit.md" class="button">Next (run the kit)</a>
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ If you’re comfortable using git and the terminal, you may prefer the [develope

The prototype kit provides a simple way to make interactive prototypes that look and feel like pages on GOV.UK. These prototypes can be used to design and lay out pages, and to use in user research.

You’ll use a copy of the kit for each different prototype you want to make - they’re self contained. Once installed, the kit uses about 100mb.

---
[Next page (requirements)](requirements.md)

---
[Documentation index](../README.md)
You’ll use a copy of the kit for each different prototype you want to make - they’re self contained. Once installed, the kit uses about 100mb.

<a href="requirements.md" class="button">Next (requirements)</a>
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,8 @@ xcode-select --install
```
If you already have command line tools, this will display `xcode-select: error: command line tools are already installed, use "Software Update" to install updates`.

![Screenshot of Command line tools popup message](../assets/images/installing-mavericks-popup.png)
![Screenshot of Command line tools popup message](/public/images/docs/installing-mavericks-popup.png)

If you don’t have command line tools, it will open an installer. Follow the instructions to install the command line tools.

---
[Previous page (introduction)](introduction.md)

[Next page (install the kit)](install-the-kit.md)

---
[Documentation index](../README.md)
<a href="install-the-kit.md" class="button">Next (install the kit)</a>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ In your web browser, visit <a href="http://localhost:3000" target="_blank">http:

You should see the prototype welcome page.

![Screenshot of the prototype kit homepage](../assets/images/prototype_kit_homepage.png)
![Screenshot of the prototype kit homepage](/public/images/docs/prototype-kit-homepage.png)

## Quitting the kit

Expand All @@ -38,8 +38,4 @@ In terminal press the `ctrl` and `c` keys together.

The kit is now installed. Congratulations!

---
[Previous page (install the kit)](install-the-kit.md)

---
[Documentation index](../README.md)
<!-- <a href="../../readme.md" class="button">Return to Getting Started</a> -->
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,3 @@ After your work is deployed, you will be able to view it on the web by visiting
You can run `heroku open` to open your prototype in a browser.

> Heroku puts apps to sleep that haven’t been accessed in a while - so if you’ve not visited your prototype for a while it may take a few seconds to open.


---
[Documentation index](../README.md)
File renamed without changes.
Loading