Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added many ui elements and pages

  • Loading branch information...
commit d0d938b059a3b42549e684e411a3f1e9f2ab20d8 1 parent cb69520
@artnez authored
View
3  src/faceoff/models/user.py
@@ -60,7 +60,8 @@ def auth_logout(session):
NOTE: If the application grows, this will likely need to be moved into a
model that is exclusively responsible for auth management.
"""
- session.pop('user_id')
+ if session.has_key('user_id'):
+ session.pop('user_id')
def generate_salt():
"""
View
113 src/faceoff/static/css/faceoff.app.css
@@ -3,4 +3,115 @@
* License: MIT, see LICENSE for details
*/
-.container {}
+.container {
+ margin-top: 20px;
+}
+
+#header {
+ position: relative;
+ background: #333;
+ padding: 20px 0;
+ margin: 0 0 25px 0;
+ width: 100%;
+ overflow: hidden;
+}
+
+#header #logo,
+#header .separator,
+#header #nickname {
+ float: left;
+ font-size: 42px;
+ line-height: 42px;
+}
+
+#header #logo {
+ margin: 0 2px 0 25px;
+}
+
+#header #logo a {
+ color: #fff;
+ text-shadow: 1px 1px 0 #000;
+ text-transform: uppercase;
+ text-decoration: none;
+}
+
+#header .separator,
+#header #nickname {
+ font-size: 38px;
+ line-height: 48px;
+ height: 38px;
+}
+
+#header .separator,
+#header #nickname a {
+ color: #666;
+ text-decoration: none;
+}
+
+#header .separator {
+ margin: 0 2px;
+}
+
+#header #nickname {
+ font-family: Georgia;
+}
+
+#header ul.menu {
+ position: absolute;
+ top: 29px;
+ right: 20px;
+ list-style: none;
+}
+
+#header ul.menu li,
+#header ul.menu li a {
+ float: left;
+ margin: 0;
+ padding: 0;
+}
+
+#header ul.menu li {
+ float: left;
+ margin: 0 0 0 6px;
+}
+
+#header ul.menu li a {
+ float: left;
+ color: #333;
+ font-weight: bold;
+ text-transform: uppercase;
+ background: #fff;
+ padding: 4px 8px;
+ text-decoration: none;
+ border-bottom: solid #333 2px;
+}
+
+#header ul.menu li:hover {
+ border-bottom: solid #666 2px;
+}
+
+#header ul.menu li.selected {
+ border-bottom: solid #fff 2px;
+}
+
+#content .section {
+ margin: 0 0 25px 0;
+}
+
+#content .section h2.center {
+ color: #999;
+ text-align: center;
+ font-family: Georgia;
+ font-weight: normal;
+ font-style: italic;
+ background: url('../img/heading-bg-line.png') no-repeat 0 50%;
+}
+
+#content .section h2.center span {
+ background: #fff;
+ padding: 0 12px;
+}
+
+#content .section:hover h2.center {
+ color: #333;
+}
View
8 src/faceoff/static/css/faceoff.css
@@ -3,6 +3,14 @@
* License: MIT, see LICENSE for details
*/
+a {
+ color: #069;
+}
+
+h1 {
+ display: none;
+}
+
/**
* Additional form styles.
*/
View
15 src/faceoff/static/css/faceoff.gate.css
@@ -18,21 +18,24 @@
margin: 0 0 10px 0;
}
-.container header {
+#header {
color: #fff;
+ font-size: 34px;
+ line-height: 34px;
+ text-align: center;
background: #333;
margin: 0 0 25px 0;
}
-.container header h1 {
- font-size: 34px;
- text-align: center;
- text-shadow: 1px 1px 0 #000;
+#header #logo {
+ display: block;
}
-.container header h1 a {
+#header #logo a {
display: block;
color: #fff;
padding: 20px 0;
text-decoration: none;
+ text-shadow: 1px 1px 0 #000;
+ text-transform: uppercase;
}
View
BIN  src/faceoff/static/img/heading-bg-line.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  src/faceoff/templates/home.html → src/faceoff/templates/dashboard.html
@@ -1,5 +1,5 @@
{% extends 'layouts/app.html' %}
{% set head_title = 'Dashboard' %}
{% block content %}
- <h1>Dashboard</h1>
+dashboard
{% endblock %}
View
5 src/faceoff/templates/history.html
@@ -0,0 +1,5 @@
+{% extends 'layouts/app.html' %}
+{% set head_title = 'Stats' %}
+{% block content %}
+<h2 class='center'><span>History</span></h2>
+{% endblock %}
View
21 src/faceoff/templates/layouts/app.html
@@ -6,6 +6,27 @@
{%- block body %}
<div class='container'>
+ <div id='header'>
+ <strong id='logo'><a href='{{ url_for('dashboard') }}'>Faceoff</a></strong>
+ <span class='separator'>/</span>
+ <em id='nickname'><a href='{{ url_for('dashboard') }}'>artnez</a></em>
+ {% set pages = [
+ {'title': 'Dashboard', 'endpoint': 'dashboard'},
+ {'title': 'Stats', 'endpoint': 'stats'},
+ {'title': 'History', 'endpoint': 'history'},
+ ] %}
+ <ul id='nav' class='menu'>
+ {% for page in pages %}
+ <li {% if request.endpoint == page.endpoint %}class='selected'{% endif %}>
+ <a href='{{ page.url or url_for(page.endpoint) }}'>{{ page.title }}</a>
+ </li>
+ {% endfor %}
+ <li><a href='{{ url_for('logout') }}'>Logout</a></li>
+ </ul>
+ </div>
+ <h1>{{ page_title or head_title }}</h1>
+ <div id='content'>
{%- block content %}{% endblock -%}
+ </div>
</div>
{% endblock -%}
View
6 src/faceoff/templates/layouts/base.html
@@ -2,14 +2,16 @@
<!doctype html>
<html>
<head>
- <title>Faceoff{{ ' | %s' % head_title if head_title }}</title>
+ <title>FACEOFF{{ ' | %s' % head_title if head_title }}</title>
<meta name='description' content='FACEOFF is a small web app that ranks players in 1-v-1 competitive games.'>
<meta name='author' content='Artem Nezvigin, artem@artnez.com'>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
+ {%- if 'no_style' not in request.args %}
<link rel='stylesheet' media='screen' href='{{ url_for('static', filename='css/bootstrap.css') }}'>
<link rel='stylesheet' media='screen' href='{{ url_for('static', filename='css/faceoff.css') }}'>
- {%- block stylesheet %}{% endblock %}
+ {%- block stylesheet %}{% endblock -%}
+ {%- endif -%}
<script src='{{ url_for('static', filename='js/jquery.js') }}'></script>
<script src='{{ url_for('static', filename='js/bootstrap.js') }}'></script>
<script src='{{ url_for('static', filename='js/faceoff.js') }}'></script>
View
8 src/faceoff/templates/layouts/gate.html
@@ -6,7 +6,11 @@
{%- block body %}
<div class='container'>
- <header><h1><a href='{{ url_for('gate') }}'>faceoff</a></h1></header>
- {%- block content %}{% endblock -%}
+ <div id='header'>
+ <strong id='logo'><a href='{{ url_for('gate') }}'>faceoff</a></strong>
+ </div>
+ <div id='content'>
+ {%- block content %}{% endblock -%}
+ </div>
</div>
{% endblock -%}
View
12 src/faceoff/templates/stats.html
@@ -0,0 +1,12 @@
+{% extends 'layouts/app.html' %}
+{% set head_title = 'Stats' %}
+{% block content %}
+<div id='leaderboard' class='section'>
+ <h2 class='center'><span>Leaderboard</span></h2>
+ <p>...</p>
+</div>
+<div id='all-players' class='section'>
+ <h2 class='center'><span>All Players</span></h2>
+ <p>...</p>
+</div>
+{% endblock %}
View
21 src/faceoff/views.py
@@ -3,10 +3,12 @@
License: MIT, see LICENSE for details
"""
+import logging
from flask import Flask, g, request, abort, redirect, url_for, session
from faceoff import app
from faceoff.forms import LoginForm, JoinForm
from faceoff.helpers.decorators import templated, authenticated
+from faceoff.models.league import search_leagues
from faceoff.models.user import find_user, create_user, auth_login, auth_logout
from faceoff.models.settings import get_setting
@@ -18,7 +20,20 @@ def db_close(exception): # pylint:disable=W0613
@app.route('/')
@templated()
@authenticated
-def home():
+def dashboard():
+ leagues = search_leagues()
+ return dict(leagues=leagues)
+
+@app.route('/stats')
+@templated()
+@authenticated
+def stats():
+ pass
+
+@app.route('/history')
+@templated()
+@authenticated
+def history():
pass
@app.route('/gate')
@@ -34,7 +49,7 @@ def login():
if request.method != 'POST' or not form.validate():
return dict(login_form=form)
if auth_login(session, **form.data):
- return redirect(url_for('home'))
+ return redirect(url_for('dashboard'))
else:
return redirect(url_for('login', fail=1))
@@ -52,4 +67,4 @@ def join():
else:
user_id = create_user(form.nickname.data, form.password.data)
session['user_id'] = user_id
- return redirect(url_for('home'))
+ return redirect(url_for('dashboard'))
Please sign in to comment.
Something went wrong with that request. Please try again.