-
Notifications
You must be signed in to change notification settings - Fork 0
Data
The goal is to make it as easy and fluid as possible to capture and reuse data as part of building a prototype.
This approach uses the localStorage
feature of the browser.
To save data, just add this line to the "front matter" settings at the top of a content page that has inputs on it (like text inputs, radio buttons, etc.): save-data: true
. (This works too: save-data: yes, please
.) It will look something like this:
---
layout: default
header: true
save-data: true
---
This will automatically save any entered data any time you "unfocus" on an input. You don't have to take any other actions to save the data, but keep in mind this also means it's very easy to change the data.
The data is saved using a "key/value" pair. The key is the name of the piece of data. The value is the data entered in the input.
The key is named automatically based on the page name and the name of the input, like this: page-name-input-name
.
To use saved data on a page, add this line where you want it to appear: {% include actions/get-data.html get-this="page-name-input-name" %}
.
It will show up on the page inside a p
(paragraph) element.
If you want the data to show up inside an input, you can add the setting put-it-here
, like this: {% include actions/get-data.html get-this="page-name-input-name" put-it-here="input-id-based-on-label" %}
.
The id of the input where you want to put saved data is based on its label. So if the label is Full name
, the id will be full-name
.
To see all the data you have saved for a particular prototype, you can go to this page: /docs/data.html
.
You have the option here to clear out all the data to reset the prototype.
These are the data files that are included in the project, either as part of the template examples or documentation.
-
cards.yml
: example card content for the Cards template. -
componentnav.yml
: side nav content for the Component kitchen sink. -
contentnav.yml
: side nav content for the Content kitchen sink. -
nav.yml
: example content for the Basic header component. -
quotes.yml
: content for the social proof on the public facing home page. -
sidenav.yml
: example side nav content for the Side navigation component. -
states.csv
: example content for the Combo box component.