-
Notifications
You must be signed in to change notification settings - Fork 0
Data Files
The project includes a data
folder that has a bunch of data files that use JSON and are named according to their place on the website.
JSON is JavaScript Object Notation. It's a very easy and quick way to structure data. Here's an example.
{
name: 'Before We Begin',
description: 'Please make sure you\'ve read our privacy terms and conditions before you begin your Values Footprint test.',
text: 'You can find our privacy statement at the bottom of the page, by starting this test you agree to our terms and conditions.',
buttons: {
start: {
name: 'Start',
goToStep: 1,
classes: [ 'btn', 'btn-outline-success' ]
}
}
}
The curly braces {
& }
signify the start and end of an object. As you can see, each object can have properties inside, such as name
, description
or text
.
Properties are separated by commas ,
.
Objects can also store a list of things if there are multiple items. Lists are signified by using [
& ]
. Notice how the classes for the start button are used as such.
Strings (text) are usually surrounded by single or double quotes, however, sometimes we use the backtick ` so we can have long chunks of text span multiple lines without looking weird. You'll find this to be most common in the profiles data file.
Numbers do not require quotes, and boolean (true/false) values also do not require quotes.
The files are as follows:
-
countries.js
: A list of all countries by name and code. -
footer.js
: Includes all footer items and links. -
home.js
: Includes all home page content. -
index.js
: This just combines all the data files into one file for easy use in development; you won't need to edit any content here. -
nav.js
: Includes all nav items/links. -
postcodes.js
: Includes groups of valid Australian postcodes, used for validating postcodes when country is set to 'Australia'. -
privacy.js
: Includes all content for the privacy page. -
profiles.js
: Includes all values profile content; updating this will update the profile content everywhere, including the home page. -
survey.js
: This is the biggest and most complex data file, it includes all the data needed to generate the survey fields and its various steps.