learningequality/ka-lite — pull request #1263 by bcipolli (2013-12-11 06:44:24+00:00)
Title: Kmap from topics

Solves #1262 by solving #667. Generalizes the knowledge map concept to allow videos and topic nodes to be leaves, as suggested in #384.

Background:
* The knowledge map used to have copies of data, and require separate json files.
* The knowledge map schema was pretty clunky
* We were serving up raw JSON files to the knowledge map javascript

Issue:
* This reduplication of data is simply data bloat.
* This doesn't work well with people manually editing the topic tree (@mjptak), or moving forward to LEX CE
* By serving up raw json files, we weren't getting an opportunity to translate strings (which we have available on the back-end, and would be expensive to expose through JS)

Solutions:
* Revamp the schema for exposing knowledge maps. Now, each topic node can have a "knowledge_map" property, which defines what nodes are in the map (by id and kind), and their location in the map. It's as easy as that.
* Generate knowledge map json blobs on the fly, by pulling necessary info off of the `NODE_CACHE` for each node in the knowledge map.
* Translate strings during the json blob generation, on the back-end.

Testing:
* Just load up the knowledge map, and make sure it works in english.
* Install a language pack (french is a good one), and verify that the topics and exercises are now translated.

![screen shot 2013-12-10 at 9 40 14 pm](https://f.cloud.github.com/assets/4072455/1721813/740f6820-622f-11e3-9247-c02307a2f788.png)

@dylanjbarth Please take a look at the topics.json file for the `knowledge_map` property. This ideally would be hand-codeable, but certainly flexible enough to be useful for LEX CE.

@rtibbles if you have any feedback on the design as well, it's greatly appreciated.

@aronasorman if you could test and officially code review, would be appreciated.