| Updating the UI - linuxgaming - Linux gaming aggregate tool, built to test out … | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 518c87952ce1238d0c559ec7d374befc9deb961c | |
| parent ad97e303220a91a439318b988b49f605323e8ebf | |
| Author: Jay Scott <[email protected]> | |
| Date: Tue, 17 Jul 2018 17:33:44 +0100 | |
| Updating the UI | |
| Diffstat: | |
| M TODO.md | 1 - | |
| M linuxgaming/__init__.py | 16 +++++++++++++++- | |
| A linuxgaming/static/images/icons/go… | 0 | |
| M linuxgaming/static/images/icons/go… | 0 | |
| M linuxgaming/static/js/script.js | 1 - | |
| M linuxgaming/static/stylesheets/sty… | 8 -------- | |
| M linuxgaming/templates/base.html | 42 ++++++++++++++++++++++++++---… | |
| M linuxgaming/templates/macros/items… | 2 +- | |
| M linuxgaming/templates/pages/detail… | 4 ---- | |
| M linuxgaming/templates/pages/list.h… | 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(hour… | |
| 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/image… | |
| Binary files differ. | |
| diff --git a/linuxgaming/static/images/icons/gog.png b/linuxgaming/static/image… | |
| 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/styl… | |
| @@ -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 Lo… | |
| - <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… | |
| + </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/ma… | |
| @@ -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/p… | |
| @@ -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/page… | |
| @@ -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… | |
| + <th data-variation="inverted" data-tooltip="Click the source to filter j… | |
| <th>Title</th> | |
| <th>Released</th> | |
| <th>Link</th> |