# HG changeset patch # User Goffi # Date 1512085602 -3600 # Node ID 9834106678da7674e54c6db83c1e7f6a7e301098 # Parent dd15b6c0b1d3ab4b7239f4daa9d69c017dcf7405 base: menu implementation: 2 menus are now handled: main menu and category menu (for submenus relative to a page). Main menu is displayed on the side bar on big screen. Added menu for tickets. diff -r dd15b6c0b1d3 -r 9834106678da default/base/base.html --- a/default/base/base.html Wed Nov 15 08:52:14 2017 +0100 +++ b/default/base/base.html Fri Dec 01 00:46:42 2017 +0100 @@ -1,4 +1,5 @@ {% set embedded = True %} {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #} +{% import 'components/common.html' as component with context %} {{ script.include('css') }} {# css.js is a common script, so it's useful to import it here #} @@ -35,36 +36,37 @@ {{ script.generate_scripts() }} - -
- {% if confirm %} - {# confirmation message used when post data has been handled correctly #} - {% block confirm %} -
- {% block confirm_message %} - {% trans %}Your data has been sent correctly.{% endtrans %} - {% endblock confirm_message %} -
- {% endblock confirm %} - {% endif %} + {% if main_menu is defined %} + {% block main_menu %} + {{ component.menu(main_menu, class="main_menu") }} + {% endblock main_menu %} + {% endif %} - {% if menus %} - {% block menu %} - - {% endblock menu %} - {% endif %} -
+
+
+ {% if confirm %} + {# confirmation message used when post data has been handled correctly #} + {% block confirm %} +
+ {% block confirm_message %} + {% trans %}Your data has been sent correctly.{% endtrans %} + {% endblock confirm_message %} +
+ {% endblock confirm %} + {% endif %} -
- {% block body %} - {% endblock body %} +
+ +
+ {% block category_menu scoped %} + {% if category_menu is defined %} + {{ component.menu(category_menu, class="category_menu") }} + {% endif %} + {% endblock category_menu %} + {% block body %} + {% endblock body %} +
+
{% block footer %}{% trans app_name=C.APP_NAME %}Powered by {{app_name}}{% endtrans %}{% endblock %}
- diff -r dd15b6c0b1d3 -r 9834106678da default/components/common.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/default/components/common.html Fri Dec 01 00:46:42 2017 +0100 @@ -0,0 +1,19 @@ +{# menu labels, map from menu names to labels #} +{% set ml = { + 'login': _('Session') if profile is defined else _('Log in'), + 'blog_view': _('Blog'), + 'merge-requests_list': _('Merge requests'), + 'merge-request_new': _('Create new merge request'), + 'tickets_list': _('Tickets'), + 'ticket_new': _('Create new ticket'), +} %} + +{% macro menu(menus, class='') %} + +{% endmacro %} diff -r dd15b6c0b1d3 -r 9834106678da default/input/xmlui.html --- a/default/input/xmlui.html Wed Nov 15 08:52:14 2017 +0100 +++ b/default/input/xmlui.html Fri Dec 01 00:46:42 2017 +0100 @@ -14,18 +14,18 @@ {% macro generate_widget(wid, config, id=none) %} {% if wid.type == 'text' %} - {{ text_widget(wid, config, id=id) }} + {{ text_widget(wid, config, id=id) }} {% elif wid.type == 'label' %} {{ label_widget(wid, config) }} {% elif wid.type == 'string' %} - {{ string_widget(wid, config, id=id) }} + {{ string_widget(wid, config, id=id) }} {% elif wid.type == 'jid' %} {# TODO: proper JID widget #} - {{ string_widget(wid, config, id=id) }} + {{ string_widget(wid, config, id=id) }} {% elif wid.type == 'textbox' %} - {{ textbox_widget(wid, config, id=id) }} + {{ textbox_widget(wid, config, id=id) }} {% elif wid.type == 'list' %} - {{ list_widget(wid, config, id=id) }} + {{ list_widget(wid, config, id=id) }} {% endif %} {% endmacro %} @@ -161,7 +161,7 @@ {{- wid|item_filter(config.filters) -}} {% else %} -

+

{{- wid|item_filter(config.filters) -}}

{% endif %} @@ -177,7 +177,7 @@ {% endfor %} {% else %} -
+
{% for value,label in wid.items %} {{- label -}} diff -r dd15b6c0b1d3 -r 9834106678da default/static/styles.css --- a/default/static/styles.css Wed Nov 15 08:52:14 2017 +0100 +++ b/default/static/styles.css Fri Dec 01 00:46:42 2017 +0100 @@ -3,11 +3,23 @@ } body { + margin: 0; + padding: 0; display: flex; height: 100vh; flex-direction: column; box-sizing: border-box; - margin: 0; +} + +#main_side_bar { + +} + +#main_area { + flex: 1; + display: flex; + flex-direction: column; + box-sizing: border-box; } #body { @@ -23,19 +35,7 @@ .box { background-color: #edf2ff; border-radius: 0; -} - -@media (min-width: 500px) { - html { - background-size: auto; - } - body { - padding: 8px; - } - .box { - border-radius: 1em; - box-shadow: 10px 10px 16px -5px rgba(0,0,0,0.5); - } + border-color: silver; } .title { @@ -53,48 +53,164 @@ margin: 1.5em auto; } -/* generic */ +/*** Generic ***/ .button:hover { background-color: #bc0000; } -/* Menus */ +/*** Messages ***/ + +.message_info { + max-width: 500px; + margin: 0 auto; + padding: 1em; + text-align: justify; +} + +.message_info pre { + background: #ddd; + padding: 1em; +} + +/*** Menus ***/ .menu ul { display: flex; - justify-content: center; + padding: 0; margin-top: 8px; - padding: 0; list-style: none; } -.menu li { +.menu a { + display: block; + color: inherit; + text-decoration: none; + font-variant: small-caps; +} + +.main_menu { + min-width: 200px; + /* background-color: #eaeaea; */ + background-color: #333; + color: white; +} + +.main_menu ul { + flex-direction: row; + flex-wrap: wrap; +} + +.main_menu li { + flex: 1; + padding: 0; + margin: 0 1em; +} + +.main_menu a { + display: inline; + white-space: nowrap; +} + +.main_menu a:hover { + background-color: initial; + text-shadow: 1px 1px 2px; + font-weight: bold; +} + +.category_menu ul { + justify-content: center; +} + +.category_menu li { margin: 0.5em; text-align: center; } -.menu a { - color: inherit; - text-decoration: none; - border: solid 1px; - padding: 0.5em; - font-variant: small-caps; - border-radius: 1em; - background: #eee; +.category_menu a { + border: solid 1px; + padding: 0.5em; + border-radius: 0.2em; + background: #eee; +} + +/*** containers ***/ + +/* tabs */ + +.tab_container { + max-width: 1000px; + margin: 0 auto; +} + +.tab_header { + background-color: white; + border-bottom: 1px solid lightgrey; +} + +.tab_header ul { + display: flex; + margin: 0; + padding: 0; + list-style: none; + background-color: white; +} + +.tab_page { + box-sizing: border-box; + padding-top: 2em; + border: 1px solid lightgrey; + border-top: none; + display: None; } -.menu a:hover { +.tab_page.clicked { + display: block; +} + +.tab_button { + display: inline; + color: grey; + background-color: white; + border-top: 1px solid lightgrey; + border-left: 1px solid lightgrey; + border-bottom: 1px solid lightgrey; + padding: 0 1em; + cursor: pointer; + /* we go down by 1px to remove bottom border from .tab_header */ + margin-bottom: -1px; } -/* Forms */ +.tab_button.clicked { + /* background: lightgrey; */ + color: inherit; + border-bottom: none; +} + +li.tab_button:last-child { + border-right: 1px solid lightgrey; +} + +.tab_button input { + display: None; +} + +.tab_button label { + margin: 1em; +} + +.tab_button input:checked + label { + font-weight: bold; +} + +/*** Forms ***/ .form_submit { margin: 1em auto 0; display: block; } -/* XMLUI */ +/*** XMLUI ***/ .xmlui_cont_vertical>* { display: block; @@ -118,3 +234,32 @@ color: inherit; text-decoration: inherit; } + +@media (min-width: 500px) { + html { + background-size: auto; + } + + body { + flex-direction: row; + } + + #main_area { + overflow: auto; + } + + .box { + border-radius: 1em; + box-shadow: 10px 10px 16px -5px rgba(0,0,0,0.5); + } + + .main_menu a { + display: block; + padding: 2em 0; + } + + .main_menu ul { + flex-direction: column; + padding-left: 2em; + } +} diff -r dd15b6c0b1d3 -r 9834106678da default/static/ticket.css --- a/default/static/ticket.css Wed Nov 15 08:52:14 2017 +0100 +++ b/default/static/ticket.css Fri Dec 01 00:46:42 2017 +0100 @@ -11,6 +11,7 @@ .tickets table { margin: 0 auto; + border-spacing: 0 0.5em; } .tickets tr:nth-child(even) { @@ -90,12 +91,12 @@ } .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; + font-size: 0.8em; + background: #eae3e3; + font-variant: small-caps; + border: 1px solid black; + border-radius: 0.5em; + padding: 0 2px; white-space: nowrap; } diff -r dd15b6c0b1d3 -r 9834106678da default/ticket/create.html --- a/default/ticket/create.html Wed Nov 15 08:52:14 2017 +0100 +++ b/default/ticket/create.html Fri Dec 01 00:46:42 2017 +0100 @@ -1,6 +1,6 @@ {# creata a new ticket #} -{% set menus = [(url_tickets_list, _('Tickets list'), 'tickets_list')] %} +{% set category_menu = [('tickets_list', url_tickets_list)] %} {% extends 'base/base.html' %} {% import 'input/form.html' as form with context %} {% import 'input/field.html' as field with context %} diff -r dd15b6c0b1d3 -r 9834106678da default/ticket/item.html --- a/default/ticket/item.html Wed Nov 15 08:52:14 2017 +0100 +++ b/default/ticket/item.html Fri Dec 01 00:46:42 2017 +0100 @@ -6,8 +6,8 @@ @variable comments_node(unicode): node for adding comments #} -{% set menus = [(url_tickets_list, _('Tickets list'), 'tickets_list'), - (url_tickets_new, _('Create new ticket'), 'ticket_new')] %} +{% set category_menus = [('tickets_list', url_tickets_list), + ('ticket_new', url_tickets_new)] %} {% if not embedded %}{% extends 'base/base.html' %}{% endif %} {% import 'input/xmlui.html' as xmlui with context %} {% import 'blog/macros.html' as blog with context %} @@ -21,7 +21,7 @@ {% block body %}
- {{ xmlui.generate(item, + {{ xmlui.generate(item, form=false, filters={'created': {'filters': ['date_fmt'], 'filters_args':[{'fmt': 'short'}]}, 'updated': {'filters': ['date_fmt'], 'filters_args':[{'fmt': 'short'}]}, diff -r dd15b6c0b1d3 -r 9834106678da default/ticket/overview.html --- a/default/ticket/overview.html Wed Nov 15 08:52:14 2017 +0100 +++ b/default/ticket/overview.html Fri Dec 01 00:46:42 2017 +0100 @@ -1,6 +1,6 @@ {# display the list of tickets #} -{% set menus = [(url_tickets_new, _('Create new ticket'), 'ticket_new')] %} +{% set category_menu = [('ticket_new', url_tickets_new)] %} {% extends 'base/base.html' %} {% import 'input/xmlui.html' as xmlui with context %}