Managing Items, Defining an Item - Bumby-Wool/builder GitHub Wiki

Previous Step: Adding New Items

Defining an Item

This page will walk through how to add a new item definition and some examples. For more details about the Item Object Properties, see the Item Object Properties page.

1. Define the Item

We'll start by giving the item a title which will be displayed on the home page and at the top of the builder page when this item is selected.

Next the link needs to follow the format /items/itemname. The itemname we will stick with in our example is testpants so our link value will be "/items/testpants". This will make the items full URL https://bumby-wool.github.io/builder/#!/items/testpants

image will only be used on the home page as an example of the item

Example

{
    title: "Test Pants",
    link: "/items/testpants",
    image: "resources/Baby-Standard-Pants-Mild-Tapered-Hemmed-Main.png",
    variants: []
},

We will define the variants in a later step

2. Adding the New Item

Place the item definition object you created into the array at /services/itemDataService.js

Example

angular.module('bumbyApp')
    .factory('itemData', function () {
        return [
            {
                title: "Test Pants",
                link: "/items/testpants",
                image: "resources/Baby-Standard-Pants-Mild-Tapered-Hemmed-Main.png",
                variants: []
            },
            {
                title: "Diaper Cover",
                link: "/items/diapercover",
            ...

Next Step: Creating an Item Template