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

View File

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

View File

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

View File

@ -146,76 +146,76 @@
</div> </div>
</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 %}
{% 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." %}
{% set package_warning="Non-free code and media." %} {% elif not package.license.is_foss and package.type != package.type.TXP %}
{% elif not package.license.is_foss and package.type != package.type.TXP %} {% set package_warning="Non-free code." %}
{% set package_warning="Non-free code." %} {% elif not package.media_license.is_foss %}
{% elif not package.media_license.is_foss %} {% set package_warning="Non-free media." %}
{% set package_warning="Non-free media." %} {% endif %}
{% endif %} {% if package_warning %}
{% if package_warning %} <div class="card-body">
<div class="alert alert-danger"> <div class="alert alert-danger">
<b>Warning:</b> {{ package_warning }} <b>Warning:</b> {{ package_warning }}
</div> </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 %} {% endif %}
<table> <tr>
<tr> <td>Author</td>
<td>Name</td> <td class="{{ package.author.rank }}">
<td>{{ package.name }}</td> <a href="{{ url_for('user_profile_page', username=package.author.username) }}">
</tr> {{ package.author.display_name }}
{% if package.provides %} </a>
<tr> </td>
<td>Provides</td> </tr>
<td>{% for meta in package.provides %} <tr>
<a class="badge badge-primary" <td>Type</td>
href="{{ url_for('meta_package_page', name=meta.name) }}">{{ meta.name }}</a> <td>{{ package.type.value }}</td>
{%- if not loop.last %} </tr>
, <tr>
{% endif %} <td>License</td>
{% endfor %}</td> <td>
</tr> {% if package.license == package.media_license %}
{% endif %} {{ package.license.name }}
<tr> {% elif package.type == package.type.TXP %}
<td>Author</td> {{ package.media_license.name }}
<td class="{{ package.author.rank }}"> {% else %}
<a href="{{ url_for('user_profile_page', username=package.author.username) }}"> {{ package.license.name }} for code,<br />
{{ package.author.display_name }} {{ package.media_license.name }} for media.
</a> {% endif %}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Added</td>
<td>{{ package.type.value }}</td> <td>{{ package.created_at | datetime }}</td>
</tr> </tr>
<tr> <tr>
<td>License</td> <td>Tags</td>
<td> <td>
{% if package.license == package.media_license %} {% for t in package.tags %}
{{ package.license.name }} <span class="badge badge-primary">{{ t.title }}</span>
{% elif package.type == package.type.TXP %} {% else %}
{{ package.media_license.name }} <i>No tags.</i>
{% else %} {% endfor %}
{{ package.license.name }} for code,<br /> </td>
{{ package.media_license.name }} for media. </table>
{% 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>
</div> </div>
{% if package.type == package.type.MOD %} {% if package.type == package.type.MOD %}

View File

@ -7,72 +7,74 @@
{% block content %} {% block content %}
{% if not current_user.is_authenticated and user.rank == user.rank.NOT_JOINED and user.forums_username %} {% 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"> <div class="alert alert-info alert alert-info">
Is this you? Claim your account now! <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> </div>
{% endif %} {% endif %}
<div class="box box_grey"> <div class="row mb-3">
<h2>{{ user.display_name }}</h2> <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"> {% if (user.forums_username and user.github_username) or user == current_user %}
<tr> |
<td>Rank:</td> {% endif %}
<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 %} {% if user.github_username %}
| <a href="https://github.com/{{ user.github_username }}">GitHub</a>
{% endif %} {% elif user == current_user %}
<a href="{{ url_for('github_signin_page') }}">Link Github</a>
{% if user.github_username %} {% endif %}
<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 %} {% 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 %} {% endif %}
</td> </table>
</tr> </div>
{% if user == current_user %} </div>
<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>
{% if form %} {% if form %}
{% from "macros/forms.html" import render_field, render_submit_field %} {% from "macros/forms.html" import render_field, render_submit_field %}
<div class="box box_grey"> <div class="col-sm-6">
<h2>Edit Details</h2> <div class="card">
<h2 class="card-header">Edit Details</h2>
<form action="" method="POST" class="form box-body" role="form"> <div class="card-body">
<div class="row"> <form action="" method="POST" class="form box-body" role="form">
<div class="col-sm-6 col-md-5 col-lg-4">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{% if user.checkPerm(current_user, "CHANGE_DNAME") %} {% if user.checkPerm(current_user, "CHANGE_DNAME") %}
@ -89,27 +91,26 @@
{% endif %} {% endif %}
{{ render_submit_field(form.submit, tabindex=280) }} {{ render_submit_field(form.submit, tabindex=280) }}
</div> </form>
</div> </div>
</form> </div>
</div> </div>
{% endif %} {% endif %}
</div>
{% from "macros/packagegridtile.html" import render_pkggrid %} {% from "macros/packagegridtile.html" import render_pkggrid %}
{{ render_pkggrid(packages, show_author=False) }} {{ render_pkggrid(packages, show_author=False) }}
{% if topics_to_add %} {% if topics_to_add %}
<div class="box box_grey"> <div class="card mt-3">
<h2>Unadded Packages</h2> <h2 class="card-header">Unadded Packages</h2>
<div class="box-body"> <p class="card-body">
<p> List of your forum topics which do not have a matching package.
List of your forum topics which do not have a matching package. </p>
</p>
{% from "macros/topics.html" import render_topics_table %} {% from "macros/topics.html" import render_topics_table %}
{{ render_topics_table(topics_to_add, show_author=False) }} {{ render_topics_table(topics_to_add, show_author=False) }}
</div>
</div> </div>
{% endif %} {% endif %}