Skip to content

Commit 61d68f2

Browse files
committed
Merge pull request sigurdga#37 from ET-CS/master
This is a major update from ET-CS. Version 8.8.2(+) and new demos: Basic, Basic-Plus, Angular, jQuery UI. * Working only with Django 1.5+. Because of the {% Verbatim %} template tag inside the Angular & jQuery demos. Django 1.6 should be just around the corner, deprecating 1.4. * Added .jquery.cookies.js for the basic and basic-plus demos to read the csrf cookie. * Used newer (not stable release) angular.js release (not like the original Jquery-File-Upload project) due to new settings in that release to supply csrf using other cookie name than default (like Django's). * DELETE view will now always return JSON.
2 parents 8baa9fc + bec79f9 commit 61d68f2

28 files changed

+1427
-150
lines changed

fileupload/static/css/bootstrap-ie6.min.css

-1
This file was deleted.

fileupload/static/css/bootstrap-responsive.min.css

-9
This file was deleted.

fileupload/static/css/bootstrap.min.css

-9
This file was deleted.

fileupload/static/css/demo-ie8.css

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@charset "UTF-8";
2+
/*
3+
* jQuery File Upload Demo CSS Fixes for IE<9 1.0.0
4+
* https://github.com/blueimp/jQuery-File-Upload
5+
*
6+
* Copyright 2013, Sebastian Tschan
7+
* https://blueimp.net
8+
*
9+
* Licensed under the MIT license:
10+
* http://www.opensource.org/licenses/MIT
11+
*/
12+
13+
.navigation {
14+
list-style: none;
15+
padding: 0;
16+
margin: 1em 0;
17+
}
18+
.navigation li {
19+
display: inline;
20+
margin-right: 10px;
21+
}

fileupload/static/css/demo.css

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
@charset "UTF-8";
2+
/*
3+
* jQuery File Upload Demo CSS 1.0.2
4+
* https://github.com/blueimp/jQuery-File-Upload
5+
*
6+
* Copyright 2013, Sebastian Tschan
7+
* https://blueimp.net
8+
*
9+
* Licensed under the MIT license:
10+
* http://www.opensource.org/licenses/MIT
11+
*/
12+
13+
body {
14+
max-width: 750px;
15+
margin: 0 auto;
16+
padding: 1em;
17+
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, sans-serif;
18+
font-size: 1em;
19+
line-height: 1.4em;
20+
background: #222;
21+
color: #fff;
22+
-webkit-text-size-adjust: 100%;
23+
-ms-text-size-adjust: 100%;
24+
}
25+
a {
26+
color: orange;
27+
text-decoration: none;
28+
}
29+
img {
30+
border: 0;
31+
vertical-align: middle;
32+
}
33+
h1 {
34+
line-height: 1em;
35+
}
36+
blockquote {
37+
padding: 0 0 0 15px;
38+
margin: 0 0 20px;
39+
border-left: 5px solid #eee;
40+
}
41+
table {
42+
width: 100%;
43+
margin: 10px 0;
44+
}
45+
46+
.fileupload-progress {
47+
margin: 10px 0;
48+
}
49+
.fileupload-progress .progress-extended {
50+
margin-top: 5px;
51+
}
52+
.error {
53+
color: red;
54+
}
55+
56+
@media (min-width: 481px) {
57+
.navigation {
58+
list-style: none;
59+
padding: 0;
60+
}
61+
.navigation li {
62+
display: inline-block;
63+
}
64+
.navigation li:not(:first-child):before {
65+
content: '| ';
66+
}
67+
}
+19-35
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@charset 'UTF-8';
1+
@charset "UTF-8";
22
/*
3-
* jQuery File Upload UI Plugin CSS 6.3
3+
* jQuery File Upload UI Plugin CSS 8.8.1
44
* https://github.com/blueimp/jQuery-File-Upload
55
*
66
* Copyright 2010, Sebastian Tschan
@@ -13,72 +13,56 @@
1313
.fileinput-button {
1414
position: relative;
1515
overflow: hidden;
16-
float: left;
17-
margin-right: 4px;
1816
}
1917
.fileinput-button input {
2018
position: absolute;
2119
top: 0;
2220
right: 0;
2321
margin: 0;
24-
border: solid transparent;
25-
border-width: 0 0 100px 200px;
2622
opacity: 0;
2723
filter: alpha(opacity=0);
28-
-moz-transform: translate(-300px, 0) scale(4);
24+
transform: translate(-300px, 0) scale(4);
25+
font-size: 23px;
2926
direction: ltr;
3027
cursor: pointer;
3128
}
3229
.fileupload-buttonbar .btn,
3330
.fileupload-buttonbar .toggle {
3431
margin-bottom: 5px;
3532
}
36-
.files .progress {
37-
width: 200px;
38-
}
33+
.progress-animated .progress-bar,
3934
.progress-animated .bar {
4035
background: url(../img/progressbar.gif) !important;
4136
filter: none;
4237
}
4338
.fileupload-loading {
44-
position: absolute;
45-
left: 50%;
46-
width: 128px;
47-
height: 128px;
39+
float: right;
40+
width: 32px;
41+
height: 32px;
4842
background: url(../img/loading.gif) center no-repeat;
43+
background-size: contain;
4944
display: none;
5045
}
5146
.fileupload-processing .fileupload-loading {
5247
display: block;
5348
}
54-
55-
/* Fix for IE 6: */
56-
*html .fileinput-button {
57-
line-height: 22px;
58-
margin: 1px -3px 0 0;
49+
.files audio,
50+
.files video {
51+
max-width: 300px;
5952
}
6053

61-
/* Fix for IE 7: */
62-
*+html .fileinput-button {
63-
margin: 1px 0 0 0;
64-
}
65-
66-
@media (max-width: 480px) {
54+
@media (max-width: 767px) {
55+
.fileupload-buttonbar .toggle,
56+
.files .toggle,
6757
.files .btn span {
6858
display: none;
6959
}
70-
.files .preview * {
71-
width: 40px;
72-
}
73-
.files .name * {
60+
.files .name {
7461
width: 80px;
75-
display: inline-block;
7662
word-wrap: break-word;
7763
}
78-
.files .progress {
79-
width: 20px;
80-
}
81-
.files .delete {
82-
width: 60px;
64+
.files audio,
65+
.files video {
66+
max-width: 80px;
8367
}
8468
}

fileupload/static/css/style.css

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
body{
2-
padding-top: 60px;
1+
@charset "UTF-8";
2+
/*
3+
* jQuery File Upload Plugin CSS Example 8.8.2
4+
* https://github.com/blueimp/jQuery-File-Upload
5+
*
6+
* Copyright 2013, Sebastian Tschan
7+
* https://blueimp.net
8+
*
9+
* Licensed under the MIT license:
10+
* http://www.opensource.org/licenses/MIT
11+
*/
12+
13+
body {
14+
padding-top: 60px;
315
}
416

517
.preview img {
6-
max-height: 50px;
7-
}
18+
max-height:50px;
19+
}
Binary file not shown.
-13.5 KB
Binary file not shown.

fileupload/static/img/progressbar.gif

3.25 KB
Loading

fileupload/static/js/app.js

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
* jQuery File Upload Plugin Angular JS Example 1.2.1
3+
* https://github.com/blueimp/jQuery-File-Upload
4+
*
5+
* Copyright 2013, Sebastian Tschan
6+
* https://blueimp.net
7+
*
8+
* Licensed under the MIT license:
9+
* http://www.opensource.org/licenses/MIT
10+
*/
11+
12+
/*jslint nomen: true, regexp: true */
13+
/*global window, angular */
14+
15+
(function () {
16+
'use strict';
17+
18+
19+
var isOnGitHub = window.location.hostname === 'blueimp.github.io',
20+
url = '/upload/angular/',
21+
urlview = '/upload/view/';
22+
23+
angular.module('demo', [
24+
'blueimp.fileupload'
25+
])
26+
.config([
27+
'$httpProvider', 'fileUploadProvider',
28+
function ($httpProvider, fileUploadProvider) {
29+
delete $httpProvider.defaults.headers.common['X-Requested-With'];
30+
fileUploadProvider.defaults.redirect = window.location.href.replace(
31+
/\/[^\/]*$/,
32+
'/cors/result.html?%s'
33+
);
34+
35+
if (isOnGitHub) {
36+
// Demo settings:
37+
angular.extend(fileUploadProvider.defaults, {
38+
// Enable image resizing, except for Android and Opera,
39+
// which actually support image resizing, but fail to
40+
// send Blob objects via XHR requests:
41+
disableImageResize: /Android(?!.*Chrome)|Opera/
42+
.test(window.navigator.userAgent),
43+
maxFileSize: 5000000,
44+
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
45+
});
46+
}
47+
}
48+
])
49+
50+
.controller('DemoFileUploadController', [
51+
'$scope', '$http', '$filter', '$window',
52+
function ($scope, $http) {
53+
$scope.options = {
54+
url: url
55+
};
56+
if (!isOnGitHub) {
57+
$scope.loadingFiles = true;
58+
$http.get(urlview)
59+
.then(
60+
function (response) {
61+
$scope.loadingFiles = false;
62+
$scope.queue = response.data.files || [];
63+
},
64+
function () {
65+
$scope.loadingFiles = false;
66+
}
67+
);
68+
}
69+
}
70+
])
71+
72+
.controller('FileDestroyController', [
73+
'$scope', '$http',
74+
function ($scope, $http) {
75+
var file = $scope.file,
76+
state;
77+
if (file.url) {
78+
file.$state = function () {
79+
return state;
80+
};
81+
file.$destroy = function () {
82+
state = 'pending';
83+
return $http({
84+
url: file.deleteUrl,
85+
method: file.deleteType,
86+
xsrfHeaderName: 'X-CSRFToken',
87+
xsrfCookieName: 'csrftoken'
88+
}).then(
89+
function () {
90+
state = 'resolved';
91+
$scope.clear(file);
92+
},
93+
function () {
94+
state = 'rejected';
95+
}
96+
);
97+
};
98+
} else if (!file.$cancel && !file._index) {
99+
file.$cancel = function () {
100+
$scope.clear(file);
101+
};
102+
}
103+
}
104+
]);
105+
106+
}());

fileupload/static/js/bootstrap.min.js

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)