Browse Source

Show usage percenteage in the tooltip

The tooltip of the initial quota display showed the usage percenteage
and the total available space. However, the total available space was
redundant, as it was shown just below. The tooltip of the updated quota
display showed the usage percenteage, but based on the quota rather than
the total available space, so there was a mismatch between the tooltip
and the bar below. Now the tooltip of the initial and the updated quota
display both show just the usage percenteage based on the total
available space.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
tags/v25.0.0beta2
Daniel Calviño Sánchez 1 year ago
parent
commit
4c837dadf2
3 changed files with 3 additions and 3 deletions
  1. 1
    1
      apps/files/js/files.js
  2. 1
    1
      apps/files/lib/Helper.php
  3. 1
    1
      apps/files/templates/appnavigation.php

+ 1
- 1
apps/files/js/files.js View File

@@ -104,7 +104,7 @@
var humanUsed = OC.Util.humanFileSize(response.data.used, true);
var humanTotal = OC.Util.humanFileSize(response.data.total, true);
if (response.data.quota > 0) {
$('#quota').attr('data-original-title', Math.floor(response.data.used/response.data.quota*1000)/10 + '%');
$('#quota').attr('data-original-title', t('files', '{used}%', {used: Math.round(response.data.usedSpacePercent)}));
$('#quota progress').val(response.data.usedSpacePercent);
$('#quotatext').html(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanTotal}));
} else {

+ 1
- 1
apps/files/lib/Helper.php View File

@@ -60,7 +60,7 @@ class Helper {
'quota' => $storageInfo['quota'],
'total' => $storageInfo['total'],
'used' => $storageInfo['used'],
'usedSpacePercent' => (int)$storageInfo['relative'],
'usedSpacePercent' => $storageInfo['relative'],
'owner' => $storageInfo['owner'],
'ownerDisplayName' => $storageInfo['ownerDisplayName'],
'mountType' => $storageInfo['mountType'],

+ 1
- 1
apps/files/templates/appnavigation.php View File

@@ -17,7 +17,7 @@
</li>
<?php else: ?>
<li id="quota" class="has-tooltip pinned <?php p($pinned === 0 ? 'first-pinned ' : '') ?>"
title="<?php p($l->t('%s%% of %s used', [$_['usage_relative'], $_['total_space']])); ?>">
title="<?php p($l->t('%s%%', [round($_['usage_relative'])])); ?>">
<a href="#" class="icon-quota svg quota-navigation-item">
<p id="quotatext" class="quota-navigation-item__text"><?php p($l->t('%1$s of %2$s used', [$_['usage'], $_['total_space']])); ?></p>
<div class="quota-navigation-item__container">

Loading…
Cancel
Save