Merge minetest/bootstrap into master

This commit is contained in:
rubenwardy 2018-12-22 12:39:35 +00:00 committed by GitHub
commit f6384e2e15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 10385 additions and 1118 deletions

2
.gitignore vendored

@ -1,7 +1,7 @@
config.cfg
config.prod.cfg
*.sqlite
main.css
custom.css
tmp
log.txt
*.rdb

9681
app/public/static/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

7
app/public/static/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

@ -8,4 +8,17 @@ $(function() {
})
$(".not_mod, .not_game, .not_txp").show()
$(".not_" + $("#type").val().toLowerCase()).hide()
$("#forums").on('paste', function(e) {
try {
var pasteData = e.originalEvent.clipboardData.getData('text')
var url = new URL(pasteData);
if (url.hostname == "forum.minetest.net") {
$(this).val(url.searchParams.get("t"));
e.preventDefault();
}
} catch (e) {
console.log("Not a URL");
}
});
})

5
app/public/static/popper.min.js vendored Normal file

File diff suppressed because one or more lines are too long

@ -5,13 +5,25 @@
* https://petprojects.googlecode.com/svn/trunk/GPL-LICENSE.txt
*/
(function($) {
function hide_error(input) {
var err = input.parent().parent().find(".invalid-remaining");
err.hide();
}
function show_error(input, msg) {
var err = input.parent().parent().find(".invalid-remaining");
console.log(err.length);
err.text(msg);
err.show();
}
$.fn.selectSelector = function(source, name, select) {
return this.each(function() {
var selector = $(this),
input = $('input[type=text]', this);
selector.click(function() { input.focus(); })
.delegate('.tag a', 'click', function() {
.delegate('.badge a', 'click', function() {
var id = $(this).parent().data("id");
for (var i = 0; i < source.length; i++) {
if (source[i].id == id) {
@ -23,13 +35,14 @@
});
function addTag(item) {
var tag = $('<span class="tag"/>')
var tag = $('<span class="badge badge-pill badge-primary"/>')
.text(item.toString() + ' ')
.data("id", item.id)
.append('<a>x</a>')
.insertBefore(input);
input.attr("placeholder", null);
select.find("option[value=" + item.id + "]").attr("selected", "selected")
hide_error(input);
}
function recreate() {
@ -42,6 +55,13 @@
}
recreate();
input.focusout(function(e) {
var value = input.val().trim()
if (value != "") {
show_error(input, "Please select an existing tag, it;s not possible to add custom ones.");
}
})
input.keydown(function(e) {
if (e.keyCode === $.ui.keyCode.TAB && $(this).data('ui-autocomplete').menu.active)
e.preventDefault();
@ -92,7 +112,7 @@
}
selector.click(function() { input.focus(); })
.delegate('.tag a', 'click', function() {
.delegate('.badge a', 'click', function() {
var id = $(this).parent().data("id");
for (var i = 0; i < selected.length; i++) {
if (selected[i] == id) {
@ -113,13 +133,14 @@
}
function addTag(id, value) {
var tag = $('<span class="tag"/>')
var tag = $('<span class="badge badge-pill badge-primary"/>')
.text(value)
.data("id", id)
.append(' <a>x</a>')
.insertBefore(input);
input.attr("placeholder", null);
hide_error(input);
}
function recreate() {
@ -147,6 +168,18 @@
result.change(readFromResult);
input.focusout(function() {
var item = input.val();
if (item.length == 0) {
input.data("ui-autocomplete").search("");
} else if (item.match(/^([a-z0-9_]+)$/)) {
selectItem(item);
recreate();
input.val("");
}
return true;
});
input.keydown(function(e) {
if (e.keyCode === $.ui.keyCode.TAB && $(this).data('ui-autocomplete').menu.active)
e.preventDefault();
@ -159,7 +192,7 @@
recreate();
input.val("");
} else {
alert("Only lowercase alphanumeric and number names allowed.");
show_error(input, "Only lowercase alphanumeric and number names allowed.");
}
e.preventDefault();
return true;

@ -1,112 +1,3 @@
h1 {
margin: 0;
}
h2, h3 {
margin: 5px 0;
}
a {
color: #0be;
font-weight: bold;
text-decoration: none;
}
a:hover {
color: #0df;
text-decoration: underline;
}
/* Containers */
.box {
border-radius: 5px;
margin: 15px 0;
padding: 0;
}
.box > h2, .box > h3 {
margin: 0;
padding: 0.5em 0.5em 0.5em 15px;
border-bottom: 1px solid #444;
}
.box .box-body {
padding: 1em !important;
}
// .box form {
// padding: 1em;
// }
.box_grey {
background: #333;
border: 1px solid #444;
}
.ul_boxes {
display: block;
margin: 0;
padding: 0;
list-style: none;
}
.ul_boxes > li {
padding: 0;
list-style: none;
}
.box_link {
display: block;
color: #ddd;
text-decoration: none;
}
.box_link:hover{
background: #3a3a3a;
}
/*
buttonset
*/
.buttonset, .buttonset li {
display: block;
margin: 0;
padding: 0;
list-style: none;
}
.buttonset {
margin: 15px 0;
}
.button, .buttonset li a, input[type=submit] {
cursor: pointer;
}
.button, .buttonset li a, input[type=submit], input[type=text],
input[type=password], textarea, select, .bulletselector {
text-align: center;
display: inline-block;
padding: 0.4em 1em;
background: rgba(255,255,255,0.07);
border: 1px solid rgba(255,255,255,0.1);
color: #ddd;
border-radius: 5px;
text-decoration: none;
font-size: 100%;
}
select > * {
color: #222;
}
input[type=text], input[type=password], textarea, select, .bulletselector {
text-align: left;
}
.ui-autocomplete, ui-front {
position:absolute;
cursor:default;
@ -133,74 +24,6 @@ input[type=text], input[type=password], textarea, select, .bulletselector {
}
}
select {
min-width: 200px;
}
select:not([multiple]) {
background: linear-gradient(#444, #333);
}
.form-group {
padding: 8px 0;
}
.form-group label {
display: block;
vertical-align: top;
padding: 0 8px 8px 0;
}
.form-group input, .form-group textarea, .form-group .bulletselector {
display: block;
min-width: 100%;
max-width: 100%;
}
.box .form-group input, .box .form-group textarea, .form-group .bulletselector {
min-width: 95%;
max-width: 95%;
}
.form-group textarea {
min-height: 200px;
}
.button:hover, .buttonset li a:hover, input[type=submit]:hover {
background: rgba(255,255,255,0.13);
border: 1px solid rgba(255,255,255,0.17);
text-decoration: none;
color: #ddd;
}
.btn_green {
background: #363 !important;
border: 1px solid #473;
}
.btn_green: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;
}
.bulletselector input {
border: none;
border-radius: 0;
@ -215,166 +38,14 @@ select:not([multiple]) {
white-space: nowrap;
background: transparent;
}
.bulletselector .tag {
background: #375D81;
border-radius: 3px;
-moz-border-radius: 3px;
color: #FFF;
.bulletselector .badge {
float: left;
height: 15px;
padding: 0.1em 0.4em 0.5em;
padding: 0.4em 0.8em;
margin-right: 0.3em;
margin-bottom: 0.3em;
vertical-align: baseline;
}
.bulletselector .tag a {
color: #FFF;
cursor: pointer;
}
.bulletselector .tag a:hover {
color: #0099CC;
text-decoration: none;
}
/* Alerts */
.alert .alert_right, .alert > form {
display: inline-block;
margin: 0;
position: absolute;
top: 0;
right: 0;
bottom: 0;
}
.alert {
padding: 10px;
position: relative;
.alert_right:not(.button) {
padding: 0;
}
.alert_right form {
height: 100%;
}
form {
display: inline-block;
margin: 0;
padding: 0;
}
input {
height: 100%;
}
input, .button {
margin: 0;
background: 0;
border: 0;
border-left: 1px solid rgba(255,255,255,0.12);
border-radius: 0;
vertical-align: middle;
}
input:hover, .button:hover {
border: 0;
border-left: 1px solid rgba(255,255,255,0.2);
}
}
#alerts {
list-style: none;
position: fixed;
bottom: 15px;
left: 0;
right: 0;
z-index: 1000;
}
#alerts .alert {
margin: 5px 0;
vertical-align: middle;
}
#alerts .close {
float: right;
color: white;
}
#alerts .close:hover {
color: #fff;
}
.alert-error, .button-danger {
background: #933 !important;
border: 1px solid #c44 !important;
}
.alert-warning {
background: #963;
border: 1px solid #c96;
}
.alert-primary {
background: #339;
border: 1px solid #66a;
}
.alert-success {
background: #161;
border: 1px solid #393;
}
table.fancyTable {
font-family: "Arial Black", Gadget, sans-serif;
border: 2px solid #000000;
background-color: #4A4A4A;
width: 100%;
text-align: center;
border-collapse: collapse;
}
table.fancyTable td, table.fancyTable th {
border: 1px solid #4A4A4A;
padding: 3px 2px;
}
table.fancyTable tbody td {
font-size: 13px;
color: #E6E6E6;
}
table.fancyTable tr:nth-child(even) {
background: #888888;
}
table.fancyTable thead {
background: #000000;
border-bottom: 3px solid #000000;
}
table.fancyTable thead th {
font-size: 15px;
font-weight: bold;
color: #E6E6E6;
text-align: center;
border-left: 2px solid #4A4A4A;
}
table.fancyTable thead th:first-child {
border-left: none;
}
table.fancyTable tfoot {
font-size: 12px;
font-weight: bold;
color: #E6E6E6;
background: #000000;
background: -moz-linear-gradient(top, #404040 0%, #191919 66%, #000000 100%);
background: -webkit-linear-gradient(top, #404040 0%, #191919 66%, #000000 100%);
background: linear-gradient(to bottom, #404040 0%, #191919 66%, #000000 100%);
border-top: 1px solid #4A4A4A;
}
table.fancyTable tfoot td {
font-size: 12px;
.invalid-remaining {
display: none;
}
.t-mll tr td:not(:first-child) {
@ -405,57 +76,6 @@ table.fancyTable tfoot td {
color: #2c2;
}
/*
Aside
*/
.asideright {
float: right;
margin: 0 0 0 15px;
max-width: 300px;
}
.outsidecontainer {
position: absolute;
right: 102%;
top: 0;
width: intrinsic; /* Safari/WebKit uses a non-standard name */
width: -moz-max-content; /* Firefox/Gecko */
width: -webkit-max-content; /* Chrome */
}
@media (max-width: 1490px) {
.outsidecontainer {
display: none;
}
}
.flatlist, .flatlist li {
list-style: none;
padding: 0;
margin: 0;
}
.flatlist li {
display: block;
}
.flatlist a {
display: block;
padding: 0.5em 20px;
color: #ddd;
font-weight: normal;
}
.flatlist a:hover {
background: #444;
text-decoration: none;
}
.table-topalign td {
vertical-align: top;
}
.wiptopic a {
color: #7ac;
}

41
app/scss/custom.scss Normal file

@ -0,0 +1,41 @@
@import "components.scss";
@import "packages.scss";
@import "packagegrid.scss";
@import "comments.scss";
.dropdown-menu {
margin-top: 0;
}
.dropdown:hover .dropdown-menu {
display: block;
}
.nav-link > img {
max-height: 1em;
}
.jumbotron {
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.alert .btn {
text-decoration: none;
}
.card .table {
margin-bottom: 0;
}
.btn-download {
color: #fff;
background-color: #00b05c;
border-color: #00b05c;
}
.btn-download:focus, .btn-download.focus {
-webkit-box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.5);
box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.5);
}

@ -1,6 +0,0 @@
@import "page.scss";
@import "components.scss";
@import "nav.scss";
@import "packages.scss";
@import "packagegrid.scss";
@import "comments.scss";

@ -1,90 +0,0 @@
nav {
margin: 0 auto 0 auto;
list-style: none;
background: #333;
}
nav .navbar-left {
float: left;
}
nav .navbar-left li {
float: left;
}
nav .navbar-right {
float: right;
}
nav ul {
margin: 0 auto 0 auto;
padding: 0;
list-style: none;
}
nav li {
margin: 0;
padding: 0;
list-style: none;
display: inline-block;
}
nav li a {
color: #ddd;
margin: 0;
padding: 1em 1em;
display: block;
border-left: 1px solid #444;
}
nav li a:not([href]) {
cursor: default;
}
nav ul li:last-child a {
border-right: 1px solid #444;
}
nav a:hover {
color: #eee;
background: #444;
text-decoration: none;
}
nav img {
height: 1em;
}
li.dropdown {
position: relative;
display: inline-block;
}
.dropdown-menu {
display: none;
position: absolute;
margin: 0;
padding: 0;
min-width:160px;
background: #333;
z-index: 1;
right: 0;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.4);
}
.dropdown:hover ul {
display: block;
}
.dropdown li {
display: block;
}
.dropdown li a {
border: none;
border-top: 1px solid #444;
}
.dropdown li:last-child a {
border-bottom: 1px solid #444;
}

@ -53,6 +53,8 @@
.packagegridinfo h3 {
color: white;
font-size: 120%;
font-weight: bold;
}
.packagegridinfo p {

@ -37,34 +37,6 @@
left: 15px;
}
.sidebar_container {
display: block;
position: relative;
padding: 0;
margin: 0;
}
.sidebar_container .right, .sidebar_container .left{
position: absolute;
display: block;
top: 10px;
margin-top: 0;
}
.sidebar_container .right {
right: 0;
width: 280px;
}
.sidebar_container .left {
right: 295px;
left: 0;
}
.sidebar_container .right > *:first-child, .sidebar_container .left > *:first-child {
margin-top: 0;
}
.package-short-large {
font-size: 120%;
}

@ -1,56 +0,0 @@
html, body {
font-family: "Arial", sans-serif;
background: #222;
color: #ddd;
padding: 0;
margin: 0;
}
.container, main, #alerts, footer {
width: 90%;
max-width: 1024px;
margin: auto;
padding: 0;
display: block;
}
main {
padding: 7px 0;
position: relative;
box-sizing: border-box;
}
.clearboth {
clear: both;
}
header h1, header p, header form {
padding: 0 5px;
margin-left: 0;
}
header {
padding: 30px;
background: #258;
}
header p {
max-width: 400px;
}
header input {
margin: 3px;
}
footer {
color: #999;
padding: 30px 0;
}
footer a {
color: #aaa;
}
footer a:hover {
color: #bbb;
}

@ -20,7 +20,7 @@
<select name="action">
<option value="importmodlist" selected>Import forum topics</option>
<option value="recalcscores">Recalculate package scores</option>
<!-- <option value="importscreenshots">Import screenshots from VCS</option> -->
<option value="importscreenshots">Import screenshots from VCS</option>
<!-- <option value="importdepends">Import dependencies from downloads</option> -->
<!-- <option value="modprovides">Set provides to mod name</option> -->
<!-- <option value="vcsrelease">Create VCS releases</option> -->

@ -6,75 +6,87 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}title{% endblock %} - {{ config.USER_APP_NAME }}</title>
<link rel="stylesheet" type="text/css" href="/static/main.css">
<link rel="stylesheet" type="text/css" href="/static/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/static/custom.css">
{% block headextra %}{% endblock %}
</head>
<body>
<nav>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<ul class="nav navbar-nav navbar-left">
<li><a href="/">{{ config.USER_APP_NAME }}</a></li>
{% for item in current_menu.children recursive %}
{% if item.visible %}
<li{% if item.children %} class="dropdown"{% endif %}>
<a href="{{ item.url }}"
{% if item.children %}
class="dropdown-toggle"
data-toggle="dropdown"
role="button"
aria-expanded="false"
{% endif %}>
{{ item.text }}
{% if item.children %}
<span class="caret"></span>
{% endif %}
</a>
{% if item.children %}
<ul class="dropdown-menu" role="menu">
{{ loop(item.children) }}
</ul>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% if current_user.is_authenticated %}
<li><a href="{{ url_for('notifications_page') }}">
<img src="/static/notification{% if current_user.notifications %}_alert{% endif %}.svg" />
</a></li>
<li><a href="{{ url_for('create_edit_package_page') }}">+</a></li>
<li class="dropdown">
<a class="dropdown-toggle"
data-toggle="dropdown"
role="button"
aria-expanded="false">{{ current_user.display_name }}
<span class="caret"></span></a>
<a class="navbar-brand" href="/">{{ config.USER_APP_NAME }}</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="{{ url_for('user_profile_page', username=current_user.username) }}">Profile</a>
<div class="collapse navbar-collapse" id="navbarColor01">
<ul class="navbar-nav mr-auto">
{% for item in current_menu.children recursive %}
{% if item.visible %}
<li class="nav-item {% if item.children %} dropdown{% endif %}">
<a class="nav-link" href="{{ item.url }}"
{% if item.children %}
class="dropdown-toggle"
data-toggle="dropdown"
role="button"
aria-expanded="false"
{% endif %}>
{{ item.text }}
{% if item.children %}
<span class="caret"></span>
{% endif %}
</a>
{% if item.children %}
<ul class="dropdown-menu" role="menu">
{{ loop(item.children) }}
</ul>
{% endif %}
</li>
{% if current_user.canAccessTodoList() %}
<li><a href="{{ url_for('todo_page') }}">Work Queue</a></li>
<li><a href="{{ url_for('user_list_page') }}">User list</a></li>
{% endif %}
{% if current_user.rank == current_user.rank.ADMIN %}
<li><a href="{{ url_for('admin_page') }}">Admin</a></li>
{% endif %}
{% if current_user.rank == current_user.rank.MODERATOR %}
<li><a href="{{ url_for('tag_list_page') }}">Tag Editor</a></li>
<li><a href="{{ url_for('license_list_page') }}">License Editor</a></li>
{% endif %}
<li><a href="{{ url_for('user.logout') }}">Sign out</a></li>
</ul>
</li>
{% else %}
<li><a href="{{ url_for('user.login') }}">Sign in</a></li>
{% endif %}
</ul>
<div class="clearboth"></div>
{% endif %}
{% endfor %}
</ul>
<form class="form-inline my-2 my-lg-0" method="GET" action="/packages/">
{% if type %}<input type="hidden" name="type" value="{{ type }}" />{% endif %}
<input class="form-control mr-sm-2" name="q" type="text" placeholder="Search {{ title | lower or 'all packages' }}" value="{{ query or ''}}">
<input class="btn btn-secondary my-2 my-sm-0 mr-sm-2" type="submit" value="Search" />
<input class="btn btn-primary my-2 my-sm-0" type="submit" name="lucky" value="Lucky" />
</form>
<ul class="navbar-nav ml-auto">
{% if current_user.is_authenticated %}
<li class="nav-item"><a class="nav-link" href="{{ url_for('notifications_page') }}">
<img src="/static/notification{% if current_user.notifications %}_alert{% endif %}.svg" />
</a></li>
<li class="nav-item"><a class="nav-link" href="{{ url_for('create_edit_package_page') }}">+</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle"
data-toggle="dropdown"
role="button"
aria-expanded="false">{{ current_user.display_name }}
<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li class="nav-item">
<a class="nav-link" href="{{ url_for('user_profile_page', username=current_user.username) }}">Profile</a>
</li class="nav-item">
{% if current_user.canAccessTodoList() %}
<li class="nav-item"><a class="nav-link" href="{{ url_for('todo_page') }}">Work Queue</a></li>
<li class="nav-item"><a class="nav-link" href="{{ url_for('user_list_page') }}">User list</a></li>
{% endif %}
{% if current_user.rank == current_user.rank.ADMIN %}
<li class="nav-item"><a class="nav-link" href="{{ url_for('admin_page') }}">Admin</a></li>
{% endif %}
{% if current_user.rank == current_user.rank.MODERATOR %}
<li class="nav-item"><a class="nav-link" href="{{ url_for('tag_list_page') }}">Tag Editor</a></li>
<li class="nav-item"><a class="nav-link" href="{{ url_for('license_list_page') }}">License Editor</a></li>
{% endif %}
<li class="nav-item"><a class="nav-link" href="{{ url_for('user.logout') }}">Sign out</a></li>
</ul>
</li>
{% else %}
<li><a class="nav-link" href="{{ url_for('user.login') }}">Sign in</a></li>
{% endif %}
</ul>
</div>
</div>
</nav>
@ -97,16 +109,22 @@
{% endblock %}
{% block container %}
<main>
<main class="container mt-4">
{% block content %}
{% endblock %}
</main>
{% endblock %}
<footer>
<footer class="container footer-copyright my-5 page-footer font-small text-center">
ContentDB &copy; 2018 to <a href="https://rubenwardy.com/">rubenwardy</a> |
<a href="https://github.com/minetest/contentdb">GitHub</a> |
<a href="{{ url_for('flatpage', path='help') }}">Help</a> |
<a href="{{ url_for('flatpage', path='help/reporting') }}">Report / DMCA</a>
</footer>
<script src="/static/jquery.min.js"></script>
<script src="/static/popper.min.js"></script>
<script src="/static/bootstrap.min.js"></script>
{% block scriptextra %}{% endblock %}
</body>
</html>

@ -61,7 +61,7 @@ Sign in
</p>
<h3>Sign in with Github</h3>
<p><a class="button" href="{{ url_for('github_signin_page') }}">GitHub</a></p>
<p><a class="btn" href="{{ url_for('github_signin_page') }}">GitHub</a></p>
</form>
</div>
@ -72,7 +72,7 @@ Sign in
<div class="box-body">
<p>Create an account using your forum account or email.</p>
<a href="{{ url_for('user_claim_page') }}" class="button">{%trans%}Claim your account{%endtrans%}</a>
<a href="{{ url_for('user_claim_page') }}" class="btn">{%trans%}Claim your account{%endtrans%}</a>
</div>
</aside>
</div>

@ -5,31 +5,26 @@ Welcome
{% endblock %}
{% block container %}
<header>
<header class="jumbotron">
<div class="container">
<h1>Content DB</h1>
<h1 class="display-3">{{ config.USER_APP_NAME }}</h1>
<p>
<p class="lead">
Minetest's official content repository.
Browse {{ count }} packages,
the majority of which are available under a free
and open source license.
</p>
<form method="get" action="/packages/">
<input type="text" name="q" value="{{ query or ''}}" />
<input type="submit" value="Search" />
</form>
</div>
</header>
<main>
<main class="container">
{% from "macros/packagegridtile.html" import render_pkggrid %}
<h2>Popular</h2>
{{ render_pkggrid(popular) }}
<a href="{{ url_for('packages_page') }}" class="button">Show More</a>
<a href="{{ url_for('packages_page') }}" class="btn">Show More</a>
<h2 style="margin-top:2em;">Newly Added</h2>
{{ render_pkggrid(new) }}

@ -2,7 +2,7 @@
<div class="form-group {% if field.errors %}has-error{% endif %} {{ kwargs.pop('class_', '') }}">
{% if field.type != 'HiddenField' and label_visible %}
{% if not label %}{% set label=field.label.text %}{% endif %}
<label for="{{ field.id }}" class="control-label">{{ label|safe }}</label>
<label for="{{ field.id }}">{{ label|safe }}</label>
{% endif %}
{{ field(class_='form-control', **kwargs) }}
{% if field.errors %}
@ -13,9 +13,8 @@
</div>
{%- endmacro %}
{% macro form_includes() -%}
{% macro form_scripts() -%}
<link href="/static/jquery-ui.min.css" rel="stylesheet" type="text/css">
<script src="/static/jquery.min.js"></script>
<script src="/static/jquery-ui.min.js"></script>
<script src="/static/tagselector.js"></script>
{% endmacro %}
@ -58,16 +57,17 @@
<div class="form-group {% if field.errors %}has-error{% endif %} {{ kwargs.pop('class_', '') }}">
{% if field.type != 'HiddenField' and label_visible %}
{% if not label %}{% set label=field.label.text %}{% endif %}
<label for="{{ field.id }}" class="control-label">{{ label|safe }}</label>
<label for="{{ field.id }}">{{ label|safe }}</label>
{% endif %}
<div class="multichoice_selector bulletselector">
<div class="multichoice_selector bulletselector form-control">
<input type="text" placeholder="Start typing to see suggestions">
<div class="clearboth"></div>
</div>
<div class="invalid-remaining invalid-feedback"></div>
{{ field(class_='form-control', **kwargs) }}
{% if field.errors %}
{% for e in field.errors %}
<p class="help-block">{{ e }}</p>
<div class="invalid-feedback">{{ e }}</div>
{% endfor %}
{% endif %}
</div>
@ -77,13 +77,14 @@
<div class="form-group {% if field.errors %}has-error{% endif %} {{ kwargs.pop('class_', '') }}">
{% if field.type != 'HiddenField' and label_visible %}
{% if not label %}{% set label=field.label.text %}{% endif %}
<label for="{{ field.id }}" class="control-label">{{ label|safe }}</label>
<label for="{{ field.id }}">{{ label|safe }}</label>
{% endif %}
<div class="metapackage_selector bulletselector">
<div class="metapackage_selector bulletselector form-control">
<input type="text" placeholder="Comma-seperated values">
<div class="clearboth"></div>
</div>
{{ field(class_='form-control', **kwargs) }}
<div class="invalid-remaining invalid-feedback"></div>
{% if field.errors %}
{% for e in field.errors %}
<p class="help-block">{{ e }}</p>
@ -96,13 +97,14 @@
<div class="form-group {% if field.errors %}has-error{% endif %} {{ kwargs.pop('class_', '') }}">
{% if field.type != 'HiddenField' and label_visible %}
{% if not label %}{% set label=field.label.text %}{% endif %}
<label for="{{ field.id }}" class="control-label">{{ label|safe }}</label>
<label for="{{ field.id }}">{{ label|safe }}</label>
{% endif %}
<div class="deps_selector bulletselector">
<div class="deps_selector bulletselector form-control">
<input type="text" placeholder="Comma-seperated values">
<div class="clearboth"></div>
</div>
{{ field(class_='form-control', **kwargs) }}
<div class="invalid-remaining invalid-feedback"></div>
{% if field.errors %}
{% for e in field.errors %}
<p class="help-block">{{ e }}</p>
@ -134,7 +136,7 @@
{% macro render_submit_field(field, label=None, tabindex=None) -%}
{% if not label %}{% set label=field.label.text %}{% endif %}
{#<button type="submit" class="form-control btn btn-default btn-primary">{{label}}</button>#}
<input type="submit" value="{{label}}"
<input type="submit" value="{{label}}" class="btn btn-primary"
{% if tabindex %}tabindex="{{ tabindex }}"{% endif %}
>
{%- endmacro %}

@ -25,12 +25,24 @@
{% endif %}
{% endmacro %}
{% macro render_threadlist(threads) -%}
<ul>
{% macro render_threadlist(threads, list_group=False) -%}
{% if not list_group %}<ul>{% endif %}
<li {% if list_group %}class="list-group-item"{% endif %}>
{% for t in threads %}
<li>{% if t.private %}&#x1f512; {% endif %}<a href="{{ url_for('thread_page', id=t.id) }}">{{ t.title }}</a> by {{ t.author.display_name }}</li>
{% if list_group %}
<a href="{{ url_for('thread_page', id=t.id) }}">
{% if t.private %}&#x1f512; {% endif %}
{{ t.title }}
by {{ t.author.display_name }}
</a>
{% else %}
{% if t.private %}&#x1f512; {% endif %}
<a href="{{ url_for('thread_page', id=t.id) }}">{{ t.title }}</a>
by {{ t.author.display_name }}
{% endif %}
{% else %}
<li><i>No threads found</i></li>
<i>No threads found</i>
{% endfor %}
</li>
</ul>
{% endmacro %}

@ -1,5 +1,5 @@
{% macro render_topics_table(topics, show_author=True) -%}
<table>
<table class="table">
<tr>
<th>Id</th>
<th></th>

@ -7,69 +7,10 @@
{% endif %}
{% endblock %}
{% block content %}
<h1>Create Package</h1>
{% from "macros/forms.html" import render_field, render_submit_field, form_scripts, render_multiselect_field, render_mpackage_field, render_deps_field, package_lists %}
<div class="box box_grey alert alert-info">
Have you read the Package Inclusion Policy and Guidance yet?
<a class="alert_right button" href="{{ url_for('flatpage', path='policy_and_guidance') }}">View</a>
</div>
{% from "macros/forms.html" import render_field, render_submit_field, form_includes, render_multiselect_field, render_mpackage_field, render_deps_field, package_lists %}
{{ form_includes() }}
{{ package_lists() }}
<form method="POST" action="" class="tableform">
{{ form.hidden_tag() }}
<h2 class="pkg_meta">Package</h2>
{{ render_field(form.type, class_="pkg_meta") }}
{{ render_field(form.name, class_="pkg_meta") }}
{{ render_field(form.title, class_="pkg_meta") }}
{{ render_field(form.shortDesc, class_="pkg_meta") }}
{{ render_field(form.desc, class_="pkg_meta") }}
{{ render_multiselect_field(form.tags, class_="pkg_meta") }}
<div class="pkg_meta">
{{ render_field(form.license, class_="not_txp") }}
</div>
{{ render_field(form.media_license, class_="pkg_meta") }}
<div class="pkg_meta">
<h2 class="not_txp">Dependency Info</h2>
{{ render_mpackage_field(form.provides_str, class_="not_txp", placeholder="Comma separated list") }}
{{ render_deps_field(form.harddep_str, class_="not_txp not_game", placeholder="Comma separated list") }}
{{ render_deps_field(form.softdep_str, class_="not_txp not_game", placeholder="Comma separated list") }}
</div>
<h2 class="pkg_meta">Repository and Links</h2>
<div class="pkg_wiz_1">
<p>Enter the repo URL for the package.
If the repo uses git then the metadata will be automatically imported.</p>
<p>Leave blank if you don't have a repo. Click skip if the import fails.</p>
</div>
{{ render_field(form.repo, class_="pkg_repo") }}
<div class="pkg_wiz_1">
<a id="pkg_wiz_1_next" class="button button-primary">Next (Autoimport)</a>
<a id="pkg_wiz_1_skip" class="button button-default">Skip Autoimport</a>
</div>
<div class="pkg_wiz_2">
Importing... (This may take a while)
</div>
{{ render_field(form.website, class_="pkg_meta") }}
{{ render_field(form.issueTracker, class_="pkg_meta") }}
{{ render_field(form.forums, class_="pkg_meta") }}
<div class="pkg_meta">{{ render_submit_field(form.submit) }}</div>
</form>
{% block scriptextra %}
{{ form_scripts() }}
<script src="/static/simplemde.min.js"></script>
<link rel="stylesheet" type="text/css" href="/static/simplemde.min.css">
@ -90,3 +31,72 @@
{% endif %}
<script src="/static/package_edit.js"></script>
{% endblock %}
{% block content %}
<h1>Create Package</h1>
<div class="alert alert-info">
<a class="float-right btn btn-sm btn-default" href="{{ url_for('flatpage', path='policy_and_guidance') }}">View</a>
Have you read the Package Inclusion Policy and Guidance yet?
</div>
{{ package_lists() }}
<form method="POST" action="" class="tableform">
{{ form.hidden_tag() }}
<fieldset>
<legend>Package</legend>
{{ render_field(form.type, class_="pkg_meta") }}
{{ render_field(form.name, class_="pkg_meta") }}
{{ render_field(form.title, class_="pkg_meta") }}
{{ render_field(form.shortDesc, class_="pkg_meta") }}
{{ render_field(form.desc, class_="pkg_meta") }}
{{ render_multiselect_field(form.tags, class_="pkg_meta") }}
<div class="pkg_meta">
{{ render_field(form.license, class_="not_txp") }}
</div>
{{ render_field(form.media_license, class_="pkg_meta") }}
</fieldset>
<fieldset class="pkg_meta">
<legend class="not_txp">Package</legend>
{{ render_mpackage_field(form.provides_str, class_="not_txp", placeholder="Comma separated list") }}
{{ render_deps_field(form.harddep_str, class_="not_txp not_game", placeholder="Comma separated list") }}
{{ render_deps_field(form.softdep_str, class_="not_txp not_game", placeholder="Comma separated list") }}
</fieldset>
<fieldset>
<legend class="pkg_meta">Repository and Links</legend>
<div class="pkg_wiz_1">
<p>Enter the repo URL for the package.
If the repo uses git then the metadata will be automatically imported.</p>
<p>Leave blank if you don't have a repo. Click skip if the import fails.</p>
</div>
{{ render_field(form.repo, class_="pkg_repo") }}
<div class="pkg_wiz_1">
<a id="pkg_wiz_1_next" class="btn btn-primary">Next (Autoimport)</a>
<a id="pkg_wiz_1_skip" class="btn btn-default">Skip Autoimport</a>
</div>
<div class="pkg_wiz_2">
Importing... (This may take a while)
</div>
{{ render_field(form.website, class_="pkg_meta") }}
{{ render_field(form.issueTracker, class_="pkg_meta") }}
{{ render_field(form.forums, class_="pkg_meta") }}
</fieldset>
<div class="pkg_meta">{{ render_submit_field(form.submit) }}</div>
</form>
{% endblock %}

@ -12,7 +12,7 @@
<p>This action can be undone by the admin, but he'll be very annoyed!</p>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" value="Delete" class="button-danger" />
<input type="submit" value="Delete" class="btn-danger" />
</div>
</form>
{% endblock %}

@ -5,35 +5,10 @@
{% endblock %}
{% block content %}
<form method="get" action="" class="plsearchform">
{% if type %}<input type="hidden" name="type" value="{{ type }}" />{% endif %}
<input type="text" name="q" value="{{ query or ''}}" />
<input type="submit" value="Search" />
<input type="submit" name="lucky" value="I'm feeling lucky" />
<p>
Found {{ packages_count }} packages.
</p>
</form>
<!--<aside class="box box_grey outsidecontainer">
<h3>Tags</h3>
<ul class="flatlist">
{% for t in tags %}
<li><a href="{{ url_for('packages_page', q=(query or '')+' tag:'+t.name, type=type) }}">
{{ t.title }}
</a></li>
{% else %}
<li><i>No tags available</i></ul>
{% endfor %}
</ul>
</aside> -->
{% from "macros/packagegridtile.html" import render_pkggrid %}
{{ render_pkggrid(packages) }}
<ul class="buttonset linedbuttonset">
<ul class="btnset linedbuttonset">
{% if prev_url %}<li><a href="{{ prev_url }}">Previous</a></li>{% endif %}
<li>{{ page }} / {{ page_max }}</li>
{% if next_url %}<li><a href="{{ next_url }}">Next</a></li> {% endif %}

@ -1,335 +1,366 @@
{% set query=package.name %}
{% extends "base.html" %}
{% block title %}
{{ package.title }}
{% endblock %}
{% block content %}
{% if not package.approved %}
<div class="box box_grey alert alert-warning">
<span class="icon_message"></span>
{% if package.releases.count() == 0 %}
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
You need to create a release before this package can be approved.
<p>
A release is a single downloadable version of your {{ package.type.value | lower }}.
You need to create releases even if you use a rolling release development cycle,
as Minetest needs them to check for updates.
</p>
<a class="button" href="{{ package.getCreateReleaseURL() }}">Create Release</a>
{% else %}
A release is required before this package can be approved.
{% endif %}
{% block container %}
<header class="jumbotron pb-3"
style="background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url('{{ package.getMainScreenshotURL() }}');
background-size: cover;
background-repeat: no-repeat;
background-position: center;">
<div class="container">
<h1 class="display-3">{{ package.title }} by {{ package.author.display_name }}</h1>
{% elif (package.type == package.type.GAME or package.type == package.type.TXP) and package.screenshots.count() == 0 %}
You need to add at least one screenshot.
<p class="lead">
{{ package.shortDesc }}
</p>
{% elif topic_error_lvl == "error" %}
Please fix the below topic issue(s).
{% elif "Other" in package.license.name or "Other" in package.media_license.name %}
Please wait for the license to be added to CDB.
{% else %}
{% if package.screenshots.count() == 0 %}
<b>You should add at least one screenshot, but this isn't required.</b><br />
{% endif %}
{% if not package.getDownloadRelease() %}
Please wait for the release to be approved.
{% elif package.checkPerm(current_user, "APPROVE_NEW") %}
You can now approve this package if you're ready.
<form method="post" action="{{ package.getApproveURL() }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" value="Approve" />
</form>
{% else %}
Please wait for the package to be approved.
{% endif %}
{% endif %}
<div style="clear: both;"></div>
<div class="row" style="margin-top: 2rem;">
<div class="col">
</div>
<div class="btn-group-horizontal col-md-auto">
{% if package.repo %}<a class="btn btn-secondary" href="{{ package.repo }}">View Source</a>{% endif %}
{% if package.forums %}<a class="btn btn-secondary" href="https://forum.minetest.net/viewtopic.php?t={{ package.forums }}">Forums</a>{% endif %}
{% if package.issueTracker %}<a class="btn btn-secondary" href="{{ package.issueTracker }}">Issue Tracker</a>{% endif %}
{% if package.website %}<a class="btn btn-secondary" href="{{ package.website }}">Website</a>{% endif %}
</div>
</div>
</div>
</header>
{% if topic_error %}
<div class="box box_grey alert alert-{{ topic_error_lvl }}">
<main class="container mt-4">
{% if not package.approved %}
<div class="alert alert-warning">
<span class="icon_message"></span>
{{ topic_error | safe }}
{% if package.releases.count() == 0 %}
<h4 class="alert-heading">Release Required</h4>
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
<p>You need to create a release before this package can be approved.</p>
<p>
A release is a single downloadable version of your {{ package.type.value | lower }}.
You need to create releases even if you use a rolling release development cycle,
as Minetest needs them to check for updates.
</p>
<a class="btn" href="{{ package.getCreateReleaseURL() }}">Create Release</a>
{% else %}
A release is required before this package can be approved.
{% endif %}
{% elif (package.type == package.type.GAME or package.type == package.type.TXP) and package.screenshots.count() == 0 %}
You need to add at least one screenshot.
{% elif topic_error_lvl == "error" %}
Please fix the below topic issue(s).
{% elif "Other" in package.license.name or "Other" in package.media_license.name %}
Please wait for the license to be added to CDB.
{% else %}
{% if package.screenshots.count() == 0 %}
<b>You should add at least one screenshot, but this isn't required.</b><br />
{% endif %}
{% if not package.getDownloadRelease() %}
Please wait for the release to be approved.
{% elif package.checkPerm(current_user, "APPROVE_NEW") %}
<form class="float-right" method="post" action="{{ package.getApproveURL() }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input class="btn btn-sm btn-warning" type="submit" value="Approve" />
</form>
You can now approve this package if you're ready.
{% else %}
Please wait for the package to be approved.
{% endif %}
{% endif %}
<div style="clear: both;"></div>
</div>
{% if topic_error %}
<div class="alert alert-{{ topic_error_lvl }}">
<span class="icon_message"></span>
{{ topic_error | safe }}
<div style="clear: both;"></div>
</div>
{% endif %}
{% if similar_topics %}
<div class="alert alert-warning">
Please make sure that this package has the right to
the name '{{ package.name }}'.
See the
<a href="/policy_and_guidance/">Inclusion Policy</a>
for more info.
</div>
{% endif %}
{% if package.author == current_user or package.checkPerm(current_user, "APPROVE_NEW") %}
{% if review_thread %}
<h2>{% if review_thread.private %}&#x1f512;{% endif %} {{ review_thread.title }}</h2>
{% if review_thread.private %}
<p><i>
This thread is only visible to the package owner and users of
Editor rank or above.
</i></p>
{% endif %}
{% from "macros/threads.html" import render_thread %}
{{ render_thread(review_thread, current_user) }}
{% else %}
<div class="alert alert-info">
<a class="float-right btn btn-sm btn-info" href="{{ url_for('new_thread_page', pid=package.id, title='Package approval comments') }}">Open Thread</a>
Privately ask a question or give feedback
<div style="clear:both;"></div>
</div>
{% endif %}
{% endif %}
{% endif %}
{% if package.author == current_user or package.checkPerm(current_user, "APPROVE_NEW") %}
{% if review_thread %}
<h2>{% if review_thread.private %}&#x1f512;{% endif %} {{ review_thread.title }}</h2>
{% if review_thread.private %}
<p><i>
This thread is only visible to the package owner and users of
Editor rank or above.
</i></p>
{% endif %}
{% from "macros/threads.html" import render_thread %}
{{ render_thread(review_thread, current_user) }}
<aside class="float-right ml-4" style="width: 18rem;">
{% if package.getDownloadRelease() %}
<a class="btn btn-download btn-lg btn-block"
href="{{ package.getDownloadURL() }}" class="btn_green">
Download
</a>
{% else %}
<div class="box box_grey alert alert-info">
Privately ask a question or give feedback
<a class="alert_right button" href="{{ url_for('new_thread_page', pid=package.id, title='Package approval comments') }}">Open Thread</a>
</div>
No download available.
{% endif %}
{% endif %}
{% endif %}
<h1>{{ package.title }} by {{ package.author.display_name }}</h1>
<ul class="screenshot_list">
{% for ss in package.screenshots %}
{% if ss.approved or package.checkPerm(current_user, "ADD_SCREENSHOTS") %}
<li>
<a href="{% if package.checkPerm(current_user, 'ADD_SCREENSHOTS') %}{{ ss.getEditURL() }}{% else %}{{ ss.url }}{% endif %}">
<img src="{{ ss.getThumbnailURL() }}" alt="{{ ss.title }}" />
</a>
</li>
{% endif %}
{% endfor %}
</ul>
<aside class="asideright box box_grey">
<h3>Details</h3>
<div class="box-body">
{% if not package.license.is_foss and not package.media_license.is_foss and package.type != package.type.TXP %}
<div class="box box_grey alert alert-error" style="margin-top: 0;">
<b>Warning:</b> Non-free code and media.
</div>
{% elif not package.license.is_foss and package.type != package.type.TXP %}
<div class="box box_grey alert alert-error" style="margin-top: 0;">
<b>Warning:</b> Non-free code.
</div>
{% elif not package.media_license.is_foss %}
<div class="box box_grey alert alert-error" style="margin-top: 0;">
<b>Warning:</b> Non-free media.
</div>
{% endif %}
<table>
<tr>
<td>Name</td>
<td>{{ package.name }}</td>
</tr>
{% if package.provides %}
<tr>
<td>Provides</td>
<td>{% for meta in package.provides %}
<a href="{{ url_for('meta_package_page', name=meta.name) }}">{{ meta.name }}</a>
{%- if not loop.last %}
,
{% endif %}
{% endfor %}</td>
</tr>
{% endif %}
<tr>
<td>Author</td>
<td class="{{ package.author.rank }}">
<a href="{{ url_for('user_profile_page', username=package.author.username) }}">
{{ package.author.display_name }}
</a>
</td>
</tr>
<tr>
<td>Type</td>
<td>{{ package.type.value }}</td>
</tr>
<tr>
<td>License</td>
<td>
{% if package.license == package.media_license %}
{{ package.license.name }}
{% elif package.type == package.type.TXP %}
{{ package.media_license.name }}
{% else %}
{{ package.license.name }} for code,<br />
{{ package.media_license.name }} for media.
{% endif %}
</td>
</tr>
<tr>
<td>Added</td>
<td>{{ package.created_at | datetime }}</td>
</tr>
</table>
<ul class="buttonset linedbuttonset">
{% if package.getDownloadRelease() %}<li><a href="{{ package.getDownloadURL() }}" class="btn_green">Download</a></li>{% endif %}
{% if package.repo %}<li><a href="{{ package.repo }}">View Source</a></li>{% endif %}
{% if package.forums %}<li><a href="https://forum.minetest.net/viewtopic.php?t={{ 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 %}
{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
<li><a href="{{ package.getEditURL() }}">Edit</a></li>
<li><a href="{{ package.getNewScreenshotURL() }}">Add screenshot</a></li>
{% endif %}
{# {% if current_user.is_authenticated %}
<li><a href="{{ package.getCreateEditRequestURL() }}">Suggest Changes</a></li>
{% endif %} #}
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
<li><a href="{{ package.getCreateReleaseURL() }}">Create Release</a></li>
{% endif %}
{% if package.approved and package.checkPerm(current_user, "CREATE_THREAD") %}
<li><a href="{{ url_for('new_thread_page', pid=package.id) }}">Open Thread</a></li>
{% endif %}
{% if package.checkPerm(current_user, "DELETE_PACKAGE") %}
<li><a href="{{ package.getDeleteURL() }}">Delete</a></li>
{% endif %}
</ul>
</div>
</aside>
<p class="package-short-large">{{ package.shortDesc }}</p>
{{ package.desc | markdown }}
<h3>Releases</h3>
<ul>
{% for rel in releases %}
{% if rel.approved or package.checkPerm(current_user, "MAKE_RELEASE") or package.checkPerm(current_user, "APPROVE_RELEASE") %}
<li>
{% if not rel.approved %}<i>{% endif %}
<a href="{{ rel.getDownloadURL() }}">{{ rel.title }}</a>{% if rel.commit_hash %}
[{{ rel.commit_hash | truncate(5, end='') }}]{% endif %},
created {{ rel.releaseDate | datetime }}.
{% if rel.task_id %}
<a href="{{ url_for('check_task', id=rel.task_id, r=package.getDetailsURL()) }}">Importing...</a>
{% elif not rel.approved %}
Waiting for approval.
<div class="card my-4">
<div class="card-header">
Details
<div class="btn-group float-right">
{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
<a class="btn btn-default btn-sm mx-1" href="{{ package.getEditURL() }}">Edit</a>
{% endif %}
{% if package.checkPerm(current_user, "MAKE_RELEASE") or package.checkPerm(current_user, "APPROVE_RELEASE") %}
<a href="{{ rel.getEditURL() }}">Edit
{% if not rel.task_id and not rel.approved and package.checkPerm(current_user, "APPROVE_RELEASE") %}
/ Approve
{% endif %}
</a>
{# {% if current_user.is_authenticated %}
<a class="btn btn-default btn-sm mx-1" href="{{ package.getCreateEditRequestURL() }}">Suggest Changes</a>
{% endif %} #}
{% if package.checkPerm(current_user, "DELETE_PACKAGE") %}
<a class="btn btn-danger btn-sm mx-1" href="{{ package.getDeleteURL() }}">Delete</a>
{% endif %}
</div>
{% if not rel.approved %}</i>{% endif %}
</li>
{% endif %}
{% else %}
<li>No releases available.</li>
{% endfor %}
</ul>
</div>
{% if not package.license.is_foss and not package.media_license.is_foss and package.type != package.type.TXP %}
{% set package_warning="Non-free code and media." %}
{% elif not package.license.is_foss and package.type != package.type.TXP %}
{% set package_warning="Non-free code." %}
{% elif not package.media_license.is_foss %}
{% set package_warning="Non-free media." %}
{% endif %}
{% if package_warning %}
<div class="card-body">
<div class="alert alert-danger">
<b>Warning:</b> {{ package_warning }}
</div>
</div>
{% endif %}
<table class="table">
<tr>
<td>Name</td>
<td>{{ package.name }}</td>
</tr>
{% if package.provides %}
<tr>
<td>Provides</td>
<td>{% for meta in package.provides %}
<a class="badge badge-primary"
href="{{ url_for('meta_package_page', name=meta.name) }}">{{ meta.name }}</a>
{%- if not loop.last %}
,
{% endif %}
{% endfor %}</td>
</tr>
{% endif %}
<tr>
<td>Author</td>
<td class="{{ package.author.rank }}">
<a href="{{ url_for('user_profile_page', username=package.author.username) }}">
{{ package.author.display_name }}
</a>
</td>
</tr>
<tr>
<td>Type</td>
<td>{{ package.type.value }}</td>
</tr>
<tr>
<td>License</td>
<td>
{% if package.license == package.media_license %}
{{ package.license.name }}
{% elif package.type == package.type.TXP %}
{{ package.media_license.name }}
{% else %}
{{ package.license.name }} for code,<br />
{{ package.media_license.name }} for media.
{% endif %}
</td>
</tr>
<tr>
<td>Added</td>
<td>{{ package.created_at | datetime }}</td>
</tr>
<tr>
<td>Tags</td>
<td>
{% for t in package.tags %}
<span class="badge badge-primary">{{ t.title }}</span>
{% else %}
<i>No tags.</i>
{% endfor %}
</td>
</table>
</div>
<h3>Tags</h3>
<ul>
{% for t in package.tags %}
<li>{{ t.title }}</li>
{% else %}
<li>No tags.</li>
{% endfor %}
</ul>
{% if package.type == package.type.MOD %}
<div class="card my-4">
<div class="card-header">Dependencies</div>
<div class="card-body">
{% for dep in package.dependencies %}
{% if dep.optional %}
{% set color="secondary" %}
{% else %}
{% set color="primary" %}
{% endif %}
<!-- <table class="table-topalign">
<tr>
<td> -->
<h3>Dependencies</h3>
<ul>
{% for dep in package.dependencies %}
<li>
{%- if dep.package %}
<a href="{{ dep.package.getDetailsURL() }}">{{ dep.package.title }}</a> by {{ dep.package.author.display_name }}
<a class="badge badge-{{ color }}"
href="{{ dep.package.getDetailsURL() }}">
{{ dep.package.title }} by {{ dep.package.author.display_name }}
{% elif dep.meta_package %}
<a href="{{ url_for('meta_package_page', name=dep.meta_package.name) }}">{{ dep.meta_package.name }}</a>
<a class="badge badge-{{ color }}"
href="{{ url_for('meta_package_page', name=dep.meta_package.name) }}">
{{ dep.meta_package.name }}
{% else %}
{{ "Excepted package or meta_package in dep!" | throw }}
{% endif %}
{% if dep.optional %}
[optional]
{% endif %}
{% endif %}</a>
{% else %}
<i>No dependencies</i>
{% endfor %}
</div>
</div>
{% endif %}
<div class="card my-4">
<div class="card-header">
Releases
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
<a class="float-right"
href="{{ package.getCreateReleaseURL() }}">+</a>
{% endif %}
</div>
<ul class="list-group list-group-flush">
{% for rel in releases %}
{% if rel.approved or package.checkPerm(current_user, "MAKE_RELEASE") or package.checkPerm(current_user, "APPROVE_RELEASE") %}
<li class="list-group-item list-group-item-action">
{% if package.checkPerm(current_user, "MAKE_RELEASE") or package.checkPerm(current_user, "APPROVE_RELEASE") %}
<a class="btn btn-sm btn-primary float-right" href="{{ rel.getEditURL() }}">Edit
{% if not rel.task_id and not rel.approved and package.checkPerm(current_user, "APPROVE_RELEASE") %}
/ Approve
{% endif %}
</a>
{% endif %}
{% if not rel.approved %}<i>{% endif %}
<a href="{{ rel.getDownloadURL() }}">{{ rel.title }}</a>{% if rel.commit_hash %}
[{{ rel.commit_hash | truncate(5, end='') }}]{% endif %}<br>
<small>created {{ rel.releaseDate | datetime }}.</small>
{% if rel.task_id %}
<a href="{{ url_for('check_task', id=rel.task_id, r=package.getDetailsURL()) }}">Importing...</a>
{% elif not rel.approved %}
Waiting for approval.
{% endif %}
{% if not rel.approved %}</i>{% endif %}
</li>
{% endif %}
{% else %}
<li class="list-group-item">No releases available.</li>
{% endfor %}
</ul>
</div>
<div class="card my-4"">
<div class="card-header">
{% if package.approved and package.checkPerm(current_user, "CREATE_THREAD") %}
<a class="float-right"
href="{{ url_for('new_thread_page', pid=package.id) }}">+</a>
{% endif %}
Threads
</div>
<ul class="list-group list-group-flush">
{% from "macros/threads.html" import render_threadlist %}
{{ render_threadlist(threads, list_group=True) }}
</ul>
</div>
</aside>
<ul class="screenshot_list mb-4">
{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
<a class="btn btn-primary float-right" href="{{ package.getNewScreenshotURL() }}">Add screenshot</a>
{% endif %}
{% for ss in package.screenshots %}
{% if ss.approved or package.checkPerm(current_user, "ADD_SCREENSHOTS") %}
<li>
<a href="{% if package.checkPerm(current_user, 'ADD_SCREENSHOTS') %}{{ ss.getEditURL() }}{% else %}{{ ss.url }}{% endif %}">
<img src="{{ ss.getThumbnailURL() }}" alt="{{ ss.title }}" />
</a>
</li>
{% endif %}
{% endfor %}
</ul>
{{ package.desc | markdown }}
<div style="clear: both;"></div>
{#
{% if current_user.is_authenticated or requests %}
<h3>Edit Requests</h3>
<ul>
{% for r in requests %}
<li>
<a href="{{ r.getURL() }}">{{ r.title }}</a>
by
<a href="{{ url_for('user_profile_page', username=r.author.username) }}">{{ r.author.display_name }}</a>
</li>
{% else %}
<li><i>No dependencies</i></li>
<li>No edit requests have been made.</li>
{% endfor %}
</ul>
<!-- </td>
<td>
<h3>Required by</h3>
<ul>
{% for p in package.dependents %}
<li><a href="{{ p.getDetailsURL() }}">{{ p.title }}</a> by {{ p.author.display_name }}</li>
{% else %}
{% if not package.softdependents %}
<li>No dependents.</li>
{% endif %}
{% endfor %}
{% for p in package.softdependents %}
<li><a href="{{ p.getDetailsURL() }}">{{ p.title }}</a> by {{ p.author.display_name }} [optional]</li>
{% endfor %}
</ul>
</td>
</tr>
</table> -->
{% endif %}
#}
{#
{% if current_user.is_authenticated or requests %}
<h3>Edit Requests</h3>
{% if alternatives %}
<h3>Related</h3>
{% from "macros/packagegridtile.html" import render_pkggrid %}
{{ render_pkggrid(alternatives) }}
{% endif %}
{% if similar_topics %}
<h3>Similar Forum Topics</h3>
<ul>
{% for r in requests %}
{% for t in similar_topics %}
<li>
<a href="{{ r.getURL() }}">{{ r.title }}</a>
by
<a href="{{ url_for('user_profile_page', username=r.author.username) }}">{{ r.author.display_name }}</a>
[{{ t.type.value }}]
<a href="https://forum.minetest.net/viewtopic.php?t={{ t.topic_id }}">
{{ t.title }} by {{ t.author.display_name }}
</a>
{% if t.wip %}[WIP]{% endif %}
</li>
{% else %}
<li>No edit requests have been made.</li>
{% endfor %}
</ul>
{% endif %}
#}
{% if alternatives %}
<h3>Alternatives</h3>
<ul>
{% for p in alternatives %}
<li><a href="{{ p.getDetailsURL() }}">{{ p.title }} by {{ p.author.display_name }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% if similar_topics %}
<h3>Similar Forum Topics</h3>
{% if not package.approved and package.type == package.type.MOD %}
<div class="box box_grey alert alert-warning">
Please make sure that this package has the right to
the name '{{ package.name }}'.
See the
<a href="/policy_and_guidance/">Inclusion Policy</a>
for more info.
</div>
{% endif %}
<ul>
{% for t in similar_topics %}
<li>
[{{ t.type.value }}]
<a href="https://forum.minetest.net/viewtopic.php?t={{ t.topic_id }}">
{{ t.title }} by {{ t.author.display_name }}
</a>
{% if t.wip %}[WIP]{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% if threads %}
<h3>Threads</h3>
{% if package.approved and package.checkPerm(current_user, "CREATE_THREAD") %}
<p><a href="{{ url_for('new_thread_page', pid=package.id) }}">Open Thread</a></p>
{% endif %}
{% from "macros/threads.html" import render_threadlist %}
{{ render_threadlist(threads) }}
{% endif %}
</main>
{% endblock %}

@ -19,7 +19,7 @@ Creating an Account
Please log out to continue.
</p>
<p>
<a href="{{ url_for('user.logout', next=url_for('user_claim_page')) }}" class="button">Logout</a>
<a href="{{ url_for('user.logout', next=url_for('user_claim_page')) }}" class="btn">Logout</a>
</p>
{% else %}
<p>
@ -108,7 +108,7 @@ Creating an Account
options.
</p>
<a class="button" href="{{ url_for('user.register') }}">Register</a>
<a class="btn" href="{{ url_for('user.register') }}">Register</a>
</div>
</div>
{% endif %}

@ -7,72 +7,74 @@
{% block content %}
{% if not current_user.is_authenticated and user.rank == user.rank.NOT_JOINED and user.forums_username %}
<div class="box box_grey alert alert-info">
Is this you? Claim your account now!
<div class="alert alert-info alert alert-info">
<a class="float-right btn btn-default btn-sm"
href="{{ url_for('user_claim_page', username=user.forums_username) }}">Claim</a>
<a class="alert_right button" href="{{ url_for('user_claim_page', username=user.forums_username) }}">Claim</a>
Is this you? Claim your account now!
</div>
{% endif %}
<div class="box box_grey">
<h2>{{ user.display_name }}</h2>
<div class="row mb-3">
<div class="col-sm-6">
<div class="card">
<h2 class="card-header">{{ user.display_name }}</h2>
<table class="table">
<tr>
<td>Rank:</td>
<td>
{{ user.rank.getTitle() }}
</td>
</tr>
<tr>
<td>Accounts:</td>
<td>
{% if user.forums_username %}
<a href="https://forum.minetest.net/memberlist.php?mode=viewprofile&un={{ user.forums_username }}">
Minetest Forum
</a>
{% elif user == current_user %}
No forum account
{% endif %}
<table class="box-body">
<tr>
<td>Rank:</td>
<td>
{{ user.rank.getTitle() }}
</td>
</tr>
<tr>
<td>Accounts:</td>
<td>
{% if user.forums_username %}
<a href="https://forum.minetest.net/memberlist.php?mode=viewprofile&un={{ user.forums_username }}">
Minetest Forum
</a>
{% elif user == current_user %}
No forum account
{% endif %}
{% if (user.forums_username and user.github_username) or user == current_user %}
|
{% endif %}
{% if (user.forums_username and user.github_username) or user == current_user %}
|
{% endif %}
{% if user.github_username %}
<a href="https://github.com/{{ user.github_username }}">GitHub</a>
{% elif user == current_user %}
<a href="{{ url_for('github_signin_page') }}">Link Github</a>
{% endif %}
{% if user.github_username %}
<a href="https://github.com/{{ user.github_username }}">GitHub</a>
{% elif user == current_user %}
<a href="{{ url_for('github_signin_page') }}">Link Github</a>
{% endif %}
{% if user == current_user %}
&#x1f30e;
{% endif %}
</td>
</tr>
{% if user == current_user %}
&#x1f30e;
<tr>
<td>Password:</td>
<td>
{% if user.password %}
Set | <a href="{{ url_for('user.change_password') }}">Change</a>
{% else %}
Not set | <a href="{{ url_for('set_password_page') }}">Set</a>
{% endif %}
</td>
</tr>
{% endif %}
</td>
</tr>
{% if user == current_user %}
<tr>
<td>Password:</td>
<td>
{% if user.password %}
Set | <a href="{{ url_for('user.change_password') }}">Change</a>
{% else %}
Not set | <a href="{{ url_for('set_password_page') }}">Set</a>
{% endif %}
</td>
</tr>
{% endif %}
</table>
</div>
</table>
</div>
</div>
{% if form %}
{% from "macros/forms.html" import render_field, render_submit_field %}
<div class="box box_grey">
<h2>Edit Details</h2>
<form action="" method="POST" class="form box-body" role="form">
<div class="row">
<div class="col-sm-6 col-md-5 col-lg-4">
<div class="col-sm-6">
<div class="card">
<h2 class="card-header">Edit Details</h2>
<div class="card-body">
<form action="" method="POST" class="form box-body" role="form">
{{ form.hidden_tag() }}
{% if user.checkPerm(current_user, "CHANGE_DNAME") %}
@ -89,27 +91,26 @@
{% endif %}
{{ render_submit_field(form.submit, tabindex=280) }}
</div>
</form>
</div>
</form>
</div>
</div>
{% endif %}
</div>
{% from "macros/packagegridtile.html" import render_pkggrid %}
{{ render_pkggrid(packages, show_author=False) }}
{% if topics_to_add %}
<div class="box box_grey">
<h2>Unadded Packages</h2>
<div class="card mt-3">
<h2 class="card-header">Unadded Packages</h2>
<div class="box-body">
<p>
List of your forum topics which do not have a matching package.
</p>
<p class="card-body">
List of your forum topics which do not have a matching package.
</p>
{% from "macros/topics.html" import render_topics_table %}
{{ render_topics_table(topics_to_add, show_author=False) }}
</div>
{% from "macros/topics.html" import render_topics_table %}
{{ render_topics_table(topics_to_add, show_author=False) }}
</div>
{% endif %}

@ -151,10 +151,11 @@ def package_page(package):
alternatives = None
if package.type == PackageType.MOD:
alternatives = Package.query \
.filter_by(name=package.name, type=PackageType.MOD, soft_deleted=False) \
.filter(Package.id != package.id) \
.order_by(db.asc(Package.title)) \
.all()
.filter_by(name=package.name, type=PackageType.MOD, soft_deleted=False) \
.filter(Package.id != package.id) \
.order_by(db.desc(Package.score)) \
.all()
show_similar_topics = current_user == package.author or \
package.checkPerm(current_user, Permission.APPROVE_NEW)