Skip to content

Commit 61525da

Browse files
committed
Add placeholder page
1 parent a2aed67 commit 61525da

4 files changed

Lines changed: 109 additions & 4 deletions

File tree

cloudbot/web/main.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
from jinja2 import Environment, PackageLoader
88

9+
wi = None
10+
911

1012
def get_template_env():
11-
env = Environment(loader=PackageLoader('cloudbot.web.templates'))
13+
env = Environment(loader=PackageLoader('cloudbot.web'))
1214
return env
1315

1416

@@ -23,7 +25,8 @@ def get_application():
2325
class TestHandler(RequestHandler):
2426
@gen.coroutine
2527
def get(self):
26-
self.write("Hello world!\n")
28+
template = wi.env.get_template('layout.html')
29+
self.write(template.render())
2730

2831

2932
class WebInterface():
@@ -32,11 +35,13 @@ def __init__(self, bot, port=8080, address="0.0.0.0"):
3235
self.port = port
3336
self.address = address
3437

35-
self.template = get_application()
36-
self.template_env = get_template_env()
38+
self.env = get_template_env()
3739

3840
self.app = None
3941

42+
global wi
43+
wi = self
44+
4045
# Install tornado IO loop.
4146
AsyncIOMainLoop().install()
4247

cloudbot/web/static/css/style.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
body {
2+
padding-top: 50px;
3+
}
4+
5+
.placeholder {
6+
padding: 40px 15px;
7+
text-align: center;
8+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*!
2+
* IE10 viewport hack for Surface/desktop Windows 8 bug
3+
* Copyright 2014 Twitter, Inc.
4+
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
5+
* details, see http://creativecommons.org/licenses/by/3.0/.
6+
*/
7+
8+
// See the Getting Started docs for more information:
9+
// http://getbootstrap.com/getting-started/#support-ie10-width
10+
11+
(function () {
12+
'use strict';
13+
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
14+
var msViewportStyle = document.createElement('style')
15+
msViewportStyle.appendChild(
16+
document.createTextNode(
17+
'@-ms-viewport{width:auto!important}'
18+
)
19+
)
20+
document.querySelector('head').appendChild(msViewportStyle)
21+
}
22+
})();

cloudbot/web/templates/layout.html

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
8+
<meta name="description" content="">
9+
<meta name="author" content="">
10+
<link rel="icon" href="../../favicon.ico">
11+
12+
<title>Starter Template for Bootstrap</title>
13+
14+
<!-- Bootstrap core CSS -->
15+
<link href="./s/css/bootstrap.min.css" rel="stylesheet">
16+
<link href="./s/css/style.css" rel="stylesheet">
17+
18+
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
19+
<!--[if lt IE 9]>
20+
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
21+
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
22+
<![endif]-->
23+
</head>
24+
25+
<body>
26+
27+
<nav class="navbar navbar-inverse navbar-fixed-top">
28+
<div class="container">
29+
<div class="navbar-header">
30+
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
31+
aria-expanded="false" aria-controls="navbar">
32+
<span class="sr-only">Toggle navigation</span>
33+
<span class="icon-bar"></span>
34+
<span class="icon-bar"></span>
35+
<span class="icon-bar"></span>
36+
</button>
37+
<a class="navbar-brand" href="#">Project name</a>
38+
</div>
39+
<div id="navbar" class="collapse navbar-collapse">
40+
<ul class="nav navbar-nav">
41+
<li class="active"><a href="#">Home</a></li>
42+
<li><a href="#about">About</a></li>
43+
<li><a href="#contact">Contact</a></li>
44+
</ul>
45+
</div>
46+
<!--/.nav-collapse -->
47+
</div>
48+
</nav>
49+
50+
<div class="container">
51+
52+
<div class="placeholder">
53+
<h1>Placeholder Text</h1>
54+
55+
<p class="lead">Use this document as a way to quickly start any new project.<br> All you get is this text and a
56+
mostly barebones HTML document.</p>
57+
</div>
58+
59+
</div>
60+
<!-- /.container -->
61+
62+
63+
<!-- Bootstrap core JavaScript
64+
================================================== -->
65+
<!-- Placed at the end of the document so the pages load faster -->
66+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
67+
<script src="./s/js/bootstrap.min.js"></script>
68+
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
69+
<script src="./s/js/ie10-viewport-bug-workaround.js"></script>
70+
</body>

0 commit comments

Comments
 (0)