Skip to content

Commit

Permalink
Move register script to utility
Browse files Browse the repository at this point in the history
(it was in public/ previously and was gitignored)
  • Loading branch information
tcitworld committed Sep 27, 2016
1 parent 8a1e68a commit 78a65f0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
if (User::isLoggedIn()) {
$eventDispatcher = $app->getContainer()->getServer()->getEventDispatcher();
$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function() {
Util::addScript('calendar', 'public/registerUtility');
Util::addScript('calendar', 'utility/registerUtility');
});
}
41 changes: 41 additions & 0 deletions js/utility/registerUtility.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Calendar App
*
* @author Thomas Citharel
* @copyright 2016 Thomas Citharel <tcit@tcit.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/

'use strict';

let register = (function () {

OCA.Files.fileActions.registerAction({
name: 'View',
mime: 'text/calendar',
displayName: t('calendar', 'Calendar'),
actionHandler: function(filename, context) {
let path = $('#fileList').find('[data-file="'+filename+'"]').data('path');
path = path.substring(1);
window.location = OC.generateUrl('apps/calendar/#/import/{filename}', {filename: encodeURI(path + '/' + filename)});
},
permissions: OC.PERMISSION_READ,
icon: function () {
return OC.imagePath('core', 'actions/view');
}
});
OCA.Files.fileActions.setDefault('text/calendar', 'View');
})();

0 comments on commit 78a65f0

Please sign in to comment.