summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
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
commita4cef6296c811f0ecf894611a2e66551059a9f15 (patch)
treeed0af6cdf94ef653f4c8e76c9b5e696fcb7c2497 /ishtar_common
parenta44bb4131dd191b4ef5be4e1403fd18bb4987b55 (diff)
downloadIshtar-a4cef6296c811f0ecf894611a2e66551059a9f15.tar.bz2
Ishtar-a4cef6296c811f0ecf894611a2e66551059a9f15.zip
✨ imports: buttons "ignore all errors", "no errors" - fix window closing on check
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/static/js/ishtar.js13
-rw-r--r--ishtar_common/templates/ishtar/blocks/view_import_csv.html28
2 files changed, 33 insertions, 8 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js
index 6d4b3aa92..2bcfe5a7e 100644
--- a/ishtar_common/static/js/ishtar.js
+++ b/ishtar_common/static/js/ishtar.js
@@ -2146,16 +2146,17 @@ var import_table_refresh_import_list = function(data){
}
}
-var import_csv_check_ignored = function(){
- let tr = $(this).parent().parent();
- if (this.checked){
+var import_csv_check_ignored = function(item){
+ let tr = $(item).parent().parent();
+ if (item.checked){
tr.addClass("import-line-ignored");
} else {
tr.removeClass("import-line-ignored");
}
- $.get(url_path + ignore_error_line_url + this.value + "/", function(){
- let import_ids = [tr.parent().parent().attr("data-import")];
- import_table_update_import_list(import_ids);
+ $.get(url_path + ignore_error_line_url + item.value + "/", function(){
+ /* update import list display - removed for now because close the "error view" window */
+ // let import_ids = [tr.parent().parent().attr("data-import")];
+ // import_table_update_import_list(import_ids);
});
}
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">&times;</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> &nbsp;{% 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> &nbsp;{% 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