add context menu option for directories in file app to 'load in GpxEdit'

merge-requests/1/head
Julien Veyssier 2017-04-05 01:59:28 +02:00
parent 5350c73f99
commit 940a3b3988
3 changed files with 33 additions and 0 deletions

View File

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- save/restore current tile layer
- integration in "Files" and "File sharing" context menu for .gpx files
[#11](https://gitlab.com/eneiluj/gpxedit-oc/issues/11) @rugk
- add directory context menu option in files app : load in GpxEdit
- notifications on tile layer add/remove
- makefile signs the app code
@ -30,6 +31,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- app is now compliant to occ check-code
- jshint and jslint in da place
- do not put @NoCSRFRequired everywhere in controllers
- replace decodeURI by decodeURIComponent
[#12](https://gitlab.com/eneiluj/gpxedit-oc/issues/12) @gezgez
- remove escapeshellcmd to avoid errors with special char in file name
## 0.0.4 2017-01-17
### Added

View File

@ -2,6 +2,30 @@ $(document).ready(function() {
if (OCA.Files && OCA.Files.fileActions && !$('#sharingToken').val()) {
var token = $('#sharingToken').val();
// file action for directories
if (!token) {
OCA.Files.fileActions.registerAction({
name: 'viewDirectoryGpxEdit',
displayName: t('gpxedit','Load in GpxEdit'),
mime: 'httpd/unix-directory',
permissions: OC.PERMISSION_READ,
icon: function () {return OC.imagePath('gpxedit', 'app_black');},
actionHandler: function(file, data){
var dir;
if (data.dir === '/'){
dir = data.dir+file;
}
else{
dir = data.dir+'/'+file;
}
var url = OC.generateUrl('apps/gpxedit/?dir={dir}',{'dir': dir});
window.open(url, '_blank');
}
});
}
function openFile(file, data){
var url = OC.generateUrl('apps/gpxedit/?file={filepath}',{'filepath': data.dir+'/'+file});
window.open(url, '_blank');

View File

@ -1570,6 +1570,11 @@
if (fileparam && fileparam !== undefined) {
loadAction(fileparam);
}
// load a directory if 'dir' GET url parameter was given
var dirparam = getUrlParameter('dir');
if (dirparam && dirparam !== undefined) {
loadFolderAction(dirparam);
}
});