Unverified Commit 5424dafc authored by Mark Stenglein's avatar Mark Stenglein
Browse files

Merge branch 'setRoughUI'

- I figure we dont need this anymore since it's moved _way_ beyond UI
parents d3a06fc9 6e1bddfe
#!/bin/bash +x
# Function to test whether or not a program is installed on the users machine
function haveProg() {
[ -x "$(which "$1")" ]
}
# Function to pause excecution till the user presses the enter key
function pause() {
read -r -p "$*"
}
#!/bin/bash
#TODO: If you wanted to, add 'update' commands to the remaining systems that need them.
# Open up version variables
. /etc/lsb-release
### For example:
### DISTRIB_ID=Ubuntu
### DISTRIB_RELEASE=12.04
### DISTRIB_CODENAME=precise
### DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"
# Handler for Debian based systems with apt
function func_apt-get() {
# Install nodejs
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get update
sudo apt-get install nodejs
}
# Handler for systems such as Fedora with yum
function func_yum() {
sudo curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
sudo yum check-update
sudo yum -y install nodejs
}
# Handler for Arch based systems with pacman
function func_pacman() {
sudo pacman -Syy
sudo pacman -S nodejs npm
}
# Handler for macOS and others with homebrew
function func_brew() {
brew update
brew install node npm #both, just in case
}
# Function to tell SUSE users to do it themselves because there are version specific instructions
function func_zypper() {
echo "Go here: http://software.opensuse.org/download.html?project=devel%3Alanguages%3Anodejs&package=nodejs"
echo "Follow the instructions on the SUSE website in a different terminal"
# Close with error code 1
end 1;
#Because the SUSE commands were version specific so I give up
}
# Handler for Gentoo systems with emerge
function func_emerge() {
emerge nodejs
}
# Handler for FreeBSD and other systems with pkg
function func_pkg() {
pkg install node
}
# Handler for macOS and others with MacPorts - because some people hate Homebrew
function func_port() {
port install nodejs
}
# Handler for a variety of other systems with pkgin
function func_pkgin() {
pkgin -y install nodejs
}
# Function which installs dependencies for the project
function func_dependencies {
# Install nodemon
if haveProg nodemon ; then echo "** nodemon already installed **"
else sudo npm install -g nodemon
fi
# Install npm dependencies
npm install
cd schedules || exit
npm install
cd ..
# Check if you have a given program
function haveProg() {
[ -x "$(which "$1")" ]
}
# Skip all of this if you have node or nodejs
if haveProg node ; then echo "** Node already installed **"
elif haveProg nodejs ; then echo "** Node already installed **"
elif haveProg apt-get ; then func_apt-get
elif haveProg yum ; then func_yum
elif haveProg pacman ; then func_pacman
elif haveProg brew ; then func_brew
elif haveProg emerge ; then func_emerge
elif haveProg zypper ; then func_zypper
elif haveProg pkg ; then func_pkg
elif haveProg port ; then func_port
elif haveProg pkgin ; then func_pkgin
else
echo '** No supported package manager found!'
echo '** Node.js not found!'
## Installation script for Ubuntu
if [ "$DISTRIB_ID" == "Ubuntu" ]
then
echo "** Installing as Ubuntu"
echo ""
if ! haveProg npm
then
echo "** Installing Node.js"
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
fi
if ! haveProg mongod
then
echo "** Installing MongoDB"
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu $DISTRIB_CODENAME/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
## Service is started in start.sh file
fi
elif haveProg yum
then
echo "** Installing as yum manager"
echo ""
echo "** yum not yet supported, go to https://git.gmu.edu/srct/schedules for help"
exit 1
# Handler for mac and macports
elif haveProg brew
then
brew update
brew install node npm
if ! haveProg mongo
then
brew install mongodb
fi
elif haveProg port
then
sudo port selfupdate
sudo port install nodejs
if ! haveProg mongo
then
sudo port install mongodb
fi
fi
# Install dependencies regardless
func_dependencies
echo "** Installation Completed **"
echo "** Run './start.sh' to run the server"
## Install node.js dependencies
npm install
cd schedules
npm install
cd ..
echo "** Application installed successfuly"
echo ""
echo "** Run ./start.sh to start application"
exit 0
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
// Load site wide configurations
var config = require('./config');
......@@ -17,8 +17,6 @@ var app = express();
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
......@@ -31,6 +29,9 @@ app.use(require('node-sass-middleware')({
}));
app.use(express.static(path.join(__dirname, 'public')));
// Connect to mongo
mongoose.connect(config.mongoDBURL);
app.use('/', routes);
app.use('/api', api);
......
......@@ -5,4 +5,23 @@ config.siteName = "Schedules";
// Application Description (subtitle)
config.siteDescription = "A simple application to add your class schedule to calendar applications like Outlook and Google Calendar."
// MongoDB config
config.mongoDBURL = 'mongodb://localhost/myappdatabase';
// Data files to load:
config.dataFiles = [
{
// Pretty Name
school: 'George Mason University',
// URL Slug for the API
slug: 'GMU',
// List of .json files to import (place in setup folder under SLUG folder)
dataSource: [
'fall2016GMU' // IE: get's put in 'setup/GMU/fall2016GMU.json'
],
// Whether to actually import the data
enabled: false
}
]
module.exports = config;
......@@ -11,9 +11,9 @@
"debug": "~2.2.0",
"express": "~4.13.4",
"jade": "~1.11.0",
"mongoose": "^4.5.5",
"morgan": "~1.7.0",
"node-sass": "^3.8.0",
"node-sass-middleware": "0.8.0",
"serve-favicon": "~2.3.0"
"node-sass-middleware": "0.8.0"
}
}
$(document).ready(function() {
$('#classSearch').DataTable();
} );
// Custom Sass entries go here and will be loaded after bootstrap
// Add center class for divs and the text within
.center-text {
text-align: center;
}
html, body {
height: 100%;
}
......@@ -5817,4 +5817,10 @@ button.close {
.hidden-print {
display: none !important; } }
.center-text {
text-align: center; }
html, body {
height: 100%; }
/*# sourceMappingURL=main.css.map */
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -54,3 +54,6 @@
// Utility classes
@import "bootstrap/utilities";
@import "bootstrap/responsive-utilities";
// Custom Classes
@import "_custom.scss";
......@@ -13,16 +13,16 @@ var schools = [
]
/* GET Schools listing. */
router.get('/lists/schools', function(req, res, next) {
router.get('/api/lists/schools', function(req, res, next) {
res.send(JSON.stringify(schools));
});
// GET ical file
router.get('/ical/:year/:season/:crns', function(req, res) {
router.get('/api/:format/:school/:semester/:crns', function(req, res) {
var crns = req.params['crns'].split(',');
var format = req.params['format'];
var year = req.params['year'];
var season = req.params['season'];
var school = req.params['school'];
var semester = req.params['semester'];
var crnNums = [{
format,
year,
......
var express = require('express');
var router = express.Router();
// Load site wide configurations
var config = require('../config');
......@@ -7,9 +8,11 @@ router.get('/docs', function(req, res, next) {
res.render('docs', { config });
})
// TODO: Actually learn how to make this function set be passed around properly
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { config });
});
})
module.exports = router;
module.exports = initialPopulate;
// Get the title from the rendering process
title= title
head
// Metadata
......@@ -11,3 +9,10 @@ head
script(src='/javascripts/bootstrap.js')
script(src="https://use.fontawesome.com/1c4cae8f2d.js")
link(href='/stylesheets/main.css', rel='stylesheet')
// Datatables
link(rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/dt-1.10.12/datatables.min.css")
script(type="text/javascript" src="https://cdn.datatables.net/v/bs/dt-1.10.12/datatables.min.js")
// Favicon
link(rel='shortcut icon', href='/favicon.ico?', type='image/x-icon')
......@@ -2,37 +2,64 @@
extends layout
block content
script(src='/javascripts/mainApp.js')
div.containter-fluid
div.row
// Main site column
div.col-md-8
// Site branding row
div.row.center
center
// Font Awesome stack of circle and calendar for logo
span.fa-stack.fa-lg.fa-5x
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}
em #{config.siteDescription}
// Site title include
include main-title.jade
// Content div
div.row
// Left padding
div.col-md-1
// Content div
div.col-md-10
ul#search-type.nav.nav-tabs
li#search-tab(role='presentation')
a(href='#search' role='tab') Search for Classes
li#import-tab(role='presentation')
a(href='#import' role='tab') Batch Import
div#tab-contents.tab-content
div#search.tab-pane.fade(role='tabpanel')
p
This is the search tab.
div#import.tab-pane.fade(role='tabpanel')
p
This is the import tab.
div.row
div.col-md-2
div.col-md-8
br
div.input-group
span.input-group-btn
button.btn.btn-info(type="button") Import CRN's
input.form-control(type="text" placeholder="Enter CRN's separated by commas...")
// br
// div.input-group
// span.input-group-btn
// button.btn.btn-info(type="button")
// i.fa.fa-search
// input.form-control(type="text" placeholder="Search for classes...")
div.col-md-2
div.row
br
div.col-md-12
table#classSearch.table.table-striped.table-bordered
thead
tr
th Add
th CRN
th Class
th Title
th Section
th Campus
th Sessions
tbody
tr
td
button.btn.btn-primary(type="button") Add
td 12345
td
td
td
td
td
// Right padding
div.col-md-1
// Registration cart div
div#sidebar.col-md-4
div.row
div.col-md-11
div#registeredClasses.row
div.well
h2 Registered Classes
div.col-md-1
div#registered-classes.col-md-4(style='background-color: red;')
center
h1 Registered Classes
doctype html
html
include head
body(style='padding-top: 70px;')
include nav
block content
body(style='padding-top: 50px;')
div.container-fluid
include nav
block content
// Site branding row
div.row.center-text
// Font Awesome stack of circle and calendar for logo
span.fa-stack.fa-lg.fa-5x
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}
......@@ -5,5 +5,6 @@ block content
div.row
div.col-lg-2
div.col-lg-8
include main-title
block docs-content
div.col-lg-2
cd schedules
echo "** Your sudo privalleges are needed to start the database, MongoDB"
sudo systemctl start mongodb
echo "** visit localhost:3000 for the server"
DEBUG=myapp:* nodemon start
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