mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-11 04:48:32 +03:00
add handlebars for blueprints
This commit is contained in:
@@ -13,11 +13,13 @@ export default ({ config, controller }) => {
|
||||
|
||||
api.get('/blueprints', (req, res) => {
|
||||
const bps = controller.blueprints()
|
||||
res.json(bps.map(bp => ({
|
||||
source: bp.sheet.name,
|
||||
tab: bp.name,
|
||||
urls: bp.urls
|
||||
})))
|
||||
res.render('blueprints', {
|
||||
bps: bps.map(bp => ({
|
||||
source: bp.sheet.name,
|
||||
tab: bp.name,
|
||||
urls: bp.urls
|
||||
}))
|
||||
})
|
||||
})
|
||||
|
||||
api.get('/update', (req, res) => {
|
||||
|
||||
@@ -5,11 +5,17 @@ import middleware from './middleware'
|
||||
import api from './api'
|
||||
// import config from './sheets_config'
|
||||
import dotenv from 'dotenv'
|
||||
const hbs = require('express-handlebars')
|
||||
|
||||
dotenv.config()
|
||||
|
||||
let app = express()
|
||||
app.server = http.createServer(app)
|
||||
app.engine('.hbs', hbs({
|
||||
extname: '.hbs',
|
||||
defaultLayout: 'default'
|
||||
}))
|
||||
app.set('view engine', '.hbs')
|
||||
|
||||
// enable cross origin requests explicitly in development
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
|
||||
@@ -9,6 +9,25 @@ const timemapStructure = {
|
||||
export_tags: BP.tree
|
||||
}
|
||||
|
||||
const treatyStructure = {
|
||||
treaty_export_events: BP.deeprows,
|
||||
treaty_export_categories: [BP.groups, BP.rows],
|
||||
export_narratives: BP.rows,
|
||||
treaty_export_sources: BP.deepids,
|
||||
export_sites: BP.rows,
|
||||
export_tags: BP.tree
|
||||
}
|
||||
|
||||
const moraldriftStructure = {
|
||||
moraldrift_export_events: BP.deeprows,
|
||||
moraldrift_export_categories: [BP.groups, BP.rows],
|
||||
moraldrift_export_narratives: BP.rows,
|
||||
moraldrift_export_sources: BP.deepids,
|
||||
moraldrift_export_sites: BP.rows,
|
||||
moraldrift_export_tags: BP.tree
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
gsheets: [{
|
||||
name: 'example',
|
||||
|
||||
Reference in New Issue
Block a user