...
 
Commits (3)
$(function() {
$('.file-upload-widget').each(function() {
function upload_widget() {
var base_widget = $(this);
if ($(base_widget).find('input[type=hidden]').val()) {
$(base_widget).find('input[type=file]').hide();
......@@ -37,5 +37,9 @@ $(function() {
$(base_widget).find('input[type=file]').click();
return false;
});
}
$('.file-upload-widget').each(upload_widget);
$(document).on('gadjo:dialog-loaded', function(ev, form) {
$(form).find('.file-upload-widget').each(upload_widget);
});
});
......@@ -10,14 +10,14 @@
<script src="{{ STATIC_URL }}js/jquery.iframe-transport.js"></script>
<script src="{{ STATIC_URL }}js/qommon.fileupload.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="/static/django_select2/js/select2.js"></script>
<script type="text/javascript" src="/static/django_select2/js/heavy_data.js"></script>
{% endblock %}
{% block css %}
{{ block.super }}
<link href="/static/django_select2/css/select2.css" rel="stylesheet">
<link href="/static/django_select2/css/extra.css" rel="stylesheet"><script type="text/javascript" src="/static/django_select2/js/select2.js"></script>
<script type="text/javascript" src="/static/django_select2/js/heavy_data.js"></script>
<link href="/static/django_select2/css/extra.css" rel="stylesheet">
<link href="{{ STATIC_URL }}css/datetimepicker.css" rel="stylesheet" type="text/css"/>
{% endblock %}
......
......@@ -11,9 +11,9 @@
<p>
<a class="button" href="edit/">Modifier</a>
{% if perms.emissions.add_diffusion %}
<a class="button" id="add-diffusion-link" href="#">Ajouter une diffusion</a>
<a class="button" href="add-diffusion" rel="popup">Ajouter une diffusion</a>
{% endif %}
<a class="button" id="add-soundfile-link" href="#">Ajouter un son</a>
<a class="button" href="add-soundfile" rel="popup">Ajouter un son</a>
{% if episode.effective_start and episode.effective_end %}
{% if internal_ip %}
<a class="button" id="download-recording" download href="{{ episode.get_pige_download_url }}">Télécharger l'enregistrement</a>
......@@ -74,14 +74,6 @@ Tags :
{% endfor %}
</ul>
<form id="add-diffusion-form" action="add-diffusion" method="POST" style="display: none;">
{% csrf_token %}
{{ add_diffusion_form.as_p }}
<button>Ajouter cet horaire</button>
<button class="cancel">Annuler</button>
</form>
<h3>Sons</h3>
......@@ -128,30 +120,12 @@ Tags :
</tbody>
</table>
<form id="add-soundfile-form" action="add-soundfile" method="POST" style="display: none;">
{% csrf_token %}
{{ add_soundfile_form.as_p }}
<button>Ajouter ce son</button>
<button class="cancel">Annuler</button>
</form>
{% endblock %}
{% block page-end %}
<script>
$(function() {
$('#add-soundfile-link').click(
function() {
$('#id_title').parent().hide();
$('#add-soundfile-form').dialog({modal: true, title: 'Son', width: 'auto'});
});
$('#add-diffusion-link').click(
function() {
$('#add-diffusion-form').dialog({modal: true, title: 'Horaire', width: 'auto'});
});
$('.image img').click(function() { $(this).toggleClass('large'); });
$('#id_fragment').change(function() {
......@@ -162,10 +136,6 @@ $(function() {
}
});
$('button.cancel').click(function() {
$(this).parent().dialog('close');
return false;
});
});
</script>
{% endblock %}