From d3484d96e17138a9b8d86a85d387bb6c0f7135f0 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 20 Mar 2018 02:17:33 +0000 Subject: [PATCH] Add more details to package page --- app/models.py | 1 + app/static/style.css | 29 +++++++++++++++++++++++++- app/templates/package_details.html | 33 +++++++++++++++++++++++------- app/views/__init__.py | 5 +++++ setup.py | 17 ++++++++++++++- 5 files changed, 76 insertions(+), 9 deletions(-) diff --git a/app/models.py b/app/models.py index c5ce4b6..cfe1931 100644 --- a/app/models.py +++ b/app/models.py @@ -89,6 +89,7 @@ class Package(db.Model): author_id = db.Column(db.Integer, db.ForeignKey('user.id')) name = db.Column(db.String(100), nullable=False) title = db.Column(db.String(100), nullable=False) + shortDesc = db.Column(db.Text, nullable=True) desc = db.Column(db.Text, nullable=True) type = db.Column(db.Enum(PackageType)) diff --git a/app/static/style.css b/app/static/style.css index c9c28d6..551cc74 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -80,7 +80,6 @@ a:hover { text-align: center; color: #ddd; text-decoration: none; - margin: 5px 0 !important; } .buttonset li a:hover { @@ -96,6 +95,24 @@ a:hover { background: #474 !important; } +.linedbuttonset a { + border: 1px solid #eee; + border-radius: 3px; + padding: 4px 10px; + margin: 0; + display: block; +} + +.linedbuttonset { + display: block; + margin: 0; +} + +.linedbuttonset li { + display: inline-block; + margin: 10px 10px 0 0; +} + /* Alerts */ #alerts { @@ -196,6 +213,12 @@ footer a { color: #666; } +.asideright { + float: right; + margin: 0 0 0 15px; + max-width: 300px; +} + /* Mod */ @@ -243,3 +266,7 @@ footer a { .sidebar_container .right > *:first-child, .sidebar_container .left > *:first-child { margin-top: 0; } + +.package-short-large { + font-size: 120%; +} diff --git a/app/templates/package_details.html b/app/templates/package_details.html index c52cd62..b75be24 100644 --- a/app/templates/package_details.html +++ b/app/templates/package_details.html @@ -1,14 +1,33 @@ {% extends "base.html" %} {% block title %} -{{ package.title }} + {{ package.title }} {% endblock %} {% block content %} - {{ package.title }} - {{ package.author.display_name }} - {{ package.name }} - {{ package.desc }} - VCS Repo - Report Issue +

{{ package.title }} by {{ package.author.display_name }}

+ + + +

{{ package.shortDesc }}

+ + {{ package.desc | markdown }} {% endblock %} diff --git a/app/views/__init__.py b/app/views/__init__.py index ed90875..9423453 100644 --- a/app/views/__init__.py +++ b/app/views/__init__.py @@ -7,8 +7,13 @@ import flask_menu as menu from flask.ext import markdown from sqlalchemy import func from werkzeug.contrib.cache import SimpleCache +from urllib.parse import urlparse cache = SimpleCache() +@app.template_filter() +def domain(url): + return urlparse(url).netloc + # TODO: remove on production! @app.route('/static/') def send_static(path): diff --git a/setup.py b/setup.py index a606c4f..fdc6221 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,22 @@ if not os.path.isfile("db.sqlite"): mod1.title = "Awards" mod1.type = PackageType.MOD mod1.author = ruben - mod1.description = "Adds achievements and an API to register new ones." + mod1.shortDesc = "Adds achievements and an API to register new ones." + mod1.desc = """ + Majority of awards are back ported from Calinou's old fork in Carbone, under same license. + +``` +awards.register_achievement("award_mesefind",{ + title = "First Mese Find", + description = "Found some Mese!", + trigger = { + type = "dig", -- award is given when + node = "default:mese", -- this type of node has been dug + target = 1, -- this number of times + }, +}) +``` + """ mod1.repo = "https://github.com/rubenwardy/awards" mod1.issueTracker = "https://github.com/rubenwardy/awards/issues" mod1.forums = "https://forum.minetest.net/viewtopic.php?t=4870"