From 9f5e80e794c041dc30855b80a0cb420248c20a54 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 9 Jun 2017 18:07:41 +0200 Subject: [PATCH 1/5] Hijack the quota box in the files app Signed-off-by: Joas Schilling --- js/quota-files-sidebar.js | 9 +++++++++ js/{quota.js => quota-personal.js} | 0 lib/AppInfo/Application.php | 3 +++ templates/quota.php | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 js/quota-files-sidebar.js rename js/{quota.js => quota-personal.js} (100%) diff --git a/js/quota-files-sidebar.js b/js/quota-files-sidebar.js new file mode 100644 index 00000000..c1ee5f0b --- /dev/null +++ b/js/quota-files-sidebar.js @@ -0,0 +1,9 @@ +$(document).ready(function () { + + var $p = $('

'); + $p.addClass('quotatext-additional').text(t('external', 'Do you need more space?')); + $('li#quota').on('click', function(e) { + OC.redirect(OC.generateUrl('/apps/external/1')); + }); + $('li#quota div.quota-container').after($p); +}); diff --git a/js/quota.js b/js/quota-personal.js similarity index 100% rename from js/quota.js rename to js/quota-personal.js diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 8d68a614..9003f0a1 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -82,6 +82,9 @@ public function registerPersonalPage(array $sites) { foreach ($sites as $site) { if ($site['type'] === SitesManager::TYPE_QUOTA) { \OCP\App::registerPersonal('external', 'personal'); + \OC::$server->getEventDispatcher()->addListener('OCA\Files::loadAdditionalScripts', function() { + \OCP\Util::addScript('external', 'quota-files-sidebar'); + }); return; } } diff --git a/templates/quota.php b/templates/quota.php index 24f0c3b0..33c3ec97 100644 --- a/templates/quota.php +++ b/templates/quota.php @@ -19,7 +19,7 @@ * */ -script('external', 'quota'); +script('external', 'quota-personal'); ?>