diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-26 17:29:01 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-26 17:48:33 +0200 |
commit | a4cef6296c811f0ecf894611a2e66551059a9f15 (patch) | |
tree | ed0af6cdf94ef653f4c8e76c9b5e696fcb7c2497 /ishtar_common/templates | |
parent | a44bb4131dd191b4ef5be4e1403fd18bb4987b55 (diff) | |
download | Ishtar-a4cef6296c811f0ecf894611a2e66551059a9f15.tar.bz2 Ishtar-a4cef6296c811f0ecf894611a2e66551059a9f15.zip |
✨ imports: buttons "ignore all errors", "no errors" - fix window closing on check
Diffstat (limited to 'ishtar_common/templates')
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/view_import_csv.html | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/ishtar_common/templates/ishtar/blocks/view_import_csv.html b/ishtar_common/templates/ishtar/blocks/view_import_csv.html index e8dd5e093..3c522f6b1 100644 --- a/ishtar_common/templates/ishtar/blocks/view_import_csv.html +++ b/ishtar_common/templates/ishtar/blocks/view_import_csv.html @@ -11,6 +11,10 @@ <span aria-hidden="true">×</span> </button> </div> + <div class="text-center pt-2"> + <button type="button" class="btn btn-success" id="check-all-ignored"><i class="fa fa-check-square" aria-hidden="true"></i> {% trans "check all" %}</button> + <button type="button" class="btn btn-success" id="uncheck-all-ignored"><i class="fa fa-square-o" aria-hidden="true"></i> {% trans "uncheck all" %}</button> + </div> <div class="table-scroll"> <table class="table table-striped table-bordered" data-import="{{import_id}}"> <thead> @@ -25,7 +29,7 @@ <tr{% if has_line_errors and line.0.1 %} class="import-line-ignored"{% endif%}> <td>{{ forloop.counter }}</td> {% for cell in line %}<td> - {% if has_line_errors and not forloop.counter0 %}<input class="check-ignored" value="{{cell.0|unlocalize}}"{% if cell.1%} checked="checked"{% endif %} type="checkbox" />{% else %}{{cell}}{% endif %} + {% if has_line_errors and not forloop.counter0 %}<input class="check-ignored {% if not cell.1 %}not-{% endif %}ignored" value="{{cell.0|unlocalize}}"{% if cell.1%} checked="checked"{% endif %} type="checkbox" />{% else %}{{cell}}{% endif %} </td>{% endfor %} </tr>{% endfor %} </tbody> @@ -34,5 +38,25 @@ </div> </div> <script type="text/javascript">{% localize off %} -$(".check-ignored").click(import_csv_check_ignored); +$(".check-ignored").click(function(e){ + import_csv_check_ignored(e.target); + $(this).removeClass('ignored').removeClass('not-ignored'); + if (this.checked){ + $(this).addClass("ignored"); + } else { + $(this).addClass("not-ignored"); + } +}); + +$("#check-all-ignored").click(function() { + if (confirm("{% trans 'Are you sure to check all the errors?' %}")){ + $(".check-ignored.not-ignored").click(); + } +}); + +$("#uncheck-all-ignored").click(function() { + if (confirm("{% trans 'Are you sure to uncheck all the errors?' %}")){ + $(".check-ignored.ignored").click(); + } +}); {% endlocalize %}</script>
\ No newline at end of file |