From b1dc73ec4dd87a9d93eabcee20588abf60aea966 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Tue, 9 Feb 2016 22:09:38 +0100 Subject: [PATCH] Use prune_elements for activate mediafile. (Fixed #1910) Use page-fit to show pdf in full width. Fix mediafile search result. --- openslides/core/static/templates/search.html | 8 +++- .../mediafiles/static/js/mediafiles/base.js | 10 ++++- .../mediafiles/static/js/mediafiles/site.js | 37 +++++++------------ 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/openslides/core/static/templates/search.html b/openslides/core/static/templates/search.html index 354e69c12..c7bce687e 100644 --- a/openslides/core/static/templates/search.html +++ b/openslides/core/static/templates/search.html @@ -15,7 +15,13 @@
  1. - {{ result.getSearchResultName() }}
    + + {{ result.getSearchResultName() }} + + + {{ result.getSearchResultName() }} + +
    {{ result.getSearchResultSubtitle() | translate }}

No results.

diff --git a/openslides/mediafiles/static/js/mediafiles/base.js b/openslides/mediafiles/static/js/mediafiles/base.js index b9c2abc95..a7b6a7851 100644 --- a/openslides/mediafiles/static/js/mediafiles/base.js +++ b/openslides/mediafiles/static/js/mediafiles/base.js @@ -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) { diff --git a/openslides/mediafiles/static/js/mediafiles/site.js b/openslides/mediafiles/static/js/mediafiles/site.js index 717e062d2..ee2f0b6d9 100644 --- a/openslides/mediafiles/static/js/mediafiles/site.js +++ b/openslides/mediafiles/static/js/mediafiles/site.js @@ -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) {