Merge pull request #1966 from emanuelschuetze/mediafile

Use prune_elements for activate mediafile. (Fixed #1910)
This commit is contained in:
Norman Jäckel 2016-02-09 23:22:42 +01:00
commit ad7653fb76
5 changed files with 69 additions and 53 deletions

View File

@ -22,7 +22,9 @@
title="{{ 'Edit current slide' | translate}}">
<i class="fa fa-pencil"></i>
</a>
&nbsp;
<!-- scale -->
<div class="btn-group">
<a ng-click="controlProjector('scale', 'down')"
class="btn btn-default btn-sm"
title="{{ 'Smaller' | translate}}">
@ -33,8 +35,16 @@
title="{{ 'Bigger' | translate}}">
<i class="fa fa-search-plus"></i>
</a>
<a ng-click="controlProjector('scale', 'reset')"
class="btn btn-default btn-sm"
title="{{ 'Reset scaling' | translate}}">
<i class="fa fa-undo"></i>
</a>
</div>
<span ng-class="{ 'notNull': scaleLevel != 0 }">{{ scaleLevel }}</span>
&nbsp;
<!-- scroll -->
<div class="btn-group">
<a ng-click="controlProjector('scroll', 'down')"
class="btn btn-default btn-sm"
title="{{ 'Scroll up' | translate}}">
@ -50,6 +60,7 @@
title="{{ 'Reset scrolling' | translate}}">
<i class="fa fa-undo"></i>
</a>
</div>
<span ng-class="{ 'notNull': scrollLevel != 0 }">{{ scrollLevel }}</span>
</div>
</div>

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,
@ -161,7 +145,6 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
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) {

View File

@ -92,7 +92,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
resolve: {
motion: function() {
return Motion.find($stateParams.id).then(function(motion) {
Motion.loadRelations(motion, 'agenda_item');
return Motion.loadRelations(motion, 'agenda_item');
});
},
},