Move dropzone code and style loading to the sources app. Improve dropzone widget appearance. Add Javascript translation catalog support.
This commit is contained in:
@@ -114,13 +114,4 @@ jQuery(document).ready(function() {
|
||||
});
|
||||
|
||||
}, 3000);
|
||||
|
||||
Dropzone.options.html5upload = {
|
||||
paramName: 'source-file',
|
||||
addRemoveLinks: true,
|
||||
createImageThumbnails: false,
|
||||
dictDefaultMessage: 'Drop files or click here to upload files',
|
||||
dictCancelUpload: 'Cancel upload',
|
||||
dictRemoveFile: 'Clear'
|
||||
};
|
||||
});
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
<link href="{% static 'appearance/packages/bootswatch.com/flatly/bootstrap.min.css' %}" media="screen" rel="stylesheet" type="text/css" />
|
||||
<link href="{% static 'appearance/packages/animate/animate.css' %}" media="screen" rel="stylesheet" type="text/css" />
|
||||
<link href="{% static 'appearance/packages/fancyBox-master/source/jquery.fancybox.css' %}" media="screen" rel="stylesheet" type="text/css" />
|
||||
<link href="{% static 'sources/packages/dropzone.css' %}" media="screen" rel="stylesheet" type="text/css" />
|
||||
<link href="{% static 'appearance/css/base.css' %}" media="screen" rel="stylesheet" type="text/css" />
|
||||
{% block stylesheets %}{% endblock %}
|
||||
|
||||
@@ -168,7 +167,6 @@
|
||||
<script type="text/javascript" src="{% static 'appearance/packages/jquery_lazyload-master/jquery.lazyload.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'appearance/packages/fancyBox-master/source/jquery.fancybox.pack.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'appearance/packages/fancyBox-master/lib/jquery.mousewheel.pack.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'sources/packages/dropzone.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'appearance/js/base.js' %}"></script>
|
||||
{% block javascript %}{% endblock %}
|
||||
{% endcompress %}
|
||||
|
||||
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
||||
from django.conf.urls import patterns, url
|
||||
from django.contrib.staticfiles.templatetags.staticfiles import static
|
||||
from django.views.generic import RedirectView
|
||||
from django.views.i18n import javascript_catalog
|
||||
|
||||
from .views import (
|
||||
AboutView, CurrentUserDetailsView, CurrentUserEditView,
|
||||
@@ -52,13 +53,16 @@ urlpatterns = patterns(
|
||||
urlpatterns += patterns(
|
||||
'',
|
||||
url(
|
||||
r'^set_language/$', 'django.views.i18n.set_language',
|
||||
name='set_language'
|
||||
),
|
||||
(
|
||||
r'^favicon\.ico$',
|
||||
RedirectView.as_view(
|
||||
r'^favicon\.ico$', RedirectView.as_view(
|
||||
permanent=True, url=static('appearance/images/favicon.ico')
|
||||
)
|
||||
),
|
||||
url(
|
||||
r'^jsi18n/(?P<packages>\S+?)/$', javascript_catalog,
|
||||
name='javascript_catalog'
|
||||
),
|
||||
url(
|
||||
r'^set_language/$', 'django.views.i18n.set_language',
|
||||
name='set_language'
|
||||
),
|
||||
)
|
||||
|
||||
@@ -173,11 +173,13 @@
|
||||
.dropzone, .dropzone * {
|
||||
box-sizing: border-box; }
|
||||
|
||||
.dz-default {
|
||||
border-style: dashed;
|
||||
}
|
||||
|
||||
.dropzone {
|
||||
min-height: 150px;
|
||||
border: 2px solid rgba(0, 0, 0, 0.3);
|
||||
background: white;
|
||||
padding: 20px 20px; }
|
||||
}
|
||||
.dropzone.dz-clickable {
|
||||
cursor: pointer; }
|
||||
.dropzone.dz-clickable * {
|
||||
@@ -192,7 +194,7 @@
|
||||
opacity: 0.5; }
|
||||
.dropzone .dz-message {
|
||||
text-align: center;
|
||||
margin: 2em 0; }
|
||||
padding: 2em 0; }
|
||||
.dropzone .dz-preview {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{% load static %}
|
||||
|
||||
{% include 'appearance/generic_multiform_subtemplate.html' %}
|
||||
|
||||
{% block stylesheets %}
|
||||
<link href="{% static 'sources/packages/dropzone.css' %}" media="screen" rel="stylesheet" type="text/css" />
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
<script type="text/javascript" src="{% static 'sources/packages/dropzone.js' %}"></script>
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
Dropzone.options.html5upload = {
|
||||
paramName: 'source-file',
|
||||
addRemoveLinks: true,
|
||||
createImageThumbnails: false,
|
||||
dictDefaultMessage: gettext('Drop files or click here to upload files'),
|
||||
dictFallbackMessage: gettext('Your browser does not support drag\'n\'drop file uploads.'),
|
||||
dictFallbackText: gettext('Please use the fallback form below to upload your files like in the olden days.'),
|
||||
dictFileTooBig: gettext('File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.'),
|
||||
dictInvalidFileType: gettext('You can\'t upload files of this type.'),
|
||||
dictResponseError: gettext('Server responded with {{statusCode}} code.'),
|
||||
dictCancelUpload: gettext('Cancel upload'),
|
||||
dictCancelUploadConfirmation: gettext('Are you sure you want to cancel this upload?'),
|
||||
dictRemoveFile: gettext('Clear'),
|
||||
dictMaxFilesExceeded: gettext('You can not upload any more files.'),
|
||||
maxFilesize: 1024,
|
||||
};
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -167,7 +167,7 @@ class UploadBaseView(MultiFormView):
|
||||
]
|
||||
else:
|
||||
subtemplates_list.append({
|
||||
'name': 'appearance/generic_multiform_subtemplate.html',
|
||||
'name': 'sources/upload_multiform_subtemplate.html',
|
||||
'context': {
|
||||
'form_action': self.request.get_full_path(),
|
||||
'form_class': 'dropzone',
|
||||
|
||||
Reference in New Issue
Block a user