summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--settings/js/apps.js35
-rw-r--r--settings/templates/apps.php2
2 files changed, 31 insertions, 6 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js
index 9dd27bcd5e1..ea6bd6ea5c6 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -62,11 +62,13 @@ OC.Settings.Apps = OC.Settings.Apps || {
var updateCategory = $.grep(jsondata, function(element, index) {
return element.ident === 'updates'
});
+ $('#apps-categories').html(html);
+ $('#app-category-' + OC.Settings.Apps.State.currentCategory).addClass('active');
if (updateCategory.length === 1) {
+ console.log(updateCategory);
OC.Settings.Apps.State.availableUpdates = updateCategory[0].counter;
+ OC.Settings.Apps.refreshUpdateCounter();
}
- $('#apps-categories').html(html);
- $('#app-category-' + OC.Settings.Apps.State.currentCategory).addClass('active');
},
complete: function() {
$('#app-navigation').removeClass('icon-loading');
@@ -143,8 +145,13 @@ OC.Settings.Apps = OC.Settings.Apps || {
}
});
} else {
- $('#apps-list').addClass('hidden');
- $('#apps-list-empty').removeClass('hidden').find('h2').text(t('settings', 'No apps found for your version'));
+ if (categoryId === 'updates') {
+ OC.Settings.Apps.showEmptyUpdates();
+ } else {
+ $('#apps-list').addClass('hidden');
+ $('#apps-list-empty').removeClass('hidden').find('h2').text(t('settings', 'No apps found for your version'));
+ $('#app-list-empty-icon').addClass('icon-search').removeClass('icon-download');
+ }
}
$('.enable.needs-download').tooltip({
@@ -518,6 +525,12 @@ OC.Settings.Apps = OC.Settings.Apps || {
}
},
+ showEmptyUpdates: function() {
+ $('#apps-list').addClass('hidden');
+ $('#apps-list-empty').removeClass('hidden').find('h2').text(t('settings', 'No app updates available'));
+ $('#app-list-empty-icon').removeClass('icon-search').addClass('icon-download');
+ },
+
updateApp:function(appId, element) {
var oldButtonText = element.val();
element.val(t('settings','Updating....'));
@@ -542,6 +555,13 @@ OC.Settings.Apps = OC.Settings.Apps || {
OC.Settings.Apps.State.availableUpdates--;
OC.Settings.Apps.refreshUpdateCounter();
+
+ if (OC.Settings.Apps.State.currentCategory === 'updates') {
+ $('#app-' + appId).remove();
+ if (OC.Settings.Apps.State.availableUpdates === 0) {
+ OC.Settings.Apps.showEmptyUpdates();
+ }
+ }
}
},'json');
},
@@ -652,7 +672,12 @@ OC.Settings.Apps = OC.Settings.Apps || {
},
refreshUpdateCounter: function() {
- $('#app-category-updates').find('.app-navigation-entry-utils-counter').html(OC.Settings.Apps.State.availableUpdates);
+ var $updateCount = $('#app-category-updates').find('.app-navigation-entry-utils-counter');
+ if (OC.Settings.Apps.State.availableUpdates > 0) {
+ $updateCount.html(OC.Settings.Apps.State.availableUpdates);
+ } else {
+ $updateCount.empty();
+ }
},
showErrorMessage: function(appId, message) {
diff --git a/settings/templates/apps.php b/settings/templates/apps.php
index f0fc5791e5a..5d519496598 100644
--- a/settings/templates/apps.php
+++ b/settings/templates/apps.php
@@ -208,7 +208,7 @@ script(
</svg>
<div id="apps-list"></div>
<div id="apps-list-empty" class="hidden emptycontent emptycontent-search">
- <div class="icon-search"></div>
+ <div id="app-list-empty-icon" class="icon-search"></div>
<h2><?php p($l->t('No apps found for your version')) ?></h2>
</div>
</div>