Skip to content
Snippets Groups Projects
Commit afe7ffc3 authored by siebenseitig's avatar siebenseitig
Browse files

feat: add list view of message

parent 5224c900
Branches
Tags
No related merge requests found
{% macro tagbox(conf_slug, tags) -%} {% macro tagbox(conf_slug, tags) -%}
<div> <div>
<h4 class="h2 mb-5">{{_("Tags")}}</h4> <h4 class="h2 mb-5">{{_("Tags")}}</h4>
<ul class="border border-tertiary px-6 pt-6 pb-5 list-unstyled mb-0 d-flex flex-row flex-wrap justify-content-center align-items-center"> <ul class="border px-6 pt-6 pb-5 list-unstyled mb-0 d-flex flex-row flex-wrap justify-content-center align-items-center">
{%- for tag in tags %} {%- for tag in tags %}
<li class="pr-2 mb-2"> <li class="pr-2 mb-2">
<a href="{{ url('plainui:tag', conf_slug=conf_slug, tag_slug=tag.tag.slug) }}" class="btn btn-tag-secondary">{{tag.tag.slug}}</a> <a href="{{ url('plainui:tag', conf_slug=conf_slug, tag_slug=tag.tag.slug) }}" class="btn btn-tag-secondary">{{tag.tag.slug}}</a>
......
...@@ -23,71 +23,75 @@ ...@@ -23,71 +23,75 @@
<h2 class="text-center bg-info p-3 text-white h3">{% if not sent_mode %}{{ _("Received Messages") }} {% else %}{{ _("Sent Messages") }}{% endif %}</h2> <h2 class="text-center bg-info p-3 text-white h3">{% if not sent_mode %}{{ _("Received Messages") }} {% else %}{{ _("Sent Messages") }}{% endif %}</h2>
<form method="POST" action="{{ url('plainui:personal_message_delete', conf_slug=conf.slug) }}"> <form method="POST" action="{{ url('plainui:personal_message_delete', conf_slug=conf.slug) }}">
{{ csrf_input }} {{ csrf_input }}
<table class="table"> <p class="my-5 font-headings text-white text-right px-2">
<thead> {{ msgs | length }} {{ _("messages_x_of_n") }} {{ total }}
<tr> </p>
<th scope="col">{% if not sent_mode %}{{ _("messages_from") }} {% else %}{{ _("messages_to") }}{% endif %}</th> <ul class="list-unstyled mb-0">
<th scope="col">{{ _("messages_subject") }}</th>
<th scope="col">{{ _("messages_date") }}</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{%- for msg in msgs %} {%- for msg in msgs %}
<tr> <li class="rc3-tile-message card mb-5">
<td> <article class="row no-gutters flex-nowrap border border-plattform-dark bg-gradient-plattform-vertical">
<figure class="rc3-tile-message__icon-col col mb-0">
<a class="rc3-tile-message__icon-container text-white" href="{{ url('plainui:personal_message_show', conf_slug=conf.slug, msg_id=msg.id) }}">
{% if not sent_mode %} {% if not sent_mode %}
{% if msg.has_responded %}
<svg class="rc3-tile-message__icon-flag" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-reply-fill" viewBox="0 0 16 16">
<title>{{_("messages_was_responded")}}</title>
<path transform="translate(16), scale(-1, 1)" d="M9.079 11.9l4.568-3.281a.719.719 0 0 0 0-1.238L9.079 4.1A.716.716 0 0 0 8 4.719V6c-1.5 0-6 0-7 8 2.5-4.5 7-4 7-4v1.281c0 .56.606.898 1.079.62z"/>
</svg>
{% endif %}
{% if msg.was_read %} {% if msg.was_read %}
<span class="ml-2" title="{{_("messages_was_read")}}"> <svg class="rc3-tile-message__icon" xmlns="http://www.w3.org/2000/svg" width="3.125rem" height="3.125rem" fill="currentColor" class="bi bi-envelope-open" viewBox="0 0 16 16">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-envelope-open" viewBox="0 0 16 16"> <title>{{_("messages_was_read")}}</title>
<path d="M8.47 1.318a1 1 0 0 0-.94 0l-6 3.2A1 1 0 0 0 1 5.4v.818l5.724 3.465L8 8.917l1.276.766L15 6.218V5.4a1 1 0 0 0-.53-.882l-6-3.2zM15 7.388l-4.754 2.877L15 13.117v-5.73zm-.035 6.874L8 10.083l-6.965 4.18A1 1 0 0 0 2 15h12a1 1 0 0 0 .965-.738zM1 13.117l4.754-2.852L1 7.387v5.73zM7.059.435a2 2 0 0 1 1.882 0l6 3.2A2 2 0 0 1 16 5.4V14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V5.4a2 2 0 0 1 1.059-1.765l6-3.2z"/> <path d="M8.47 1.318a1 1 0 0 0-.94 0l-6 3.2A1 1 0 0 0 1 5.4v.818l5.724 3.465L8 8.917l1.276.766L15 6.218V5.4a1 1 0 0 0-.53-.882l-6-3.2zM15 7.388l-4.754 2.877L15 13.117v-5.73zm-.035 6.874L8 10.083l-6.965 4.18A1 1 0 0 0 2 15h12a1 1 0 0 0 .965-.738zM1 13.117l4.754-2.852L1 7.387v5.73zM7.059.435a2 2 0 0 1 1.882 0l6 3.2A2 2 0 0 1 16 5.4V14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V5.4a2 2 0 0 1 1.059-1.765l6-3.2z"/>
</svg> </svg>
</span>
{% else %} {% else %}
<span class="ml-2" title="{{_("messages_is_new")}}"> <svg class="rc3-tile-message__icon" xmlns="http://www.w3.org/2000/svg" width="3.125rem" height="3.125rem" fill="currentColor" class="bi bi-envelope-fill" viewBox="0 0 16 16">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-envelope-fill" viewBox="0 0 16 16"> <title>{{_("messages_is_new")}}</title>
<path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555zM0 4.697v7.104l5.803-3.558L0 4.697zM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757zm3.436-.586L16 11.801V4.697l-5.803 3.546z"/> <path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555zM0 4.697v7.104l5.803-3.558L0 4.697zM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757zm3.436-.586L16 11.801V4.697l-5.803 3.546z"/>
</svg> </svg>
</span>
{% endif %} {% endif %}
<a href="{{ url('plainui:personal_message_send_to', conf_slug=conf.slug, recipient=msg.sender_name) }}"> {% endif %}
{{msg.sender_name}}
</a> </a>
{% else %} </figure>
<a href="{{ url('plainui:personal_message_send_to', conf_slug=conf.slug, recipient=msg.recipient_name) }}"> <section class="col pt-3 px-2">
{{msg.recipient_name}} {% set recipient = msg.sender_name if not sent_mode else msg.recipient_name %}
<a class="text-white" href="{{ url('plainui:personal_message_send_to', conf_slug=conf.slug, recipient=recipient) }}">
<h3 class="px-2 card-title h4 text-white">
{{recipient}}
</h3>
</a> </a>
{% endif %}
</td> <a class="text-white" href="{{ url('plainui:personal_message_show', conf_slug=conf.slug, msg_id=msg.id) }}">
<td> <p class="px-2">
{% if not sent_mode %} {{msg.subject}}
{% if msg.has_responded %} </p>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-reply-fill" viewBox="0 0 16 16"> </a>
<path transform="translate(16), scale(-1, 1)" d="M9.079 11.9l4.568-3.281a.719.719 0 0 0 0-1.238L9.079 4.1A.716.716 0 0 0 8 4.719V6c-1.5 0-6 0-7 8 2.5-4.5 7-4 7-4v1.281c0 .56.606.898 1.079.62z"/>
<footer class="card-footer d-flex justify-content-between align-items-center bg-transparent text-white font-headings fs-medium">
<time datetime="{{ msg.timestamp }}">{{msg.timestamp | strftime}}</time>
<div class="d-inline-flex">
<a class="ml-2 btn-icon-big btn btn-secondary" title="{{_("read")}}" href="{{ url('plainui:personal_message_show', conf_slug=conf.slug, msg_id=msg.id) }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-double-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M3.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L9.293 8 3.646 2.354a.5.5 0 0 1 0-.708z"/>
<path fill-rule="evenodd" d="M7.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L13.293 8 7.646 2.354a.5.5 0 0 1 0-.708z"/>
</svg> </svg>
{% endif %} </a>
{% endif %} <button class="ml-2 btn-icon-big btn btn-secondary" type="submit" name="id" value="{{msg.id}}" title="{{ _("messages_delete") }}">
<a href="{{ url('plainui:personal_message_show', conf_slug=conf.slug, msg_id=msg.id) }}">{{msg.subject}}</a> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
</td> <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/>
<td>{{msg.timestamp | strftime}}</td> <path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/>
<td> </svg>
{# {% not implemented? should color the flag button instead! if msg.flagged_for_abuse %}[{ _("messages_flagged") }]{% endif %} #} </button>
{% if not sent_mode %} {% if not sent_mode %}
{{ fbtns.report(report_url=msg.id, kind="pn", title=_("report this message")) }} {{ fbtns.report(report_url=msg.id, kind="pn", title=_("report this message")) }}
{% endif %} {% endif %}
<button class="ml-2 btn-icon-big btn btn-danger" type="submit" name="id" value="{{msg.id}}" title="{{ _("messages_delete") }}"> </div>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-square-fill" viewBox="0 0 16 16"> </footer>
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm3.354 4.646L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 1 1 .708-.708z"/> </section>
</svg> </article>
</button> </li>
</td>
</tr>
{%- endfor %} {%- endfor %}
</tbody> </ul>
</table>
{{ msgs | length }} {{ _("messages_x_of_n") }} {{ total }}
</form> </form>
</div> </div>
{% endblock %} {% endblock %}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
{{ titleMacro.title(_("Send Personal Message")) }} {{ titleMacro.title(_("Send Personal Message")) }}
<form <form
method="POST" method="POST"
class="border p-6 mx-auto mb-11{% if form.errors %} border-danger{% else %} border-tertiary{% endif %}" class="border p-6 mx-auto mb-11{% if form.errors %} border-danger{% endif %}"
> >
<h2 class="text-center bg-info p-3 text-white h3">{{ _("new message") }}</h2> <h2 class="text-center bg-info p-3 text-white h3">{{ _("new message") }}</h2>
{{ csrf_input }} {{ csrf_input }}
......
...@@ -4,25 +4,29 @@ ...@@ -4,25 +4,29 @@
{% extends "plainui/base.html" %} {% extends "plainui/base.html" %}
{% block title %}{{conf.name}} - {{ _("Personal Message") }}{% endblock %} {% block title %}{{conf.name}} - {{ _("Personal Message") }}{% endblock %}
{% block content %} {% block content %}
{{ titleMacro.title(_("Personal Messages"), report_url=msg.id, report_kind="pn") }} {{ titleMacro.title( msg.subject, report_url=msg.id, report_kind="pn") }}
<div class="border p-6 text-light mx-0 my-11">
<h2 class="text-center bg-info p-3 text-white h3">
{{ _("messages_from_short") }} {{ msg.sender.username }} {{ _("messages_to_short") }} {{ msg.recipient.username }}
<time datetime="{{msg.timestamp}}" class="d-block font-sans-serif fs-medium">
{{ msg.timestamp | strftime }}
</time>
</h2>
<div class="border border-tertiary p-6 text-light mx-0">
<h2 class="w-100 bg bg-info p-2 px-5 h3 text-white text-center">{{ msg.subject }}</h2>
<h6 class="card-subtitle mb-2 text-muted">{{ _("messages_from_short") }} {{ msg.sender.username }} {{ _("messages_to_short") }} {{ msg.recipient.username }} {{ _("messages_at") }} {{ msg.timestamp | strftime }}</h6>
{{ markdown(msg_body) }} {{ markdown(msg_body) }}
<ul class="mt-2 list-unstyled row justify-content-end ">
<li class="col-1"> <ul class="row justify-content-end list-unstyled mt-5 mb-0">
<li class="col-12 col-md-3 mb-3 mb-lg-0">
<form method="POST" action="{{ url('plainui:personal_message_delete', conf_slug=conf.slug) }}"> <form method="POST" action="{{ url('plainui:personal_message_delete', conf_slug=conf.slug) }}">
<button class="ml-2 btn-icon-big btn btn-danger" type="submit" name="id" value="{{msg.id}}" title="{{ _("messages_delete") }}"> <button class="ml-2 btn btn-xl btn-block btn-secondary" type="submit" name="id" value="{{msg.id}}" title="{{ _("messages_delete") }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-square-fill" viewBox="0 0 16 16"> {{ _("Delete") }}
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm3.354 4.646L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 1 1 .708-.708z"/>
</svg>
</button> </button>
</form> </form>
</li> </li>
{% if user.id == msg.recipient.id %} {% if user.id == msg.recipient.id %}
<li class="col-1"> <li class="col-12 col-md-3">
<a class="btn btn-primary" href="{{ url('plainui:personal_message_send_to', conf_slug=conf.slug, recipient=msg.sender.username) ~ '?in_reply_to=' ~ msg.id | urlencode ~ '&subject=AW: ' ~ msg.subject | truncate(100) | urlencode }}"> <a class=" btn btn-xl btn-block btn-primary" href="{{ url('plainui:personal_message_send_to', conf_slug=conf.slug, recipient=msg.sender.username) ~ '?in_reply_to=' ~ msg.id | urlencode ~ '&subject=AW: ' ~ msg.subject | truncate(100) | urlencode }}">
{{_("Reply")}} {{_("Reply")}}
</a> </a>
</li> </li>
......
...@@ -7,4 +7,5 @@ ...@@ -7,4 +7,5 @@
@import "syntaxhilite"; @import "syntaxhilite";
@import "player"; @import "player";
@import "tile-board"; @import "tile-board";
@import "tile-message";
@import "slider"; @import "slider";
.rc3-tile-message {
&__icon-col {
width: 9.375rem;
flex: 0 0 9.375rem;
}
&__icon-container {
position: relative;
width: 100%;
height: 100%;
display: flex;
flex-flow: column nowrap;
align-items: center;
justify-content: center;
margin-bottom: 0;
text-decoration: none;
}
&__icon {
&-flag {
margin-left: 2.5rem;
}
}
@include media-breakpoint-down('md') {
&__icon-col {
width: 5rem;
flex: 0 0 5rem;
}
&__icon {
max-width: 2.5rem;
&-flag {
margin-left: 1.25rem;
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment