Add more details to package page

This commit is contained in:
rubenwardy 2018-03-20 02:17:33 +00:00
parent d17535fc78
commit d3484d96e1
5 changed files with 76 additions and 9 deletions

@ -89,6 +89,7 @@ class Package(db.Model):
author_id = db.Column(db.Integer, db.ForeignKey('user.id')) author_id = db.Column(db.Integer, db.ForeignKey('user.id'))
name = db.Column(db.String(100), nullable=False) name = db.Column(db.String(100), nullable=False)
title = 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) desc = db.Column(db.Text, nullable=True)
type = db.Column(db.Enum(PackageType)) type = db.Column(db.Enum(PackageType))

@ -80,7 +80,6 @@ a:hover {
text-align: center; text-align: center;
color: #ddd; color: #ddd;
text-decoration: none; text-decoration: none;
margin: 5px 0 !important;
} }
.buttonset li a:hover { .buttonset li a:hover {
@ -96,6 +95,24 @@ a:hover {
background: #474 !important; 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 */
#alerts { #alerts {
@ -196,6 +213,12 @@ footer a {
color: #666; color: #666;
} }
.asideright {
float: right;
margin: 0 0 0 15px;
max-width: 300px;
}
/* Mod */ /* Mod */
@ -243,3 +266,7 @@ footer a {
.sidebar_container .right > *:first-child, .sidebar_container .left > *:first-child { .sidebar_container .right > *:first-child, .sidebar_container .left > *:first-child {
margin-top: 0; margin-top: 0;
} }
.package-short-large {
font-size: 120%;
}

@ -1,14 +1,33 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %} {% block title %}
{{ package.title }} {{ package.title }}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{{ package.title }} <h1>{{ package.title }} by {{ package.author.display_name }}</h1>
{{ package.author.display_name }}
{{ package.name }} <aside class="asideright box box_grey">
{{ package.desc }} <table>
<a href="{{ package.repo }}">VCS Repo</a> <tr>
<a href="{{ package.issueTracker }}">Report Issue</a> <td>Name</td>
<td>{{ package.name }}</td>
</tr>
<tr>
<td>Type</td>
<td>{{ package.type.getTitle() }}</td>
</tr>
</table>
<ul class="buttonset linedbuttonset">
{% if package.repo %}<li><a href="{{ package.repo }}">View Source</a></li>{% endif %}
{% if package.forums %}<li><a href="{{ package.forums }}">Forums</a></li>{% endif %}
{% if package.issueTracker %}<li><a href="{{ package.issueTracker }}">Issue Tracker</a></li>{% endif %}
{% if package.website %}<li><a href="{{ package.website }}">Website</a></li>{% endif %}
</ul>
</aside>
<p class="package-short-large">{{ package.shortDesc }}</p>
{{ package.desc | markdown }}
{% endblock %} {% endblock %}

@ -7,8 +7,13 @@ import flask_menu as menu
from flask.ext import markdown from flask.ext import markdown
from sqlalchemy import func from sqlalchemy import func
from werkzeug.contrib.cache import SimpleCache from werkzeug.contrib.cache import SimpleCache
from urllib.parse import urlparse
cache = SimpleCache() cache = SimpleCache()
@app.template_filter()
def domain(url):
return urlparse(url).netloc
# TODO: remove on production! # TODO: remove on production!
@app.route('/static/<path:path>') @app.route('/static/<path:path>')
def send_static(path): def send_static(path):

@ -21,7 +21,22 @@ if not os.path.isfile("db.sqlite"):
mod1.title = "Awards" mod1.title = "Awards"
mod1.type = PackageType.MOD mod1.type = PackageType.MOD
mod1.author = ruben 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.repo = "https://github.com/rubenwardy/awards"
mod1.issueTracker = "https://github.com/rubenwardy/awards/issues" mod1.issueTracker = "https://github.com/rubenwardy/awards/issues"
mod1.forums = "https://forum.minetest.net/viewtopic.php?t=4870" mod1.forums = "https://forum.minetest.net/viewtopic.php?t=4870"