Merge pull request #1666 from normanjaeckel/Mediafile

Fixed serializer and template. Fixed #1650.
This commit is contained in:
Oskar Hahn 2015-11-07 07:14:39 +01:00
commit 08c31a6b09
5 changed files with 5 additions and 8 deletions

View File

@ -25,6 +25,6 @@
"font-awesome-bower": "4.3.0", "font-awesome-bower": "4.3.0",
"js-data": "~2.3.0", "js-data": "~2.3.0",
"js-data-angular": "~3.0.0", "js-data-angular": "~3.0.0",
"ng-file-upload": "~7.0.17" "ng-file-upload": "~9.1.2"
} }
} }

View File

@ -44,7 +44,6 @@ class MediafileSerializer(ModelSerializer):
'mediafile', 'mediafile',
'uploader', 'uploader',
'filesize', 'filesize',
'filetype',
'timestamp',) 'timestamp',)
def get_filesize(self, mediafile): def get_filesize(self, mediafile):

View File

@ -96,9 +96,7 @@ function uploadFile($timeout, $scope, $state, Upload, mediafile) {
file.upload = Upload.upload({ file.upload = Upload.upload({
url: '/rest/mediafiles/mediafile/' + (mediafile ? mediafile.id : ''), url: '/rest/mediafiles/mediafile/' + (mediafile ? mediafile.id : ''),
method: mediafile ? 'PUT' : 'POST', method: mediafile ? 'PUT' : 'POST',
fields: {title: file.title}, data: {mediafile: file.newFile, title: file.title}
file: file.mediafile,
fileFormDataName: 'mediafile'
}); });
file.upload.then(function (response) { file.upload.then(function (response) {

View File

@ -14,7 +14,7 @@
<div ng-if="mediafile.id"> <div ng-if="mediafile.id">
<span translate>Current value: </span>{{ mediafile.filename }} <span translate>Current value: </span>{{ mediafile.filename }}
</div> </div>
<input type="file" ngf-select ng-model="mediafile.mediafile" required/> <input type="file" ngf-select ng-model="mediafile.newFile" required/>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -50,8 +50,8 @@
<tbody> <tbody>
<tr ng-repeat="mediafile in mediafiles | filter: filter.search | <tr ng-repeat="mediafile in mediafiles | filter: filter.search |
orderBy: sortColumn:reverse"> orderBy: sortColumn:reverse">
<td><a ng-href="{{ mediafile.mediafile }}" target="_self">{{ mediafile.title_or_filename }}</a> <td><a ng-href="/media/{{ mediafile.mediafile.name }}" target="_self">{{ mediafile.title_or_filename }}</a>
<td class="optional">{{ mediafile.filetype }} <td class="optional">{{ mediafile.mediafile.type }}
<td>{{ mediafile.filesize }} <td>{{ mediafile.filesize }}
<td>{{ mediafile.timestamp }} <td>{{ mediafile.timestamp }}
<td>{{ mediafile.uploader }} <td>{{ mediafile.uploader }}