diff options
Diffstat (limited to 'ishtar_common/templates')
14 files changed, 242 insertions, 125 deletions
diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html index b9270d910..ef3060a5f 100644 --- a/ishtar_common/templates/base.html +++ b/ishtar_common/templates/base.html @@ -40,6 +40,7 @@ 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 added_message = "{% trans " items added." %}"; var YES = "{% trans 'yes' %}"; var NO = "{% trans 'no' %}"; var autorefresh_message_start = "{% trans 'Autorefresh start. The form is disabled.' %}"; @@ -141,7 +142,8 @@ {% 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"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close" + onclick="closed_wait = true;return true;"> <span aria-hidden="true">×</span> </button> </div> diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html index 70d47cb8d..b5f669963 100644 --- a/ishtar_common/templates/blocks/DataTables.html +++ b/ishtar_common/templates/blocks/DataTables.html @@ -10,12 +10,6 @@ <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"> @@ -140,8 +134,6 @@ datatable_submit_search = function(){ return false; }; - - jQuery(document).ready(function(){ jQuery("#search_{{name}}").click(datatable_submit_search); @@ -162,16 +154,35 @@ jQuery(document).ready(function(){ "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' %}" + {% if multiple_select or quick_actions %}"buttons": [ + {% for url, title, icon, target in quick_actions %} + { + {% if target == 'one' %}extend: 'selectedSingle', + {% elif target == 'many' %}extend: 'selected', + {% endif %} + className: "btn btn-success", + text: "{{icon}}", + titleAttr: "{{title}}", + action: function (e, dt, node, config) { + var url = dt_generate_qa_url(dt, "{{url}}"); + dt_qa_open(url); + return false; + } + }, + {% if not forloop.last %},{% endif %} + {% endfor %}{% if multiple_select %}{% if quick_actions%},{% endif %} + { + extend: 'selectAll', + text: '<i class="fa fa-check-circle-o"></i>', + titleAttr: "{% trans 'Select all items' %}" + }, + { + extend: 'selectNone', + text: '<i class="fa fa-times"></i>', + titleAttr: "{% trans 'Deselect' %}" } - }, + {% endif %} + ], "dom": 'lBtip', {% else %} "dom": 'ltip', @@ -190,49 +201,6 @@ jQuery(document).ready(function(){ 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}}"); @@ -273,8 +241,10 @@ jQuery(document).ready(function(){ {% if multiple_select %} var value = ""; for (k in data){ - if (k > 0) value += ","; - value += data[k]['id']; + if (typeof data[k]['id'] != "undefined") { + if (value) value += ","; + value += data[k]['id']; + } } {% else %} var value = data[0]['id']; diff --git a/ishtar_common/templates/blocks/bs_form_snippet.html b/ishtar_common/templates/blocks/bs_form_snippet.html index 95b8ac086..0f5f9d83d 100644 --- a/ishtar_common/templates/blocks/bs_form_snippet.html +++ b/ishtar_common/templates/blocks/bs_form_snippet.html @@ -12,6 +12,7 @@ </div>{% endif %} {% endfor %} +{% csrf_token %} {% for field in form.visible_fields %} {% if form.SEARCH_AND_SELECT %} {{field}} @@ -48,22 +49,9 @@ <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> + <div class="form-group col-12" id="advanced-search-info"></div> </div> - <div class="modal-body form-row"> - <div class="form-group col-12" id="advanced-search-info"> - </div> - <div class="form-group col-12"> - <p class="text-center"> - <button type="button" - class="btn btn-primary advanced-search-valid"> - {% trans "Add" %}</button> - <button type="button" - class="btn btn-secondary advanced-search-clear"> - {% trans 'Clear' %}</button> - <button type="button" class="btn btn-secondary" - data-dismiss="modal">{% trans 'Close' %}</button> - </p> - </div> + <div class="modal-body body-scroll"> <hr> {% endif %} {% if field.name in form.HEADERS %} @@ -91,6 +79,8 @@ {% if search and forloop.counter0 >= 1 %} </div> + </div> + <div class="modal-footer"> <div class="form-group col-12"> <p class="text-center"> <button type="button" diff --git a/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html b/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html index 953b0ef40..e1dc852d9 100644 --- a/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html +++ b/ishtar_common/templates/ishtar/blocks/advanced_shortcut_menu.html @@ -1,27 +1,36 @@ {% extends "ishtar/blocks/base_shortcut_menu.html" %} {% load i18n %} {% block short_content %} -<div class="short-menu-buttons btn-group" role="group"> - <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' 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 class="d-flex"> + <div class="short-menu-buttons btn-group p-2" role="group"> + <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' class="btn-group p-2" 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> + <div class="short-menu-buttons btn-group ml-auto p-2" role="group"> + <button type="button" class="btn btn-secondary active" + id='short-menu-refresh' onclick="location.reload();" + title="{% trans 'Refresh current page' %}"> + <i class="icon fa fa-refresh" aria-hidden="true"></i> + </button> + </div> </div> <p id='current_items'> {% for lbl, model_name, current, widget in menu %} diff --git a/ishtar_common/templates/ishtar/blocks/shortcut_menu.html b/ishtar_common/templates/ishtar/blocks/shortcut_menu.html index 10113aa59..447deb573 100644 --- a/ishtar_common/templates/ishtar/blocks/shortcut_menu.html +++ b/ishtar_common/templates/ishtar/blocks/shortcut_menu.html @@ -1,10 +1,19 @@ {% extends "ishtar/blocks/base_shortcut_menu.html" %} {% load i18n %} {% block short_content %} -<div class="short-menu-buttons btn-group" role="group"> - <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 class="d-flex"> + <div class="short-menu-buttons btn-group p-2" role="group"> + <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 class="short-menu-buttons btn-group ml-auto p-2" role="group"> + <button type="button" class="btn btn-secondary active" + id='short-menu-refresh' onclick="location.reload();" + title="{% trans 'Refresh current page' %}"> + <i class="icon fa fa-refresh" aria-hidden="true"></i> + </button> + </div> </div> <div> <p class="alert alert-info mt-2"> diff --git a/ishtar_common/templates/ishtar/blocks/window_image_detail.html b/ishtar_common/templates/ishtar/blocks/window_image_detail.html index b095c8b04..5be68eeef 100644 --- a/ishtar_common/templates/ishtar/blocks/window_image_detail.html +++ b/ishtar_common/templates/ishtar/blocks/window_image_detail.html @@ -112,7 +112,7 @@ </div> </div> {% endif %} -{% if image.item_number %} +{% if image.item_number and image.item_number != 1 %} <div class="row"> <div class="col-2"> <strong>{% trans "Number of items" %}</strong> diff --git a/ishtar_common/templates/ishtar/blocks/window_nav.html b/ishtar_common/templates/ishtar/blocks/window_nav.html index 764797ce2..6cd4bff40 100644 --- a/ishtar_common/templates/ishtar/blocks/window_nav.html +++ b/ishtar_common/templates/ishtar/blocks/window_nav.html @@ -31,26 +31,32 @@ {% 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' %}"> - {% if pin_action and item.SLUG %} - <a class="btn btn-secondary" href="#" class='pin-action' + {% if pin_action and item.SLUG %} + <div class="btn-group btn-group-sm" role="group" + aria-label="{% trans 'Pin' %}"> + <a class="btn btn-secondary pin-action" href="#" 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> + <i class="fa fa-thumb-tack"></i> </a> - {% endif %} + </div> + {% endif %} + <div class="btn-group btn-group-sm" role="group" aria-label="{% trans 'Actions' %}"> {% block extra_actions %}{% endblock %} {% if modify_url %} - <a class="btn btn-secondary" href='{% url modify_url item.pk %}' + <a class="btn btn-success" href='{% url modify_url item.pk %}' title="{% trans 'Modify' %}"> <i class="fa fa-pencil"></i> </a> {% endif %} - {% for url, base_text, icon, extra_text, css_class in extra_actions %} - <a class="btn btn-secondary{% if css_class %} {{css_class}}{% endif %}" - href='{{url}}' title="{{base_text}}"> + {% for url, base_text, icon, extra_text, css_class, is_qa in extra_actions %} + <a class="{% if is_qa %}btn-qa {% endif %}btn btn-success{% if css_class %} {{css_class}}{% endif %}" + {% if is_qa %}href="#" data-target="{{url}}"{% else %}href='{{url}}'{% endif %} title="{{base_text}}"> <i class="{{icon}}"></i> {{extra_text}} </a> {% endfor %} + </div> + <div class="btn-group btn-group-sm" role="group" + aria-label="{% trans 'Export' %}"> <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> @@ -66,3 +72,8 @@ {% trans "Relation between items are not historized." %} </div> {% endif %} +<script type="text/javascript"> +$(document).ready(function(){ + register_qa_on_sheet(); +}); +</script>
\ No newline at end of file diff --git a/ishtar_common/templates/ishtar/forms/bookmark_delete.html b/ishtar_common/templates/ishtar/forms/bookmark_delete.html new file mode 100644 index 000000000..4a0b907ff --- /dev/null +++ b/ishtar_common/templates/ishtar/forms/bookmark_delete.html @@ -0,0 +1,7 @@ +{% extends "ishtar/forms/qa_base.html" %} +{% load i18n inline_formset table_form %} + +{% block main_form %} + <p>{% trans "Are you sure you want to delete: " %} {{item}}</p> +{% endblock %} + diff --git a/ishtar_common/templates/ishtar/forms/qa_base.html b/ishtar_common/templates/ishtar/forms/qa_base.html new file mode 100644 index 000000000..70fe70e65 --- /dev/null +++ b/ishtar_common/templates/ishtar/forms/qa_base.html @@ -0,0 +1,77 @@ +{% load i18n inline_formset table_form %} + +<div + class="modal-dialog {% if modal_size == 'large' %}modal-lg {% elif modal_size == 'small'%}modal-sm {% endif%}modal-dialog-centered"> + <div class="modal-content"> + <div class="modal-header"> + <h2>{{page_name|safe}}</h2> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <form enctype="multipart/form-data" action="{{url}}" method="post" + id="qa-action">{% csrf_token %} + <div class="modal-body body-scroll"> + <div class='form'> + {% block main_form %} + + {% for error in form.non_field_errors %} + <p>{{ error }}</p> + {% endfor %} + {% bs_form form %} + + {% if confirm %} + <input type="hidden" name="confirm" value="1"/> + <h4>{% trans "Modified items" %}</h4> + <ul>{% for item in items %} + <li>{{item}}</li>{% endfor %} + </ul> + <h4>{% trans "Modification" %}</h4> + <table> + {% for field in form %} + {% if field.value %} + <tr> + <th>{{field.label}}{% trans ":" %} </th> + <td>{% if field.field.rendered_value %} + {{ field.field.rendered_value }} + {% else %} + {{ field.value }} + {% endif %} + </td> + </tr> + {% endif %} + {% endfor %} + </table> + {% endif %} + + {% endblock %} + </div> + </div> + <div class="modal-footer"> + {% block footer %} + <button type="submit" id="submit_form" name='validate' + value="validate" class="btn btn-success"> + {% if action_name %} + {{ action_name }} + {% else %} + {% trans "Modify" %} + {% endif %} + </button> + <button type="button" data-dismiss="modal" + aria-label="Close" class="btn btn-secondary"> + {% trans "Cancel" %} + </button> + {% endblock %} + </div> + </form> + </div> +</div> +<script type="text/javascript"> + {% block js %} + {% endblock %} + $(document).ready(function(){ + qa_action_register("{{url}}"); + }); +</script> + + diff --git a/ishtar_common/templates/ishtar/forms/qa_form.html b/ishtar_common/templates/ishtar/forms/qa_form.html new file mode 100644 index 000000000..c843dbd2d --- /dev/null +++ b/ishtar_common/templates/ishtar/forms/qa_form.html @@ -0,0 +1,33 @@ +{% extends "ishtar/forms/qa_base.html" %} +{% load i18n inline_formset table_form %} + +{% block main_form %} + {% for error in form.non_field_errors %} + <p>{{ error }}</p> + {% endfor %} + {% bs_form form %} + + {% if confirm %} + <input type="hidden" name="confirm" value="1"/> + <h4>{% trans "Modified items" %}</h4> + <ul>{% for item in items %} + <li>{{item}}</li>{% endfor %} + </ul> + <h4>{% trans "Modification" %}</h4> + <table> + {% for field in form %} + {% if field.value %} + <tr> + <th>{{field.label}}{% trans ":" %} </th> + <td>{% if field.field.rendered_value %} + {{ field.field.rendered_value }} + {% else %} + {{ field.value }} + {% endif %} + </td> + </tr> + {% endif %} + {% endfor %} + </table> + {% endif %} +{% endblock %} diff --git a/ishtar_common/templates/ishtar/forms/success.html b/ishtar_common/templates/ishtar/forms/success.html index 77fa260d1..3b28ac1d8 100644 --- a/ishtar_common/templates/ishtar/forms/success.html +++ b/ishtar_common/templates/ishtar/forms/success.html @@ -9,7 +9,7 @@ $(document).ready(function(){ }); </script> -<div class="modal-dialog modal-sm" id="form-result-div"> +<div class="modal-dialog modal-sm modal-dialog-centered" id="form-result-div"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> @@ -17,7 +17,7 @@ $(document).ready(function(){ </button> </div> <div class="modal-body form-row"> - {% trans "Form successfully submited" %} + {% trans "Changes made successfully." %} </div> </div> </div> diff --git a/ishtar_common/templates/ishtar/manage_basket.html b/ishtar_common/templates/ishtar/manage_basket.html index 26dd75c4c..28d713e9a 100644 --- a/ishtar_common/templates/ishtar/manage_basket.html +++ b/ishtar_common/templates/ishtar/manage_basket.html @@ -2,20 +2,24 @@ {% load i18n inline_formset %} {% block content %} <h2>{{page_name}}{% trans ":"%} {{basket}}</h2> -<form enctype="multipart/form-data" action="." method="post">{% csrf_token %} -<div class='form'> +<form enctype="multipart/form-data" action="." method="post" + id="wizard-form">{% csrf_token %} +<div class='form' id="basket-manage"> <div class="alert alert-warning" role="alert"> {% trans 'Checking "Select all" only selects the current page.' %} </div> {{form}} - <div class="text-center"> + <div class="text-center" id="basket-add-button"> <button class="btn btn-primary" type="button" id='add_to'> - {% trans "Add" %} + <span class="d-none d-lg-block">{% trans "Add" %}</span> + <span class="d-block d-lg-none">></span> </button> </div> -<h3>{% trans "Basket content" %}</h3> -<div id='basket-content' style='text-align:left'> -</div> + <div id="basket-content-wrapper"> + <h3>{% trans "Basket content" %}</h3> + <div id='basket-content'> + </div> + </div> {% block "footer" %} <div id="footer"> <div id='validation-bar'> @@ -30,10 +34,14 @@ </form> <script type='text/javascript' language='javascript'> +var current_item_number = 0; + function load_list(data, last){ $('#basket-content').html(data); - if (last){ + if (last == true){ close_wait(); + var added = $("#basket-content li").length - current_item_number; + display_info(added + added_message); } } @@ -41,6 +49,7 @@ $('#add_to').click(function(){ var selected_items = datatable_pk.rows( { selected: true } ).data(); if(!selected_items) return false; $('.modal-progress').modal('show'); + current_item_number = $("#basket-content li").length; for (i = 0, n = selected_items.length; i < n; i++) { var selected_item = selected_items[i]['id']; last = i == n - 1; diff --git a/ishtar_common/templates/ishtar/sheet_document.html b/ishtar_common/templates/ishtar/sheet_document.html index 3b178c29e..af94f8fbe 100644 --- a/ishtar_common/templates/ishtar/sheet_document.html +++ b/ishtar_common/templates/ishtar/sheet_document.html @@ -31,7 +31,7 @@ {% 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 %} + {% if item.item_number != 1 %}{% field_flex "Item number" item.item_number %}{% endif %} {% field_flex "Ref." item.reference %} {% field_flex "Internal ref." item.internal_reference %} {% field_flex "Creation date" item.creation_date %} diff --git a/ishtar_common/templates/widgets/search_input.html b/ishtar_common/templates/widgets/search_input.html index 0cdf74cc5..e63d067a9 100644 --- a/ishtar_common/templates/widgets/search_input.html +++ b/ishtar_common/templates/widgets/search_input.html @@ -2,7 +2,7 @@ <input type="{{ widget.type }}" name="{{ widget.name }}" {% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} /> <span class="input-group-append"> - <span class="input-group-text input-link" + <span class="input-group-text input-link bg-primary text-white" title="{% trans 'Search' %}" id="submit-search"> <i class="fa fa-search" aria-hidden="true"></i> |
