Improve card and user profile formatting

This commit is contained in:
rubenwardy 2018-12-22 12:36:49 +00:00
parent 5dcff01436
commit 09a201759b
4 changed files with 141 additions and 132 deletions

@ -3,6 +3,10 @@
@import "packagegrid.scss";
@import "comments.scss";
.dropdown-menu {
margin-top: 0;
}
.dropdown:hover .dropdown-menu {
display: block;
}
@ -21,6 +25,10 @@
text-decoration: none;
}
.card .table {
margin-bottom: 0;
}
.btn-download {
color: #fff;
background-color: #00b05c;

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

@ -146,76 +146,76 @@
</div>
</div>
<div class="card-body">
{% 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 %}
{% 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 %}
<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>
<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>
{% if package.type == package.type.MOD %}

@ -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 %}