mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 00:33:17 +00:00
redirecting browser that don't support file api
This commit is contained in:
parent
363703405a
commit
f207cd6b52
2 changed files with 9 additions and 0 deletions
|
|
@ -1,4 +1,10 @@
|
|||
$(function(){
|
||||
// Redirect users that don't support filereader
|
||||
if(!$('html').hasClass('filereader')){
|
||||
document.location.href = window.simple_upload_url;
|
||||
return false;
|
||||
}
|
||||
|
||||
// prevents browser default drag/drop
|
||||
$(document).bind('drop dragover', function (e) {
|
||||
e.preventDefault();
|
||||
|
|
@ -84,6 +90,7 @@ $(function(){
|
|||
var itemElement = $(data.context);
|
||||
itemElement.addClass('upload-success')
|
||||
$('.right', itemElement).append(data.result);
|
||||
// run tagit enhancement
|
||||
$('.tag_field input', itemElement).tagit(window.tagit_opts);
|
||||
|
||||
// ajax-enhance forms added on done()
|
||||
|
|
@ -98,6 +105,7 @@ $(function(){
|
|||
}else{
|
||||
console.log(data);
|
||||
form.replaceWith(data.form);
|
||||
// run tagit enhancement on new form
|
||||
$('.tag_field input', form).tagit(window.tagit_opts);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
|
||||
{% url 'wagtailadmin_tag_autocomplete' as autocomplete_url %}
|
||||
<script>
|
||||
window.simple_upload_url = "{% url 'wagtailimages_add_image' %}";
|
||||
window.tagit_opts = {
|
||||
autocomplete: {source: "{{ autocomplete_url|addslashes }}"}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue