diff options
| -rw-r--r-- | changelog/en/changelog_2022-06-15.md | 6 | ||||
| -rw-r--r-- | changelog/fr/changelog_2023-01-25.md | 7 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/window_nav.html | 30 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/sheet.html | 4 | ||||
| -rw-r--r-- | ishtar_common/templatetags/window_header.py | 2 | ||||
| -rw-r--r-- | ishtar_common/views_item.py | 1 | 
6 files changed, 36 insertions, 14 deletions
diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md index 0619163cc..d045ac087 100644 --- a/changelog/en/changelog_2022-06-15.md +++ b/changelog/en/changelog_2022-06-15.md @@ -1,3 +1,9 @@ +v4.0.51 - 2099-07-03 +-------------------- + +### Features/improvements ### +- sheet: add a refresh button to update informations +  v4.0.50 - 2023-07-03  -------------------- diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md index 3c49c25dc..794b328aa 100644 --- a/changelog/fr/changelog_2023-01-25.md +++ b/changelog/fr/changelog_2023-01-25.md @@ -1,3 +1,10 @@ +v4.0.51 - 2099-07-03 +-------------------- + +### Fonctionnalités/améliorations ### +- fiche : ajouter un bouton de rafraîchissement pour mettre à jour les informations + +  v4.0.50 - 2023-07-03  -------------------- diff --git a/ishtar_common/templates/ishtar/blocks/window_nav.html b/ishtar_common/templates/ishtar/blocks/window_nav.html index c1d96acde..41572c5f2 100644 --- a/ishtar_common/templates/ishtar/blocks/window_nav.html +++ b/ishtar_common/templates/ishtar/blocks/window_nav.html @@ -1,11 +1,23 @@ -{% load i18n ishtar_helpers %} +{% load l10n i18n ishtar_helpers %} +<script type="text/javascript">{% localize off %} +    var current_url_{{window_id_underscore}}; +    var reload_window_{{window_id_underscore}} = function() { +        load_window(current_url_{{window_id_underscore}}, +                    '', function(){hide_window("{{window_id}}");}, +                    true); +    }; +{% endlocalize %}</script>  {% if not item.is_external %}  <div class="row toolbar"> -  {% if current_user.is_superuser %} -  {% 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="{% trans 'Refresh' %}" +                onclick="reload_window_{{window_id_underscore}}();return false;"> +            <i class="fa fa-refresh"></i> +        </button> +        {% if current_user.is_superuser and previous %}            <button type="button" class="btn btn-secondary"                    data-toggle="tooltip" data-placement="bottom"                    title="{{previous|date}} {{previous|time:'H:i'}}" @@ -13,10 +25,10 @@                <i class="fa fa-step-backward"></i>            </button>          {% endif %} -        {% if next %} +        {% if current_user.is_superuser and 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"%}", function(){closeAllWindows();load_window("{% url show_url item.pk None %}");});}' +                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"%}", function(){closeAllWindows();load_window("{% url show_url item.pk None %}");});}'                  title="{% trans 'Restore this version' %}">              <i class="fa fa-history"></i>          </button> @@ -30,12 +42,6 @@      </div>    </div>    <div class='offset-md-1 col-md-9 text-right'> -  {% else %} -  <div class='offset-md-3 col-md-9 text-right'> -  {% endif %} -  {% else %} -  <div class='offset-md-6 col-md-6 text-right'> -  {% endif %}        {% if pin_action and item.SLUG %}        <div class="btn-group btn-group-sm" role="group"             aria-label="{% trans 'Pin' %}"> diff --git a/ishtar_common/templates/ishtar/sheet.html b/ishtar_common/templates/ishtar/sheet.html index f3df2e510..49c06b0a6 100644 --- a/ishtar_common/templates/ishtar/sheet.html +++ b/ishtar_common/templates/ishtar/sheet.html @@ -77,8 +77,8 @@          {% if output != "ODT" and output != "PDF" %}          {% block head_sheet %}          <script type="text/javascript">{% localize off %} -        var last_window='{{window_id}}'; - +        var last_window = '{{window_id}}'; +        var current_url_{{window_id_underscore}} = "{{current_window_url}}{{item.pk}}/";          jQuery(document).ready(function(){              if (! get_next_table_id("{{item.pk}}")){                  jQuery('.next_page').hide(); diff --git a/ishtar_common/templatetags/window_header.py b/ishtar_common/templatetags/window_header.py index 5d0e85f72..c36cbc465 100644 --- a/ishtar_common/templatetags/window_header.py +++ b/ishtar_common/templatetags/window_header.py @@ -44,6 +44,7 @@ def window_nav(context, item, window_id, show_url, modify_url='', histo_url='',          'revert_url': revert_url,          'item': item,          'window_id': window_id, +        'window_id_underscore': window_id.replace("-", "_"),          'previous': previous,          'next': nxt,          'extra_actions': extra_actions, @@ -91,6 +92,7 @@ def window_file_nav(context, item, window_id, previous=None, nxt=None):          'item': item,          'extra_action': mark_safe(add_operation),          'window_id': window_id, +        'window_id_underscore': window_id.replace("-", "_"),          'previous': previous,          'next': nxt,          'extra_actions': extra_actions, diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 1cb0b80f2..da1543e7b 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -367,6 +367,7 @@ def show_item(model, name, extra_dct=None, model_for_perms=None):              date = dct.pop("date")          dct["sheet_id"] = f"{name}-{pk}"          dct["window_id"] = f"{name}-{pk}-{datetime.datetime.now().strftime('%M%s')}" +        dct["window_id_underscore"] = dct["window_id"].replace("-", "_")          if str(pk).startswith("source-"):              return show_source_item(request, pk, model, name, dct, extra_dct)          try:  | 
