Use prune_elements for activate mediafile. (Fixed #1910)

Use page-fit to show pdf in full width.
Fix mediafile search result.
This commit is contained in:
Emanuel Schuetze 2016-02-09 22:09:38 +01:00
parent 9fda27dfd6
commit b1dc73ec4d
3 changed files with 30 additions and 25 deletions

View File

@ -15,7 +15,13 @@
<div class="searchresults spacer-top-lg">
<ol ng-show="results">
<li ng-repeat="result in results">
<a ui-sref="{{ result.urlState }}({{ result.urlParam }})">{{ result.getSearchResultName() }}</a><br>
<a ng-if="!result.mediafileUrl" ui-sref="{{ result.urlState }}({{ result.urlParam }})">
{{ result.getSearchResultName() }}
</a>
<a ng-if="result.mediafileUrl" href="{{ result.mediafileUrl }}" target="_blank">
{{ result.getSearchResultName() }}
</a>
<br>
<span class="grey">{{ result.getSearchResultSubtitle() | translate }}</span>
</ol>
<p ng-show="!results" translate>No results.</p>

View File

@ -15,7 +15,15 @@ angular.module('OpenSlidesApp.mediafiles', [])
methods: {
getResourceName: function () {
return name;
}
},
// link name which is shown in search result
getSearchResultName: function () {
return this.title;
},
// subtitle of search result
getSearchResultSubtitle: function () {
return "File";
},
},
computed: {
is_presentable: ['filetype', function (filetype) {

View File

@ -135,24 +135,8 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
// ** PDF presentation functions **/
// show document on projector
$scope.showPdf = function (mediafile) {
var postUrl,
data;
if ($scope.presentedMediafiles.length > 0) {
// update first mediafile, at the moment there should not be more
var uuid = $scope.presentedMediafiles[0].uuid;
postUrl = '/rest/core/projector/1/update_elements/';
data = {};
data[uuid] = {
id: mediafile.id,
numPages: mediafile.mediafile.pages,
page: 1,
scale: 1,
rotate: 0,
visible: true
};
} else {
postUrl = '/rest/core/projector/1/prune_elements/';
data = [{
var postUrl = '/rest/core/projector/1/prune_elements/';
var data = [{
name: 'mediafiles/mediafile',
id: mediafile.id,
numPages: mediafile.mediafile.pages,
@ -160,8 +144,7 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
scale: 1,
rotate: 0,
visible: true
}];
}
}];
$http.post(postUrl, data);
};
@ -192,19 +175,27 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
};
$scope.mediafileZoomIn = function () {
var mediafileElement = getCurrentlyPresentedMediafile();
var scale = 1;
if (parseFloat(mediafileElement.scale)) {
scale = mediafileElement.scale;
}
sendMediafileCommand({
scale: parseFloat(mediafileElement.scale) + 0.2
scale: scale + 0.2
});
};
$scope.mediafileFit = function () {
sendMediafileCommand({
scale: 1
scale: 'page-fit'
});
};
$scope.mediafileZoomOut = function () {
var mediafileElement = getCurrentlyPresentedMediafile();
var scale = 1;
if (parseFloat(mediafileElement.scale)) {
scale = mediafileElement.scale;
}
sendMediafileCommand({
scale: parseFloat(mediafileElement.scale) - 0.2
scale: scale - 0.2
});
};
$scope.mediafileChangePage = function(pageNum) {