changeset 138:85877c76d47d

merge-request: discovery page
author Goffi <goffi@goffi.org>
date Tue, 27 Mar 2018 08:33:11 +0200
parents efbf5423d7be
children 909361c96a58
files default/components/block.html default/components/common.html default/merge-request/create.html default/merge-request/discover.html default/merge-request/item.html default/ticket/discover.html
diffstat 6 files changed, 48 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/default/components/block.html	Tue Mar 27 08:32:34 2018 +0200
+++ b/default/components/block.html	Tue Mar 27 08:33:11 2018 +0200
@@ -15,3 +15,20 @@
         {% endif %}
     </div>
 {% endmacro %}
+
+{% macro disco_icon_grid(disco_entities, icon_name) %}
+{# display discovered entities in a grid
+    @param disco_entities: entities which mush have a name and url key or attribute
+    @param icon_name: name of a defined icon
+#}
+    <ul class="grid grid--center">
+        {% for disco_entity in disco_entities %}
+            <li class='grid__item grid__item--medium grid__item--selectable'>
+                <a href="{{disco_entity.url}}" class="items_vert--centered">
+                    {{ icon(icon_name, cls='icon--medium') }}
+                    <span>{{ disco_entity.name }}</span>
+                </a>
+            </li>
+        {% endfor %}
+    </ul>
+{% endmacro %}
--- a/default/components/common.html	Tue Mar 27 08:32:34 2018 +0200
+++ b/default/components/common.html	Tue Mar 27 08:33:11 2018 +0200
@@ -3,7 +3,7 @@
     'login': _('Session') if profile else _('Log in'),
     'blog': _('Blog'),
     'forums': _('Forums'),
-    'merge-requests_list': _('Merge requests'),
+    'merge-requests': _('Merge requests'),
     'merge-request_new': _('Create new merge request'),
     'tickets': _('Tickets'),
     'ticket_new': _('Create new ticket'),
--- a/default/merge-request/create.html	Tue Mar 27 08:32:34 2018 +0200
+++ b/default/merge-request/create.html	Tue Mar 27 08:33:11 2018 +0200
@@ -1,6 +1,6 @@
 {# creata a new ticket #}
 
-{% set category_menu = [('merge-requests_list', url_tickets_list)] %}
+{% set category_menu = [('merge-requests', url_tickets_list)] %}
 {% extends 'base/base.html' %}
 {% block body %}
 <div class="box message--info">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/merge-request/discover.html	Tue Mar 27 08:33:11 2018 +0200
@@ -0,0 +1,25 @@
+{% extends 'base/base.html' %}
+{% import 'components/block.html' as block with context %}
+{% import 'components/images.html' as images with context %}
+{% import 'components/avatar.html' as avatar with context %}
+{% import 'input/form.html' as form with context %}
+{% import 'input/field.html' as field with context %}
+
+{% block body %}
+{{ icon_defs('merge') }}
+<p class="instructions--head">
+    {% trans %}
+    Please select a merge-requests handler
+    {% endtrans %}
+</p>
+{% if mr_handlers is defined %}
+    <div class="disco_tickets">
+        {{block.disco_icon_grid(mr_handlers, 'merge')}}
+    </div>
+{% endif %}
+
+{% call form.form(class="form_single") %}
+    {{ field.text("jid", _("handler jid"), required=true)}}
+    {{ field.submit(_("Access")) }}
+{% endcall %}
+{% endblock body %}
--- a/default/merge-request/item.html	Tue Mar 27 08:32:34 2018 +0200
+++ b/default/merge-request/item.html	Tue Mar 27 08:33:11 2018 +0200
@@ -6,7 +6,7 @@
     @variable comments_node(unicode): node for adding comments
 #}
 
-{% set category_menu = [('merge-requests_list', url_tickets_list),
+{% set category_menu = [('merge-requests', url_tickets_list),
                         ('merge-request_new', url_tickets_new)] %}
 {% if not embedded %}{% extends 'base/base.html' %}{% endif %}
 {% import 'input/xmlui.html' as xmlui with context %}
--- a/default/ticket/discover.html	Tue Mar 27 08:32:34 2018 +0200
+++ b/default/ticket/discover.html	Tue Mar 27 08:33:11 2018 +0200
@@ -1,29 +1,20 @@
 {% extends 'base/base.html' %}
-{% import 'components/block.html' as block %}
+{% import 'components/block.html' as block with context %}
 {% import 'components/images.html' as images with context %}
 {% import 'components/avatar.html' as avatar with context %}
 {% import 'input/form.html' as form with context %}
 {% import 'input/field.html' as field with context %}
 
 {% block body %}
+{{ icon_defs('clipboard') }}
 <p class="instructions--head">
     {% trans %}
     Please select a tickets tracker
     {% endtrans %}
 </p>
 {% if tickets_trackers is defined %}
-    {{ icon_defs('clipboard') }}
     <div class="disco_tickets">
-        <ul class="grid grid--center">
-            {% for tracker in tickets_trackers %}
-                <li class='grid__item grid__item--medium grid__item--selectable'>
-                    <a href="{{tracker.url}}" class="items_vert--centered">
-                        {{ icon('clipboard', cls='icon--medium') }}
-                        <span>{{ tracker.name }}</span>
-                    </a>
-                </li>
-            {% endfor %}
-        </ul>
+        {{block.disco_icon_grid(tickets_trackers, 'clipboard')}}
     </div>
 {% endif %}