summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar/import_table.html
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/templates/ishtar/import_table.html')
-rw-r--r--ishtar_common/templates/ishtar/import_table.html146
1 files changed, 98 insertions, 48 deletions
diff --git a/ishtar_common/templates/ishtar/import_table.html b/ishtar_common/templates/ishtar/import_table.html
index 3be92d42d..57e28abc3 100644
--- a/ishtar_common/templates/ishtar/import_table.html
+++ b/ishtar_common/templates/ishtar/import_table.html
@@ -1,7 +1,14 @@
{% load i18n l10n inline_formset %}
+{% trans "Source" as source_label %}
+{% trans "Media" as media_label %}
+{% trans "Result" as result_label %}
+{% trans "Error" as error_label %}
+{% trans "Match" as match_label %}
{% localize off %}<script type="text/javascript">
{% comment %}
+
/* TODO : à effacer ? */
+
var html = $("#message_list").html();
{% if MESSAGES and AJAX %}{% for message, message_type in MESSAGES %}
html += '<div class="alert alert-{{message_type}} alert-dismissible fade show"';
@@ -14,6 +21,7 @@
html += ' </div>';
{% endfor %}{% endif %}
$("#message_list").html(html);
+
{% endcomment %}
$("#import-list").find('select').prop('disabled', true);
@@ -30,6 +38,7 @@
if (import_table_update_import_ids.length) need_refresh = true;
$(document).ready(function(){
+ register_qa();
if (need_refresh) setInterval(function(){
import_table_update_import_list(import_table_update_import_ids)
}, 3 * 1000);
@@ -51,6 +60,7 @@
<th>{% trans "Diagnostic files" %}</th>{% endif %}
</tr>
{% for import in object_list %}
+ {% with current_import=import %}
<tr id="import-{{import.import_id}}"
class='import-row{% if import.has_error or not import.pre_import_form_is_valid %}-error{% endif %}{% if import.pk in refreshed_pks %} bg-info{% endif %}'>
<td><ul class="simple">
@@ -74,38 +84,57 @@
{% endfor%}
</select>
</td>
- <td><ul class="simple">
- {% if import.imported_file %}<li>
- <i class="fa fa-fw fa-file-text-o" aria-hidden="true"></i> <a href='{{import.imported_file.url}}'>{% trans "Source" %}</a>
+ <td><ul class="simple table-import-files">
+ {% if import.imported_file %}<li class="p-1">
+ {% with file_label=source_label logo='fa fa-fw fa-file-text-o' file_type='source' file=import.imported_file %}
+ {% include "ishtar/blocks/import_table_buttons_view.html" %}
+ {% endwith %}
</li>
- {% if import.get_imported_images %}<li>
- <i class="fa fa-fw fa-file-image-o" aria-hidden="true"></i> <a href="{{ import.get_imported_images.url }}">{% trans "Media" %}</a>
+ {% if import.get_imported_images %}<li class="p-1">
+ {% with file_label=media_label logo='fa fa-fw fa-file-image-o' file_type='' file=import.get_imported_images %}
+ {% include "ishtar/blocks/import_table_buttons_view.html" %}
+ {% endwith %}
</li>{% endif %}
{% elif import.archive_file %}<li>
<i class="fa fa-fw fa-file-archive-o" aria-hidden="true"></i> <a href='{{import.archive_file.url}}'>{% trans "Archive" context "name" %}</a>
</li>{% endif %}
</ul></td>{% if not ARCHIVE_PAGE %}
- <td><ul class="simple">
- {% if import.has_pre_import_form %}<li>
- {% if not import.pre_import_form_is_valid %}
- <i class="text-danger fa fa-fw fa-exclamation-triangle" aria-hidden="true"></i>
- {% else %}
- <i class="fa fa-fw fa-check-square-o" aria-hidden="true"></i>
- {% endif %}
- <a href='{% url "import_pre_import_form" import.pk %}'>{% trans "Pre-import values" %}</a>
+ <td><ul class="simple table-import-match-files">
+ {% if import.has_pre_import_form %}<li class="p-1">
+ <div class="btn-group btn-group-sm" role="group">
+ <a class="btn btn-secondary" href='{% url "import_pre_import_form" import.pk %}'>
+ {% if not import.pre_import_form_is_valid %}
+ <i class="text-danger fa fa-fw fa-exclamation-triangle" aria-hidden="true"></i>
+ {% else %}
+ <i class="fa fa-fw fa-check-square-o" aria-hidden="true"></i>
+ {% endif %}
+ {% trans "Pre-import values" %}
+ </a>
+ </div>
</li>{% endif %}
- {% if import.need_matching %}<li>
- <i class="fa fa-fw fa-arrows-h" aria-hidden="true"></i> <a href='{% url "import_link_unmatched" import.pk %}'>{% trans "Make match" %}</a>
+ {% if import.need_matching %}<li class="p-1">
+ <div class="btn-group btn-group-sm" role="group">
+ <a class="btn btn-secondary" href='{% url "import_link_unmatched" import.pk %}'>
+ <i class="fa fa-fw fa-arrows-h" aria-hidden="true"></i> {% trans "Make match" %}
+ </a>
+ </div>
</li>{% endif %}
</ul></td>
- <td style="white-space: nowrap;"><ul class="simple">{% if import.error_file %}<li>
- <i class="text-danger fa fa-fw fa-exclamation-triangle" aria-hidden="true"></i> <a href='{{import.error_file.url}}'>{% trans "Error" %}</a>
+ <td style="white-space: nowrap;"><ul class="simple table-import-diag">
+ {% if import.error_file %}<li class="p-1">
+ {% with file_label=error_label logo='text-danger fa fa-fw fa-exclamation-triangle' file_type='error' file=import.error_file %}
+ {% include "ishtar/blocks/import_table_buttons_view.html" %}
+ {% endwith %}
</li>{% endif %}
- {% if import.result_file %}<li>
- <i class="fa fa-fw fa-th" aria-hidden="true"></i> <a href='{{import.result_file.url}}'>{% trans "Result" %}</a>
+ {% if import.result_file %}<li class="p-1">
+ {% with file_label=result_label logo='fa fa-fw fa-th' file_type='result' file=import.result_file %}
+ {% include "ishtar/blocks/import_table_buttons_view.html" %}
+ {% endwith %}
</li>{% endif %}
- {% if import.match_file %}<li>
- <i class="fa fa-fw fa-arrows-h" aria-hidden="true"></i> <a href='{{import.match_file.url}}'>{% trans "Match" %}</a>
+ {% if import.match_file %}<li class="p-1">
+ {% with file_label=match_label logo='fa fa-fw fa-arrows-h' file_type='match' file=import.match_file %}
+ {% include "ishtar/blocks/import_table_buttons_view.html" %}
+ {% endwith %}
</li>{% endif %}</ul>
</td>{% endif %}
</tr>
@@ -122,46 +151,66 @@
</td>
</tr>
{% endif %}
+ {% endwith %}
{% if not import.importer_type.type_label and not ARCHIVE_PAGE %} {# group #}
{% for sub in import.import_list %}
+ {% with current_import=sub %}
<tr id="import-{{sub.import_id}}">
<td></td>
<td>{{sub.importer_type}}</td>
<td id="status-{{sub.import_id}}">{{sub.status}}</td>
<td></td>
- <td><ul class="simple">
- {% if sub.imported_file %}<li>
- <i class="fa fa-fw fa-file-text-o" aria-hidden="true"></i> <a href='{{sub.imported_file.url}}'>{% trans "Source" %}</a>
+ <td><ul class="simple table-import-files">
+ {% if sub.imported_file %}<li class="p-1">
+ {% with file_label=source_label logo='fa fa-fw fa-file-text-o' file_type='source' file=sub.imported_file %}
+ {% include "ishtar/blocks/import_table_buttons_view.html" %}
+ {% endwith %}
</li>{% endif %}
- {% if sub.get_imported_images %}<li>
- <i class="fa fa-fw fa-file-image-o" aria-hidden="true"></i> <a href="{{ sub.get_imported_images.url }}">{% trans "Media" %}</a>
+ {% if sub.get_imported_images %}<li class="p-1">
+ {% with file_label=media_label logo='fa fa-fw fa-file-image-o' file_type='' file=sub.get_imported_images %}
+ {% include "ishtar/blocks/import_table_buttons_view.html" %}
+ {% endwith %}
</li>{% endif %}
</ul></td>{% if not ARCHIVE_PAGE %}
- <td><ul class="simple">
- {% if sub.has_pre_import_form %}<li>
- {% if not sub.pre_import_form_is_valid %}
- <i class="text-danger fa fa-fw fa-exclamation-triangle" aria-hidden="true"></i>
- {% else %}
- <i class="fa fa-fw fa-check-square-o" aria-hidden="true"></i>
- {% endif %}
- <a href='{% url "import_pre_import_form" sub.pk %}'>{% trans "Pre-import values" %}</a>
- </li>{% endif %}
- {% if sub.need_matching %}<li>
- <i class="fa fa-fw fa-arrows-h" aria-hidden="true"></i> <a href='{% url "import_link_unmatched" sub.pk %}'>{% trans "Make match" %}</a>
- </li>{% endif %}
+ <td><ul class="simple table-import-match-files">
+ {% if sub.has_pre_import_form %}<li class="p-1">
+ <div class="btn-group btn-group-sm" role="group">
+ <a class="btn btn-secondary" href='{% url "import_pre_import_form" sub.pk %}'>
+ {% if not sub.pre_import_form_is_valid %}
+ <i class="text-danger fa fa-fw fa-exclamation-triangle" aria-hidden="true"></i>
+ {% else %}
+ <i class="fa fa-fw fa-check-square-o" aria-hidden="true"></i>
+ {% endif %}
+ {% trans "Pre-import values" %}
+ </a>
+ </div>
+ </li>{% endif %}
+ {% if sub.need_matching %}<li class="p-1">
+ <div class="btn-group btn-group-sm" role="group">
+ <a class="btn btn-secondary" href='{% url "import_link_unmatched" sub.pk %}'>
+ <i class="fa fa-fw fa-arrows-h" aria-hidden="true"></i> {% trans "Make match" %}
+ </a>
+ </div>
+ </li>{% endif %}
</ul></td>
- <td><ul class="simple">
- {% if sub.error_file %}<li>
- <i class="text-danger fa fa-fw fa-exclamation-triangle" aria-hidden="true"></i> <a href='{{sub.error_file.url}}'>{% trans "Error" %}</a>
- </li>{% endif %}
- {% if sub.result_file %}<li>
- <i class="fa fa-fw fa-th" aria-hidden="true"></i> <a href='{{sub.result_file.url}}'>{% trans "Result" %}</a>
+ <td style="white-space: nowrap;"><ul class="simple table-import-diag">
+ {% if sub.error_file %}<li class="p-1">
+ {% with file_label=error_label logo='text-danger fa fa-fw fa-exclamation-triangle' file_type='error' file=sub.error_file %}
+ {% include "ishtar/blocks/import_table_buttons_view.html" %}
+ {% endwith %}
</li>{% endif %}
- {% if sub.match_file %}<li>
- <i class="fa fa-fw fa-arrows-h" aria-hidden="true"></i> <a href='{{sub.match_file.url}}'>{% trans "Match" %}</a>
+ {% if sub.result_file %}<li class="p-1">
+ {% with file_label=result_label logo='fa fa-fw fa-th' file_type='result' file=sub.result_file %}
+ {% include "ishtar/blocks/import_table_buttons_view.html" %}
+ {% endwith %}
</li>{% endif %}
- </ul>
- </td>{% endif %}
+ {% if sub.match_file %}<li class="p-1">
+ {% with file_label=match_label logo='fa fa-fw fa-arrows-h' file_type='match' file=sub.match_file %}
+ {% include "ishtar/blocks/import_table_buttons_view.html" %}
+ {% endwith %}
+ </li>{% endif %}</ul>
+ </td>
+ {% endif %}
</tr>
<tr></tr>{# only for even and odd style #}
<tr id="progress-display-{{sub.id}}"{% if sub.state != 'IP' and sub.state != 'PP' %} style="display:none"{% endif %}>
@@ -174,6 +223,7 @@
</div>
</td>
</tr>
+ {% endwith %}
{% endfor %}
{% endif %}
{% endfor %}