Unverified Commit fe09ad9f authored by Mark Stenglein's avatar Mark Stenglein
Browse files

Finish initial models, and fix broken configs for routes

Next up will be getting the database to sync and etc
- :ocelotsloth:
parent 6cf40c8a
......@@ -13,7 +13,7 @@ var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var Sequelize = require('sequelize');
var config = require('config');
//var config = require('config');
// Load in Routes
// TODO: Make this a dynamic loading system that simply scans the directory
......@@ -42,7 +42,7 @@ app.use(require('node-sass-middleware')({
app.use(express.static(path.join(__dirname, 'public')));
// Initialize the Database and Connection
var db = require(path.join(__dirname, 'models', 'index'));
app.set('db', path.join(__dirname, 'models', 'index'));
// Populate initial data
// TODO: populate the information
......
......@@ -41,3 +41,6 @@ schools :
longName : "Spring 2017"
dataFile : "GMU2017SP.min.json"
schoolSlugs :
- "GMU"
- "VT"
......@@ -8,9 +8,9 @@ module.exports = function(sequelize, DataTypes) {
name: DataTypes.STRING,
universitySlug: {
type: DataTypes
type: DataTypes.STRING,
references: {
model: University
model: University,
key: slug
}
}
......
......@@ -9,16 +9,17 @@ var router = express.Router();
var mongoose = require('mongoose');
var Semester = require('../../models/Semester');
var ical = require('ical-generator');
var config = require('config');
// Load site wide configurations
var config = require('../../config');
var schoolSlugs = config.get('schoolSlugs');
////////////////////////////////////////////////////////////////////////////////
// JSON API Section
// Get school and semester slug listing
router.get('/json/schools', function(req, res, next) {
res.json(config.schoolSlugs);
res.json(schoolSlugs);
});
// GET classes for a semester
......
......@@ -6,12 +6,13 @@
////////////////////////////////////////////////////////////////////////////////
var express = require('express');
var router = express.Router();
var config = require('config');
// Load site wide configurations
var config = require('../config');
var siteInfo = config.get('general');
router.get('/', function(req, res, next) {
res.render('docs', { config });
res.render('docs', { siteInfo });
})
module.exports = router;
......@@ -6,13 +6,14 @@
////////////////////////////////////////////////////////////////////////////////
var express = require('express');
var router = express.Router();
var config = require('config');
// Load site wide configurations
var config = require('../config');
var siteInfo = config.get('general');
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { config });
res.render('index', { siteInfo });
})
module.exports = router;
......@@ -4,7 +4,7 @@ var Semester = require('../models/Semester');
var fs = require("fs");
// Load site wide configurations
var config = require('../config');
//var config = require('../config');
var populateDB = function() {
if (config.ReloadDB) {
......
......@@ -10,5 +10,5 @@ div.row.center-text
i.fa.fa-circle-thin.fa-stack-2x(aria-hidden='true')
i.fa.fa-calendar.fa-stack-1x(aria-hidden='true')
// Title for the site
h1 #{config.siteName}
small #{config.siteDescription}
h1 #{siteInfo.name}
small #{siteInfo.description}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment