mirror of https://gitlab.com/brutaldon/brutaldon
Ensure that file buttons can still be updated when you expand minimal toot form
This commit is contained in:
parent
4f8bba7765
commit
d9cb4b36e5
|
@ -93,3 +93,36 @@ function expandCWButtonPrepare()
|
|||
});
|
||||
};
|
||||
}
|
||||
|
||||
function fileButtonUpdaters()
|
||||
{
|
||||
var file1 = document.getElementById("id_media_file_1");
|
||||
file1.onchange = function(){
|
||||
if (file1.files.length > 0)
|
||||
{
|
||||
document.getElementById('media_filename_1').innerHTML = file1.files[0].name;
|
||||
}
|
||||
};
|
||||
var file2 = document.getElementById("id_media_file_2");
|
||||
file2.onchange = function(){
|
||||
if (file2.files.length > 0)
|
||||
{
|
||||
document.getElementById('media_filename_2').innerHTML = file2.files[0].name;
|
||||
}
|
||||
};
|
||||
var file3 = document.getElementById("id_media_file_3");
|
||||
file3.onchange = function(){
|
||||
if (file3.files.length > 0)
|
||||
{
|
||||
document.getElementById('media_filename_3').innerHTML = file3.files[0].name;
|
||||
}
|
||||
};
|
||||
var file4 = document.getElementById("id_media_file_4");
|
||||
file4.onchange = function(){
|
||||
if (file4.files.length > 0)
|
||||
{
|
||||
document.getElementById('media_filename_4').innerHTML = file4.files[0].name;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
{% elif redraft %}
|
||||
<form method="post" id="post-form" action="{% url "redraft" toot.id %}" enctype="multipart/form-data">
|
||||
{% else %}
|
||||
<form id="post-form" method="post" action="{% url "toot" %}" enctype="multipart/form-data">
|
||||
<form id="post-form" method="post" action="{% url "toot" %}" enctype="multipart/form-data">
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
|||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="control is-expanded">
|
||||
<div class="control is-expanded">
|
||||
{% render_field form.media_text_1 class+="input mousetrap" placeholder="Describe attachment" %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -73,7 +73,7 @@
|
|||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="control is-expanded">
|
||||
<div class="control is-expanded">
|
||||
{% render_field form.media_text_2 class+="input mousetrap" placeholder="Describe attachment" %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -92,7 +92,7 @@
|
|||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="control is-expanded">
|
||||
<div class="control is-expanded">
|
||||
{% render_field form.media_text_3 class+="input mousetrap" placeholder="Describe attachment" %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -110,7 +110,7 @@
|
|||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="control is-expanded">
|
||||
<div class="control is-expanded">
|
||||
{% render_field form.media_text_4 class+="input mousetrap" placeholder="Describe attachment" %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -126,37 +126,10 @@
|
|||
class="level-item emoji-link" title="custom emoji reference">😊</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if not preferences.theme.is_brutalist %}
|
||||
<script type="application/javascript">
|
||||
var file1 = document.getElementById("id_media_file_1");
|
||||
file1.onchange = function(){
|
||||
if (file1.files.length > 0)
|
||||
{
|
||||
document.getElementById('media_filename_1').innerHTML = file1.files[0].name;
|
||||
}
|
||||
};
|
||||
var file2 = document.getElementById("id_media_file_2");
|
||||
file2.onchange = function(){
|
||||
if (file2.files.length > 0)
|
||||
{
|
||||
document.getElementById('media_filename_2').innerHTML = file2.files[0].name;
|
||||
}
|
||||
};
|
||||
var file3 = document.getElementById("id_media_file_3");
|
||||
file3.onchange = function(){
|
||||
if (file3.files.length > 0)
|
||||
{
|
||||
document.getElementById('media_filename_3').innerHTML = file3.files[0].name;
|
||||
}
|
||||
};
|
||||
var file4 = document.getElementById("id_media_file_4");
|
||||
file4.onchange = function(){
|
||||
if (file4.files.length > 0)
|
||||
{
|
||||
document.getElementById('media_filename_4').innerHTML = file4.files[0].name;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
{% endif %}
|
||||
{% if not preferences.theme.is_brutalist %}
|
||||
<script type="application/javascript">
|
||||
fileButtonUpdaters();
|
||||
Intercooler.ready(fileButtonUpdaters);
|
||||
</script>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue