Skip to content

CME | Decision Tree Living Guide

Luke C Hartman edited this page Jun 4, 2020 · 1 revision

Dev Setup

  1. Download the repo from https://github.com/engagingnewsproject/decision-tree/
  2. Get tree-db.php and tree-config.php from the cmetree WP Engine install and set the config items to match your local install.
  3. Export the database from the cmetree install so you have all the database tables. You can also use the sql/tree_create_database.sql file to create the tables instead.
  4. Setup your domain via laravel mix or the like
  5. Run npm install to get the development build running. This will likely need to be updated since the last time I [Jerry] worked on this in 2018.

General Notes

Adding a Tree

  1. Open up Terminal on a Mac.
  2. Change “My New Tree Title” in the following command to the title you want to use.
  3. Copy/paste the following command into the terminal and hit enter:
curl -X POST -k https://decision-tree.test/api/v1/trees -H "X-API-Client: d8b6eb0d4ae0a6d9a8c2ae44ef87e3abfc607de574c0d4ad2fa5b6cbf1e1b0be" -H "X-API-Access: 6dd15203269602c69bcd669f30054dd4bfac99117764adfac68e9b2c949e693e" -d title="My New Tree Title"

curl -X POST -k https://tree.mediaengagement.org/api/v1/trees -H "X-API-Client: 9363f17d4cf870dd12ab820573c60d275a2c03d3a6885c5e12814487b3088fcd" -H "X-API-Access: 6100efed327e39cb1029c2c7b4fe519cf7f2592604fcdee4dee1e8d0c84ab602" -d title="How to Register to Vote in Texas"

Editing Trees

  1. Go to https://tree.mediaengagement.org/edit/tree/{{slug}}

  2. If you get the clientToken and accessToken required message, open up the dev tools console and enter:

    localStorage.setItem('clientToken', '9363f17d4cf870dd12ab820573c60d275a2c03d3a6885c5e12814487b3088fcd')
    localStorage.setItem('accessToken', '6100efed327e39cb1029c2c7b4fe519cf7f2592604fcdee4dee1e8d0c84ab602')
    
  3. Reload the page, and you should have access to the tree editor.

  4. MAKE SURE YOU COMPILE THE TREE. There’s a button at the end of the page that actually builds all the changes. This is an intensive process, so we’re only compiling when we need to. Your changes won’t be used by the tree until you press compile. It compiles all the changes to a .json file in /data/{{ slug }}

  5. You can see the compiled changes to your tree data by going to: https://tree.mediaengagement.org/api/v1/trees/{{ slug }}/compiled \

Clone this wiki locally