digidem / react-mapfilter

Visualizing, exploring, filtering and printing geographic data and geotagged photos and video
https://lab.digital-democracy.org/mapfilter
29 stars 11 forks source link

Feature/generic templates #26

Closed jlev closed 8 years ago

jlev commented 8 years ago

Initial implementation of generic info-pane template. Iterates over keys, omitting any that start with _ or are named "meta". Allows configuration of image and date fields, which may not be consistent between data sets.

See digidem/sample-monitoring-data#2 for more complex template logic

gmaclennan commented 8 years ago

Great work. I'm wondering if we should use handlebars and hbsfy instead of ejs? Would maybe lower the barrier for non-coders modifying templates, and we can register helpers without globals on window (globals make me nervous).

For reading the template, hubfs.js might be useful - it's a wrapper I wrote to simplify working with Github API.

gmaclennan commented 8 years ago

I'm wondering if we should move some of the info-pane specific layout out of the template e.g. the map icon and close button, so we can simplify it, and avoid users breaking functionality with the template. Maybe getImage() should return an empty PNG or a white image with an icon "no image", that way we can skip the conditional, and we should probably be more explicit about there not being an image vs. image has not loaded anyway.

jlev commented 8 years ago

I've pushed a commit that parse a github repo from the url hash, and will get a config.json file from the named repository. Having a slight problem with the async nature of hubfs, which we can discuss on Monday.

jlev commented 8 years ago

Working implementation of hubfs. Pulls simpleodk.json from identified repository, overrides local defaults.json. Reloads collection with URL for data, then triggers fetch and filter reset. Then fetches each named template, compiles and saves to correct view.

jlev commented 8 years ago

I'll investigate other template systems tomorrow, and can switch to Handlebars or JST if it makes sense before the trip.