diff options
Diffstat (limited to 'ishtar_common/templates')
47 files changed, 1662 insertions, 812 deletions
| diff --git a/ishtar_common/templates/actions.html b/ishtar_common/templates/actions.html new file mode 100644 index 000000000..bd70ddf15 --- /dev/null +++ b/ishtar_common/templates/actions.html @@ -0,0 +1,26 @@ +<ul class="navbar-nav action-menu justify-content-start"> +    {% with MENU.current_section as section_label %} +    {% with MENU.current_sections as sections %} +    {% include "blocks/action_list.html" %} +    {% endwith %}{% endwith %} + +    {% if MENU.current_subsections %} +    <li class="nav-item d-none d-lg-block"> +        <span class="nav-link">></span> +    </li> +    {% with MENU.current_subsection as section_label %} +    {% with MENU.current_subsections as sections %} +    {% include "blocks/action_list.html" %} +    {% endwith %}{% endwith %} +    {% endif %} + +    {% if MENU.current_subsubsections %} +    <li class="nav-item d-none d-lg-block"> +        <span class="nav-link">></span> +    </li> +    {% with MENU.current_subsubsection as section_label %} +    {% with MENU.current_subsubsections as sections %} +    {% include "blocks/action_list.html" %} +    {% endwith %}{% endwith %} +    {% endif %} +</ul> diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html index 75e0e3740..b2f0b055c 100644 --- a/ishtar_common/templates/base.html +++ b/ishtar_common/templates/base.html @@ -1,35 +1,28 @@ -{% load i18n %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" -    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{LANGUAGE_CODE}}" lang="{{LANGUAGE_CODE}}"> - +{% load i18n compress %}<!doctype html> +<html lang="{{LANGUAGE_CODE}}">  <head> +    <meta charset="utf-8"> +    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">      <link rel="shortcut icon" href="{{STATIC_URL}}/media/images/favicon.png"/> -    <title>{% block title %}Ishtar{% if APP_NAME %} - {{APP_NAME}}{%endif%}{% endblock %} -    </title> +    <title>{% block title %}Ishtar{% if APP_NAME %} - {{APP_NAME}}{%endif%}{% endblock %}</title> +    {% compress js %}      <script language="javascript" type="text/javascript">          var url_path = "{{URL_PATH}}";      </script>      <script language="javascript" type="text/javascript" src="{{JQUERY_URL}}?ver={{VERSION}}"></script> +    <script language="javascript" type="text/javascript" src="{{STATIC_URL}}popper.min.js?ver={{VERSION}}"></script> +    <script language="javascript" type="text/javascript" src="{{STATIC_URL}}bootstrap/bootstrap.js?ver={{VERSION}}"></script>      <script language="javascript" type="text/javascript" src="{{JQUERY_UI_URL}}jquery-ui.js?ver={{VERSION}}"></script> -    <script language="javascript" type="text/javascript" src="{{JQUERY_UI_URL}}ui/i18n/jquery.ui.datepicker-{{COUNTRY}}.js?ver={{VERSION}}"></script>      <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/chosen/chosen.jquery.min.js?ver={{VERSION}}"></script> -    <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/prettyPhoto/js/jquery.prettyPhoto.js?ver={{VERSION}}"></script> -    <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/i18n/grid.locale-{{COUNTRY}}.js?ver={{VERSION}}"></script> -    <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/jquery.jqGrid.min.js?ver={{VERSION}}"></script> -    <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/grid.tbltogrid.js?ver={{VERSION}}"></script> +    {# <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/prettyPhoto/js/jquery.prettyPhoto.js?ver={{VERSION}}"></script> #} +    <script language="javascript" type="text/javascript" +            src="{{STATIC_URL}}datatables/datatables.min.js?ver={{VERSION}}"></script> +    <script language="javascript" type="text/javascript" src="{{STATIC_URL}}datatables/dataTables.bootstrap4.min.js?ver={{VERSION}}"></script> +    <script language="javascript" type="text/javascript" src="{{STATIC_URL}}datatables/dataTables.buttons.min.js?ver={{VERSION}}"></script>      <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/ishtar.js?ver={{VERSION}}"></script> -    <link type="text/css" href="{{JQUERY_UI_URL}}jquery-ui.css?ver={{VERSION}}" rel="stylesheet" /> -    <link type="text/css" href="{{STATIC_URL}}js/chosen/chosen.min.css?ver={{VERSION}}" rel="stylesheet" /> -    <link rel="stylesheet" href="{{STATIC_URL}}font-awesome/css/font-awesome.min.css?ver={{VERSION}}" /> -    <link rel="stylesheet" href="{{STATIC_URL}}js/prettyPhoto/css/prettyPhoto.css?ver={{VERSION}}" /> -    <link rel="stylesheet" href="{{STATIC_URL}}media/ui.jqgrid.css?ver={{VERSION}}" /> -    <link rel="stylesheet" href="{{STATIC_URL}}media/style.css?ver={{VERSION}}" /> -    {% for url_css in JQGRID_CSS %}<link rel="stylesheet" href="{{url_css}}?ver={{VERSION}}" />{% endfor %} -    {% include "blocks/extra_head.html" %} -    {% block extra_head %} -    {% endblock %} -    {% if raw_css %}<style media="screen" type="text/css">{{raw_css|safe}} -    </style>{% endif %} +    <script language="javascript" type="text/javascript" +            src="{{STATIC_URL}}datatables/i18n/{{LANGUAGE_CODE}}.js?ver={{VERSION}}"></script> +    {{EXTRA_JS|safe}}      <script type='text/javascript'>      var shortcut_url = '{% url "shortcut-menu" %}';      var get_file_url = '{% url "get-file-shortcut" %}'; @@ -40,80 +33,56 @@      var activate_own_search_url = '{% url "activate-own-search" %}';      var activate_all_search_msg = "{% trans 'Searches in the shortcut menu deal with all items.' %}";      var activate_own_search_msg = "{% trans 'Searches in the shortcut menu deal with only your items.' %}"; +    var YES = "{% trans 'yes' %}"; +    var NO = "{% trans 'no' %}";      </script> +    {% endcompress %} +    {% compress css %} +    <link rel="stylesheet" href="{{STATIC_URL}}bootstrap/bootstrap.css?ver={{VERSION}}"> +    <link rel="stylesheet" href="{{STATIC_URL}}js/chosen/chosen.min.css?ver={{VERSION}}"> +    <link rel="stylesheet" href="{{STATIC_URL}}font-awesome/css/font-awesome.min.css?ver={{VERSION}}"> +    <link rel="stylesheet" href="{{STATIC_URL}}js/prettyPhoto/css/prettyPhoto.css?ver={{VERSION}}"> +    <link rel="stylesheet" +          href="{{STATIC_URL}}datatables/datatables.min.css?ver={{VERSION}}"> +    <link rel="stylesheet" href="{{STATIC_URL}}datatables/dataTables.bootstrap4.min.css?ver={{VERSION}}"> +    <link rel="stylesheet" href="{{STATIC_URL}}media/styles.css?ver={{VERSION}}"> +    {% for url_css in JQGRID_CSS %}<link rel="stylesheet" href="{{url_css}}?ver={{VERSION}}">{% endfor %} +    {{EXTRA_CSS|safe}} +    {% endcompress %} +    {% block extra_head %} +    {% endblock %} +    {% comment %}{% if raw_css %}<style media="screen" type="text/css"> +    {{raw_css |safe}}</style>{% endif %}{% endcomment %}  </head>  <body{% if current_theme%} id='{{current_theme}}'{%endif%}> -    <div id="header"> -        {% block header %} -        {% if user.is_authenticated %} -        {% trans "Logged in" %}: {{ user.username }} -        (<a href="{% url 'auth_logout' %}">{% trans "Log out" %}</a> | -        <a href="{% url 'auth_password_change' %}">{% trans "Change password" %}</a>) -        {% else %} -        <strong><a href="{% url 'auth_login' %}">{% trans "Log in" %}</a></strong> -        {% endif %} -        {% if LANGUAGES|length > 1 %} -        <div id="language_form_div"> -            <form action="/i18n/setlang/" method="post" id='language_form'> -                {% csrf_token %} -                {% comment %}<label for='language_selector'>{% trans "Lang" %}{% trans ":"%} </label>{% endcomment %} -                <select name="language" id='language_selector'> -                    <option value="">----------</option> -                {% for lang in LANGUAGES %} -                    <option value="{{ lang.0 }}"{% ifequal LANGUAGE_CODE lang.0 %} selected='selected'{% endifequal %}>{{ lang.1 }}</option> -                {% endfor %} -                </select> -            </form> -        </div>{% endif %} -        {% endblock %} -    </div> -    <div class="nav-button ui-state-default ui-corner-all" id="to_bottom_arrow"> -        <i class="fa fa-arrow-circle-down" aria-hidden="true"></i> -    </div> -    <div class="nav-button ui-state-default ui-corner-all" id="to_top_arrow"> -        <i class="fa fa-arrow-circle-up" aria-hidden="true"></i> -    </div> -    <div id="window"></div> -    <a href='{% url "start" %}' id="logo"> -{% if APP_NAME %}<p id="app_name">{{APP_NAME}}</p>{%endif%} -    </a> -    {% if not reminders %}<div id="context_menu"></div> -    {% else %}<fieldset id='reminder'><legend>{% trans "Current items" %}</legend> +    {% include "navbar.html" %} +    <div id="context-menu" class="navbar navbar-expand-lg"></div> +    {% if reminders %} +    <div id="reminder"><h5>{% trans "Current items" %}</h5>  {% for lbl, value in reminders %}  <p><strong class='lbl'>{{lbl}}{% trans ":"%}</strong> <span class='value'>{{value}}</span></p>  {% endfor %} -</fieldset>{%endif%} -    <div id="main_menu"> -    <ul> -      {% for section in MENU.childs %} -      {% if section.available %} -        <li id='section-{{section.idx}}'{% if section.css %} class="{{section.css}}"{% endif %}> -            {{section.label}} -      <ul> -          {% for menu_item in section.childs %}{%if menu_item.available%} -          {% if menu_item.childs %}<li id='subsection-{{menu_item.idx}}'{% if menu_item.css %} class="{{menu_item.css}}"{% endif %}>{{menu_item.label}} -            <ul> -                {% for menu_subitem in menu_item.childs %}{% if menu_subitem.available %} -                {% url 'action' menu_subitem.idx as item_url %} -                <li id='{{menu_subitem.idx}}'{% if item_url in CURRENT_PATH %} class='selected'{% endif %}><a -                        href='{{item_url}}'>{{menu_subitem.label}}</a></li> -            {%endif%}{% endfor %}</ul></li> -        {% else %} -          {% url 'action' menu_item.idx as item_url %} -        <li id='{{menu_item.idx}}' -            class="{% if item_url in CURRENT_PATH %}selected{% endif %} {% if menu_item.css %}{{menu_item.css}}{% endif %}"><a href="{{item_url}}">{{menu_item.label}}</a></li> -        {%endif%}{% endif %}{% endfor %} -      </ul> -      </li>{%endif%} -      {% endfor %} -    </ul> -    </div> -    <div id="content"> -        {% if warnings %} -        <ul class="alert">{% for warning in warnings %} -            <li>{{warning}}</li>{% endfor %} -        </ul> -        {% endif %} +</div> {%endif%} +    <button class="nav-button btn btn-sm btn-secondary" id="to_bottom_arrow"> +        <i class="fa fa-arrow-down" aria-hidden="true"></i> +    </button> +    <button class="nav-button btn btn-sm btn-secondary" id="to_top_arrow"> +        <i class="fa fa-arrow-up" aria-hidden="true"></i> +    </button> +    {% block pre_container %}{% endblock %} +    <div class="container"> +        {% block top_content %}{% endblock %} +        <div id="window_wrapper"> +            <div id="window" role="tablist"></div> +        </div> + +        {% if warnings %}{% for warning in warnings %} +        <div class="alert alert-warning alert-dismissible fade show" role="alert"> +            {{warning}}<button type="button" class="close" data-dismiss="alert" aria-label="Close"> +                <span aria-hidden="true">×</span> +            </button> +        </div> +        {% endfor %}{% endif %}          {% block content %}{% endblock %}      </div> @@ -122,13 +91,30 @@          {% include 'ishtar/blocks/footer.html' %}      </div>      {% endblock %} -    <div id="progress"> -        <div id='progress-content'> -            <p class='progress-detail progress-1'>{% trans "Processing..." %}</p> -            <p class='progress-detail progress-2'>{% trans "This can be long." %}</p> -            <p class='progress-detail progress-3'>{% trans "Time to take a coffee?" %} <i class="fa fa-coffee" aria-hidden="true"></i></p> -            <p class='progress-detail progress-4'>{% trans "Time to take another coffee?" %} <i class="fa fa-coffee" aria-hidden="true"></i></p> +    <div class="modal modal-progress" tabindex="-1" role="dialog" +         data-backdrop="static" data-keyboard="false" aria-hidden="true"> +      <div class="modal-dialog modal-sm modal-dialog-centered"> +        <div class="modal-content" id='progress-content'> +            <div class="modal-header"> +                <span class='progress-detail progress-1'> +                    {% trans "Processing..." %}</span> +                <span class='progress-detail progress-2'> +                    {% trans "This can be long." %}</span> +                <span class='progress-detail progress-3'> +                    {% trans "Time to take a coffee?" %} <i class="fa fa-coffee" aria-hidden="true"></i></span> +                <span class='progress-detail progress-4'> +                    {% trans "Time to take another coffee?" %} <i class="fa fa-coffee" aria-hidden="true"></i></span> +                <button type="button" class="close" data-dismiss="modal" aria-label="Close"> +                  <span aria-hidden="true">×</span> +                </button> +            </div> +            <div class="modal-body"> +                <div class="progress"> +                  <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div> +                </div> +            </div>          </div> +      </div>      </div>      <div id='message'>          <div class='information'><i class="fa fa-info-circle" aria-hidden="true"></i> <span class='content'></span></div> diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html new file mode 100644 index 000000000..7f7e97c5b --- /dev/null +++ b/ishtar_common/templates/blocks/DataTables.html @@ -0,0 +1,294 @@ +{% load i18n %} + +<p class="text-center"> + +<button id='search_{{name}}' class='btn btn-primary' type="button"> +    {% trans "Search" %}</button> + +{% if url_new %} +<p><a href="#" onclick="open_window('{{url_new}}');">{{new_message}}</a></p> +{% endif %} + +<div class="alert alert-info" role="alert" id="pinned_search_{{name}}"> +    <i class="fa fa-thumb-tack"></i>   +    <strong>{% trans "Pinned search:" %}</strong> +    <em><span id="pinned_search_content_{{name}}"></span></em> +</div> + +<div class="modal fade table-modal-lg" tabindex="-1" role="dialog" +     aria-hidden="true" id="modal_grid_{{name}}"> +  <div class="modal-dialog full modal-lg"> +      <div class="modal-content"> +      <div class="modal-header"> +        <button type="button" class="close" data-dismiss="modal" aria-label="Close"> +          <span aria-hidden="true">×</span> +        </button> +      </div> +      <div class="modal-body"> +          <div class="current-sheets"></div> +          <div class="current-grid"></div> +      </div> +    </div> +  </div> +</div> + +<div id="grid_{{name}}_meta_wrapper"> +    <table id='grid_{{name}}' class="display" width="100%"> +        <thead> +        <tr> +            <th></th> +            <th></th>{% for col in col_names %} +            <th>{{col}}</th> +        {% endfor %}</tr> +        </thead> +    </table> +</div> + +<div id='foot_{{name}}' class="gridfooter row toolbar"> +    <div class='col-md-2'> +        <div class="btn-group btn-group-sm" role="group"> +            <button type='button' class="btn btn-secondary" data-toggle="modal" +                    data-target="#modal_grid_{{name}}"> +                {% trans "Expand table" %} <i class="fa fa-expand" aria-hidden="true"></i> +            </button> +        </div> +    </div> +    <div class='col-md-2'> +        <div class="btn-group btn-group-sm" role="group" +             aria-label="{% trans 'Export'%}"> +            {% if source_full or extra_sources %} +            <a class="btn btn-secondary" href='{{source}}csv' target='_blank' +               title="{% trans 'Export as CSV - ' %}{% trans 'simple'%}">{% trans "Simple CSV" %}</a> +            {% if source_full %}<a class='btn btn-secondary' href='{{source_full}}csv' target='_blank' title="{% trans 'Export as CSV - full' %}">{% trans "CSV full" %}</a>{% endif %} +            {% for slug, name, extra_source in extra_sources %} +            <a class="btn btn-secondary" href='{{extra_source}}csv' target='_blank' title="{% trans 'Export as CSV - ' %}{{name}}">{{name}}</a> +            {% endfor %} +            {% else %} +            <a class="btn btn-secondary" href="{{source}}csv" target="_blank" title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a> +            {% endif %} +        </div> +    </div> +</div> + +{% if multiple %} +<input type="button" id="add_button_{{name}}" value="{% trans 'Add' %}"/> +<ul id="selectmulti_{{name}}" class="selectmulti"></ul> +{% endif %} + +<input type="hidden" id="hidden_{{name}}" name="{{name}}"/> + +<script type="text/javascript" language='javascript'> +$('#modal_grid_{{name}}').on('show.bs.modal', function (e) { +    $('#grid_{{name}}_wrapper').appendTo( +        '#modal_grid_{{name}} .modal-body .current-grid'); +    $('#window').appendTo( +        '#modal_grid_{{name}} .modal-body .current-sheets'); +    $('#grid_{{name}}').DataTable().clear().draw(); +    current_modal = $("#modal_grid_{{name}}"); +}); + +$('#modal_grid_{{name}}').on('hide.bs.modal', function (e) { +    $('#grid_{{name}}_wrapper').appendTo( +        '#grid_{{name}}_meta_wrapper'); +    $('#window').appendTo('#window_wrapper'); +    $('#grid_{{name}}').DataTable().clear().draw(); +    current_modal = null; +}); + + +var query_vars = new Array({{col_idx|safe}}); +var selItems_{{sname}} = new Array(); +jQuery(document).ready(function(){ +  jQuery("#search_{{name}}").click(function (){ +    if ($('.modal-progress').length > 0){ +        $('.modal-progress').modal('show'); +    } +    var data = ""; +    for (idx in query_vars){ +        var key = query_vars[idx]; +        var item = jQuery("#id_"+key); +        var val = null; +        if (item.prop('type') == 'checkbox'){ +            if (item.prop('checked')){ +                var val = item.val(); +            } +        } else { +            var val = item.val(); +        } +        if (val){ +            if (data) data += "&"; +            data += key + "=" + val; +        } +    } +    var mygrid = jQuery("#grid_{{name}}"); +    var url = "{{source}}?submited=1&" + data; +    datatable_{{sname}}.ajax.url(url).load(); +    var csv_url = "{{source}}csv?submited=1&" + data; +    $(".{{sname}}-csv").attr("href", csv_url); +    var csv_full_url = "{{source_full}}csv?submited=1&" + data; +    $(".{{sname}}-csv-full").attr("href", csv_full_url); +    {% for slug, name, extra_source in extra_sources %} +    $(".{{slug}}-csv-full").attr("href", '{{extra_source}}csv?submited=1&' + data); +    {% endfor %} + +    if ($('.modal-progress').length > 0){ +        $('.modal-progress').modal('hide'); +    } +    return false; +  }); + +  datatable_options = { +    "ajax": { +        "url": "{{source}}", +        "dataSrc": function (json) { +            manage_pinned_search("{{name}}", json); +            return json.rows; +        } +    }, +    "select": { +        "style": {% if multiple_select %}'multi'{% else %}'single'{% endif %} +    }, +    {% if multiple_select %}"buttons": [ +        'selectAll', +        'selectNone' +    ], +    language: { +        buttons: { +            selectAll: "{% trans 'Select all items' %}", +            selectNone: "{% trans 'Select none' %}" +        } +    }, +    "dom": 'lBtip', +    {% endif %} +    "columns": [ +        { "data": "id", "visible": false }, +        { "data": "link", "orderable": false },{% for col in extra_cols %} +        { "data": "{{col}}", "defaultContent": "-"}{% if not forloop.last %},{% endif %}{% endfor %} +    ] +  }; + +  $.extend(datatable_options, datatables_default); +  if (datatables_i18n) datatable_options['language'] = datatables_i18n; +  datatable_{{sname}} = jQuery("#grid_{{name}}").DataTable(datatable_options); + +{% comment %} + +  jQuery("#grid_{{name}}").jqGrid({ +    url:'{{source}}', +    datatype: "json", +    mtype: 'GET', +    colNames:['id', '', {{col_names|safe}}], +    colModel:[ +      {name:'id', index:'id', hidden:true}, +      {name:'link', index:'link', width:30}, +      {{extra_cols|safe}} +    ], +    height: 300, +    sortname: '__default__', +    viewrecords: true, +    sortorder: "asc", +    emptyrecords: "{{no_result}}", +    loadtext: "{{loading}}", +    pager: '#pager_{{name}}', +    width: null, +    shrinkToFit: false, +    rowNum:20, +    {% if multiple_select %}multiselect: true,{% endif %} +    jsonReader : {repeatitems: false}, +    loadError: function (jqXHR, textStatus, errorThrown) { +        alert("{% trans "An error as occured during search. Check your query fields." %}"); +    }, +    beforeProcessing: function(data, status, xhr){ +        $('#pinned_search_content_{{name}}').html(''); +        for (idx in data){ +            if (idx == 'pinned-search' && data[idx] != ''){ +               $('#pinned_search_content_{{name}}').html(data[idx]); +            } +        } +        if ($('#pinned_search_content_{{name}}').html()){ +            $('#pinned_search_{{name}}').show(); +        } else { +            $('#pinned_search_{{name}}').hide(); +        } +    } +  }); +{% endcomment %} + +{% if multiple %} +  jQuery("#add_button_{{name}}").click(function (){ +    var mygrid = jQuery("#grid_{{name}}"); +    var idx = mygrid.getGridParam('selrow'); +    var lbl_cols = new Array({{multi_cols|safe}}); +    var label = ""; +    for (var id in lbl_cols){ +        if(id == 1){ +            label += " ("; +        }else if (id > 1){ +            label += " ; "; +        } +        label += mygrid.getCell(idx, lbl_cols[id]); +    } +    if (id > 0){ +        label += ")"; +    } +    for (id in selItems_{{sname}}){ +        if(selItems_{{sname}}[id] == idx){ +            return false; +        } +    } +    selItems_{{sname}}.push(idx); +    jQuery("#selectmulti_{{name}}").append( +               "<li id='selected_{{name}}_"+idx+"'>\ +<a href='#' class='remove' \ +  onclick=\"multiRemoveItem(selItems_{{sname}}, '{{name}}', "+ idx +");\ +  return false;\" title=\"{{remove}}\">X</a>" + label + "</li>"); +    return true; +  }); +  jQuery("#submit_form").click(function (){ +    jQuery("#hidden_{{name}}").val(selItems_{{sname}}); +    return true; +  }); +{% else %} +  jQuery("#submit_form").click(function (){ +    var data = datatable_{{sname}}.rows( { selected: true } ).data(); +    {% if multiple_select %} +    var value = ""; +    for (k in data){ +        if (k > 0) value += ","; +        value += data[k]['id']; +    } +    {% else %} +    var value = data[0]['id']; +    {% endif %} +    jQuery("#hidden_{{name}}").val(value); +    return true; +  }); +{% endif %} + +}); + +  function get_next_table_id(c_id){ +    var has_current_id = false; + +    ids = datatable_{{sname}}.column(0).data(); +    for (idx=0 ; idx < ids.length; idx++){ +        if (has_current_id) return ids[idx]; +        if (ids[idx] == c_id) has_current_id = true; +    } +    return false; +  } +  function get_previous_table_id(c_id){ +    var previous_id = 0; + +    ids = datatable_{{sname}}.column(0).data(); +    for (idx in ids){ +        if (ids[idx] == c_id){ +            if (previous_id) return previous_id; +            return false; +        } +        previous_id = ids[idx]; +    } +    return false; +  } +</script> + diff --git a/ishtar_common/templates/blocks/JQueryJqGrid.html b/ishtar_common/templates/blocks/JQueryJqGrid.html index 1768ab427..74ccd7780 100644 --- a/ishtar_common/templates/blocks/JQueryJqGrid.html +++ b/ishtar_common/templates/blocks/JQueryJqGrid.html @@ -1,33 +1,41 @@  {% load i18n %} -<button id='search_{{name}}' class='submit ui-widget-header'>{% trans "Search" %}</button> +<p class="text-center"> + +<button id='search_{{name}}' class='btn btn-primary btn-block'> +    {% trans "Search" %}</button>  {% if url_new %}  <p><a href="#" onclick="open_window('{{url_new}}');">{{new_message}}</a></p>  {% endif %} -<h4>{% trans "Search and select an item" %}</h4> +<h4 class="text-center">{% trans "Search and select an item" %}</h4> -<h5 id="pinned_search_{{name}}"> +<div class="alert alert-info" role="alert" id="pinned_search_{{name}}">      <i class="fa fa-thumb-tack"></i>        <strong>{% trans "Pinned search:" %}</strong>      <em><span id="pinned_search_content_{{name}}"></span></em> -</h5> +</div>  <table id='grid_{{name}}' class='jqgrid'></table>  <div id='pager_{{name}}'></div> -<div id='foot_{{name}}' class='gridfooter'> - -{% if source_full or extra_sources %} -<a class='badge {{sname}}-csv' href='{{source}}csv' target='_blank' title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a> -{% if source_full %}<a class='badge {{sname}}-csv-full' href='{{source_full}}csv' target='_blank' title="{% trans 'Export as CSV - full' %}">{% trans "CSV full" %}</a>{% endif %} -{% for slug, name, extra_source in extra_sources %} -<a class='badge {{slug}}-csv-full' href='{{extra_source}}csv' target='_blank' title="{% trans 'Export as CSV - ' %}{{name}}">{{name}}</a> -{% endfor %} -{% else %} -<a class='{{sname}}-csv' href="{{source}}csv" target="_blank" title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a> -{% endif %} {{encoding}} +<div id='foot_{{name}}' class="gridfooter row toolbar"> +    <div class='col-md-2'> +        <div class="btn-group btn-group-sm" role="group" +             aria-label="{% trans 'Export'%}"> +            {% if source_full or extra_sources %} +            <a class="btn btn-secondary" href='{{source}}csv' target='_blank' +               title="{% trans 'Export as CSV - ' %}{% trans 'simple'%}">{% trans "CSV" %}</a> +            {% if source_full %}<a class='btn btn-secondary' href='{{source_full}}csv' target='_blank' title="{% trans 'Export as CSV - full' %}">{% trans "CSV full" %}</a>{% endif %} +            {% for slug, name, extra_source in extra_sources %} +            <a class="btn btn-secondary" href='{{extra_source}}csv' target='_blank' title="{% trans 'Export as CSV - ' %}{{name}}">{{name}}</a> +            {% endfor %} +            {% else %} +            <a class="btn btn-secondary" href="{{source}}csv" target="_blank" title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a> +            {% endif %} +        </div> +    </div>  </div>  {% if multiple %} @@ -43,8 +51,8 @@ var query_vars = new Array({{col_idx|safe}});  var selItems_{{sname}} = new Array();  jQuery(document).ready(function(){    jQuery("#search_{{name}}").click(function (){ -    if ($("#progress").length > 0){ -        $("#progress").show(); +    if ($('.modal-progress').length > 0){ +        $('.modal-progress').modal('show');      }      var data = "";      for (idx in query_vars) @@ -76,8 +84,8 @@ jQuery(document).ready(function(){      mygrid.setGridParam({url:url, page:1});      mygrid.trigger("reloadGrid"); -    if ($("#progress").length > 0){ -        $("#progress").hide(); +    if ($('.modal-progress').length > 0){ +        $('.modal-progress').modal('hide');      }      return false;    }); diff --git a/ishtar_common/templates/blocks/SquareMeterWidget.html b/ishtar_common/templates/blocks/SquareMeterWidget.html index 85a9fa548..09e93b425 100644 --- a/ishtar_common/templates/blocks/SquareMeterWidget.html +++ b/ishtar_common/templates/blocks/SquareMeterWidget.html @@ -1,4 +1,11 @@ -<input class="area_widget" type="text"{{final_attrs|safe}}> {{unit}} (<span id="ha_{{id}}">0</span> ha) +<div class="input-group"> +    <input class="area_widget form-control" type="text"{{final_attrs|safe}}> +    <div class="input-group-append"> +        <div class="input-group-text"> +            {{unit}} (<span id="ha_{{id}}">0</span> ha) +        </div> +    </div> +</div>  <script type="text/javascript"><!--//      function evaluate_{{safe_id}}(){          value = parseFloat($("#{{id}}").val()); diff --git a/ishtar_common/templates/blocks/action_list.html b/ishtar_common/templates/blocks/action_list.html new file mode 100644 index 000000000..50a6554c4 --- /dev/null +++ b/ishtar_common/templates/blocks/action_list.html @@ -0,0 +1,12 @@ +<li class="nav-item dropdown"> +    <a class="nav-link dropdown-toggle" +       data-toggle="dropdown" href="#" role="button" aria-haspopup="true" +       aria-expanded="false">{{section_label}}</a> + +    <div class="dropdown-menu"> +        {% for label, url, has_children in sections %} +        <a class="dropdown-item{% if has_children%} font-weight-bold{%endif%}" href="{{url}}"> +            {{ label }} +        </a>{% endfor %} +    </div> +</li> diff --git a/ishtar_common/templates/blocks/bs_field_snippet.html b/ishtar_common/templates/blocks/bs_field_snippet.html new file mode 100644 index 000000000..c157461b7 --- /dev/null +++ b/ishtar_common/templates/blocks/bs_field_snippet.html @@ -0,0 +1,26 @@ +{% load i18n %} +    <div class="form-group col-lg-6{% if field.field.required %} required{% endif %}"> +        {{ field.label_tag }} +        {% if field.help_text %} +        <div class="input-group"> +        {% endif %} +        {{field|safe}} +        {% if field.help_text %} +          <span class="input-group-append"> +            <a class="input-group-text" data-toggle="collapse" +               href="#{{field.auto_id}}_help" +               aria-expanded="false" aria-controls="{{field.auto_id}}_help"> +               <i class="fa fa-question-circle" aria-hidden="true"></i> +            </a> +          </span> +        </div> +        <div class="collapse" id="{{field.auto_id}}_help"> +            <div class="card card-body"> +                {{field.help_text}} +            </div> +        </div> +        {% endif %} +        {% if field.errors %}<div class="invalid-feedback"> +          {{ field.errors }} +        </div>{% endif %} +    </div> diff --git a/ishtar_common/templates/blocks/bs_form_snippet.html b/ishtar_common/templates/blocks/bs_form_snippet.html new file mode 100644 index 000000000..a4d772236 --- /dev/null +++ b/ishtar_common/templates/blocks/bs_form_snippet.html @@ -0,0 +1,96 @@ +{% load i18n %} +{% if form.non_field_errors %} +<div class="alert alert-danger" role="alert"> +    {{form.non_field_errors}} +</div> +{% endif %} + +{% for hidden in form.hidden_fields %} +{{hidden}} +{% if hidden.errors %}<div class="invalid-feedback"> +    {{ hidden.errors }} +</div>{% endif %} +{% endfor %} + +{% for field in form.visible_fields %} +{% if form.SEARCH_AND_SELECT %} +{{field}} +{% elif field.name == 'search_vector' and forloop.counter0 == 0 %} +<div class="form-row"> +    <div class="form-group col-lg-10"> +        <div class="input-group"> +          <span class="input-group-prepend"> +            <span class="input-group-text"> +               <i class="fa fa-search" aria-hidden="true"></i></span> +          </span> +          {{field|safe}} +        </div> +        {% if field.help_text %} +        <small><a data-toggle="collapse" href="#{{field.auto_id}}_help" +                  aria-expanded="false" aria-controls="{{field.auto_id}}_help"> +            {% trans 'help'%}</a></small>{% endif %} +        {% if field.errors %} +        <div class="invalid-feedback"> +            {{ field.errors }} +        </div>{% endif %} +    </div> +    <div class="form-group col-lg"> +        <p class="text-right"> +            <button type="button" class="btn btn-secondary" data-toggle="modal" +               data-target="#modal-advanced-search"> +                {% trans "Advanced search" %} <i class="fa fa-cogs" aria-hidden="true"></i> +            </button> +        </p> +    </div> + +    {% if field.help_text %} +    <div class="collapse" id="{{field.auto_id}}_help"> +        <div class="card card-body"> +            {{field.help_text}} +        </div> +    </div> +    {% endif %} +</div> +<div class="alert alert-info" role="alert" id="advanced-search-resume"> +    <strong><i class="fa fa-cogs" aria-hidden="true"></i>{% trans ":" %} </strong> +    <span id="advanced-search-resume-content"></span> +</div> +{% else %} +{% if search and forloop.counter0 == 1 %} +<div class="modal" id="modal-advanced-search" tabindex="-1" role="dialog" +     data-backdrop="static" data-keyboard="false" aria-hidden="true"> +    <div class="modal-dialog modal-lg"> +        <div class="modal-content"> +            <div class="modal-header"> +                <h5>{% trans "Advanced search" %}</h5> +            </div> +            <div class="modal-body form-row"> +{% endif %} + +{% if not search and forloop.counter0|divisibleby:2 or search and forloop.counter1|divisibleby:2 %} +{% if forloop.counter0 %} +  </div>{% endif %} +  <div class="form-row"> +{% endif %} +      {% include "blocks/bs_field_snippet.html" %} +{% if forloop.last %} +{% if search and forloop.counter0 >= 1 %} +            </div> +            <div class="modal-footer"> +                <button type="button" class="btn btn-secondary advanced-search-reset" +                        data-dismiss="modal">{% trans 'Reset' %}</button> +                <button type="button" class="btn btn-primary advanced-search-valid" +                        data-dismiss="modal">{% trans "Validate" %}</button> +            </div> +        </div> +    </div> +{% endif %} +</div> +{% endif %} +{% endif %} +{% endfor %} + +{% if search %} +<script type="text/javascript"> +$(register_advanced_search);</script> +{% endif %} diff --git a/ishtar_common/templates/blocks/form_snippet.html b/ishtar_common/templates/blocks/table_form_snippet.html index 5ee88e25f..5ee88e25f 100644 --- a/ishtar_common/templates/blocks/form_snippet.html +++ b/ishtar_common/templates/blocks/table_form_snippet.html diff --git a/ishtar_common/templates/ishtar/basket_list.html b/ishtar_common/templates/ishtar/basket_list.html index 011ed97a0..43236aeb0 100644 --- a/ishtar_common/templates/ishtar/basket_list.html +++ b/ishtar_common/templates/ishtar/basket_list.html @@ -1,10 +1,19 @@  {% load i18n %} -<table> -<tr>{% for item in basket.items.all %} -    <td><a class="display_details" href="#" onclick="load_window('{{item_url}}/{{item.pk}}/');"><i class="fa fa-info-circle" aria-hidden="true"></i></a></td> -    <td>{{item.full_label}}</td> -    <td><a class='async-link' data-target='#basket-content' href='{{delete_url}}/{{basket.pk}}/{{item.pk}}/'>{% trans "remove" %}</a></td></tr>{% endfor %} -</table> +<ul class="list-group"> +    {% for item in basket.items.all %} +    <li class="list-group-item"> +        <a class="display_details" href="#" +            onclick="load_window('{{item_url}}/{{item.pk}}/');"><i class="fa fa-info-circle" aria-hidden="true"></i> +        </a> +        <span>{{item.full_label}}</span> +        <a class='async-link text-danger float-right' +           data-target='#basket-content' +           href='{{delete_url}}/{{basket.pk}}/{{item.pk}}/'> +            <i class="fa fa-times" aria-hidden="true"></i> +        </a> +    </li> +    {% endfor %} +</ul>  <script type='text/javascript'>      $("a.async-link").click(manage_async_link);  </script> diff --git a/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html b/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html index cd7bf88f8..953b0ef40 100644 --- a/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html +++ b/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html @@ -1,49 +1,54 @@ +{% extends "ishtar/blocks/base_shortcut_menu.html" %}  {% load i18n %} -{% if menu %} -<form method="post" action="{% url 'update-current-item' %}"> -<fieldset id='shortcut-menu'> -<span class="fa-stack short-menu-close"> -  <i class="fa fa-circle fa-stack-2x"></i> -  <i class="fa fa-times fa-stack-1x fa-inverse"></i> -</span> -<span class="fa-stack short-menu-open"> -  <i class="fa fa-circle fa-stack-2x"></i> -  <i class="fa fa-plus fa-stack-1x fa-inverse"></i> -</span> +{% block short_content %}  <div class="short-menu-buttons btn-group" role="group"> -  <button type="button" class="btn" id='short-menu-simple' title="{% trans 'Simple menu limited to your own items. Be careful only the last 100 items are displayed.' %}">{% trans "simple" %}</button> -  <button type="button" class="btn btn-selected" id='short-menu-advanced' title="{% trans 'Advanced menu' %}">{% trans "advanced" %}</button> +    <button type="button" class="btn btn-secondary" +            id='short-menu-simple' title="{% trans 'Simple menu limited to your own items. Be careful only the last 100 items are displayed.' %}">{% trans "simple" %}</button> +    <button type="button" class="btn btn-secondary active" id='short-menu-advanced' title="{% trans 'Advanced menu' %}">{% trans "advanced" %}</button>  </div> -<div id='action_current_items'> -<p><i class="icon fa fa-thumb-tack fa-2x" aria-hidden="true" title="{% trans 'Pin an item in order to constrain default searches with this item. By default only your items are displayed. New created and modified items are auto-pin.' %}"></i></p> -<p> -<a href='' onclick='return activate_own_search();' class='activate_own_search{% if SHORTCUT_SEARCH == 'all' %} disabled{% endif %}'><i class="icon fa fa-user" aria-hidden="true" title="{% trans 'Search within my items' %}"></i></a> -<a href='' class='activate_all_search{% if SHORTCUT_SEARCH == 'own' %} disabled{% endif %}' onclick='return activate_all_search();'><i class="icon fa fa-users" aria-hidden="true" title="{% trans 'Search within all items' %}"></i></a> -</p> -<p> -<a href='' onclick='return load_shortcut_menu();' class='disabled'><i class="icon fa fa-2x fa-refresh" aria-hidden="true" title="{% trans 'Refresh menu' %}"></i></a> -</p> +<div id='action_current_items' class="btn-group" role="group"> +    <button type="button" onclick='return activate_own_search();' +           title="{% trans 'Search within my items' %}" +           class='btn btn-secondary activate_own_search{% if SHORTCUT_SEARCH == "own" %} active{% endif %}'> +        <i class="icon fa fa-user" aria-hidden="true"></i> +    </button> +    <button type="button" onclick='return activate_all_search();' +           title="{% trans 'Search within all items' %}" +           class='btn btn-secondary activate_all_search{% if SHORTCUT_SEARCH == "all" %} active{% endif %}'> +        <i class="icon fa fa-users" aria-hidden="true"></i> +    </button> +    {% comment %} +    <p> +        <a href='' onclick='return load_shortcut_menu();' class='disabled'><i class="icon fa fa-2x fa-refresh" aria-hidden="true" title="{% trans 'Refresh menu' %}"></i></a> +    </p> +    {% endcomment %}  </div> -<table id='current_items'> -{% for lbl, model_name, current, widget in menu %} -<tr> -    <td><label for="current_{{model_name}}">{{lbl}}</label></td> -    <td> -        {{widget|safe}} -    </td>{% with 'show-'|add:model_name as model_url%} -    <td><a href='#' onclick='load_current_window("{% url model_url current %}", "{{model_name}}");' class='display_details'><i class="fa fa-info-circle" aria-hidden="true"></i></a></td> -    <td><span class='disabled pin-action' onclick='$.get("{% url 'unpin' model_name %}", function(){load_shortcut_menu();});' title="{% trans 'Unpin' %}"> -            <i class="fa fa-times"></i> -    </span></td> -    {% endwith %} -</tr> -{% endfor %} -</table> -</fieldset> -</form> -<script type='text/javascript'> +<p id='current_items'> +    {% for lbl, model_name, current, widget in menu %} +      <div class="form-group row"> +          <label for="current_{{model_name}}" +                 class="col-sm-4 col-form-label">{{lbl}}</label> +          <div class="col-sm-6"> +              {{widget|safe}} +          </div> +          {% with 'show-'|add:model_name as model_url%} +          <div class="col-sm-2"> +              <a href='#' onclick='load_current_window("{% url model_url current %}", "{{model_name}}");' class='display_details'> +                  <i class="fa fa-info-circle" aria-hidden="true"></i> +              </a> +              <a href='#' +                 class='disabled pin-action text-danger' +                 onclick='$.get("{% url "unpin" model_name %}", function(){load_shortcut_menu();});' title="{% trans 'Unpin' %}"> +                  <i class="fa fa-times"></i> +              </a> +          </div> +          {% endwith %} +      </div> +    </tr> +    {% endfor %} +</p> +{% endblock %} + +{% block short_extrajs %}  var advanced_menu = true; -{% if SHORTCUT_SHOW == 'off' %}var shortcut_menu_hide = true; -{% else %}var shortcut_menu_hide = false;{% endif %} -</script> -{% endif %} +{% endblock %} diff --git a/ishtar_common/templates/ishtar/blocks/base_shortcut_menu.html b/ishtar_common/templates/ishtar/blocks/base_shortcut_menu.html new file mode 100644 index 000000000..95e030b85 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/base_shortcut_menu.html @@ -0,0 +1,46 @@ +{% load i18n %} +{% if current_menu or menu %} +{% comment %} +<button class="navbar-toggler" type="button" +        data-toggle="collapse" data-target="#navbar-shortcut" +        aria-controls="navbar-shortcut" aria-expanded="false" +        aria-label="{% trans 'Toggle navigation' %}"> +    <span class="navbar-toggler-icon"></span> +</button> +{% endcomment %} +<div class="navbar-collapse collapse justify-content-end"> +    <ul class="navbar-nav" id="navbar-shortcut"> +      <li class="nav-item"> +          <ol class="breadcrumb"> +                {% for lbl in current_selected_labels %} +                <li class="breadcrumb-item">{{lbl}}</li> +                {% empty %} +                {% trans "No default selection" %} +                {% endfor %} +          </ol> +      </li> +      <li class="nav-item dropdown"> +        <a class="nav-link dropdown-toggle" data-toggle="dropdown" +           href="#" role="button" aria-haspopup="true" +           id="dropdown-toggle-shortcut-menu"> +            <i class="icon fa fa-thumb-tack fa-2x" aria-hidden="true" title="{% trans 'Pin an item in order to constrain default searches with this item. By default only your items are displayed. New created and modified items are auto-pin.' %}"></i> +        </a> +        <div id="shortcut-menu" class="dropdown-menu dropdown-menu-right"> +            <form method="post" action="{% url 'update-current-item' %}"> +                <h4>{% trans "Default selection" %}</h4> +                {% block short_content %} +                {% endblock %} +            </form> +        </div> +      </li> +    </ul> +</div> + +<script type='text/javascript'> +{% if SHORTCUT_SHOW == 'off' %}var shortcut_menu_hide = true; +{% else %}var shortcut_menu_hide = false;{% endif %} +{% block short_extrajs %} +{% endblock %} +</script> + +{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/sheet_creation_section.html b/ishtar_common/templates/ishtar/blocks/sheet_creation_section.html index e6ce31c25..78126a240 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_creation_section.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_creation_section.html @@ -1,19 +1,21 @@  {% load i18n link_to_window %}  {% if item.history_creator.ishtaruser.person %} -<li><label>{% trans "Creation" context "Sheet" %}</label> -    <span class='value'> +<div class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> +    <dt class="col-5">{% trans "Creation" context "Sheet" %}</dt> +    <dd class="col-7">          {{item.history_creator.ishtaruser.person}}          {{item.history_creator.ishtaruser.person|link_to_window}} <br/> -        <small><em>{{item.history_creation_date|date:"DATETIME_FORMAT"}}</em></small> -    </span> -</li> +        <small class="text-muted">{{item.history_creation_date|date:"DATETIME_FORMAT"}}</small> +    </dd> +</div>  {% endif %}  {% if item.history_creation_date != item.last_edition_date %} -<li><label>{% trans "Modification" context "Sheet" %}</label> -    <span class='value'> +<div class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> +    <dt class="col-5">{% trans "Modification" context "Sheet" %}</dt> +    <dd class='col-7'>          {{item.history_modifier.ishtaruser.person}}          {{item.history_modifier.ishtaruser.person|link_to_window}} <br/> -        <small><em>{% firstof item.history_date|date:"DATETIME_FORMAT" item.history.all.0.history_date|date:"DATETIME_FORMAT" %}</em></small> -    </span> -</li> +        <small class="text-muted">{% firstof item.history_date|date:"DATETIME_FORMAT" item.history.all.0.history_date|date:"DATETIME_FORMAT" %}</small> +    </dd> +</div>  {% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/sheet_json.html b/ishtar_common/templates/ishtar/blocks/sheet_json.html index 31e6acb84..6aaf4bae7 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_json.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_json.html @@ -4,8 +4,8 @@  <h3>{{json_section}}</h3>  {% endif %}  {% for label, value in json_fields %} -{% if forloop.first %}<ul class='form-flex'>{% endif %} -    {% field_li label value %} -{% if forloop.last %}</ul>{% endif %} +{% if forloop.first %}<div class='row'>{% endif %} +    {% field_flex label value %} +{% if forloop.last %}</div>{% endif %}  {% endfor %}  {% endfor %} diff --git a/ishtar_common/templates/ishtar/blocks/shortcut_menu.html b/ishtar_common/templates/ishtar/blocks/shortcut_menu.html index 67f91dfea..10113aa59 100644 --- a/ishtar_common/templates/ishtar/blocks/shortcut_menu.html +++ b/ishtar_common/templates/ishtar/blocks/shortcut_menu.html @@ -1,44 +1,43 @@ +{% extends "ishtar/blocks/base_shortcut_menu.html" %}  {% load i18n %} -{% if current_menu %} -<form method="post" action="{% url 'update-current-item' %}"> -<fieldset id="shortcut-menu"> -<span class="fa-stack short-menu-close"> -  <i class="fa fa-circle fa-stack-2x"></i> -  <i class="fa fa-times fa-stack-1x fa-inverse"></i> -</span> -<span class="fa-stack short-menu-open"> -  <i class="fa fa-circle fa-stack-2x"></i> -  <i class="fa fa-plus fa-stack-1x fa-inverse"></i> -</span> +{% block short_content %}  <div class="short-menu-buttons btn-group" role="group"> -  <button type="button" class="btn btn-selected" id='short-menu-simple' title="{% trans 'Simple menu limited to your own items. Be careful only the last 100 items are displayed.' %}">{% trans "simple" %}</button> -  <button type="button" class="btn" id='short-menu-advanced' title="{% trans 'Advanced menu' %}">{% trans "advanced" %}</button> +    <button type="button" class="btn btn-secondary active" +            id='short-menu-simple' title="{% trans 'Simple menu limited to your own items. Be careful only the last 100 items are displayed.' %}">{% trans "simple" %}</button> +    <button type="button" class="btn btn-secondary" id='short-menu-advanced' title="{% trans 'Advanced menu' %}">{% trans "advanced" %}</button>  </div>  <div> -<i class="icon fa fa-thumb-tack fa-2x" aria-hidden="true" title="{% trans 'Pin an item in order to constrain default searches with this item. By default only your items are displayed. New created and modified items are auto-pin.' %}"></i> -<table id='current_items'> -{% for lbl, model_name, main_cls, items in current_menu %} -<tr> -    <td><label for="current_{{model_name}}">{{lbl}}</label></td> -    <td> -      <select class='{{main_cls}} chosen-select' id='current_{{model_name}}'> -        <option class='normal' value=''>--</option> -        {% for val, label, selected, cls in items %}<option{% if cls %} class='{{cls}}'{% endif %} value='{{val}}'{% if selected %} selected="selected"{% endif %}>{% ifequal cls 'basket' %} {% endifequal %}{% ifequal cls 'green' %} {% endifequal %}{% ifequal cls 'orange' %} {% endifequal %}{% ifequal cls 'red' %} {% endifequal %}{{label}}</option> -      {% endfor %}</select> -    </td>{% with 'show-'|add:model_name as model_url%} -    <td><a href='#' onclick='load_current_window("{% url model_url 0 %}", "{{model_name}}");' class='display_details'><i class="fa fa-info-circle" aria-hidden="true"></i></a></td> -    <td><span class='pin-action' onclick='$.get("{% url 'unpin' model_name %}", function(){load_shortcut_menu();});' title="{% trans 'Unpin' %}"> -            <i class="fa fa-times"></i> -    </span></td> -    {% endwith %} -</tr> -{% endfor %} -</table> +    <p class="alert alert-info mt-2"> +        {% trans 'Simple menu limited to your own items. Be careful only the last 100 items are displayed.' %} +    </p> +    <p id='current_items'> +        {% for lbl, model_name, main_cls, items in current_menu %} +        <div class="form-group row"> +            <label for="current_{{model_name}}" +                class="col-sm-4 col-form-label">{{lbl}}</label> +            <div class="col-sm-6"> +                <select class='{{main_cls}} chosen-select' id='current_{{model_name}}'> +                    <option class='normal' value=''>--</option> +                    {% for val, label, selected, cls in items %}<option{% if cls %} class='{{cls}}'{% endif %} value='{{val}}'{% if selected %} selected="selected"{% endif %}>{% ifequal cls 'basket' %} {% endifequal %}{% ifequal cls 'green' %} {% endifequal %}{% ifequal cls 'orange' %} {% endifequal %}{% ifequal cls 'red' %} {% endifequal %}{{label}}</option> +                    {% endfor %}</select> +            </div> +            {% with 'show-'|add:model_name as model_url%} +            <div class="col-sm-2"> +                <a href='#' onclick='load_current_window("{% url model_url 0 %}", "{{model_name}}");' class='display_details'> +                    <i class="fa fa-info-circle" aria-hidden="true"></i></a> +                <a href='#' +                   class='disabled pin-action text-danger' +                   onclick='$.get("{% url "unpin" model_name %}", function(){load_shortcut_menu();});' title="{% trans 'Unpin' %}"> +                    <i class="fa fa-times"></i> +                </a> +            </div> +            {% endwith %} +        </div> +        {% endfor %} +    </p>  </div> -</fieldset> -</form> -<script type='text/javascript'>var advanced_menu = false; -{% if SHORTCUT_SHOW == 'off' %}var shortcut_menu_hide = true; -{% else %}var shortcut_menu_hide = false;{% endif %} -</script> -{% endif %} +{% endblock %} + +{% block short_extrajs %} +var advanced_menu = false; +{% endblock %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field.html b/ishtar_common/templates/ishtar/blocks/window_field.html index b52ed78ee..097ae3fd2 100644 --- a/ishtar_common/templates/ishtar/blocks/window_field.html +++ b/ishtar_common/templates/ishtar/blocks/window_field.html @@ -1,3 +1,6 @@ -{% load i18n %}{% if data %}{% if li %}<li>{% else %}<p>{% endif %}<label>{% trans caption %}</label> -<span class='value'>{{pre_data|safe}}{{data|linebreaksbr}}{{post_data|safe}}</span>{% if li %}</li>{% else %}</p>{% endif %} +{% load i18n %}{% if data %}{% if li %}<li>{% elif flex %} +    <div class="col-12 col-md-6 col-lg-4 d-flex flex-wrap">{% else %}<p>{% endif %} +        <label>{% trans caption %}</label> +        <span class='value'>{{pre_data|safe}}{{data|linebreaksbr}}{{post_data|safe }}</span> +    {% if li %}</li>{% elif flex %}</div>{% else %}</p>{% endif %}  {% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex.html b/ishtar_common/templates/ishtar/blocks/window_field_flex.html new file mode 100644 index 000000000..add2a5520 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex.html @@ -0,0 +1,6 @@ +{% load i18n %}{% if data %} +    <dl class="col-12 {% if size == 2 %}col-lg-6{% else %}col-md-6 col-lg-4{% endif %} d-flex flex-wrap row"> +        <dt class="col-5">{% trans caption %}</dt> +        <dd class="col-7">{{pre_data|safe}}{{data|linebreaksbr}}{{post_data|safe }}</dd> +    </dl> +{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html new file mode 100644 index 000000000..5968f9afa --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_detail.html @@ -0,0 +1,6 @@ +{% load i18n %}{% if item %} +<dl class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> +    <dt class="col-5">{% trans caption %}</dt> +    <dd class="col-7">{{item}}{{link}}</dd> +</dl> +{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_full.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_full.html new file mode 100644 index 000000000..f44cdc6fd --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_full.html @@ -0,0 +1,6 @@ +{% load i18n %}{% if data %} +    <dl class="col-12 row"> +        <dt class="col-12">{% trans caption %}</dt> +        <dd class="col-12">{{pre_data|safe}}{{data|linebreaksbr}}{{post_data|safe }}</dd> +    </dl> +{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html new file mode 100644 index 000000000..60f6361b7 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_multiple.html @@ -0,0 +1,8 @@ +{% load i18n %}{% if data.count %} +<dl class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> +    <dt class="col-5">{% trans caption %}</dt> +    <dd class="col-7">{% for d in data.all %} +        {% if forloop.counter0 %} ; {% endif %}{{ d }} +    {% endfor %}</dd> +</dl> +{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_url.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_url.html new file mode 100644 index 000000000..59f612bc6 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_url.html @@ -0,0 +1,7 @@ +{% load i18n %}{% if link %} +<div class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> +    <dt class="col-5">{% trans caption %}</dt> +    <dd class="col-7"> +        <a target="_blank" href='{{link|safe}}'>{% if link_name %}{{link_name}}{% else %}{{link}}{% endif %}</a> +    </dd> +{% endif%} diff --git a/ishtar_common/templates/ishtar/blocks/window_nav.html b/ishtar_common/templates/ishtar/blocks/window_nav.html index f212ebff6..89263d0de 100644 --- a/ishtar_common/templates/ishtar/blocks/window_nav.html +++ b/ishtar_common/templates/ishtar/blocks/window_nav.html @@ -1,56 +1,62 @@  {% load i18n %} -{% if previous or next %} -  <div class='tool-right'> -    {% if previous %} -    <a class='history-nav' href="#" onclick='load_window("{% url histo_url item.pk previous|date:"c"%}");$("#{{window_id}}").hide();return false;' title="{%trans 'Previous version'%}"> -    <span class="fa-stack"> -      <i class="fa fa-circle fa-stack-2x"></i> -      <i class="fa fa-step-backward fa-stack-1x fa-inverse"></i> -    </span> -    <br/>{{previous}} -    </a> -    {% else %} -    <span class='history-nav'> </span> -    {% endif %} -    {% if next %} -    <a class='history-nav' title="{% trans 'Restore this version' %}" href="#" onclick='if(confirm("{%trans 'Are you sure to restore to this version? All changes made since this version will be lost.' %}")){load_url("{% url revert_url item.pk item.history_date|date:"c"%}");closeAllWindows();load_window("{% url show_url item.pk None %}");}'> -    <span class="fa-stack fa-lg"> -      <i class="fa fa-circle fa-stack-2x"></i> -      <i class="fa fa-history fa-stack-1x fa-inverse"></i> -    </span> -    <br/>{% trans "Restore" %} -    </a> -    <a class='history-nav' href="#" onclick='load_window("{% url histo_url item.pk next|date:"c" %}");$("#{{window_id}}").hide();return false;' title="{%trans 'Next version'%}"> -    <span class="fa-stack"> -      <i class="fa fa-circle fa-stack-2x"></i> -      <i class="fa fa-step-forward fa-stack-1x fa-inverse"></i> -    </span> -    <br/>{{next}} -    </a> -    {% else %} -    <span class='history-nav'> </span> -    <span class='history-nav'> </span> -    {% endif %} +<div class="row toolbar"> +  {% if previous or next %} +  <div class='col-md-2'> +    <div class="btn-group btn-group-sm" role="group" aria-label="{% trans 'History'%}"> +        {% if previous %} +          <button type="button" class="btn btn-secondary" +                  data-toggle="tooltip" data-placement="bottom" +                  title="{{previous}}" +                  onclick='load_window("{% url histo_url item.pk previous|date:"c"%}");$("#{{window_id}}").hide();return false;'> +              <i class="fa fa-step-backward"></i> +          </button> +        {% endif %} +        {% if next %} +        <button type="button" class="btn btn-secondary" +                data-toggle="tooltip" data-placement="bottom" +                onclick='if(confirm("{%trans 'Are you sure to restore to this version? All changes made since this version will be lost.' %}")){load_url("{% url revert_url item.pk item.history_date|date:"c"%}");closeAllWindows();load_window("{% url show_url item.pk None %}");}' +                title="{% trans 'Restore this version' %}"> +            <i class="fa fa-history"></i> +        </button> +        <button type="button" class="btn btn-secondary" +                data-toggle="tooltip" data-placement="bottom" +                onclick='load_window("{% url histo_url item.pk next|date:"c" %}");$("#{{window_id}}").hide();return false;' +                title="{{next}}"> +            <i class="fa fa-step-forward"></i> +        </button> +        {% endif %} +    </div>    </div> -{% endif %} -<div class='tool-left'> +  <div class='offset-md-6 col-md-4 text-right'> +  {% else %} +  <div class='offset-md-8 col-md-4 text-right'> +  {% endif %} +      <div class="btn-group btn-group-sm" role="group" aria-label="{% trans 'Actions' %}">    {% block extra_actions %}{% endblock %} -  {% if modify_url %}<a href='{% url modify_url item.pk %}' title="{% trans 'Modify' %}"> -  <span class="fa-stack fa-lg"> -    <i class="fa fa-circle fa-stack-2x"></i> -    <i class="fa fa-pencil fa-stack-1x fa-inverse"></i> -  </span> -  </a>{% endif %} -  {% if pin_action and item.SLUG %} -  <span class='pin-action' onclick='$.get("{% url 'pin' item.SLUG item.pk %}", function(){load_shortcut_menu(); display_info("{% trans 'Item pined in your shortcut menu.' %}")});' title="{% trans 'Pin' %}"> -  <span class="fa-stack fa-lg"> -    <i class="fa fa-circle fa-stack-2x"></i> -    <i class="fa fa-thumb-tack fa-stack-1x fa-inverse"></i> -  </span> -  </span>{% endif %} -  <a class='badge' href='{% url show_url item.pk "odt" %}' title='{% trans "Export as OpenOffice.org file"%}'>ODT</a> <a class='badge' href='{% url show_url item.pk "pdf" %}' title='{% trans "Export as PDF file"%}'>PDF</a> +        {% if modify_url %} +        <a class="btn btn-secondary" href='{% url modify_url item.pk %}' +           title="{% trans 'Modify' %}"> +            <i class="fa fa-pencil"></i> +        </a> +        {% endif %} +        {% if pin_action and item.SLUG %} +        <a class="btn btn-secondary" href="#" class='pin-action' +           onclick='$.get("{% url "pin" item.SLUG item.pk %}", function(){load_shortcut_menu(); display_info("{% trans 'Item pined in your shortcut menu.' %}")});' title="{% trans 'Pin' %}"> +            <i class="fa fa-thumb-tack"></i> +        </a> +        {% endif %} +          <a class="btn btn-secondary" href='{% url show_url item.pk "odt" %}' +             title='{% trans "Export as OpenOffice.org file"%}'> +              ODT <i class="fa fa-file-word-o" aria-hidden="true"></i> +          <a class="btn btn-secondary" href='{% url show_url item.pk "pdf" %}' +             title='{% trans "Export as PDF file"%}'> +              PDF <i class="fa fa-file-pdf-o" aria-hidden="true"></i> +          </a> +      </div> +  </div>  </div> -<hr class='clear'>  {% if next %} -    <p class='info-box'><i class="fa fa-info-circle" aria-hidden="true"></i> <em>{% trans "Relation between items are not historized." %}</em></p> +<div class="alert alert-warning" role="alert"> +  {% trans "Relation between items are not historized." %} +</div>  {% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html b/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html index 891cd0f6f..96093403d 100644 --- a/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html +++ b/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html @@ -1,23 +1,95 @@  {% load i18n %}  <h4>{{caption}}</h4> -<table id='grid_{{name}}' class='jqgrid'></table> -<div id='pager_{{name}}'></div> - -<div id='foot_{{name}}' class='gridfooter'> -{% if source_full %} -<a class="badge" href='{{simple_source}}csv{{ source_attrs|safe }}' target='_blank' title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a> -<a class="badge" href='{{source_full}}csv{{ source_attrs|safe }}' target='_blank' title="{% trans 'Export as CSV - full' %}">{% trans "CSV full" %}</a> -{% else %} -<a class="badge" href="{{simple_source}}csv{{ source_attrs|safe }}" target="_blank" title="{% trans 'Export as CSV' %}">CSV</a> -{% endif %} {{encoding}} + +<div class="modal fade table-modal-lg" tabindex="-1" role="dialog" +     aria-hidden="true" id="modal_grid_{{name}}"> +    <div class="modal-dialog full modal-lg"> +        <div class="modal-content"> +            <div class="modal-header"> +                <button type="button" class="close" data-dismiss="modal" aria-label="Close"> +                    <span aria-hidden="true">×</span> +                </button> +            </div> +            <div class="modal-body"> +                <div class="current-sheets"></div> +                <div class="current-grid"></div> +            </div> +        </div> +    </div> +</div> + +<div id="grid_{{name}}_meta_wrapper"> +    <table id='grid_{{name}}' class="display" width="100%"> +        <thead> +        <tr> +            <th></th> +            <th></th>{% for col in col_names %} +            <th>{{col}}</th> +            {% endfor %}</tr> +        </thead> +    </table> +</div> + +<div id='foot_{{name}}' class="gridfooter row toolbar"> +    <div class='col-md-2'> +        <div class="btn-group btn-group-sm" role="group"> +            <button class="btn btn-secondary" data-toggle="modal" +                    data-target=".table-modal-lg"> +                {% trans "Expand table" %} <i class="fa fa-expand" aria-hidden="true"></i> +            </button> +        </div> +    </div> +    <div class='col-md-2'> +        <div class="btn-group btn-group-sm" role="group" +             aria-label="{% trans 'Export'%}"> +            {% if source_full %} +            <a class="btn btn-secondary" href='{{simple_source}}csv{{ source_attrs|safe }}' target='_blank' title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a> +            <a class="btn btn-secondary" href='{{source_full}}csv{{ source_attrs|safe }}' target='_blank' title="{% trans 'Export as CSV - full' %}">{% trans "CSV full" %}</a> +            {% else %} +            <a class="btn btn-secondary" href="{{simple_source}}csv{{ source_attrs|safe }}" target="_blank" title="{% trans 'Export as CSV' %}">CSV</a> +            {% endif %} +        </div> +    </div> +</div> + +<div class="row toolbar justify-content-center">  </div>  <script type="text/javascript" language='javascript'>  setTimeout(      function(){ -      $("#grid_{{name}}").jqGrid({ +      datatable_options = { +        "ajax": { +            "url": "{{source}}", +            "dataSrc": "rows" +        }, +        "columns": [ +            { "data": "id", "visible": false }, +            { "data": "link", "orderable": false },{% for col in extra_cols %} +            { "data": "{{col}}", "defaultContent": "-"}{% if not forloop.last %},{% endif %}{% endfor %} +        ] +      }; +      $.extend(datatable_options, datatables_default); +      if (datatables_i18n) datatable_options['language'] = datatables_i18n; + +      datatable_{{sname}} = jQuery("#grid_{{name}}").DataTable(datatable_options); + +        $('#modal_grid_{{name}}').on('show.bs.modal', function (e) { +            $('#grid_{{name}}_wrapper').appendTo( +                '#modal_grid_{{name}} .modal-body .current-grid'); +            $('#grid_{{name}}').DataTable().clear().draw() +        }); + +        $('#modal_grid_{{name}}').on('hide.bs.modal', function (e) { +            $('#grid_{{name}}_wrapper').appendTo( +                '#grid_{{name}}_meta_wrapper'); +            $('#grid_{{name}}').DataTable().clear().draw() +        }); + +      {% comment %} +      {          url:'{{source|safe}}',          datatype: "json",          mtype: 'GET', @@ -42,6 +114,7 @@ setTimeout(          }        });        {% if large %}jQuery("#grid_{{name}}").jqGrid('setGridHeight', 272);{% endif %} +    {% endcomment %}  }, 200);  </script> diff --git a/ishtar_common/templates/ishtar/blocks/wizard_breadcrumb.html b/ishtar_common/templates/ishtar/blocks/wizard_breadcrumb.html new file mode 100644 index 000000000..79bca71f1 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/wizard_breadcrumb.html @@ -0,0 +1,21 @@ +<form action="." method="post">{% csrf_token %} +    <nav aria-label="breadcrumb" role="navigation"> +        <ol class="breadcrumb"> +            {% for step in previous_steps %} +            <li class="breadcrumb-item"> +                <button class='change_step' name="form_prev_step" +                        value="{{forloop.counter0}}">{{step}}</button> +            </li> +            {% endfor %} +            <li class="breadcrumb-item active"> +                <a href='#'>{{current_step_label}}</a> +            </li> +            {% for step in next_steps %} +            <li class="breadcrumb-item"> +                <button class='change_step' name="form_prev_step" +                        value="{{forloop.counter|add:previous_step_counter}}">{{step}}</button> +            </li> +            {% endfor %} +        </ol> +    </nav> +</form> diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html index ed61d1265..692e435a3 100644 --- a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html @@ -13,25 +13,40 @@  <link rel="stylesheet" href="{{STATIC_URL}}js/jqplot/jquery.jqplot.min.css?ver={{VERSION}}" />  {% endblock %}  {% block content %} - <script> +<script type="text/javascript">  $(function() { - $( "#dash-tabs" ).tabs({ -   beforeActivate: function( event, ui ) { -    $("#progress").show(); -   }, -   load: function( event, ui ) { -    $("#progress").hide(); -   } - }); +    $('#dashboard .nav-link').click(function () { +        var url = $(this).attr('data-url'); +        dynamic_load(url, "#dashboard .card-body"); +        $('#dashboard li').removeClass('active'); +        $('#dashboard li').removeClass('show'); +        $(this).parent().tab('show'); +    }) +    $('#dashboard li:first-child a').click();  }); +  </script> -<div id='dashboard'> - <div id="dash-tabs"> -  <ul> -    {% for label, app in app_list %} -   <li><a href="{% url 'dashboard-main-detail' app %}">{{label}}</a></li>{% endfor %} -   <li><a href="{% url 'dashboard-main-detail' 'users' %}">{% trans "Users" %}</a></li> -  </ul> - </div> +<div id='dashboard' class="card"> +    <div class="card-header"> +        <ul class="nav nav-tabs card-header-tabs"> +            {% for label, app in app_list %} +            <li class="nav-item" id="{{app}}-tab"> +                <a class="nav-link" href="#{{app}}-pane" +                   data-url="{% url 'dashboard-main-detail' app %}">{{label}}</a> +            </li>{% endfor %} +            <li class="nav-item" id="users-tab"> +                <a class="nav-link" href="#users-pane" +                   data-url="{% url 'dashboard-main-detail' 'users' %}">{% trans "Users" %}</a> +            </li> +        </ul> +    </div> +    <div class="card-body tab-content"> +        {% for label, app in app_list %} +        <div class="tab-pane{% if forloop.counter0 == 0%} active{% endif %}" id="{{app}}-pane" +             role="tabpanel" aria-labelledby="{{app}}-tab"></div>{% endfor %} +        <div class="tab-pane" id="users-pane" role="tabpanel" +             aria-labelledby="users-tab"></div> +    </div>  </div> +  {% endblock %} diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html index 5ebb05af4..75a7aa542 100644 --- a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html @@ -1,64 +1,134 @@ -{% load i18n date_formating humanize %} -<div class='dashboard' id="{{unique_id}}-tab"> -  <div> +{% load i18n date_formating humanize table_form %} +<div id="{{unique_id}}-tab">      <h4>{% trans "Numbers" %}</h4>      {% if form %}      <div class='form'>      <form method='post' action="{% url 'dashboard-main-detail' item_name %}" id='{{unique_id}}_form'> -      <table>{% csrf_token %} -        {{form}} -      </table> -      <button id="search_{{unique_id}}" class="submit">{% trans "Change" %}</button> +        {% csrf_token %} +        {% bs_form form %} +        <div class="text-center"> +            <button type='button' id="search_{{unique_id}}" +                    class="btn btn-primary"> +                {% trans "Change" %}</button> +        </div>      </form>      </div>      {% endif %}      <p><strong>{% trans "Total:" %}</strong> {{dashboard.total_number|intcomma}}</p> -    <div class='table'> -    <div id="chart_{{unique_id}}" style="height:400px; width:700px;"></div> -    <p class='info-box'><i class="fa fa-info-circle" aria-hidden="true"></i> {% trans 'Draw rectangle on the graph to zoom. Double-click to reinitialize.' %}</p> -    <div class='form chart-img-form'> -      <button id="chart_img_display_{{unique_id}}" class='submit'>{% trans "Display as an image" %}</button> -      <div id="chart_img_{{unique_id}}" class='chart-img'> -        <div id="img_{{unique_id}}"></div> -        <p class='info-box'><i class="fa fa-info-circle" aria-hidden="true"></i> {% trans 'Right-click on this image to save it.' %}</p> -      </div> +    <div> +        <div id="chart_{{unique_id}}" +             style="height:400px; width:700px; margin-right:auto; margin-left:auto"></div> +        <p class='alert alert-info'> +            {% trans 'Draw rectangle on the graph to zoom. Double-click to reinitialize.' %} +        </p> +        <div class='form chart-img-form'> +          <div class="text-center"> +            <button id="chart_img_display_{{unique_id}}" +                    type='button' class='btn btn-secondary'> +                {% trans "Display as an image" %} +            </button> +          </div> +          <div id="chart_img_{{unique_id}}" class='chart-img'> +              <div class="card"> +                <div id="img_{{unique_id}}" +                     class="card-img-top text-center"></div> +                  <div class="card-body"> +                <div class='alert alert-info'> +                    {% trans 'Right-click on this image to save it.' %} +                </div> +                  </div> +              </div> +          </div> +        </div>      </div> -    </div> -    <div class='clean-table'> -    <div class='clean-table-wrap'> -    <table> +    <hr> +    <table class="table table-striped">      {% for idx, lbl, values in dashboard.values %} -      <tr class='idx {% if forloop.counter0|divisibleby:"2" %}even{%else%}odd{%endif%}'> +      <tr>        <th>{{lbl}}</th>        {% for value in values reversed %}{% if forloop.parentloop.counter0 %}<td>{% else %}<th>{%endif%}{{value|date_formating }}{% if forloop.parentloop.counter0 %}</td>{% else %}</th>{%endif%}{% endfor%}        </tr>      {% endfor%}      </table> -    </div> -    </div> +    <hr>      {% if dashboard.periods %}      <h4>{% trans "By years" %}</h4> -    <ul> -      <li><strong>{% trans "Average:" %}</strong> {{dashboard.average}}</li> -      <li><strong>{% trans "Variance:" %}</strong> {{dashboard.variance}}</li> -      <li><strong>{% trans "Standard deviation:" %}</strong> {{dashboard.standard_deviation}}</li> -      <li><strong>{% trans "Median:" %}</strong> {{dashboard.median}}</li> -      <li><strong>{% trans "Mode:" %}</strong> {{dashboard.mode}}</li> -    </ul> +    <dl class="row"> +        <dt class="col-sm-3"> +            {% trans "Average:" %} +        </dt> +        <dd class="col-sm-9"> +            {{dashboard.average}} +        </dd> + +        <dt class="col-sm-3"> +            {% trans "Variance:" %} +        </dt> +        <dd class="col-sm-9"> +            {{dashboard.variance}} +        </dd> + +        <dt class="col-sm-3"> +            {% trans "Standard deviation:" %} +        </dt> +        <dd class="col-sm-9"> +            {{dashboard.standard_deviation}} +        </dd> +        <dt class="col-sm-3"> +            {% trans "Median:" %} +        </dt> +        <dd class="col-sm-9"> +            {{dashboard.median}} +        </dd> +        <dt class="col-sm-3"> +            {% trans "Mode:" %} +        </dt> +        <dd class="col-sm-9"> +            {{dashboard.mode}} +        </dd> +    </dl> +    <hr>      {% endif %}      {% if dashboard.operation_average %}      <h4>{% trans "By operations" %}</h4> -    <ul> -      <li><strong>{% trans "Average:" %}</strong> {{dashboard.operation_average}}</li> -      <li><strong>{% trans "Variance:" %}</strong> {{dashboard.operation_variance}}</li> -      <li><strong>{% trans "Standard deviation:" %}</strong> {{dashboard.operation_standard_deviation}}</li> -      <li><strong>{% trans "Median:" %}</strong> {{dashboard.operation_median}}</li> -      <li><strong>{% trans "Mode:" %}</strong> {{dashboard.operation_mode}}</li> -    </ul> +    <dl class="row"> +        <dt class="col-sm-3"> +            {% trans "Average:" %} +        </dt> +        <dd class="col-sm-9"> +            {{dashboard.operation_average}} +        </dd> + +        <dt class="col-sm-3"> +            {% trans "Variance:" %} +        </dt> +        <dd class="col-sm-9"> +            {{dashboard.operation_variance}} +        </dd> + +        <dt class="col-sm-3"> +            {% trans "Standard deviation:" %} +        </dt> +        <dd class="col-sm-9"> +            {{dashboard.operation_standard_deviation}} +        </dd> +        <dt class="col-sm-3"> +            {% trans "Median:" %} +        </dt> +        <dd class="col-sm-9"> +            {{dashboard.operation_median}} +        </dd> +        <dt class="col-sm-3"> +            {% trans "Mode:" %} +        </dt> +        <dd class="col-sm-9"> +            {{dashboard.operation_mode}} +        </dd> +    </dl> +    <hr>      {% endif %} -    <div class='clean-table'>      <h4>{% trans "Created last" %}</h4> -    <table> +    <table class="table table-striped">        <tr><th>{{lbl}}</th><th>{% trans "Created" %}</th><th></th></tr>        {% for item in dashboard.lasts %}<tr>          <td class='ref'>{{item}}</td> @@ -68,10 +138,9 @@          </a>{%endif%}</td>        </tr>{% endfor %}      </table> -    </div> -    <div class='clean-table'> +    <hr>      <h4>{% trans "Recent changes" %}</h4> -    <table> +    <table class="table table-striped">        <tr><th>{{lbl}}</th><th>{% trans "Modified" %}</th><th></th></tr>        {% for item in dashboard.recents %}<tr>          <td class='ref'>{{item}}</td> @@ -81,8 +150,7 @@          </a>{%endif%}</td>        </tr>{% endfor %}      </table> -    </div> -  </div> +</div>  <script language="javascript" type="text/javascript">  $(document).ready(function(){ @@ -109,8 +177,11 @@ $(document).ready(function(){  if (typeof values_1_{{unique_id}} === 'undefined'      || values_1_{{unique_id}}.length == 0){ -$('#chart_img_{{unique_id}}').hide(); -$('#chart_{{unique_id}}').html("<p class='alert'><i class='fa fa-exclamation-triangle' aria-hidden='true'></i> {% trans 'No data for these criteria.' %}</p>"); +    $('#chart_img_{{unique_id}}').hide(); +    $('#chart_{{unique_id}}').html( +        "<p class='alert alert-warning'>{% trans 'No data for these criteria.' %}</p>" +    ); +    $('#chart_{{unique_id}}').css('height', 'auto');  } else {  var showmarker = false; @@ -165,7 +236,6 @@ var plot_{{unique_id}} = $.jqplot('chart_{{unique_id}}',      );      $('#chart_img_{{unique_id}}').show('slow');    }); -  }  $('#search_{{unique_id}}').click(function (){ @@ -176,10 +246,5 @@ $('#search_{{unique_id}}').click(function (){              });      return false;  }); - -{% if item_name == 'files' or item_name == "operations" or item_name == "treatments" or item_name == "treatmentfiles" %} -load_jquerydate_{{item_name}}_after(); -load_jquerydate_{{item_name}}_before(); -{% endif %}  });  </script> diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html index 6ffd8c3c9..f6ead643a 100644 --- a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html @@ -1,36 +1,32 @@  {% load i18n %} -<div class='dashboard'> -  <div> -<script language="javascript" type="text/javascript"> -$(document).ready(function(){ -var values_users = []; -{% for user_type in ishtar_users.types %} -values_users.push(['{{user_type.person__person_types__label}}', {{user_type.number}}]); {% endfor%} - -var plot_users = jQuery.jqplot ('user_chart', [values_users], -    { -      seriesDefaults: { -        renderer: jQuery.jqplot.PieRenderer, -        rendererOptions: { -          showDataLabels: true -        } -      }, -      legend: { show:true, location: 'e' } -    } - ); -}); -</script> -    <div id="user_chart" style="height:300px; width:700px;"></div> -    <div class='table'> -    <table class='resume'> +<div class='dashboard centered'> +    <div id="user_chart" style="height:300px; width:700px;margin-left: auto;margin-right: auto;"></div> +    <table class='table table-striped'>        <tr><th>{% trans "User type" %}</th><th>{% trans "Number" %}</th></tr> -    {% for user_type in ishtar_users.types %} +      {% for user_type in ishtar_users.types %}        <tr>          <td class='string'>{{user_type.person__person_types__label}}{#TODO: Display all#}</td>          <td>{{user_type.number}}</td>        </tr> -    {% endfor%} +    {% endfor %}      </table> -    </div>  </div> +<script language="javascript" type="text/javascript"> +$(document).ready(function(){ +    var values_users = []; +    {% for user_type in ishtar_users.types %} +    values_users.push(['{{user_type.person__person_types__label}}', {{user_type.number}}]); {% endfor%} +    var plot_users = jQuery.jqplot ('user_chart', [values_users], +        { +          seriesDefaults: { +            renderer: jQuery.jqplot.PieRenderer, +            rendererOptions: { +              showDataLabels: true +            } +          }, +          legend: { show:true, location: 'e' } +        } +     ); +}); +</script>
\ No newline at end of file diff --git a/ishtar_common/templates/ishtar/form.html b/ishtar_common/templates/ishtar/form.html index 236818c66..b99d504a0 100644 --- a/ishtar_common/templates/ishtar/form.html +++ b/ishtar_common/templates/ishtar/form.html @@ -1,17 +1,34 @@  {% extends "base.html" %} -{% load i18n inline_formset %} +{% load i18n inline_formset table_form %} +{% block pre_container %} +<form enctype="multipart/form-data" action="." method="post"{% if confirm %} +      onsubmit='return confirm("{{confirm}}");'{% endif %}>{% csrf_token %} +{% endblock %}  {% block content %}  <h2>{{page_name}}</h2>  <div class='form'> -<form enctype="multipart/form-data" action="." method="post"{% if confirm %} -    onsubmit='return confirm("{{confirm}}");'{% endif %}>{% csrf_token %}      {% for error in form.non_field_errors %}      <p>{{ error }}</p>      {% endfor %} -<table> -{{form}} -</table> -<input id="submit_form" type="submit" value="{% if submit_label %}{{submit_label}}{% else%}{% trans "Validate" %}{% endif %}"/> -</form> +    {% bs_form form %}  </div>  {% endblock %} + +{% block footer %} +<div id="footer"> +    {% if form.SEARCH_AND_SELECT %} +    <p class="confirm-message">{% trans "Search and select an item in the table" %}</p> +    {% endif %} +    <div id='validation-bar' class="row text-center"> +        <div class="col-sm"> +            <button type="submit" id="submit_form" name='validate' +                    value="validate" class="btn btn-success"> +               {% if submit_label %}{{submit_label}}{% else%}{% trans "Validate" %}{% endif %} +            </button> +        </div> +    </div> +    {% include 'ishtar/blocks/footer.html' %} +</div> +</form> +{% endblock %} + diff --git a/ishtar_common/templates/ishtar/import_list.html b/ishtar_common/templates/ishtar/import_list.html index c72c86d10..ee466ad24 100644 --- a/ishtar_common/templates/ishtar/import_list.html +++ b/ishtar_common/templates/ishtar/import_list.html @@ -1,13 +1,17 @@  {% extends "base.html" %}  {% load i18n inline_formset %} + +{% block pre_container %} +<form action="." method="post">{% csrf_token %} +{% endblock %} +  {% block content %}  <h2>{{page_name}}</h2>  <div class='form'>  {% if not object_list %}  <p>{% trans "No pending imports." %}</p>  {% else %} -<form action="." method="post">{% csrf_token %} -<table class="clean-table"> +<table class="table table-striped">  <tr>    <th>{% trans "Name" %}</th>    <th>{% trans "Type" %}</th> @@ -15,6 +19,10 @@    <th>{% trans "Creation" %}</th>    <th>{% trans "Status" %}</th>    <th>{% trans "Action" %}</th> +  <th>{% trans "Unmatched items" %}</th> +  <th>{% trans "Error" %}</th> +  <th>{% trans "Control" %}</th> +  <th>{% trans "Match" %}</th>  </tr>  {% for import in object_list %}  <tr> @@ -43,24 +51,36 @@    </td>    <td>      {% if import.need_matching %} -    <a href='{% url "import_link_unmatched" import.pk %}'>{% trans "Link unmatched items" %}</a> +    <a href='{% url "import_link_unmatched" import.pk %}'>{% trans "Match"%}</a>      {% endif %}    </td>    <td>{% if import.error_file %} -    <a href='{{import.error_file.url}}'>{% trans "Error file" %}</a> +    <a href='{{import.error_file.url}}'>{% trans "File" context "not a directory" %}</a>    {% endif %}</td>    <td>{% if import.result_file %} -    <a href='{{import.result_file.url}}'>{% trans "Control file" %}</a> +    <a href='{{import.result_file.url}}'>{% trans "File" context "not a directory" %}</a>    {% endif %}</td>    <td>{% if import.match_file %} -    <a href='{{import.match_file.url}}'>{% trans "Match file" %}</a> +    <a href='{{import.match_file.url}}'>{% trans "File" context "not a directory" %}</a>    {% endif %}</td>  </tr>  {% endfor %}  </table> -    <input type="submit" onclick="long_wait();return true;" value="{% trans 'Validate' %}" /> -</form>  {% endif %}  </div>  {% endblock %} +{% block footer %} +<div id="footer"> +  <div id='validation-bar' class="row text-center"> +    <div class="col-sm"> +      <button type="submit" id="submit_form" name='validate' +              value="validate" class="btn btn-success" onclick="long_wait();return true;"> +        {% trans "Validate" %} +      </button> +    </div> +  </div> +  {% include 'ishtar/blocks/footer.html' %} +</div> +</form> +{% endblock %} diff --git a/ishtar_common/templates/ishtar/manage_basket.html b/ishtar_common/templates/ishtar/manage_basket.html index 3292318ea..26dd75c4c 100644 --- a/ishtar_common/templates/ishtar/manage_basket.html +++ b/ishtar_common/templates/ishtar/manage_basket.html @@ -4,12 +4,15 @@  <h2>{{page_name}}{% trans ":"%} {{basket}}</h2>  <form enctype="multipart/form-data" action="." method="post">{% csrf_token %}  <div class='form'> -<p class='alert'> -    <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> -    {% trans 'Checking "Select all" only selects the current page.' %} -</p> -{{form}} -<button id='add_to' onclick='return false'>{% trans "Add" %}</button> +    <div class="alert alert-warning" role="alert"> +        {% trans 'Checking "Select all" only selects the current page.' %} +    </div> +    {{form}} +    <div class="text-center"> +        <button class="btn btn-primary" type="button" id='add_to'> +            {% trans "Add" %} +        </button> +    </div>  <h3>{% trans "Basket content" %}</h3>  <div id='basket-content' style='text-align:left'>  </div> @@ -27,15 +30,20 @@  </form>  <script type='text/javascript' language='javascript'> -function load_list(data){ +function load_list(data, last){      $('#basket-content').html(data); +    if (last){ +        close_wait(); +    }  }  $('#add_to').click(function(){ -    var selected_items = jQuery("#grid_pk").getGridParam('selarrrow'); +    var selected_items = datatable_pk.rows( { selected: true } ).data();      if(!selected_items) return false; +    $('.modal-progress').modal('show');      for (i = 0, n = selected_items.length; i < n; i++) { -        var selected_item = selected_items[i]; +        var selected_item = selected_items[i]['id']; +        last = i == n - 1;          $.ajax({              type: "POST",              url: '{{add_url}}', @@ -43,11 +51,14 @@ $('#add_to').click(function(){                  basket_id: {{basket.pk}},                  item_id: selected_item              }, -            success: load_list +            success: function(data){ +                load_list(data, last); +            }          });      }      return false;  }); +  jQuery(document).ready(function(){      $.get('{{list_url}}', load_list);  }); diff --git a/ishtar_common/templates/ishtar/sheet.html b/ishtar_common/templates/ishtar/sheet.html index bfefd5eb6..ee57d312d 100644 --- a/ishtar_common/templates/ishtar/sheet.html +++ b/ishtar_common/templates/ishtar/sheet.html @@ -1,8 +1,4 @@ -{% load i18n %} -{% block main_head %} -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" -    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +{% load i18n %}{% block main_head %}<html lang="en">  <head>      <title>{% block title %}Ishtar{% if APP_NAME %} - {{APP_NAME}}{%endif%}{% endblock %}      </title> @@ -12,68 +8,88 @@  </head>  <body>  {% endblock %} -<div class="sheet" id='{{window_id}}'> -{% block head_sheet %} -<script type="text/javascript">var last_window='{{window_id}}';</script> -<div class="head"> +  <div class="card sheet" id="{{window_id}}"> +    <div class="card-header" data-sheet-id="{{sheet_id}}" role="tab" id='head-{{window_id}}'> +      <div class="row"> +          <div class="col-9"> +              <h5 class="mb-0"> +                <a data-toggle="collapse" href="#collapse-{{window_id}}" aria-expanded="true" +                   aria-controls="collapse-{{window_id}}"> +                    {% block head_title %}{% endblock %} +                </a> +              </h5> +          </div> +          <div class='col-2 text-center'> +              <a href='#' class='previous_page'> +                <span class="fa-stack"> +                  <i class="fa fa-circle fa-stack-2x"></i> +                  <i class="fa fa-arrow-left fa-stack-1x fa-inverse"></i> +                </span> +              </a> +              <a href='#' class='next_page'> +                <span class="fa-stack"> +                  <i class="fa fa-circle fa-stack-2x"></i> +                  <i class="fa fa-arrow-right fa-stack-1x fa-inverse"></i> +                </span> +              </a> +          </div> +          <div class='col-1 text-right'> +            <a href='#' onclick='$("#{{window_id}}").hide()' title="{% trans 'Close' %}"> +              <span class="fa-stack"> +                <i class="fa fa-circle fa-stack-2x"></i> +                <i class="fa fa-times fa-stack-1x fa-inverse"></i> +              </span> +            </a> +            {% comment %} +            <a href='#' onclick='closeAllWindows();' title="{% trans "Close all windows" %}"> +              <span class="fa-stack"> +                <i class="fa fa-files-o fa-stack-2x"></i> +                <i class="fa fa-circle fa-stack-15x"></i> +                <i class="fa fa-times fa-stack-1x fa-inverse"></i> +              </span> +            </a> +            {% endcomment %} +          </div> +      </div> +      {% block header_title %}{% endblock %} +    </div> -<a href='#' class='previous_page'> -<span class="fa-stack fa-lg"> -  <i class="fa fa-circle fa-stack-2x"></i> -  <i class="fa fa-arrow-left fa-stack-1x fa-inverse"></i> -</span> -</a> -<div class='close-buttons'> -<a href='#' onclick='$("#{{window_id}}").hide("slow")' title="{% trans 'Close' %}"> -<span class="fa-stack"> -  <i class="fa fa-circle fa-stack-2x"></i> -  <i class="fa fa-times fa-stack-1x fa-inverse"></i> -</span> -</a> -<a href='#' onclick='closeAllWindows();' title="{% trans "Close all windows" %}"> -<span class="fa-stack"> -  <i class="fa fa-files-o fa-stack-2x"></i> -  <i class="fa fa-circle fa-stack-15x"></i> -  <i class="fa fa-times fa-stack-1x fa-inverse"></i> -</span> -</a> -</div> -<a href='#' class='next_page'> -<span class="fa-stack fa-lg"> -  <i class="fa fa-circle fa-stack-2x"></i> -  <i class="fa fa-arrow-right fa-stack-1x fa-inverse"></i> -</span> -</a> - -<h1>{% block head_title %}{% endblock %}</h1> -</div> +    <div id="collapse-{{window_id}}" class="collapse show" role="tabpanel" +         aria-labelledby="heading-{{window_id}}" data-parent="#window"> +      {% block toolbar %}{% endblock %} +      <div class="card-body"> +        {% block head_sheet %} +        <script type="text/javascript"> +        var last_window='{{window_id}}'; -<script type="text/javascript" language='javascript'> -jQuery(document).ready(function(){ -    if (! get_next_table_id({{item.pk}})){ -        jQuery('.next_page').hide(); -    } -    if (! get_previous_table_id({{item.pk}})){ -        jQuery('.previous_page').hide(); -    } -    jQuery(".next_page").click(function() { -        load_window("{{current_window_url}}" + get_next_table_id({{item.pk}}) + "/", -                    '', function(){$("#{{window_id}}").hide();}); -    }); -    jQuery(".previous_page").click(function() { -        load_window("{{current_window_url}}" + get_previous_table_id({{item.pk}}) + "/", -                    '', function(){$("#{{window_id}}").hide();}); -    }); -}); -</script> -{% endblock %} -{% block header_title %}{% endblock %} -<div class="body"> -{% block toolbar %}{% endblock %} -{% block content %} -{% endblock %} -</div> +        jQuery(document).ready(function(){ +            if (! get_next_table_id({{item.pk}})){ +                jQuery('.next_page').hide(); +            } +            if (! get_previous_table_id({{item.pk}})){ +                jQuery('.previous_page').hide(); +            } +            jQuery(".next_page").click(function() { +                load_window("{{current_window_url}}" + get_next_table_id({{item.pk}}) + "/", +                            '', function(){$("#{{window_id}}").remove();}, +                            true); +            }); +            jQuery(".previous_page").click(function() { +                load_window("{{current_window_url}}" + get_previous_table_id({{item.pk}}) + "/", +                            '', function(){$("#{{window_id}}").remove();}, +                            true); +            }); +        }); +        </script> +        {% endblock %} +        <div class="body"> +        {% block content %} +        {% endblock %} +        </div> +      </div> +    </div> +  </div>  </div>  {%block main_foot%}  </body> diff --git a/ishtar_common/templates/ishtar/sheet_organization.html b/ishtar_common/templates/ishtar/sheet_organization.html index 403eb7dec..37f7a76ce 100644 --- a/ishtar_common/templates/ishtar/sheet_organization.html +++ b/ishtar_common/templates/ishtar/sheet_organization.html @@ -1,19 +1,24 @@  {% extends "ishtar/sheet.html" %} -{% load i18n window_header window_tables %} +{% load i18n window_header window_field window_tables %} -{% block head_title %}{% trans "Organization" %}{% endblock %} +{% block head_title %}<strong>{% trans "Organization" %}</strong> - {{item.name}}{% endblock %} -{% block content %} +{% block toolbar %}  {% window_nav item window_id 'show-organization' 'organization_modify' %} -<p><label>{% trans "Name" %}</label> <span class='value'>{{item.name}}</span></p> -<p><label>{%trans "Created by:"%}</label> <span class='value'>{{ item.history_creator.ishtaruser.person }}</span></p> -{% include "ishtar/blocks/sheet_address_section.html" %} -{% if item.phone %}<p><label>{% trans "Phone" %}</label> <span class='value'>{{item.phone}}</span></p> {% endif %} -{% if item.mobile_phone %}<p><label>{% trans "Mobile phone" %}</label> <span class='value'>{{item.mobile_phone}}</span></p> {% endif %} +{% endblock %} + +{% block content %} +<div class="row"> +  {% field_flex "Name" item.name %} +  {% field_flex_detail "Created by" item.history_creator.ishtaruser.person %} +  {% include "ishtar/blocks/sheet_address_section.html" %} +  {% field_flex "Phone" item.phone %} +  {% field_flex "Mobile phone" item.mobile_phone %} +</div> +<h3>{%trans "Person in the organization"%}</h3> -<table class='simple'> -  <caption>{%trans "Person in the organization"%}</caption> +<table class='table table-striped'>    <tr>      <th>{% trans "Name" %}</th>      <th>{% trans "Surname" %}</th> diff --git a/ishtar_common/templates/ishtar/sheet_person.html b/ishtar_common/templates/ishtar/sheet_person.html index aa5192dc4..d6cee2e61 100644 --- a/ishtar_common/templates/ishtar/sheet_person.html +++ b/ishtar_common/templates/ishtar/sheet_person.html @@ -1,23 +1,26 @@  {% extends "ishtar/sheet.html" %}  {% load i18n window_field window_tables window_header %} -{% block head_title %}{% trans "Person"%}{% endblock %} -{% block content %} +{% block head_title %}<strong>{% trans "Person"%}</strong> - {{item}}{% endblock %} + +{% block toolbar %}  {% window_nav item window_id 'show-person' 'person_modify' %} -<h3>{% trans "Identity" %}</h3> - -<ul class='form-flex'> -{% field_li "Title" item.full_title %} -{% field_li "Name" item.name %} -{% field_li "Surname" item.surname %} -{% field_li "Raw name" item.raw_name %} -{% field_li_detail "Created by" item.history_creator.ishtaruser.person %} -{% field_li "Email" item.email %} -{% field_li "Type(s)" item.person_types_list %} -</ul> +{% endblock %} + +{% block content %} + +<div class="row"> +{% field_flex "Title" item.full_title %} +{% field_flex "Name" item.name %} +{% field_flex "Surname" item.surname %} +{% field_flex "Raw name" item.raw_name %} +{% field_flex_detail "Created by" item.history_creator.ishtaruser.person %} +{% field_flex "Email" item.email %} +{% field_flex "Type(s)" item.person_types_list %} +</div>  {% if item.phone or item.phone2 or item.phone3 or item.mobile_phone %} -<table class='formset table-form'> +<table class='table table-striped'>    <caption>{% trans "Phone" %}</caption>    <tr>      <th>{% trans "Phone type" %}</th> @@ -44,33 +47,33 @@  {% if item.address or item.postal_code or item.town %}  <h3>{% trans "Business address" %}</h3> -<ul class='form-flex'> -    {% field_li "Address" item.address %} -    {% field_li "Address complement" item.address_complement %} -    {% field_li "Postal code" item.postal_code %} -    {% field_li "Town" item.town %} -</ul>{% endif %} +<div class="row"> +    {% field_flex "Address" item.address %} +    {% field_flex "Address complement" item.address_complement %} +    {% field_flex "Postal code" item.postal_code %} +    {% field_flex "Town" item.town %} +</div>{% endif %}  {% if item.alt_address or item.alt_postal_code or item.alt_town %}  <h3>{% trans "Other address" %}</h3> -<ul class='form-flex'> -    {% field_li "Address" item.alt_address %} -    {% field_li "Address complement" item.alt_address_complement %} -    {% field_li "Postal code" item.alt_postal_code %} -    {% field_li "Town" item.alt_town %} -</ul>{% endif %} +<div class="row"> +    {% field_flex "Address" item.alt_address %} +    {% field_flex "Address complement" item.alt_address_complement %} +    {% field_flex "Postal code" item.alt_postal_code %} +    {% field_flex "Town" item.alt_town %} +</div>{% endif %}  {% if item.attached_to %}<h3>{% trans "Associated organization"%}</h3> -<ul class='form-flex'> -    {% field_li_detail "Name" item.attached_to %} -    {% field_li "Address" item.attached_to.address %} -    {% field_li "Address complement" item.attached_to.address_complement %} -    {% field_li "Postal code" item.attached_to.postal_code %} -    {% field_li "Town" item.attached_to.town %} -    {% field_li "Phone" item.attached_to.phone %} -    {% field_li "Mobile phone" item.attached_to.mobile_phone %} -</ul>{% endif %} +<div class="row"> +    {% field_flex_detail "Name" item.attached_to %} +    {% field_flex "Address" item.attached_to.address %} +    {% field_flex "Address complement" item.attached_to.address_complement %} +    {% field_flex "Postal code" item.attached_to.postal_code %} +    {% field_flex "Town" item.attached_to.town %} +    {% field_flex "Phone" item.attached_to.phone %} +    {% field_flex "Mobile phone" item.attached_to.mobile_phone %} +</div>{% endif %}  {% trans "Associated operations as scientist" as ao %} diff --git a/ishtar_common/templates/ishtar/sheet_source.html b/ishtar_common/templates/ishtar/sheet_source.html index 24477ce2c..a1a8948dc 100644 --- a/ishtar_common/templates/ishtar/sheet_source.html +++ b/ishtar_common/templates/ishtar/sheet_source.html @@ -4,35 +4,42 @@  {% block content %}  {% block window_nav %}{% endblock %}  {% block general %} -{% block related %} -{% trans "Related item" as related_item_label %} -{% field related_item_label item.owner %} -{% endblock %}  {% if item.image %} -<a href='{{item.image.url}}' rel="prettyPhoto" title="{{item.label}}" class='photo'><img src='{{item.thumbnail.url}}'/></a> -{% endif%} +<div class="row"> +    <div class="offset-lg-4 col-lg-4 offset-md-3 col-md-6 offset-sm-1 col-sm-10 col-12"> +        <div class="card"> +            <img class='card-img-top' src="{{item.thumbnail.url}}"> +        </div> +    </div> +</div> +{% endif %} + +<div class="row"> +    {% block related %} +    {% trans "Related item" as related_item_label %} +    {% field_flex related_item_label item.owner %} +    {% endblock %} +    {% field_flex "Title" item.title %} +    {% field_flex "Index" item.index %} +    {% field_flex "Source type" item.source_type %} +    {% field_flex "Format type" item.format_type %} +    {% field_flex "Scale" item.scale %} +    {% trans "Web link" as weblink_label %} +    {% field_flex_url weblink_label item.associated_url %} +    {% field_flex "Item number" item.item_number %} +    {% field_flex "Ref." item.reference %} +    {% field_flex "Internal ref." item.internal_reference %} +    {% field_flex "Creation date" item.creation_date %} +    {% field_flex "Receipt date" item.receipt_date %} +    {% field_flex "Receipt date in documentation" item.receipt_date_in_documentation %} +    {% field_flex "Has a duplicate" item.duplicate %} +    {% field_flex "Description" item.description %} +    {% field_flex "Comment" item.comment %} +    {% field_flex "Additional information" item.additional_information %} +    {% field_flex_full "Authors" item.authors|add_links:'person' %} +</div> -<ul class='form-flex'> -{% field_li "Title" item.title %} -{% field_li "Index" item.index %} -{% field_li "Source type" item.source_type %} -{% field_li "Format type" item.format_type %} -{% field_li "Scale" item.scale %} -{% trans "Web link" as weblink_label %} -{% field_li_url weblink_label item.associated_url %} -{% field_li "Item number" item.item_number %} -{% field_li "Ref." item.reference %} -{% field_li "Internal ref." item.internal_reference %} -{% field_li "Creation date" item.creation_date %} -{% field_li "Receipt date" item.receipt_date %} -{% field_li "Receipt date in documentation" item.receipt_date_in_documentation %} -{% field_li "Has a duplicate" item.duplicate %} -{% field_li "Description" item.description %} -{% field_li "Comment" item.comment %} -{% field_li "Additional information" item.additional_information %} -</ul> -{% field "Authors" item.authors|add_links:'person' %}  {% endblock %}  {% endblock %} diff --git a/ishtar_common/templates/ishtar/wizard/confirm_wizard.html b/ishtar_common/templates/ishtar/wizard/confirm_wizard.html index 7339af9a8..1128e9561 100644 --- a/ishtar_common/templates/ishtar/wizard/confirm_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/confirm_wizard.html @@ -3,25 +3,31 @@  {% load range %}  {% block content %}  <h2>{{wizard_label}}</h2> -<form action="." method="post">{% csrf_token %} -<ul id='form_path'> -{% for step in previous_steps %} -  <li><button name="form_prev_step" value="{{forloop.counter0}}">{{step}}</button></li> -{% endfor %} -  <li class='current'><a href='#'>{{current_step_label}}</a></li> -</ul> -</form> + +{% include "ishtar/blocks/wizard_breadcrumb.html" %} +  <form action="." method="post">{% csrf_token %}  <div class='form'>    {% block "warning_informations" %}{% endblock %}    <p>{%if confirm_msg %}{{confirm_msg|safe}}{%else%}{% trans "You have entered the following informations:" %}{%endif%}</p>    {% for form_label, form_data in datas %} -  <table class='confirm'> -    <caption>{{form_label}}</caption> -    {% for data in form_data %} -    <tr{%if data.2%} class='{{data.2}}'{%endif%}><th>{{data.0}}</th><td>{{data.1}}</td></tr> -    {% endfor %} -  </table> + +  <div class="card"> +    {% if form_label %} +    <div class="card-header"> +      {{form_label}} +    </div>{% endif %} +    <div class="card-body form-row"> +      <table class='table'> +        {% for data in form_data %} +        <tr{%if data.2%} class='{{data.2}}'{%endif%}><th>{{data.0}}</th><td>{{data.1}}</td></tr> +        {% endfor %} +      </table> + +    </div> +  </div> + +    {% endfor %}  {{wizard.management_form}}    {%if not wizard.form.is_hidden %} diff --git a/ishtar_common/templates/ishtar/wizard/default_wizard.html b/ishtar_common/templates/ishtar/wizard/default_wizard.html index 19076b0de..a7a705f59 100644 --- a/ishtar_common/templates/ishtar/wizard/default_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/default_wizard.html @@ -5,21 +5,13 @@  {% endblock %}  {% block content %}  {% block wizard_head %} -<h2>{{wizard_label}}</h2> -<form action="." method="post">{% csrf_token %} -<ul id='form_path'> -{% for step in previous_steps %} -  <li><button class='change_step' name="form_prev_step" value="{{forloop.counter0}}">{{step}}</button></li> -{% endfor %} -  <li class='current'><a href='#'>{{current_step_label}}</a></li> -{% for step in next_steps %} -  <li><button class='change_step' name="form_prev_step" value="{{forloop.counter|add:previous_step_counter}}">{{step}}</button></li> -{% endfor %} -</ul> -</form> +<h3>{{wizard_label}}</h3> + +{% include "ishtar/blocks/wizard_breadcrumb.html" %} +  {% endblock %}  {% block wizard_form %} -<form action="." method="post" name='wizard'{% if wizard.form.file_upload %} enctype="multipart/form-data"{% endif %}>{% csrf_token %} +<form action="." class='wizard-form' id="wizard-form" method="post" name='wizard'{% if wizard.form.file_upload %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}  <div class='form'>  {{ wizard.form.media }}  {{ wizard.management_form }} @@ -27,18 +19,19 @@  {% block form_detail %}  {% if wizard.form.forms %}    {{ wizard.form.management_form }} -<div class='top_button'><input type="submit" id="submit_form" value="{% trans "Validate" %}"/></div> -<table class='formset'> -  {%if wizard.form.non_form_errors%}<tr class='error'><th colspan='2'>{{wizard.form.non_form_errors}}</th></tr>{%endif%} +  {% if wizard.form.non_form_errors %} +    <div class="alert alert-danger" role="alert"> +        {{wizard.form.non_form_errors}} +    </div> +  {% endif %}    {% for formsetform in wizard.form.forms %} -  {% table_form formsetform %} +  {% bs_form formsetform %}    {% endfor %} -  <tr class='modify'><td colspan="2"><button name="formset_modify" value="{{wizard.steps.current}}">{% trans "Add/Modify" %}</button></td></tr></li> -</table> +    <button class="btn btn-success" name="formset_modify" value="{{wizard.steps.current}}"> +      {% trans "Add/Modify" %} +    </button>  {% else %} -{% if not is_search %}<table>{% endif %} -{% table_form wizard.form %} -{% if not is_search %}</table>{% endif %} +  {% bs_form wizard.form %}  {% endif %}  {% endblock %}  <input type="hidden" name="{{ step_field }}" value="{{ step0 }}" /> @@ -46,6 +39,9 @@  {% block "footer" %}    <div id="footer">    {% block "validation_bar" %} +    {% if wizard.form.SEARCH_AND_SELECT %} +    <p class="confirm-message">{% trans "Search and select an item in the table" %}</p> +    {% endif %}    {% include 'ishtar/wizard/validation_bar.html' %}    {% endblock %}    {% include 'ishtar/blocks/footer.html' %} diff --git a/ishtar_common/templates/ishtar/wizard/parcels_wizard.html b/ishtar_common/templates/ishtar/wizard/parcels_wizard.html index 28ec962f4..6a553d3c1 100644 --- a/ishtar_common/templates/ishtar/wizard/parcels_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/parcels_wizard.html @@ -1,5 +1,5 @@  {% extends "ishtar/wizard/default_wizard.html" %} -{% load i18n range inline_formset %} +{% load i18n range inline_formset table_form %}  {% block extra_head %}  {{wizard.form.media}}  {% endblock %} @@ -9,19 +9,30 @@  {{ wizard.form.media }}  {{ wizard.management_form }}    {{ wizard.form.management_form }} -{% if automatic_parcel_association %}<p class='alert'><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <label>{%trans "Existing parcels from the operation will be automatically added to the archaeological file." %}</label></p>{% endif %} -  {%if wizard.form.non_form_errors%} -<table class='formset'> -<tr class='error'><th colspan='2'>{{wizard.form.non_form_errors}}</th></tr> -</table>{%endif%} -{{wizard.form.selection_form}} +  {% if automatic_parcel_association %} +  <div class="alert alert-danger" role="alert"> +    {%trans "Existing parcels from the operation will be automatically added to the archaeological file." %} +  </div> +  {% endif %} +  {% if wizard.form.non_form_errors %} +  <div class="alert alert-danger" role="alert"> +    {{wizard.form.non_form_errors}} +  </div>{%endif%} + +  {% bs_form wizard.form.selection_form %} +  <table class='inline-table' id='parcel-table'>    <tr>{% for field in wizard.form.forms.0 %}<th{% if not forloop.last %} rowspan='2'{% endif %}>{{ field.label_tag }}</th>{% endfor %}</tr>    <tr><td>({% trans "all"%} <input type='checkbox' name='check-all' class='check-all'/>)</td></tr>    {% inline_formset 'Parcels' wizard.form.forms False %}  </table>  {% if add_all %}<p><input type='checkbox' name='add_all_parcels' id='add_all_parcels'> <label for='add_all_parcels'>{% trans "Add all parcels from the archaeological file" %}</label></p>{% endif %} -<p><button name="formset_modify" value="{{wizard.steps.current}}">{% trans "Add/Modify" %}</button></p> + +  <div class="text-center"> +      <button class="btn btn-success" name="formset_modify" value="{{wizard.steps.current}}"> +        {% trans "Add/Modify" %} +      </button> +  </div>  <input type="hidden" name="{{ step_field }}" value="{{ step0 }}" />  {{ previous_fields|safe }}    {% block "footer" %} diff --git a/ishtar_common/templates/ishtar/wizard/search.html b/ishtar_common/templates/ishtar/wizard/search.html index e5066cf87..e1f2433ea 100644 --- a/ishtar_common/templates/ishtar/wizard/search.html +++ b/ishtar_common/templates/ishtar/wizard/search.html @@ -4,10 +4,18 @@  {{wizard.form.media}}  {% endblock %}  {% block content %} -<h2>{{wizard_label}}</h2> -<ul id='form_path'> -  <li class='current'><a href='#'>{{current_step.form_label}}</a></li> -</ul> +<h3>{{wizard_label}}</h3> + +{% comment %} +<nav aria-label="breadcrumb" role="navigation"> +  <ol class="breadcrumb"> +    <li class="breadcrumb-item active"> +      <a href='#'>{{current_step.form_label}}</a> +    </li> +  </ol> +</nav> +{% endcomment %} +<form action="." class='wizard-form' id="wizard-form" method="post" name='wizard'>{% csrf_token %}  {% if wizard.form.forms %}  <div class='form'>  <div class='top_button'><input type="submit" id="submit_form" value="{% trans "Validate" %}"/></div> @@ -20,8 +28,10 @@    <tr class='modify'><td colspan="2"><button name="formset_modify" value="{{wizard.steps.current}}">{% trans "Add/Modify" %}</button></td></tr></li>  </table>  {% else %} -<div class='form'> +<div class='form search'>    {{ wizard.form.as_p }}  </div> +</div>  {% endif %} +</form>  {% endblock %} diff --git a/ishtar_common/templates/ishtar/wizard/validation_bar.html b/ishtar_common/templates/ishtar/wizard/validation_bar.html index b99b9e689..0a30fb7e1 100644 --- a/ishtar_common/templates/ishtar/wizard/validation_bar.html +++ b/ishtar_common/templates/ishtar/wizard/validation_bar.html @@ -1,8 +1,24 @@  {% load i18n %} -<div id='validation-bar'> -    <input type="submit" id="submit_form" name='validate' value="{% trans 'Validate' %}"/> +<div id='validation-bar' class="row text-center"> +    <div class="col-sm"> +        <button type="submit" id="submit_form" name='validate' +                value="validate" class="btn btn-success"> +            {% trans 'Validate' %} +        </button> +    </div>      {% if last_step_is_available and next_steps %} -    <input type="submit" id="submit_end_form" name='validate_and_end' value="{% trans 'Validate and end' %}"/> +    <div class="col-sm"> +        <button type="submit" id="submit_end_form" name='validate_and_end' +            value="validate_and_end" class="btn btn-success"> +            {% trans 'Validate and end' %} +        </button> +    </div>      {% endif %} -    <a href="{% url 'reset_wizards' %}" id="reset_wizards" class='button'>{% trans "Cancel" %}</a> +    <div class="col-sm"> +        <a href="{% url 'reset_wizards' %}" id="reset_wizards"> +            <button type="button" class="btn btn-secondary"> +                {% trans "Cancel" %} +            </button> +        </a> +    </div>  </div> diff --git a/ishtar_common/templates/ishtar/wizard/wizard_done.html b/ishtar_common/templates/ishtar/wizard/wizard_done.html index 2823c1bae..5acd6e78e 100644 --- a/ishtar_common/templates/ishtar/wizard/wizard_done.html +++ b/ishtar_common/templates/ishtar/wizard/wizard_done.html @@ -1,14 +1,24 @@  {% extends "base.html" %}  {% load i18n %} + +{% block top_content %} +<div class="alert alert-success alert-dismissible fade show" role="alert"> +    {%trans "Item successfully saved"%}<button type="button" class="close" data-dismiss="alert" aria-label="Close"> +    <span aria-hidden="true">×</span> +</button> +</div> +{% endblock %} +  {% block content %} -<p>{%trans "Item successfully saved"%}</p>  {% if redirect or wizard_done_window %}  <script type='text/javascript' language='javascript'>  {% if redirect %}  window.location.href = "{{redirect}}";  {% endif %}  {% if wizard_done_window %} -$(function(){ load_window("{{wizard_done_window}}{{item.pk}}/"); }); +$(function(){ +    load_window("{{wizard_done_window}}{{item.pk}}/", "", +                function (){}, true); });  {% endif %}  </script>  {% endif %} diff --git a/ishtar_common/templates/ishtar/wizard/wizard_person.html b/ishtar_common/templates/ishtar/wizard/wizard_person.html index e518ecc3d..fc15dbfad 100644 --- a/ishtar_common/templates/ishtar/wizard/wizard_person.html +++ b/ishtar_common/templates/ishtar/wizard/wizard_person.html @@ -1,59 +1,88 @@  {% extends "ishtar/wizard/default_wizard.html" %}  {% load i18n range table_form %}  {% block form_detail %} +{% if form.non_field_errors %} +<div class="alert alert-danger" role="alert"> +  {{form.non_field_errors}} +</div> +{% endif %} -<table class='formset'> -  <caption>{% trans "Identity" %}</caption> -  {% table_field wizard.form.title %} -  {% table_field wizard.form.surname 1 %} -  {% table_field wizard.form.name 1 %} -  {% table_field wizard.form.raw_name %} -  {% table_field wizard.form.email %} -  {% table_field wizard.form.attached_to %} -</table> +{% for hidden in form.hidden_fields %} +{{hidden}} +{% if hidden.errors %}<div class="invalid-feedback"> +  {{ hidden.errors }} +</div>{% endif %} +{% endfor %} -<hr class='spacer'/> -<table class='formset table-form'> -  <caption>{% trans "Phone" %}</caption> -  <tr> -    <th>{% trans "Phone type" %}</th> -    <th>{% trans "Number" context "phone number" %}</th> -  </tr> -  <tr> -    <td>{{ wizard.form.phone_desc.errors }}{{wizard.form.phone_desc|safe}}</td> -    <td>{{ wizard.form.phone.errors }}{{wizard.form.phone|safe}}</td> -  </tr> -  <tr> -    <td>{{ wizard.form.phone_desc2.errors }}{{wizard.form.phone_desc2|safe}}</td> -    <td>{{ wizard.form.phone2.errors }}{{wizard.form.phone2|safe}}</td> -  </tr> -  <tr> -    <td>{{ wizard.form.phone_desc3.errors }}{{wizard.form.phone_desc3|safe}}</td> -    <td>{{ wizard.form.phone3.errors }}{{wizard.form.phone3|safe}}</td> -  </tr> -  <tr> -    <td>{% trans "Mobile phone" %}</td> -    <td>{{ wizard.form.mobile_phone.errors }}{{wizard.form.mobile_phone|safe}}</td> -  </tr> -</table> -<hr class='spacer'/> +<div class="card"> +  <div class="card-header"> +    {% trans "Identity" %} +  </div> +  <div class="card-body form-row"> +    {% bs_field wizard.form.surname 1 %} +    {% bs_field wizard.form.name 1 %} +    {% bs_field wizard.form.title %} +    {% bs_field wizard.form.raw_name %} +    {% bs_field wizard.form.email %} +    {% bs_field wizard.form.attached_to %} +  </div> +</div> -<table class='formset'> -  <caption>{% trans "Business address" %}</caption> -  {% table_field wizard.form.address %} -  {% table_field wizard.form.address_complement %} -  {% table_field wizard.form.postal_code %} -  {% table_field wizard.form.town %} -  {% table_field wizard.form.country %} -</table> -<hr class='spacer'/> -<table class='formset'> -  <caption>{% trans "Other address" %}</caption> -  {% table_field wizard.form.alt_address 0 'Address' %} -  {% table_field wizard.form.alt_address_complement 0 'Address complement' %} -  {% table_field wizard.form.alt_postal_code 0 'Postal code' %} -  {% table_field wizard.form.alt_town 0 'Town' %} -  {% table_field wizard.form.alt_country 0 'Country' %} -</table> +<div class="card"> +  <div class="card-header"> +    {% trans "Phone" %} +  </div> +  <div class="card-body form-row"> +    <table class='table table-striped'> +      <tr> +        <th>{% trans "Phone type" %}</th> +        <th>{% trans "Number" context "phone number" %}</th> +      </tr> +      <tr> +        <td>{{ wizard.form.phone_desc.errors }}{{wizard.form.phone_desc|safe}}</td> +        <td>{{ wizard.form.phone.errors }}{{wizard.form.phone|safe}}</td> +      </tr> +      <tr> +        <td>{{ wizard.form.phone_desc2.errors }}{{wizard.form.phone_desc2|safe}}</td> +        <td>{{ wizard.form.phone2.errors }}{{wizard.form.phone2|safe}}</td> +      </tr> +      <tr> +        <td>{{ wizard.form.phone_desc3.errors }}{{wizard.form.phone_desc3|safe}}</td> +        <td>{{ wizard.form.phone3.errors }}{{wizard.form.phone3|safe}}</td> +      </tr> +      <tr> +        <td>{% trans "Mobile phone" %}</td> +        <td>{{ wizard.form.mobile_phone.errors }}{{wizard.form.mobile_phone|safe}}</td> +      </tr> +    </table> +  </div> +</div> + + +<div class="card"> +  <div class="card-header"> +    {% trans "Business address" %} +  </div> +  <div class="card-body form-row"> +  {% bs_field wizard.form.address %} +  {% bs_field wizard.form.address_complement %} +  {% bs_field wizard.form.postal_code %} +  {% bs_field wizard.form.town %} +  {% bs_field wizard.form.country %} +  </div> +</div> + +<div class="card"> +  <div class="card-header"> +    {% trans "Other address" %} +  </div> +  <div class="card-body form-row"> +  {% bs_field wizard.form.alt_address 0 'Address' %} +  {% bs_field wizard.form.alt_address_complement 0 'Address complement' %} +  {% bs_field wizard.form.alt_postal_code 0 'Postal code' %} +  {% bs_field wizard.form.alt_town 0 'Town' %} +  {% bs_field wizard.form.alt_country 0 'Country' %} +  </div> +</div>  {% endblock %} diff --git a/ishtar_common/templates/navbar.html b/ishtar_common/templates/navbar.html new file mode 100644 index 000000000..a5c135a59 --- /dev/null +++ b/ishtar_common/templates/navbar.html @@ -0,0 +1,59 @@ +{% load i18n %} +<header class="navbar navbar-expand-lg navbar-dark bg-dark"> +    {% block header %} +    <a class="navbar-brand" href="/"> +        <img src="{{STATIC_URL}}media/images/ishtar-blason.svg" +             width="30" height="30" alt=""> +    </a> +    {% include "actions.html" %} +    <button class="navbar-toggler" type="button" +            data-toggle="collapse" data-target="#navbar-actions" +            aria-controls="navbar-actions" aria-expanded="false" +            aria-label="{% trans 'Toggle navigation' %}"> +        <span class="navbar-toggler-icon"></span> +    </button> +    <div class="collapse navbar-collapse justify-content-end" id="navbar-actions"> +    <ul class="navbar-nav"> +        {% if APP_NAME %} +        <li class="nav-item"> +            <a class="navbar-brand" href="/">{{APP_NAME}}</a> +        </li> +        {% endif %} +        {% if user.is_authenticated %} +        <li class="nav-item dropdown"> +            <a class="nav-link dropdown-toggle" data-toggle="dropdown" +               href="#" role="button" aria-haspopup="true" aria-expanded="false">{{ user.username }}</a> +            <div class="dropdown-menu dropdown-menu-right"> +                <a class="dropdown-item" href="{% url 'auth_logout' %}"> +                    {% trans "Log out" %} +                </a> +                <a class="dropdown-item" href="{% url 'auth_password_change' %}"> +                    {% trans "Change password" %} +                </a> +            </div> +        </li> +        {% else %} +        <li class="nav-item"> +            <a class="nav-link" href="{% url 'auth_login' %}">{% trans "Log in" %}</a> +        </li> +        {% endif %} +        {% if LANGUAGES|length > 1 %} +        <li class="nav-item dropdown"> +            <a class="nav-link dropdown-toggle" data-toggle="dropdown" +               href="#" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-flag" aria-hidden="true"></i></a> +                {% csrf_token %} +            <div class="dropdown-menu dropdown-menu-right" id="language-selector"> +                {% for lang in LANGUAGES %}<a class="dropdown-item" href="#" data-lang="{{ lang.0 }}"> +                    {{ lang.1 }} +                </a>{% endfor %} +                <form action="/i18n/setlang/" method="post" id='language-form'> +                    {% csrf_token %} +                    <input name="language" value="{{LANGUAGE_CODE}}"> +                </form> +            </div> +        </li> +        {% endif %} +    </ul> +    </div> +    {% endblock %} +</header> diff --git a/ishtar_common/templates/registration/login.html b/ishtar_common/templates/registration/login.html index e8122f150..3e82a882f 100644 --- a/ishtar_common/templates/registration/login.html +++ b/ishtar_common/templates/registration/login.html @@ -2,18 +2,46 @@  {% load i18n %}  {% block content %} -<div class='form'> -<form method="post" action=".">{% csrf_token %} -<table id='login'> -  <caption>{%trans "Log in"%}</caption> -{{ form.as_table }} -  <tr class='submit'><td colspan='2'><input type="submit" value="{% trans 'Log in' %}" /></td></tr> -  <input type="hidden" name="next" value="{{ next }}" /> -</table> -</form> +<div class="row justify-content-center"> +  <div class="col-md-6"> +    <h4>{%trans "Log in"%}</h4> +    <form method="post" action=".">{% csrf_token %} +        <input type="hidden" name="next" value="{{ next }}" /> +      {% if form.non_field_errors %} +      <div class="form-group row"> +          {% for error in form.non_field_errors %} +          <div class="form-group has-errors text-danger small"> +              {{error}} +          </div> +          {% endfor %} +      </div> +      {% endif %} + +      {% for field in form %} +      {% if field.errors %} +      <div class="form-group row has-errors text-danger small"> +        {{field.errors}} +      </div> +      {% endif %} +      <div class="form-group row"> +          <label for="{{field.id}}" class="col-6 col-form-label">{{field.label}}</label> +          <div class="col-6">{{field}}</div> +      </div> +      {% endfor %} + +      <div class="row justify-content-center"> +        <div class="col-12"> +           <button type="submit" class="btn btn-primary">{% trans 'Log in' %}</button> +        </div> +      </div> +    </form> +  </div>  </div> -<div class='info'> -<p>{% trans "Forgot password?" %} <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a></p> -<p>{% trans "Not member?" %} <a href="{% url 'registration_register' %}">{% trans "Register" %}</a></p> +<hr/> +<div class="row justify-content-center"> +    <div class="col-md-6"> +        <small class="text-secondary">{% trans "Forgot password?" %} <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a> – +        {% trans "Not member?" %} <a href="{% url 'registration_register' %}">{% trans "Register" %}</a></small> +    </div>  </div>  {% endblock %} diff --git a/ishtar_common/templates/sheet_ope.html b/ishtar_common/templates/sheet_ope.html deleted file mode 100644 index 1e18e8b7e..000000000 --- a/ishtar_common/templates/sheet_ope.html +++ /dev/null @@ -1,146 +0,0 @@ -{% extends "sheet.html" %} -{% load i18n %} -{% block content %} -<div class='tool'>{%trans "Export as:"%} <a href='{% url show-file item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-file item.pk "pdf" %}'>{%trans "PDF file"%}</a></div> -<h3>{% trans "General"%}</h3> -<p><label>{%trans "Year:"%}</label> <span class='value'>{{ item.year }}</span></p> -<p><label>{%trans "Numerical reference:"%}</label> <span class='value'>{{ item.numeric_reference }}</span></p> - -{% if item.patriarche_code %}<p><label>{%trans "Patriarche OA code:"%}</label> <span class='value'>{{ item.patriarche_code }}</span></p>{%endif%} -{% if item.patriarche_code_not_recorded %}<p><label>{%trans "Patriarche OA code not yet recorded !"%}</label></p>{%endif%} - -<p><label>{%trans "Operation's name:"%}</label> <span class='value'>{{ item.internal_reference }}</span></p> - -<p><label>{%trans "Edition date:"%}</label> <span class='value'>{{ item.history.all.0.history_date }}</span></p> <!-- date = now --> - -<p><label>{%trans "Begining date:"%}</label> <span class='value'>{{ item.begin_date }}</span></p> -<p><label>{%trans "Field work end date:"%}</label> <span class='value'>{{ item.end_date }}</span></p> - -<p><label>{%trans "Head scientist:"%}</label> <span class='value'>{{ item.head_scientist.full_label }}</span></p> -<p><label>{%trans "State:"%}</label> <span class='value'>{% if item.is_active %}{%trans "Active file"%}</span></p> -{% else %}{%trans "Closed operation"%}</span></p> -<p><label>{%trans "Closing date:"%}</label> <span class='value'>{{ item.closing.date }} <strong>{%trans "by" %}</strong> {{ item.closing.user }}</span></p> -{% endif %} -<p><label>{%trans "Type:"%}</label> <span class='value'>{{ item.operation_type }}</span></p> -<p><label>{%trans "Surface:"%}</label> <span class='value'>{{ item.total_surface }} m<sup>2</sup> ({{ item.total_surface_ha }} ha)</span></p> -<p><label>{%trans "Cost:"%}</label> <span class='value'>{{ item.cost }} Euros, ({{ item.cost_by_m2 }} Euros/m<sup>2</sup>)</span></p> -<p><label>{%trans "Duration:"%}</label> <span class='value'>{{ item.duration }} {%trans "Day"%}s</span></p> - -<p><label>{%trans "Remains:"%}</label> <span class='value'>{{ item.remains.all|join:", " }}</span></p> -<p><label>{%trans "Periods:"%}</label> <span class='value'>{{ item.periods.all|join:", " }}</span></p> - -{% if item.related_file %} -<p><label>{%trans "Related file:"%}</label> <span class='value'><a href='{% url show-file item.related_file.pk ''%}'>{{ item.related_file }}</a></span></p><!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file --> -{% if item.related_file.is_preventive %} -{% if item.operator_reference_code %}<p><label>{%trans "Operator's reference code:"%}</label> <span class='value'>{{ item.operator_reference_code }}</span></p>{% endif %} -{% if item.related_file.town_planning_service %}<p><label>{%trans "Planning service:"%}</label> <span class='value'>{{ item.related_file.town_planning_service }}</span></p>{% endif %} -{% if item.related_file.permit_type %}<p><label>{%trans "Permit type:"%}</label> <span class='value'>{{ item.related_file.permit_type }}</span></p>{% endif %} -{% if item.related_file.permit_reference %}<p><label>{%trans "Permit reference:"%}</label> <span class='value'>{{ item.related_file.permit_reference }}</span></p>{% endif %} -{% if item.related_file.general_contractor.attached_to %}<p><label>{%trans "General contractor organisation:"%}</label> <span class='value'>{{ item.related_file.general_contractor.attached_to }}</span></p>{% endif %} <!-- Contractor's organisation displayed as concat of Name/Adress/postal_code/city --> -{% if item.related_file.general_contractor %}<p><label>{%trans "General contractor:"%}</label> <span class='value'>{{ item.related_file.general_contractor.full_label }}</span></p>{% endif %} -{% endif %} -{% endif %} -  -{% if item.comment %}<p><label>{%trans "Comment:"%}</label> <span class='value'>{{ item.comment }}</span></p>{%endif%} - -<h3>{% trans "Localisation"%}</h3> -<p><label>{%trans "Towns:"%}</label> <span class='value'>{{ item.towns.all|join:", " }}</span></p> - -<p><label>{%trans "Main address:"%}</label> <span class='value'>{{ item.address }}</span></p> -{% if item.address_complement %}<p><label>{%trans "Complement:"%}</label> <span class='value'>{{ item.address_complement }}</span></p>{%endif%} -{% if item.postal_code %}<p><label>{%trans "Postal code:"%}</label> <span class='value'>{{ item.postal_code }}</span></p>{%endif%} - -<p><label>{%trans "Lambert X:"%}</label> <span class='value'>{{ item.lambert_x }}</span></p> -<p><label>{%trans "Lambert Y:"%}</label> <span class='value'>{{ item.lambert_y }}</span></p> -<p><label>{%trans "Altitude (m NGF):"%}</label> <span class='value'>{{ item.altitude }}</span></p> - -<table> -  <caption>{%trans "Associated parcels"%}</caption> -  <tr> -    <th>{% trans "Commune" %}</th> -    <th>{% trans "Year" %}</th> -    <th>{% trans "Section" %}</th> -    <th>{% trans "Parcel" %}</th> -    <th>{% trans "Owner" %}</th> -  </tr> -  {% for parcels in item.parcel.all %} -  <tr> -    <td>{{operation.commune}}</td> -    <td>{{operation.year}}</td> -    <td>{{operation.section}}</td> -    <td>{{operation.parcel}}</td> -    <td class='string'>{{operation.parcel.owner}}</td> -  </tr> -  {% empty %} -  <tr><td colspan="5" class='no_items'>{% trans "No parcel associated to this operation" %}</td></tr> -  {% endfor %} -</table> - -<h3>{% trans "Admninistrative acts"%}</h3> -<table> -  <caption>{%trans "Admninistrative acts"%}</caption> -  <tr> -    <th>{% trans "Year" %}</th> -    <th>{% trans "Reference" %}</th> -    <th>{% trans "Type" %}</th> -    <th>{% trans "Date" %}</th> -  </tr> -  {% for act in item.administrative_act.all %} -  <tr> -    <td>{{act.signature_date.year}}</td> -    <td>{{act.ref_sra}}</td> -    <td class='string'>{{act.act_type}}</td> -    <td>{{act.signature_date}}</td> -  </tr> -  {% empty %} -  <tr><td colspan="4" class='no_items'>{% trans "No administrative act associated to this operation" %}</td></tr> -  {% endfor %} -</table> - -<h3>{% trans "Documentation"%}</h3> -<table> -  <caption>{%trans "Documents"%}</caption> -  <tr> -    <th>{% trans "Title" %}</th> -    <th>{% trans "Type" %}</th> -    <th>{% trans "Authors" %}</th> -    <th>{% trans "Localisation" %}</th> -  </tr> -  {% for doc in item.doc.all %} -  <tr> -    <td>{{ doc.title }}</td> -    <td class='string'>{{doc.type}}</td> -    <td>{{ doc.author.all|join:", " }}</td> -    <td>{{ doc.localisation }}</td> -  </tr> -  {% empty %} -  <tr><td colspan="4" class='no_items'>{% trans "No document associated to this operation" %}</td></tr> -  {% endfor %} -</table> - -<h3>{% trans "Context Records"%}</h3> -<table> -  <caption>{%trans "Context Records"%}</caption> -  <tr> -    <th>{% trans "ID" %}</th> -    <th>{% trans "Type" %}</th> -    <th>{% trans "Chronology" %}</th> -    <th>{% trans "Description" %}</th> -    <th>{% trans "Parcel" %}</th> -    <th class='link'> </th> -  </tr> -  {% for record_unit in item.record_unit.all %} -  <tr> -    <td>{{ record_unit.label }}</td> -    <td class='string'>{{record_unit.unit_type}}</td> -    <td>{{ record_unit.period.all|join:", " }}</td> -    <td>{{ record_unit.description }}</td> -    <td>{{ record_unit.section_and_parcel }}</td><!-- Displayed as (Section)-(parcel number). A record unit can be linked to only one parcel. --> -    <td class='link'><a href="#{#{%url show-record_unit record_unit.pk%}#}">{% trans "Details" %}</a></td> -  </tr> -  {% empty %} -  <tr><td colspan="6" class='no_items'>{% trans "No context record associated to this operation" %}</td></tr> -  {% endfor %} -</table> - -{% endblock %} diff --git a/ishtar_common/templates/welcome.html b/ishtar_common/templates/welcome.html index 4b9f3b5c5..59a53d759 100644 --- a/ishtar_common/templates/welcome.html +++ b/ishtar_common/templates/welcome.html @@ -1,11 +1,21 @@  {% load i18n %}  <h2>{% trans "Welcome in Ishtar, open source software for management and inventory of archaeological data" %}</h2> -{{random_image}} -<p>{% trans "Some useful links:" %}</p> -<ul> -    <li><a href='https://ishtar-archeo.net' target="_blank">{% trans "Presentation site and blog" %}</a>{% trans ":"%} {% trans "stay tuned with Ishtar news!" %}</li> -    <li><a href='{% url 'admin:index' %}' target="_blank">{% trans "Admin interface" %}</a>{% trans ":"%} {% trans "for admin only." %}</li> -    <li><a href="https://forum.ishtar-archeo.net/" target="_blank">{% trans "Forum" %}</a>{% trans ":"%} {% trans "need help? find a new bug? a fantastic feature to propose? Here is the place to go." %}</li> -    <li><a href="https://gitlab.com/iggdrasil/ishtar" target="_blank">{% trans "Source code" %}</a> – <a href="https://tickets.iggdrasil.net/projects/ishtar" target="_blank">{% trans "tickets" %}</a>{% trans ":"%} {% trans "where the magic happens." %}</li> -</ul> +<div class="row"> +    <div class="col col-lg-4"> +        {{random_image}} +    </div> +    <div class="col col-lg-8"> +        <div class="card"> +            <div class="card-body"> +                <p>{% trans "Some useful links:" %}</p> +                <ul> +                    <li><a href='https://ishtar-archeo.net' target="_blank">{% trans "Presentation site and blog" %}</a>{% trans ":"%} {% trans "stay tuned with Ishtar news!" %}</li> +                    <li><a href="{% url 'admin:index' %}" target="_blank">{% trans "Admin interface" %}</a>{% trans ":"%} {% trans "for admin only." %}</li> +                    <li><a href="https://forum.ishtar-archeo.net/" target="_blank">{% trans "Forum" %}</a>{% trans ":"%} {% trans "need help? find a new bug? a fantastic feature to propose? Here is the place to go." %}</li> +                    <li><a href="https://gitlab.com/iggdrasil/ishtar" target="_blank">{% trans "Source code" %}</a> – <a href="https://tickets.iggdrasil.net/projects/ishtar" target="_blank">{% trans "tickets" %}</a>{% trans ":"%} {% trans "where the magic happens." %}</li> +                </ul> +            </div> +        </div> +    </div> +</div> diff --git a/ishtar_common/templates/widgets/image_input.html b/ishtar_common/templates/widgets/image_input.html new file mode 100644 index 000000000..79be1aaf9 --- /dev/null +++ b/ishtar_common/templates/widgets/image_input.html @@ -0,0 +1,15 @@ +<div class="form-row form-control"> +    {% if is_initial %} +    <span class="col-4"> +        <a href="{{ widget.value.url }}"> +            <img class="form-thumbnail" src="{{ widget.value.url }}"> +        </a> +    </span>{% endif %} +    <span class="col-8"> +    {% if not widget.required and is_initial %} +        <input type="checkbox" name="{{ checkbox_name }}" id="{{ checkbox_id }}" /> +        <label for="{{ checkbox_id }}">{{ clear_checkbox_label }}</label> +    {% endif %} +        <input type="{{ widget.type }}" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %} /> +    </span> +</div>
\ No newline at end of file diff --git a/ishtar_common/templates/window.html b/ishtar_common/templates/window.html index 1ff790780..dcb4d4084 100644 --- a/ishtar_common/templates/window.html +++ b/ishtar_common/templates/window.html @@ -12,7 +12,6 @@      </script>      <script language="javascript" type="text/javascript" src="{{JQUERY_URL}}?ver={{VERSION}}"></script>      <script language="javascript" type="text/javascript" src="{{JQUERY_UI_URL}}jquery-ui.js?ver={{VERSION}}"></script> -    <script language="javascript" type="text/javascript" src="{{JQUERY_UI_URL}}ui/i18n/jquery.ui.datepicker-{{COUNTRY}}.js?ver={{VERSION}}"></script>      <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/chosen/chosen.jquery.min.js?ver={{VERSION}}"></script>      <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/ishtar.js?ver={{VERSION}}"></script>      {{form.media}} | 
