Skip to content

Commit e555da3

Browse files
committed
Merge branch 'master' into sql
2 parents ed34543 + 550417c commit e555da3

File tree

7 files changed

+191
-30
lines changed

7 files changed

+191
-30
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies {
3838

3939
dependencyManagement {
4040
imports {
41-
mavenBom("com.amazonaws:aws-java-sdk-bom:1.11.39")
41+
mavenBom("com.amazonaws:aws-java-sdk-bom:1.11.67")
4242
}
4343
}
4444
task wrapper(type: Wrapper) {

public/app/gameController.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,8 @@ function Game($q, $scope, $http, $interval, $routeParams, SessionService, UserSe
7272

7373
});
7474
}
75-
75+
$scope.$on('$destroy',function(){
76+
if($scope.interval)
77+
$interval.cancel($scope.interval);
78+
});
7679
}

public/app/sessionController.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ function Session($scope, $http, $location, $interval, $routeParams, SessionServi
4141
$scope.interval = $interval(function(){
4242
$scope.loadSession();
4343
}, 5000);
44-
4544
$scope.createGame = function (gamename, gamerules) {
4645
var sessionid = $routeParams.sessionid;
4746

@@ -95,4 +94,8 @@ function Session($scope, $http, $location, $interval, $routeParams, SessionServi
9594
$location.path('/');
9695
});
9796
};
97+
$scope.$on('$destroy',function(){
98+
if($scope.interval)
99+
$interval.cancel($scope.interval);
100+
});
98101
}

public/css/scorekeep.css

Lines changed: 144 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,144 @@
1-
/* Main page */
2-
#main, #session {
1+
/*
2+
* Pages
3+
*/
4+
5+
.page {
6+
text-align: left;
7+
padding-left: 10px;
8+
}
9+
10+
.page-header {
11+
font-size: 2em;
12+
}
13+
14+
.section-header {
15+
font-size: 1.5em;
16+
}
17+
18+
/*
19+
* Base structure
20+
*/
21+
22+
html,
23+
body {
24+
height: 100%;
25+
background-color: #fff;
26+
}
27+
body {
28+
color: #000;
329
text-align: center;
4-
width: 300px;
5-
padding: 10px;
6-
margin: 10px;
7-
position: absolute;
8-
left: 10px;
930
}
10-
#game {
31+
32+
a, a:active, a:focus, a:hover {
33+
color: #000;
34+
outline: none;
35+
text-decoration: none;
36+
}
37+
38+
/* Extra markup and styles for table-esque vertical and horizontal centering */
39+
.site-wrapper {
40+
display: table;
41+
width: 100%;
42+
height: 100%; /* For at least Firefox */
43+
min-height: 100%;
44+
}
45+
.site-wrapper-inner {
46+
display: table-cell;
47+
}
48+
.cover-container {
49+
margin-right: auto;
50+
margin-left: auto;
51+
margin-top: 75px;
52+
}
53+
54+
/* Padding for spacing */
55+
.inner {
56+
padding: 2rem;
57+
}
58+
59+
/*
60+
* Header
61+
*/
62+
63+
.masthead {
64+
margin-bottom: 15px;
65+
padding-bottom: 10px;
66+
background-color: #fff;
67+
}
68+
69+
.masthead-brand {
70+
margin-bottom: 0;
71+
}
72+
73+
.nav-masthead .nav-link {
74+
padding: .25rem 0;
75+
font-weight: bold;
76+
color: #FF851B;
77+
}
78+
79+
.nav-masthead .nav-link + .nav-link {
80+
margin-left: 1rem;
81+
}
82+
83+
.nav-masthead .active {
84+
color: #000;
85+
}
86+
87+
@media (min-width: 48em) {
88+
.masthead-brand {
89+
float: left;
90+
}
91+
.nav-masthead {
92+
float: right;
93+
}
94+
}
95+
96+
97+
/*
98+
* Cover
99+
*/
100+
101+
.cover {
102+
padding: 0 1.5rem;
103+
}
104+
.cover .btn-lg {
105+
padding: .75rem 1.25rem;
106+
font-weight: bold;
107+
}
108+
109+
/*
110+
* Affix and center
111+
*/
112+
113+
@media (min-width: 40em) {
114+
/* Pull out the header */
115+
.masthead {
116+
position: fixed;
117+
top: 0;
118+
}
119+
/* Handle the widths */
120+
.masthead,
121+
.cover-container {
122+
width: 100%; /* Must be percentage or pixels for horizontal alignment */
123+
}
124+
}
125+
126+
@media (min-width: 62em) {
127+
.masthead,
128+
.cover-container {
129+
width: 42rem;
130+
}
131+
}
132+
/* Main page */
133+
#instructions {
134+
display: none;
135+
margin-top: 75px;
136+
}
137+
#main, #session, #game {
11138
text-align: center;
12139
width: 350px;
13140
padding: 10px;
14-
margin: 10px;
15-
position: absolute;
16-
left: 10px;
141+
margin: auto;
17142
}
18143
.session-game {
19144
text-align: left;
@@ -23,11 +148,6 @@
23148
height: 120px;
24149
padding: 15px;
25150
}
26-
.main-header {
27-
font-size: 20px;
28-
text-align: left;
29-
padding-left: 20px;
30-
}
31151
.sub-header {
32152
font-size: 16px;
33153
text-align: left;
@@ -43,7 +163,7 @@
43163
.button {
44164
background-color: #f39c12;
45165
width: 100px;
46-
margin-left: 128px;
166+
margin-left: 176px;
47167
margin-top: 10px;
48168
border-radius: 5px;
49169
border-width: 2px;
@@ -85,11 +205,13 @@ input {
85205
font-size: 20px;
86206
text-align: left;
87207
}
208+
#session-id {
209+
width: auto;
210+
text-align: left;
211+
padding-left: 10px;
212+
}
88213
#user {
89-
position: absolute;
90-
right: 0;
91-
top: 0;
92-
padding-top: 15px;
214+
float: right;
93215
}
94216
#rules-select {
95217
display: inline-block;
@@ -137,4 +259,4 @@ input {
137259
}
138260
.square:active {
139261
background-color: #85144b;
140-
}
262+
}

public/index.html

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,46 @@
2020
<script src="app/sessionCollection.js"></script>
2121
<script src="app/gameCollection.js"></script>
2222
<script src="app/mainController.js"></script>
23-
<link rel="stylesheet" href="css/scorekeep.css"/>
2423
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous"/>
2524
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/css/tether.css"/>
25+
<link rel="stylesheet" href="css/scorekeep.css"/>
2626
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.js"></script>
2727
<script src="https://code.jquery.com/jquery-3.1.1.js" integrity="sha256-16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA=" crossorigin="anonymous"></script>
2828
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js" integrity="sha384-BLiI7JTZm+JWlgKa0M0kGRpJbF2J8q+qreVrKBC47e3K6BW78kGLrCkeRX6I9RoK" crossorigin="anonymous"></script>
29+
<script>
30+
function showhide(div) {
31+
if ( document.getElementById(div).style.display == 'block') {
32+
document.getElementById(div).style.display = 'none';
33+
}
34+
else {
35+
document.getElementById(div).style.display = 'block';
36+
}
37+
}
38+
</script>
2939
</head>
3040
<body>
31-
<div ng-view></div>
41+
<div class="site-wrapper">
42+
<div class="site-wrapper-inner">
43+
<div class="cover-container">
44+
<div class="masthead clearfix">
45+
<div class="inner">
46+
<h3 class="masthead-brand"><a href="#/">Scorekeep</a></h3>
47+
<nav class="nav nav-masthead">
48+
<a class="nav-link" href='#/' onclick="showhide('instructions');return false;">Instructions</a>
49+
<a class="nav-link" target="blank" href="https://aws.amazon.com/elasticbeanstalk/">Powered by AWS Elastic Beanstalk</a>
50+
</nav>
51+
</div>
52+
</div>
53+
<div class="inner cover" id="instructions">
54+
<h3 class="cover-heading">Using the web app</h1>
55+
<p>Use the form below to create a user and session. When you click <b>Create</b>, the web app calls the Scorekeep API to create a user and a session, and joins the session lobby. If you don't enter a username, Scorekeep calls a separate web API to generate a random name.</p>
56+
<p>To create and join a second user to the session, open the web app in a second tab, enter the session ID shown in the lobby, and click <b>Join</b>.</p>
57+
<p>In the session lobby, enter a game name, and set the rules to <b>Tic Tac Toe</b>. Click <b>Create</b> to create a game. Open the networking tab in your browser's developer tools to see the calls that the web app makes to the API to keep the list of games up-to-date.</p>
58+
<p>Choose <b>Play</b> with each user to start the game.</p>
59+
</div>
60+
<div ng-view></div>
61+
</div>
62+
</div>
63+
</div>
3264
</body>
3365
</html>

public/main.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div id="main">
22
<div id="main-user">
3-
<div class="main-header">Username</div>
3+
<div class="section-header">Username</div>
44
<div id="usernamef" class="field"><input name="user" ng-model="username"></div>
55
</div>
66
<div id="main-session">
7-
<div class="main-header">Session</div>
7+
<div class="section-header">Session</div>
88
<div id="sessionnamef" class="field"><input name="name" ng-model="sessionname"></div>
99
<div id="create" class="button" ng-click="createSession(sessionname, username)">Create</div>
1010
<div id="sessionid" class="field"><input name="sessionid" ng-model="sessionid" placeholder="session ID"></div>

public/session.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div id="session">
2-
<div class="session-header">{{ session.name }}</div>
32
<div id="user"><h6>{{ user.name}}</h6></div>
3+
<div class="session-header">{{ session.name }}</div>
4+
<div id="session-id">Session ID: {{ session.id }}</div>
45
<div class="sub-header">Create a game</div>
56
<div id="create-game-form">
67
<form name="create-game">

0 commit comments

Comments
 (0)