Skip to content

Commit

Permalink
Make app updates better visible (part1)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickvergessen committed Feb 16, 2016
1 parent 1cb3583 commit ffc5336
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
10 changes: 10 additions & 0 deletions settings/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,16 @@ span.version {
margin-bottom: 1em;
}

#apps-list.has-controls {
padding-top: 25px;
}

#controls .update-filter {
position: relative;
top: 12px;
left: 12px;
}


/* LOG */
#log {
Expand Down
30 changes: 28 additions & 2 deletions settings/js/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ OC.Settings.Apps = OC.Settings.Apps || {
.removeClass('hidden')
.html('');
$('#apps-list-empty').addClass('hidden');
$('#controls').addClass('hidden');

$('#app-category-' + OC.Settings.Apps.State.currentCategory).removeClass('active');
$('#app-category-' + categoryId).addClass('active');
OC.Settings.Apps.State.currentCategory = categoryId;
Expand Down Expand Up @@ -124,6 +126,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
$('.app-level .experimental').tipsy({fallback: t('settings', 'This app is not checked for security issues and is new or known to be unstable. Install at your own risk.')});
},
complete: function() {
var availableUpdates = 0;
$('#apps-list').removeClass('icon-loading');
$.ajax(OC.generateUrl('settings/apps/list?category={categoryId}&includeUpdateInfo=1', {
categoryId: categoryId
Expand All @@ -135,8 +138,17 @@ OC.Settings.Apps = OC.Settings.Apps || {
var $update = $('#app-' + app.id + ' .update');
$update.removeClass('hidden');
$update.val(t('settings', 'Update to %s').replace(/%s/g, app.update));
availableUpdates++;
OC.Settings.Apps.State.apps[app.id].update = true;
}
})
});

if (availableUpdates > 0) {
$('#controls').removeClass('hidden');
$('#filter_update_apps').attr('checked', false);
$('#apps-list').addClass('has-controls');
OC.Notification.showTemporary(n('settings', 'You have %n app update pending', 'You have %n app updates pending', availableUpdates));
}
}
});
}
Expand Down Expand Up @@ -409,13 +421,22 @@ OC.Settings.Apps = OC.Settings.Apps || {
);
},

filter: function(query) {
filter: function(query, filterUpdate) {
var $appList = $('#apps-list'),
$emptyList = $('#apps-list-empty');
$appList.removeClass('hidden');
$appList.find('.section').removeClass('hidden');
$emptyList.addClass('hidden');

if (filterUpdate) {
_.each(OC.Settings.Apps.State.apps, function (app) {
if (!app.update) {
$('#app-' + app.id).addClass('hidden');
}
});
return;
}

if (query === '') {
return;
}
Expand Down Expand Up @@ -574,6 +595,11 @@ OC.Settings.Apps = OC.Settings.Apps || {
}
});
});

$(document).on('click', '#filter_update_apps', function () {
var state = $(this).prop('checked');
OC.Settings.Apps.filter('', state);
});
}
};

Expand Down
11 changes: 11 additions & 0 deletions settings/templates/apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
<div class="app-description-toggle-show"><?php p($l->t("Show description …"));?></div>
<div class="app-description-toggle-hide hidden"><?php p($l->t("Hide description …"));?></div>

<div class="app-dependencies update hidden">
<p><?php p($l->t('This app has an update available.')); ?></p>
</div>

{{#if missingMinOwnCloudVersion}}
<div class="app-dependencies">
<p><?php p($l->t('This app has no minimum ownCloud version assigned. This will be an error in ownCloud 11 and later.')); ?></p>
Expand Down Expand Up @@ -162,6 +166,13 @@
</div>
</div>
<div id="app-content">
<div id="controls" class="hidden">
<div class="update-filter">
<input id="filter_update_apps" name="filter_update_apps" type="checkbox" class="checkbox" />
<label for="filter_update_apps"><?php p($l->t('Only show apps with available updates')); ?></label>
</div>
</div>

<div id="apps-list" class="icon-loading"></div>
<div id="apps-list-empty" class="hidden emptycontent">
<div class="icon-search"></div>
Expand Down

0 comments on commit ffc5336

Please sign in to comment.