linuxgaming

This is my own Linux gaming aggregate web app I built for personal use.
git clone git://git.beardyjay.co.uk/linuxgaming
Log | Files | Refs | README

commit edf72452a850498528111706d4828dc3ad616792
parent 39519d1598b86948b332380d46d5d441b1e5c06b
Author: Jay Scott <jay@beardyjay.co.uk>
Date:   Tue, 17 Jul 2018 17:33:44 +0100

Updating the UI

Diffstat:
MTODO.md | 1-
Mlinuxgaming/__init__.py | 16+++++++++++++++-
Alinuxgaming/static/images/icons/gog.jpg | 0
Mlinuxgaming/static/images/icons/gog.png | 0
Mlinuxgaming/static/js/script.js | 1-
Mlinuxgaming/static/stylesheets/style.css | 8--------
Mlinuxgaming/templates/base.html | 42+++++++++++++++++++++++++++++++++++-------
Mlinuxgaming/templates/macros/items.html | 2+-
Mlinuxgaming/templates/pages/details.html | 4----
Mlinuxgaming/templates/pages/list.html | 6+++++-
10 files changed, 56 insertions(+), 24 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -3,7 +3,6 @@ ## pre 1.0 - - Get configs from ENV - Page / limit results on main page. - Add search options to reflect this. - Refactor code diff --git a/linuxgaming/__init__.py b/linuxgaming/__init__.py @@ -2,6 +2,9 @@ from flask import render_template, Flask from flask_compress import Compress from flask_pymongo import PyMongo from flask_htmlmin import HTMLMIN +from datetime import datetime, timedelta + +import dateutil.parser from . import update from . import details @@ -26,10 +29,15 @@ def create_app(): # register blueprint modules app.register_blueprint(update.bp) app.register_blueprint(details.bp) + + +# {"date":{'$lte': search_date.strftime("%Y-%m-%d %H:%M:%S"}} @app.route("/") def home(): - all_data = mongo.db.items.find().sort('date', -1) + + today = datetime.now() + all_data = mongo.db.items.find({"date":{'$gte': today - timedelta(hours=24)}}).sort('date', -1) return render_template('pages/list.html', entries=all_data) @app.errorhandler(500) @@ -48,4 +56,10 @@ def create_app(): icon="frown", msg="I think you are lost!"), 404 + @app.template_filter('strftime') + def _jinja2_filter_datetime(date, fmt=None): + date = dateutil.parser.parse(str(date)) + native = date.replace(tzinfo=None) + format='%a %d %b %X %Y' + return native.strftime(format) return app diff --git a/linuxgaming/static/images/icons/gog.jpg b/linuxgaming/static/images/icons/gog.jpg Binary files differ. diff --git a/linuxgaming/static/images/icons/gog.png b/linuxgaming/static/images/icons/gog.png Binary files differ. diff --git a/linuxgaming/static/js/script.js b/linuxgaming/static/js/script.js @@ -13,4 +13,3 @@ $("#search").keyup(function() { }); }); - diff --git a/linuxgaming/static/stylesheets/style.css b/linuxgaming/static/stylesheets/style.css @@ -1,7 +0,0 @@ -body { - padding: 1em; -} - -.ui.divider { - padding-bottom: 2em; -}- \ No newline at end of file diff --git a/linuxgaming/templates/base.html b/linuxgaming/templates/base.html @@ -13,18 +13,46 @@ <body> <div class="ui secondary menu"></div> - <img src="{{ url_for('static', filename='images/logo.png')}}" alt="Site Logo" class="ui centered small image"> - <div class="sub ui centered header"> - <div class="ui labeled big input"> - <div class="ui olive label"> - Search.. + <div class="sub ui centered header"></div> + + <div class="ui container centered"> + + <div class="ui borderless small icon menu"> + <a class="item" href="/"> + + <img alt="Site Logo" src="{{ url_for('static', filename='images/logo.png')}}"> + </a> + <div class="item"> + Filter + <i class="right arrow black large icon"></i> + </div> + <a class="item"> + <i class="twitch purple link large icon"></i> + </a> + <a class="item"> + <i class="youtube red large icon"></i> + </a> + <a class="item"> + <i class="rss orange large icon"></i> + </a> + <a class="item"> + <i class="steam black large icon"></i> + </a> + <a class="item"> + <i class="bomb red large icon"></i> + </a> + <div class="right item"> + <div class="ui icon input"> + <input id="search" placeholder="Search..." type="text"> + <i class="search olive icon"></i> + </div> </div> - <input id="search" placeholder="Search..." type="text"> </div> - + </div> <div class="ui hidden divider"></div> + <div class="ui container"> {% block content %} {% endblock %} diff --git a/linuxgaming/templates/macros/items.html b/linuxgaming/templates/macros/items.html @@ -19,7 +19,7 @@ <td> {{ item.title }} </td> - <td>{{ item.date }}</td> + <td>{{ item.date|strftime}}</td> <td> <a href="{{ item.url }}" target="_blank"> <i class="external alternate olive bordered icon"></i> diff --git a/linuxgaming/templates/pages/details.html b/linuxgaming/templates/pages/details.html @@ -3,10 +3,6 @@ {% block content %} -<h2 class="ui header"><a href="/"><i class="backward icon"></i> - <div class="content">Back</div></a> -</h2> - <div class="ui centered items"> <div class="item"> diff --git a/linuxgaming/templates/pages/list.html b/linuxgaming/templates/pages/list.html @@ -18,11 +18,15 @@ {% endif %} {% endwith %} +<div class="ui horizontal divider"> + Latest 24 hours +</div> + <table class="ui striped very compact small olive table"> <thead> <tr> <th>Type</th> - <th data-tooltip="Click the source for more details!" data-position="top center">Source</th> + <th data-variation="inverted" data-tooltip="Click the source to filter just them!" data-position="top center">Source</th> <th>Title</th> <th>Released</th> <th>Link</th>