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"> <div class="searchresults spacer-top-lg">
<ol ng-show="results"> <ol ng-show="results">
<li ng-repeat="result in 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> <span class="grey">{{ result.getSearchResultSubtitle() | translate }}</span>
</ol> </ol>
<p ng-show="!results" translate>No results.</p> <p ng-show="!results" translate>No results.</p>

View File

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

View File

@ -135,24 +135,8 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
// ** PDF presentation functions **/ // ** PDF presentation functions **/
// show document on projector // show document on projector
$scope.showPdf = function (mediafile) { $scope.showPdf = function (mediafile) {
var postUrl, var postUrl = '/rest/core/projector/1/prune_elements/';
data; var 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 = [{
name: 'mediafiles/mediafile', name: 'mediafiles/mediafile',
id: mediafile.id, id: mediafile.id,
numPages: mediafile.mediafile.pages, numPages: mediafile.mediafile.pages,
@ -161,7 +145,6 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
rotate: 0, rotate: 0,
visible: true visible: true
}]; }];
}
$http.post(postUrl, data); $http.post(postUrl, data);
}; };
@ -192,19 +175,27 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
}; };
$scope.mediafileZoomIn = function () { $scope.mediafileZoomIn = function () {
var mediafileElement = getCurrentlyPresentedMediafile(); var mediafileElement = getCurrentlyPresentedMediafile();
var scale = 1;
if (parseFloat(mediafileElement.scale)) {
scale = mediafileElement.scale;
}
sendMediafileCommand({ sendMediafileCommand({
scale: parseFloat(mediafileElement.scale) + 0.2 scale: scale + 0.2
}); });
}; };
$scope.mediafileFit = function () { $scope.mediafileFit = function () {
sendMediafileCommand({ sendMediafileCommand({
scale: 1 scale: 'page-fit'
}); });
}; };
$scope.mediafileZoomOut = function () { $scope.mediafileZoomOut = function () {
var mediafileElement = getCurrentlyPresentedMediafile(); var mediafileElement = getCurrentlyPresentedMediafile();
var scale = 1;
if (parseFloat(mediafileElement.scale)) {
scale = mediafileElement.scale;
}
sendMediafileCommand({ sendMediafileCommand({
scale: parseFloat(mediafileElement.scale) - 0.2 scale: scale - 0.2
}); });
}; };
$scope.mediafileChangePage = function(pageNum) { $scope.mediafileChangePage = function(pageNum) {