Commit 07095908 authored by fred's avatar fred

use normal popup for add sound form

parent 851dcfe3
$(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);
});
});
......@@ -13,7 +13,7 @@
{% if perms.emissions.add_diffusion %}
<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>
......@@ -120,25 +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'});
});
$('.image img').click(function() { $(this).toggleClass('large'); });
$('#id_fragment').change(function() {
......@@ -149,10 +136,6 @@ $(function() {
}
});
$('button.cancel').click(function() {
$(this).parent().dialog('close');
return false;
});
});
</script>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment