templates: share bits between cart@ds templates
This commit is contained in:
parent
aaa5e11795
commit
9f2ceb50bc
|
@ -0,0 +1,37 @@
|
|||
<script type="text/javascript" src="/static/js/jquery.fileupload.js"></script>
|
||||
<script type="text/javascript" src="/static/js/qommon.fileupload.js"></script>
|
||||
|
||||
<script>
|
||||
$.CartaDs = {
|
||||
change: function() {
|
||||
var $widget = $(this).parents('.file-upload-widget');
|
||||
var token = $widget.find('input[type=hidden]').val();
|
||||
if (! token) return;
|
||||
var url = $(this).data('url');
|
||||
$widget.find('.remove').on('click', function() {
|
||||
$.ajax({
|
||||
url: url + token + '/delete/',
|
||||
method: 'POST'
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('.file-upload-widget input[type=file]').on('change', $.CartaDs.change);
|
||||
$('.file-upload-widget.has-file input[type=file]').each($.CartaDs.change);
|
||||
|
||||
$('button.plus').on('click', function() {
|
||||
var $file_button = $(this).parent().prev().clone();
|
||||
$file_button.find('div.title').remove();
|
||||
$file_button.find('input[type=hidden]').val('');
|
||||
$file_button.find('.fileinfo').hide();
|
||||
$file_button.find('input[type=file]').show().on('change', $.CartaDs.change);
|
||||
$file_button.removeClass('has-file').addClass('has-no-file');
|
||||
$(this).parent().before($file_button);
|
||||
$file_button.each($.WcsFileUpload.prepare);
|
||||
if ($(this).parents('.piece').find('.file-upload-widget').length == 6) {
|
||||
$(this).attr('disabled', true);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,36 @@
|
|||
{% load i18n %}
|
||||
<div class="piece">
|
||||
<div class="title grid-1-1 newline">{% if piece.codePiece %}{{ piece.codePiece }} - {% endif %}{{ piece.text }}
|
||||
{% if piece.reglementaire %}<span class="required">*</span>{% endif %}</div>
|
||||
|
||||
{% for file in piece.files %}
|
||||
<div class="file-upload-widget short {{ grid }} {% if file.token %}has-file{% endif %}" style="margin-bottom: 1rem">
|
||||
<div class="file-button">
|
||||
<input type="file" data-url="{{ file.url }}"
|
||||
{% if not piece.codePiece %}accept="application/pdf"{% endif %}>
|
||||
<input type="hidden" value="{{ file.token }}">
|
||||
<div class="widget-message click-to-upload">
|
||||
{% trans "Drop a file or click to select one" %}
|
||||
</div>
|
||||
<div class="widget-message upload-done">
|
||||
{% trans "Upload done" %}
|
||||
</div>
|
||||
<style>.click-to-upload, .upload-done { display: none; }</style>
|
||||
<div class="fileprogress" style="display: none;">
|
||||
<div class="bar"
|
||||
data-upload="{% trans "Upload in progress..." %}"
|
||||
data-error="{% trans "Error during upload." %}"></div>
|
||||
</div>
|
||||
<div class="fileinfo">
|
||||
<span class="filename">{{ file.name }}</span>
|
||||
<a href="#" class="remove" title="{% trans 'Remove this file' %}">{% trans "remove" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if piece.max_files > 1 %}
|
||||
<div class="grid-1-12 button-plus">
|
||||
<button class="plus">+</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
|
@ -1,97 +1,20 @@
|
|||
{% extends "qommon/forms/widgets/comment.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block widget-content %}
|
||||
<script type="text/javascript" src="/static/js/jquery.fileupload.js"></script>
|
||||
<script type="text/javascript" src="/static/js/qommon.fileupload.js"></script>
|
||||
|
||||
{% if form_tracking_code %}
|
||||
{% with webservice.cartads_pieces.data as pieces %}
|
||||
{% for piece in pieces %}
|
||||
|
||||
{% if piece.section_start %}<div class="grid-1-1 newline"><h3>{{ piece.section_start }}</h3></div>{% endif %}
|
||||
{% if piece.section_start == "Cerfa" %}
|
||||
{% for cerfa in webservice.cartads_cerfa.data %}
|
||||
<p>Télécharger : <a href="{{ cerfa.url }}">{{ cerfa.text }}</a></p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<div class="piece">
|
||||
<div class="title grid-1-1 newline">{% if piece.codePiece %}{{ piece.codePiece }} - {% endif %}{{ piece.text }}
|
||||
{% if piece.reglementaire %}<span class="required">*</span>{% endif %}</div>
|
||||
|
||||
|
||||
{% for file in piece.files %}
|
||||
<div class="file-upload-widget short grid-1-3 {% if file.token %}has-file{% endif %}" style="margin-bottom: 1rem">
|
||||
<div class="file-button">
|
||||
<input type="file" data-url="{{ file.url }}"
|
||||
{% if not piece.codePiece %}accept="application/pdf"{% endif %}>
|
||||
<input type="hidden" value="{{ file.token }}">
|
||||
<div class="widget-message click-to-upload">
|
||||
{% trans "Drop a file or click to select one" %}
|
||||
</div>
|
||||
<div class="widget-message upload-done">
|
||||
{% trans "Upload done" %}
|
||||
</div>
|
||||
<style>.click-to-upload, .upload-done { display: none; }</style>
|
||||
<div class="fileprogress" style="display: none;">
|
||||
<div class="bar"
|
||||
data-upload="{% trans "Upload in progress..." %}"
|
||||
data-error="{% trans "Error during upload." %}"></div>
|
||||
</div>
|
||||
<div class="fileinfo">
|
||||
<span class="filename">{{ file.name }}</span>
|
||||
<a href="#" class="remove" title="{% trans 'Remove this file' %}">{% trans "remove" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if piece.max_files > 1 %}
|
||||
<div class="grid-1-12 button-plus">
|
||||
<button class="plus">+</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% include "qommon/forms/widgets/includes/cartads-piece.html" with piece=piece grid="grid-1-3" only %}
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
{% include "qommon/forms/widgets/includes/cartads-js.html" only %}
|
||||
{% else %}
|
||||
<div class="infonotice">Prévisualisation impossible.</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<script>
|
||||
$.CartaDs = {
|
||||
change: function() {
|
||||
var $widget = $(this).parents('.file-upload-widget');
|
||||
var token = $widget.find('input[type=hidden]').val();
|
||||
if (! token) return;
|
||||
var url = $(this).data('url');
|
||||
$widget.find('.remove').on('click', function() {
|
||||
$.ajax({
|
||||
url: url + token + '/delete/',
|
||||
method: 'POST'
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('.file-upload-widget input[type=file]').on('change', $.CartaDs.change);
|
||||
$('.file-upload-widget.has-file input[type=file]').each($.CartaDs.change);
|
||||
|
||||
$('button.plus').on('click', function() {
|
||||
var $file_button = $(this).parent().prev().clone();
|
||||
$file_button.find('div.title').remove();
|
||||
$file_button.find('input[type=hidden]').val('');
|
||||
$file_button.find('.fileinfo').hide();
|
||||
$file_button.find('input[type=file]').show().on('change', $.CartaDs.change);
|
||||
$file_button.removeClass('has-file').addClass('has-no-file');
|
||||
$(this).parent().before($file_button);
|
||||
$file_button.each($.WcsFileUpload.prepare);
|
||||
if ($(this).parents('.piece').find('.file-upload-widget').length == 6) {
|
||||
$(this).attr('disabled', true);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,91 +1,14 @@
|
|||
{% extends "qommon/forms/widgets/comment.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block widget-content %}
|
||||
<script type="text/javascript" src="/static/js/jquery.fileupload.js"></script>
|
||||
<script type="text/javascript" src="/static/js/qommon.fileupload.js"></script>
|
||||
|
||||
{% if form_tracking_code %}
|
||||
{% with webservice.cartads_pieces_complementaires.data as pieces %}
|
||||
{% for piece in pieces %}
|
||||
|
||||
<div class="piece">
|
||||
<div class="title grid-1-1 newline">{% if piece.codePiece %}{{ piece.codePiece }} - {% endif %}{{ piece.text }}</div>
|
||||
|
||||
{% for file in piece.files %}
|
||||
<div class="file-upload-widget short grid-1-2 {% if file.token %}has-file{% endif %}" style="margin-bottom: 1rem">
|
||||
<div class="file-button">
|
||||
<input type="file" data-url="{{ file.url }}"
|
||||
{% if not piece.codePiece %}accept="application/pdf"{% endif %}>
|
||||
<input type="hidden" value="{{ file.token }}">
|
||||
<div class="widget-message click-to-upload">
|
||||
{% trans "Drop a file or click to select one" %}
|
||||
</div>
|
||||
<div class="widget-message upload-done">
|
||||
{% trans "Upload done" %}
|
||||
</div>
|
||||
<style>.click-to-upload, .upload-done { display: none; }</style>
|
||||
<div class="fileprogress" style="display: none;">
|
||||
<div class="bar"
|
||||
data-upload="{% trans "Upload in progress..." %}"
|
||||
data-error="{% trans "Error during upload." %}"></div>
|
||||
</div>
|
||||
<div class="fileinfo">
|
||||
<span class="filename">{{ file.name }}</span>
|
||||
<a href="#" class="remove" title="{% trans 'Remove this file' %}">{% trans "remove" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="grid-1-1 newline">
|
||||
{% if piece.max_files > 1 %}
|
||||
<div class="grid-1-12 button-plus">
|
||||
<button class="plus">+</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "qommon/forms/widgets/includes/cartads-piece.html" with piece=piece grid="grid-1-2" only %}
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
{% include "qommon/forms/widgets/includes/cartads-js.html" only %}
|
||||
{% else %}
|
||||
<div class="infonotice">Prévisualisation impossible.</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<script>
|
||||
$.CartaDs = {
|
||||
change: function() {
|
||||
var $widget = $(this).parents('.file-upload-widget');
|
||||
var token = $widget.find('input[type=hidden]').val();
|
||||
if (! token) return;
|
||||
var url = $(this).data('url');
|
||||
$widget.find('.remove').on('click', function() {
|
||||
$.ajax({
|
||||
url: url + token + '/delete/',
|
||||
method: 'POST'
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('.file-upload-widget input[type=file]').on('change', $.CartaDs.change);
|
||||
$('.file-upload-widget.has-file input[type=file]').each($.CartaDs.change);
|
||||
|
||||
$('button.plus').on('click', function() {
|
||||
var $file_button = $(this).parent().prev().clone();
|
||||
$file_button.find('div.title').remove();
|
||||
$file_button.find('input[type=hidden]').val('');
|
||||
$file_button.find('.fileinfo').hide();
|
||||
$file_button.find('input[type=file]').show().on('change', $.CartaDs.change);
|
||||
$file_button.removeClass('has-file').addClass('has-no-file');
|
||||
$(this).parent().before($file_button);
|
||||
$file_button.each($.WcsFileUpload.prepare);
|
||||
if ($(this).parents('.piece').find('.file-upload-widget').length == 6) {
|
||||
$(this).attr('disabled', true);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,90 +1,14 @@
|
|||
{% extends "qommon/forms/widgets/comment.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block widget-content %}
|
||||
<script type="text/javascript" src="/static/js/jquery.fileupload.js"></script>
|
||||
<script type="text/javascript" src="/static/js/qommon.fileupload.js"></script>
|
||||
|
||||
{% if form_var_dossier_tracking_code %}
|
||||
{% with webservice.cartads_pieces_daact.data as pieces %}
|
||||
{% for piece in pieces %}
|
||||
|
||||
<div class="piece">
|
||||
<div class="title grid-1-1 newline">{% if piece.codePiece %}{{ piece.codePiece }} - {% endif %}{{ piece.text }}
|
||||
{% if piece.reglementaire %}<span class="required">*</span>{% endif %}</div>
|
||||
|
||||
{% for file in piece.files %}
|
||||
<div class="file-upload-widget short grid-1-3 {% if file.token %}has-file{% endif %}" style="margin-bottom: 1rem">
|
||||
<div class="file-button">
|
||||
<input type="file" data-url="{{ file.url }}"
|
||||
{% if not piece.codePiece %}accept="application/pdf"{% endif %}>
|
||||
<input type="hidden" value="{{ file.token }}">
|
||||
<div class="widget-message click-to-upload">
|
||||
{% trans "Drop a file or click to select one" %}
|
||||
</div>
|
||||
<div class="widget-message upload-done">
|
||||
{% trans "Upload done" %}
|
||||
</div>
|
||||
<style>.click-to-upload, .upload-done { display: none; }</style>
|
||||
<div class="fileprogress" style="display: none;">
|
||||
<div class="bar"
|
||||
data-upload="{% trans "Upload in progress..." %}"
|
||||
data-error="{% trans "Error during upload." %}"></div>
|
||||
</div>
|
||||
<div class="fileinfo">
|
||||
<span class="filename">{{ file.name }}</span>
|
||||
<a href="#" class="remove" title="{% trans 'Remove this file' %}">{% trans "remove" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if piece.max_files > 1 %}
|
||||
<div class="grid-1-12 button-plus">
|
||||
<button class="plus">+</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% include "qommon/forms/widgets/includes/cartads-piece.html" with piece=piece grid="grid-1-3" only %}
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
{% include "qommon/forms/widgets/includes/cartads-js.html" only %}
|
||||
{% else %}
|
||||
<div class="infonotice">Prévisualisation impossible.</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<script>
|
||||
$.CartaDs = {
|
||||
change: function() {
|
||||
var $widget = $(this).parents('.file-upload-widget');
|
||||
var token = $widget.find('input[type=hidden]').val();
|
||||
if (! token) return;
|
||||
var url = $(this).data('url');
|
||||
$widget.find('.remove').on('click', function() {
|
||||
$.ajax({
|
||||
url: url + token + '/delete/',
|
||||
method: 'POST'
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('.file-upload-widget input[type=file]').on('change', $.CartaDs.change);
|
||||
$('.file-upload-widget.has-file input[type=file]').each($.CartaDs.change);
|
||||
|
||||
$('button.plus').on('click', function() {
|
||||
var $file_button = $(this).parent().prev().clone();
|
||||
$file_button.find('div.title').remove();
|
||||
$file_button.find('input[type=hidden]').val('');
|
||||
$file_button.find('.fileinfo').hide();
|
||||
$file_button.find('input[type=file]').show().on('change', $.CartaDs.change);
|
||||
$file_button.removeClass('has-file').addClass('has-no-file');
|
||||
$(this).parent().before($file_button);
|
||||
$file_button.each($.WcsFileUpload.prepare);
|
||||
if ($(this).parents('.piece').find('.file-upload-widget').length == 6) {
|
||||
$(this).attr('disabled', true);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,90 +1,14 @@
|
|||
{% extends "qommon/forms/widgets/comment.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block widget-content %}
|
||||
<script type="text/javascript" src="/static/js/jquery.fileupload.js"></script>
|
||||
<script type="text/javascript" src="/static/js/qommon.fileupload.js"></script>
|
||||
|
||||
{% if form_var_dossier_tracking_code %}
|
||||
{% with webservice.cartads_pieces_doc.data as pieces %}
|
||||
{% for piece in pieces %}
|
||||
|
||||
<div class="piece">
|
||||
<div class="title grid-1-1 newline">{% if piece.codePiece %}{{ piece.codePiece }} - {% endif %}{{ piece.text }}
|
||||
{% if piece.reglementaire %}<span class="required">*</span>{% endif %}</div>
|
||||
|
||||
{% for file in piece.files %}
|
||||
<div class="file-upload-widget short grid-1-3 {% if file.token %}has-file{% endif %}" style="margin-bottom: 1rem">
|
||||
<div class="file-button">
|
||||
<input type="file" data-url="{{ file.url }}"
|
||||
{% if not piece.codePiece %}accept="application/pdf"{% endif %}>
|
||||
<input type="hidden" value="{{ file.token }}">
|
||||
<div class="widget-message click-to-upload">
|
||||
{% trans "Drop a file or click to select one" %}
|
||||
</div>
|
||||
<div class="widget-message upload-done">
|
||||
{% trans "Upload done" %}
|
||||
</div>
|
||||
<style>.click-to-upload, .upload-done { display: none; }</style>
|
||||
<div class="fileprogress" style="display: none;">
|
||||
<div class="bar"
|
||||
data-upload="{% trans "Upload in progress..." %}"
|
||||
data-error="{% trans "Error during upload." %}"></div>
|
||||
</div>
|
||||
<div class="fileinfo">
|
||||
<span class="filename">{{ file.name }}</span>
|
||||
<a href="#" class="remove" title="{% trans 'Remove this file' %}">{% trans "remove" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if piece.max_files > 1 %}
|
||||
<div class="grid-1-12 button-plus">
|
||||
<button class="plus">+</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% include "qommon/forms/widgets/includes/cartads-piece.html" with piece=piece grid="grid-1-3" only %}
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
{% include "qommon/forms/widgets/includes/cartads-js.html" only %}
|
||||
{% else %}
|
||||
<div class="infonotice">Prévisualisation impossible.</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<script>
|
||||
$.CartaDs = {
|
||||
change: function() {
|
||||
var $widget = $(this).parents('.file-upload-widget');
|
||||
var token = $widget.find('input[type=hidden]').val();
|
||||
if (! token) return;
|
||||
var url = $(this).data('url');
|
||||
$widget.find('.remove').on('click', function() {
|
||||
$.ajax({
|
||||
url: url + token + '/delete/',
|
||||
method: 'POST'
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('.file-upload-widget input[type=file]').on('change', $.CartaDs.change);
|
||||
$('.file-upload-widget.has-file input[type=file]').each($.CartaDs.change);
|
||||
|
||||
$('button.plus').on('click', function() {
|
||||
var $file_button = $(this).parent().prev().clone();
|
||||
$file_button.find('div.title').remove();
|
||||
$file_button.find('input[type=hidden]').val('');
|
||||
$file_button.find('.fileinfo').hide();
|
||||
$file_button.find('input[type=file]').show().on('change', $.CartaDs.change);
|
||||
$file_button.removeClass('has-file').addClass('has-no-file');
|
||||
$(this).parent().before($file_button);
|
||||
$file_button.each($.WcsFileUpload.prepare);
|
||||
if ($(this).parents('.piece').find('.file-upload-widget').length == 6) {
|
||||
$(this).attr('disabled', true);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue