-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae19ae4
commit 10c3a45
Showing
6 changed files
with
112 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,48 @@ | ||
@(message: String) | ||
@(content: String) | ||
<!DOCTYPE html> | ||
|
||
@main("Welcome to Play") { | ||
<html> | ||
<head> | ||
<title>Reactive Tweets</title> | ||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> | ||
<!--link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css"--> | ||
<link rel="stylesheet" href="@routes.Assets.at("stylesheets/flatly.min.css")"> | ||
<link rel="stylesheet" href="@routes.Assets.at("stylesheets/main.css")"> | ||
|
||
@play20.welcome(message) | ||
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script> | ||
|
||
} | ||
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script> | ||
|
||
<script src="//builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script> | ||
|
||
<script src="@routes.Assets.at("javascripts/application.js")" type="text/javascript"></script> | ||
</head> | ||
<body> | ||
|
||
<script id="message-template" type="text/x-handlebars-template"> | ||
<li> | ||
<div class="message"> | ||
<p class="author">{{author}}</p> | ||
<p class="text">{{message}}</p> | ||
</div> | ||
</li> | ||
</script> | ||
|
||
<div class="header"> | ||
<div class="container"> | ||
<h1>Reactive Tweets</h1> | ||
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p> | ||
</div> | ||
</div> | ||
|
||
<div class="container text-center"> | ||
<form class="form-horizontal"> | ||
<div class="col-lg-6"> | ||
<input type="text" class="form-control col-lg-4" id="inputName" placeholder="Your Name"> | ||
</div> | ||
<button type="button" class="btn btn-default" onclick="RT.connect()">Connect</button> | ||
</form> | ||
<ul id="messages"></ul> | ||
</div> <!-- /container --> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var RT = { | ||
|
||
template : function(){}, | ||
|
||
prependListItem : function(listItemHTML){ | ||
$(listItemHTML) | ||
.hide() | ||
.css('opacity',0.0) | ||
.prependTo('#messages') | ||
.slideDown('fast') | ||
.animate({opacity: 1.0}); | ||
}, | ||
|
||
connect: function() { | ||
var name = $('#inputName').val(); | ||
var socket = new WebSocket('ws://localhost:9000/socket?name=' + name); | ||
|
||
socket.onmessage = function(event) { | ||
var message = JSON.parse(event.data); | ||
console.log(message); | ||
console.log(RT.template); | ||
var html = RT.template(message); | ||
RT.prependListItem(html); | ||
}; | ||
} | ||
}; | ||
|
||
$(document).ready( function() { | ||
var source = $("#message-template").html(); | ||
RT.template = Handlebars.compile(source); | ||
console.log(RT.template); | ||
}); |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
body { | ||
margin-left:0; | ||
margin-right: 0; | ||
} | ||
|
||
.header { | ||
padding-top: 60px; | ||
padding-bottom: 60px; | ||
font-size: 24px; | ||
text-align: left; | ||
|
||
position: relative; | ||
padding: 30px 15px; | ||
color: #fff; | ||
background-color: #2c3e50; | ||
} | ||
|
||
.header p { | ||
text-shadow: 0 1px 0 rgba(0,0,0,.1); | ||
} |