changeset 56:ea67eba3199d

ticket: first draft: those templates are the first implementations to: - show a list of tickets - create a new ticket - display a ticket an its comments
author Goffi <goffi@goffi.org>
date Sun, 05 Nov 2017 22:04:34 +0100
parents d58fdd57df49
children 50957f0669b9
files default/static/ticket.css default/ticket/create.html default/ticket/item.html default/ticket/overview.html default/ticket/tickets.html
diffstat 5 files changed, 205 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/static/ticket.css	Sun Nov 05 22:04:34 2017 +0100
@@ -0,0 +1,128 @@
+@import 'blog.css'; /* needed as blog/articles.html is included */
+
+.instructions {
+    font-style: italic;
+    text-align: center;
+}
+
+.instructions span {
+    padding: 0.3em;
+}
+
+.tickets table {
+    margin: 0 auto;
+}
+
+.tickets tr:nth-child(even) {
+    background: #CCC9;
+}
+
+.tickets tr:nth-child(odd) {
+    background: #FFF;
+}
+
+.tickets tbody tr:hover {
+    background: yellow;
+}
+
+.tickets tbody tr.severity_major .td_title a::before {
+    content: '⚠ ';
+    color: red;
+}
+
+.tickets tbody tr.status_closed {
+    text-decoration: line-through;
+    color: grey;
+}
+
+/* single ticket */
+
+.ticket {
+    padding: 20px;
+    max-width: 500px;
+    margin: 0 auto;
+}
+
+.view .xmlui_widget {
+    width: auto;
+}
+
+.view #label_wid_title,
+.view #label_wid_body,
+.view #label_wid_id,
+.view #label_wid_comments_uri,
+.view #wid_comments_uri {
+    display: none
+}
+
+.view .xmlui_widget {
+    text-align: right;
+}
+
+.view #wid_id {
+    margin: 0;
+    font-style: italic;
+}
+
+.view .xmlui_label {
+    font-weight: bold;
+    float: left;
+    color: #808080cc;
+}
+
+.view #wid_title {
+    font-weight: bold;
+    display: block;
+    text-align: center;
+}
+.view #wid_title:first-letter {
+    text-transform: uppercase;
+}
+
+.view #wid_labels span {
+	font-size: 0.8em;
+	background: #eae3e3;
+	font-variant: small-caps;
+	border: 1px solid black;
+	border-radius: 0.5em;
+	padding: 0 2px;
+    white-space: nowrap;
+}
+
+.view #wid_labels span.value_work_in_progress {
+    background: yellow;
+}
+
+.view #wid_type {
+    font-weight: bold;
+}
+
+.view #wid_type span.value_bug::after {
+    content: ' 🐛';
+    color: red;
+}
+
+.view #wid_severity span.value_major {
+    font-weight: bold;
+    color: red;
+}
+
+.view #wid_severity span.value_major::after {
+    content: '⚠ ';
+}
+
+.view #wid_body {
+    white-space: pre-wrap;
+    max-height: 500px;
+    overflow: auto;
+    resize: both;
+    background-color: white;
+    padding: 5px;
+    text-align: justify;
+    border: 1px solid black;
+    border-radius: 5px;
+}
+
+.comment_post {
+    margin-top: 3em;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/ticket/create.html	Sun Nov 05 22:04:34 2017 +0100
@@ -0,0 +1,16 @@
+{% extends 'base/base.html' %}
+{% import 'input/form.html' as form with context %}
+{% import 'input/field.html' as field with context %}
+{% import 'input/xmlui.html' as xmlui with context %}
+
+{% block body %}
+<div class='instructions'>
+    <p><span class="box">{% trans app_name=C.APP_NAME%}This page allows you to report an issue or ask/suggest a new feature for {{app_name}}{% endtrans %}</span></p>
+</div>
+<div class="create single ticket box">
+{% call form.form() %}
+    {{ xmlui.generate(new_ticket_xmlui) }}
+    {{ field.submit(_("Create ticket")) }}
+{% endcall %}
+</div>
+{% endblock body %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/ticket/item.html	Sun Nov 05 22:04:34 2017 +0100
@@ -0,0 +1,38 @@
+{# display a single ticket
+
+    @variable item(xmlui_item): ticket to display
+    @variable comments(data_object.BlogItems): comments of the ticket
+    @variable comments_service(unicode): service for adding comments
+    @variable comments_node(unicode): node for adding comments
+#}
+
+{% if not embedded %}{% extends 'base/base.html' %}{% endif %}
+{% import 'input/xmlui.html' as xmlui with context %}
+{% import 'blog/macros.html' as blog with context %}
+{% import 'input/comment.html' as comment with context %}
+
+{% block title %}{{item|adv_format('[{value.widget_value.id}] {value.widget_value.title}') }}{% endblock %}
+
+{% block confirm_message %}
+    {% trans %}Your comment has been sent{% endtrans %}
+{% endblock confirm_message %}
+
+{% block body %}
+<div id="{{ item.widget_value['id'] }}" class="view single ticket box">
+    {{ xmlui.generate(item,
+        form=false,
+        filters={'created': {'filters': ['date_fmt'], filters_args:[{'fmt': 'short'}]},
+                 'updated': {'filters': ['date_fmt'], filters_args:[{'fmt': 'short'}]}},
+        )}}
+</div>
+{% if comments is defined %}
+<div id="blog_items">
+    {{ blog.show_items(comments|reverse, expanded=true) }}
+</div>
+{% endif %}
+{% if comments_node is defined %}
+    <div class="comment_post">
+        {{- comment.comment_or_login(service=comments_service, node=comments_node) -}}
+    </div>
+{% endif %}
+{% endblock body %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/ticket/overview.html	Sun Nov 05 22:04:34 2017 +0100
@@ -0,0 +1,11 @@
+{% extends 'base/base.html' %}
+{% import 'input/xmlui.html' as xmlui with context %}
+
+{% block body %}
+<div id="tickets" class="view tickets overview">
+    {{ xmlui.generate_table(tickets, (('id', _('Id')),
+                                      ('title', _('Title'))),
+                            tr_class_fields=['status', 'priority', 'severity'],
+                            on_click=on_ticket_click) }}
+</div>
+{% endblock body %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/ticket/tickets.html	Sun Nov 05 22:04:34 2017 +0100
@@ -0,0 +1,12 @@
+{% extends 'base/base.html' %}
+{% import 'input/xmlui.html' as xmlui with context %}
+
+{% block body %}
+<div id="tickets">
+    {% for ticket in tickets %}
+        <div class="ticket_full">
+            {{ xmlui.generate(ticket) }}
+        </div>
+    {% endfor %}
+</div>
+{% endblock body %}