Fixed mediafile serializer and template. Fixed #1650.

This commit is contained in:
Norman Jäckel 2015-11-06 16:43:21 +01:00
parent fb4a261cc5
commit cc21b3d015
5 changed files with 5 additions and 8 deletions

View File

@ -25,6 +25,6 @@
"font-awesome-bower": "4.3.0",
"js-data": "~2.3.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',
'uploader',
'filesize',
'filetype',
'timestamp',)
def get_filesize(self, mediafile):

View File

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

View File

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

View File

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