Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Commit

Permalink
Use camelCase for JSON properties. Closes #2417.
Browse files Browse the repository at this point in the history
  • Loading branch information
blueimp committed Jul 10, 2013
1 parent 7700ae6 commit 51fd3eb
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 60 deletions.
14 changes: 9 additions & 5 deletions angularjs.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<!--
/*
* jQuery File Upload Plugin AngularJS Demo 1.4.0
* jQuery File Upload Plugin AngularJS Demo 1.5.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
Expand Down Expand Up @@ -112,15 +112,18 @@ <h2 class="lead">AngularJS version</h2>
<!-- The table listing the files available for upload/download -->
<table class="table table-striped files ng-cloak">
<tr data-ng-repeat="file in queue">
<td data-ng-switch data-on="!!file.thumbnail_url">
<td data-ng-switch data-on="!!file.thumbnailUrl">
<div class="preview" data-ng-switch-when="true">
<a data-ng-href="{{file.url}}" title="{{file.name}}" class="gallery" download="{{file.name}}" data-ng-click="display($event, file)"><img data-ng-src="{{file.thumbnail_url}}" alt=""></a>
<a data-ng-href="{{file.url}}" title="{{file.name}}" download="{{file.name}}" data-gallery><img data-ng-src="{{file.thumbnailUrl}}" alt=""></a>
</div>
<div class="preview" data-ng-switch-default data-file-upload-preview="file"></div>
</td>
<td>
<p class="name" data-ng-switch data-on="!!file.url">
<a data-ng-switch-when="true" data-ng-href="{{file.url}}" title="{{file.name}}" class="gallery" download="{{file.name}}" data-ng-click="display($event, file)">{{file.name}}</a>
<span data-ng-switch-when="true" data-ng-switch data-on="!!file.thumbnailUrl">
<a data-ng-switch-when="true" data-ng-href="{{file.url}}" title="{{file.name}}" download="{{file.name}}" data-gallery>{{file.name}}</a>
<a data-ng-switch-default data-ng-href="{{file.url}}" title="{{file.name}}" download="{{file.name}}">{{file.name}}</a>
</span>
<span data-ng-switch-default>{{file.name}}</span>
</p>
<div data-ng-show="file.error"><span class="label label-important">Error</span> {{file.error}}</div>
Expand Down Expand Up @@ -160,7 +163,7 @@ <h3>Demo Notes</h3>
</div>
</div>
<!-- The blueimp Gallery widget -->
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls">
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even">
<div class="slides"></div>
<h3 class="title"></h3>
<a class="prev"></a>
Expand All @@ -181,6 +184,7 @@ <h3 class="title"></h3>
<script src="http://blueimp.github.io/cdn/js/bootstrap.min.js"></script>
<!-- blueimp Gallery script -->
<script src="http://blueimp.github.io/Gallery/js/blueimp-gallery.min.js"></script>
<script src="http://blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="js/jquery.iframe-transport.js"></script>
<!-- The basic File Upload plugin -->
Expand Down
10 changes: 5 additions & 5 deletions index.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<!--
/*
* jQuery File Upload Plugin Demo 8.3.0
* jQuery File Upload Plugin Demo 8.6.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -184,14 +184,14 @@ <h3 class="title"></h3>
<tr class="template-download fade">
<td>
<span class="preview">
{% if (file.thumbnail_url) { %}
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnail_url%}"></a>
{% if (file.thumbnailUrl) { %}
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
{% } %}
</span>
</td>
<td>
<p class="name">
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnail_url?'data-gallery':''%}>{%=file.name%}</a>
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
</p>
{% if (file.error) { %}
<div><span class="label label-important">Error</span> {%=file.error%}</div>
Expand All @@ -201,7 +201,7 @@ <h3 class="title"></h3>
<span class="size">{%=o.formatFileSize(file.size)%}</span>
</td>
<td>
<button class="btn btn-danger delete" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}"{% if (file.delete_with_credentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
<button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
<i class="icon-trash icon-white"></i>
<span>Delete</span>
</button>
Expand Down
23 changes: 3 additions & 20 deletions js/app.js
@@ -1,5 +1,5 @@
/*
* jQuery File Upload Plugin Angular JS Example 1.1.3
* jQuery File Upload Plugin Angular JS Example 1.2.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
Expand Down Expand Up @@ -48,23 +48,6 @@
$scope.options = {
url: url
};
$scope.display = function ($event, file) {
var images = $filter('filter')($scope.queue, function (file) {
if (file.thumbnail_url) {
return true;
}
});
if ($window.blueimp.Gallery(images, {
index: file,
urlProperty: 'url',
titleProperty: 'name',
thumbnailProperty: 'thumbnail_url'
})) {
// Prevent the default link action on
// successful Gallery initialization:
$event.preventDefault();
}
};
$http.get(url)
.then(
function (response) {
Expand All @@ -91,8 +74,8 @@
file.$destroy = function () {
state = 'pending';
return $http({
url: file.delete_url,
method: file.delete_type
url: file.deleteUrl,
method: file.deleteType
}).then(
function () {
state = 'resolved';
Expand Down
8 changes: 4 additions & 4 deletions server/gae-go/app/main.go
@@ -1,5 +1,5 @@
/*
* jQuery File Upload Plugin GAE Go Example 3.0.2
* jQuery File Upload Plugin GAE Go Example 3.1.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2011, Sebastian Tschan
Expand Down Expand Up @@ -47,13 +47,13 @@ var (
type FileInfo struct {
Key appengine.BlobKey `json:"-"`
Url string `json:"url,omitempty"`
ThumbnailUrl string `json:"thumbnail_url,omitempty"`
ThumbnailUrl string `json:"thumbnailUrl,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
Size int64 `json:"size"`
Error string `json:"error,omitempty"`
DeleteUrl string `json:"delete_url,omitempty"`
DeleteType string `json:"delete_type,omitempty"`
DeleteUrl string `json:"deleteUrl,omitempty"`
DeleteType string `json:"deleteType,omitempty"`
}

func (fi *FileInfo) ValidateType() (valid bool) {
Expand Down
8 changes: 4 additions & 4 deletions server/gae-python/main.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# jQuery File Upload Plugin GAE Python Example 2.0.2
# jQuery File Upload Plugin GAE Python Example 2.1.0
# https://github.com/blueimp/jQuery-File-Upload
#
# Copyright 2011, Sebastian Tschan
Expand Down Expand Up @@ -90,8 +90,8 @@ def handle_upload(self):
self.write_blob(fieldStorage.value, result)
)
blob_keys.append(blob_key)
result['delete_type'] = 'DELETE'
result['delete_url'] = self.request.host_url +\
result['deleteType'] = 'DELETE'
result['deleteUrl'] = self.request.host_url +\
'/?key=' + urllib.quote(blob_key, '')
if (IMAGE_TYPES.match(result['type'])):
try:
Expand All @@ -101,7 +101,7 @@ def handle_upload(self):
'https'
)
)
result['thumbnail_url'] = result['url'] +\
result['thumbnailUrl'] = result['url'] +\
THUMBNAIL_MODIFICATOR
except: # Could not get an image serving url
pass
Expand Down
8 changes: 4 additions & 4 deletions server/node/server.js
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/*
* jQuery File Upload Plugin Node.js Example 2.0.4
* jQuery File Upload Plugin Node.js Example 2.1.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2012, Sebastian Tschan
Expand Down Expand Up @@ -68,7 +68,7 @@
this.name = file.name;
this.size = file.size;
this.type = file.type;
this.delete_type = 'DELETE';
this.deleteType = 'DELETE';
},
UploadHandler = function (req, res, callback) {
this.req = req;
Expand Down Expand Up @@ -176,12 +176,12 @@
var that = this,
baseUrl = (options.ssl ? 'https:' : 'http:') +
'//' + req.headers.host + options.uploadUrl;
this.url = this.delete_url = baseUrl + encodeURIComponent(this.name);
this.url = this.deleteUrl = baseUrl + encodeURIComponent(this.name);
Object.keys(options.imageVersions).forEach(function (version) {
if (_existsSync(
options.uploadDir + '/' + version + '/' + that.name
)) {
that[version + '_url'] = baseUrl + version + '/' +
that[version + 'Url'] = baseUrl + version + '/' +
encodeURIComponent(that.name);
}
});
Expand Down
16 changes: 8 additions & 8 deletions server/php/UploadHandler.php
@@ -1,6 +1,6 @@
<?php
/*
* jQuery File Upload Plugin PHP Class 6.7.1
* jQuery File Upload Plugin PHP Class 6.8.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -223,15 +223,15 @@ protected function get_download_url($file_name, $version = null, $direct = false
}

protected function set_additional_file_properties($file) {
$file->delete_url = $this->options['script_url']
$file->deleteUrl = $this->options['script_url']
.$this->get_query_separator($this->options['script_url'])
.'file='.rawurlencode($file->name);
$file->delete_type = $this->options['delete_type'];
if ($file->delete_type !== 'DELETE') {
$file->delete_url .= '&_method=DELETE';
$file->deleteType = $this->options['delete_type'];
if ($file->deleteType !== 'DELETE') {
$file->deleteUrl .= '&_method=DELETE';
}
if ($this->options['access_control_allow_credentials']) {
$file->delete_with_credentials = true;
$file->deleteWithCredentials = true;
}
}

Expand Down Expand Up @@ -271,7 +271,7 @@ protected function get_file_object($file_name) {
foreach($this->options['image_versions'] as $version => $options) {
if (!empty($version)) {
if (is_file($this->get_upload_path($file_name, $version))) {
$file->{$version.'_url'} = $this->get_download_url(
$file->{$version.'Url'} = $this->get_download_url(
$file->name,
$version
);
Expand Down Expand Up @@ -652,7 +652,7 @@ protected function handle_image_file($file_path, $file) {
foreach($this->options['image_versions'] as $version => $options) {
if ($this->create_scaled_image($file->name, $version, $options)) {
if (!empty($version)) {
$file->{$version.'_url'} = $this->get_download_url(
$file->{$version.'Url'} = $this->get_download_url(
$file->name,
$version
);
Expand Down
10 changes: 5 additions & 5 deletions test/index.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<!--
/*
* jQuery File Upload Plugin Test 8.3.0
* jQuery File Upload Plugin Test 8.6.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -112,14 +112,14 @@ <h2 id="qunit-userAgent"></h2>
<tr class="template-download">
<td>
<span class="preview">
{% if (file.thumbnail_url) { %}
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnail_url%}"></a>
{% if (file.thumbnailUrl) { %}
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
{% } %}
</span>
</td>
<td>
<p class="name">
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnail_url?'data-gallery':''%}>{%=file.name%}</a>
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
</p>
{% if (file.error) { %}
<div><span class="label label-important">Error</span> {%=file.error%}</div>
Expand All @@ -129,7 +129,7 @@ <h2 id="qunit-userAgent"></h2>
<span class="size">{%=o.formatFileSize(file.size)%}</span>
</td>
<td>
<button class="btn btn-danger delete" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}"{% if (file.delete_with_credentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
<button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
<i class="icon-trash icon-white"></i>
<span>Delete</span>
</button>
Expand Down
10 changes: 5 additions & 5 deletions test/test.js
@@ -1,5 +1,5 @@
/*
* jQuery File Upload Plugin Test 8.0
* jQuery File Upload Plugin Test 8.6.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -959,8 +959,8 @@ $(function () {
$('#fileupload').data('fileupload'))
._renderDownload([{
name: 'test',
delete_url: 'test',
delete_type: 'DELETE'
deleteUrl: 'test',
deleteType: 'DELETE'
}])
.appendTo($('#fileupload .files'))
.show()
Expand Down Expand Up @@ -1065,8 +1065,8 @@ $(function () {
$('#fileupload').data('fileupload'))
._renderDownload([{
name: 'test',
delete_url: '.',
delete_type: 'GET'
deleteUrl: '.',
deleteType: 'GET'
}])
.appendTo($('#fileupload .files'))
.show()
Expand Down

0 comments on commit 51fd3eb

Please sign in to comment.