Skip to content

Commit

Permalink
added initial web app stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankohl committed Dec 20, 2011
1 parent 0581789 commit b73419c
Show file tree
Hide file tree
Showing 23 changed files with 1,485 additions and 0 deletions.
21 changes: 21 additions & 0 deletions html/index.html
@@ -0,0 +1,21 @@
<html>
<head>
<title>NHL Data Demo</title>
<link rel="stylesheet" href="/css/index.css"/>
<script type="text/javascript" src="/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="/js/index.js"></script>
</head>
<body>
<div id="top">
<h1 id="title">Hockey Overflow</h1>
</div>
<div id="content">
<div id="teamList">
<select id="teams">
</select>
</div>
<div id="teamInfo"/>
</div>
</body>
</html>
8 changes: 8 additions & 0 deletions html/index.html~
@@ -0,0 +1,8 @@
<html>
<head>
<title>NHL Data Demo</title>
</head>
<body>
<p>I am index</p>
</body>
</html>
15 changes: 15 additions & 0 deletions resources/public/css/index.css
@@ -0,0 +1,15 @@
#title {
margin-left: auto;
margin-right: auto;
text-align: center;
}
#content {
clear: both;
}
#teams {
float: left;
}
#teamInfo {
float: right;
}

14 changes: 14 additions & 0 deletions resources/public/css/index.css~
@@ -0,0 +1,14 @@
#title {
margin-left: auto;
margin-right: auto;
font-size: 18px;
}
#content {
clear: both;
}
#teams {
float: left;
}
#teamInfo {
float: right;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
568 changes: 568 additions & 0 deletions resources/public/css/smoothness/jquery-ui-1.8.16.custom.css

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions resources/public/js/index.js
@@ -0,0 +1,41 @@
var names;
var teams;
var reverseTeams= {};
var teamList;
var badges;
var badgeTypes;

$(document).ready(getData)
function keys(x) {
return $.map(x, function(v,k) { return k });
}
function values(x) {
return $.map(x, function(v,k) { return v });
}
function getData() {
$.getJSON('/data', function(data) {
names= data.teamData['team-names'];
teams= keys(names);
$.each(teams, function(v,k) { reverseTeams[v]= k });
teamList= values(names).sort();
badges= data.badgeData;
badgeTypes= keys(badges);
renderData();
// showBadgeData('http://www.nhl.com/team-25');
});
}
function renderData() {
$('#teams').empty();
$.each(teamList, function(i, v) {
$('#teams').append('<option value="'+reverseTeams[v]+'">'+v+'</option>');
})
}
function showBadgeData(teamID) {
var b= [];
$.each(badgeTypes, function(i,x) {
// return $.grep(badges[x], function(v,k) { v.team == teamID });
return
});
b= $.grep(b, function(x,i) { x.team == teamID });
alert(b);
}
14 changes: 14 additions & 0 deletions resources/public/js/index.js~
@@ -0,0 +1,14 @@
$.ready() {
getData();
}

function getData() {
$.getJSON('/data', function(data) {
getTeams();
renderData();
});
}

function renderData() {

}
4 changes: 4 additions & 0 deletions resources/public/js/jquery-1.7.1.min.js

Large diffs are not rendered by default.

791 changes: 791 additions & 0 deletions resources/public/js/jquery-ui-1.8.16.custom.min.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/nhl/server.clj
@@ -0,0 +1,9 @@
(ns nhl.server
(:use noir.core)
(:require [noir.server :as server]))

(defpage "/" [] (slurp "html/index.html"))
(defpage "/data" [] (slurp "files/results.json"))

(defn -main [& m]
(server/start 8080))

0 comments on commit b73419c

Please sign in to comment.