diff --git a/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js b/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js
index 784ac3f3b2..dafdb87c13 100644
--- a/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js
+++ b/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js
@@ -5,9 +5,27 @@
window.FoxxCollection = Backbone.Collection.extend({
model: window.Foxx,
+ sortOptions: {
+ desc: false
+ },
+
url: "/_admin/aardvark/foxxes",
- comparator: "name",
+ comparator: function(item, item2) {
+ var a, b;
+ if (this.sortOptions.desc === true) {
+ a = item.get('name');
+ b = item2.get('name');
+ return a < b ? 1 : a > b ? -1 : 0;
+ }
+ a = item.get('name');
+ b = item2.get('name');
+ return a > b ? 1 : a < b ? -1 : 0;
+ },
+
+ setSortingDesc: function(val) {
+ this.sortOptions.desc = val;
+ },
installFoxxFromGithub: function (url, name, version) {
diff --git a/js/apps/system/aardvark/frontend/js/templates/applicationsView.ejs b/js/apps/system/aardvark/frontend/js/templates/applicationsView.ejs
index 4ce6330b85..6cd33b3f84 100644
--- a/js/apps/system/aardvark/frontend/js/templates/applicationsView.ejs
+++ b/js/apps/system/aardvark/frontend/js/templates/applicationsView.ejs
@@ -44,9 +44,20 @@
Inactive
-
+ -->
+
+
diff --git a/js/apps/system/aardvark/frontend/js/views/applicationsView.js b/js/apps/system/aardvark/frontend/js/views/applicationsView.js
index 34dd88ee92..158da6425f 100644
--- a/js/apps/system/aardvark/frontend/js/views/applicationsView.js
+++ b/js/apps/system/aardvark/frontend/js/views/applicationsView.js
@@ -14,7 +14,15 @@ window.ApplicationsView = Backbone.View.extend({
"click #importFoxxToggle" : "slideToggleImport",
"change #importFoxx" : "uploadSetup",
"click #confirmFoxxImport" : "importFoxx",
- "click #installFoxxFromGithub" : "createGithubModal"
+ "click #installFoxxFromGithub" : "createGithubModal",
+ "click .css-label" : "checkBoxes",
+ "change #appsDesc" : "sorting"
+ },
+
+ checkBoxes: function (e) {
+ //chrome bugfix
+ var clicked = e.currentTarget.id;
+ $('#'+clicked).click();
},
uploadSetup: function (e) {
@@ -23,6 +31,17 @@ window.ApplicationsView = Backbone.View.extend({
this.allowUpload = true;
},
+ sorting: function() {
+ if ($('#appsDesc').is(":checked")) {
+ this.collection.setSortingDesc(true);
+ }
+ else {
+ this.collection.setSortingDesc(false);
+ }
+
+ this.render();
+ },
+
createGithubModal: function() {
var buttons = [], tableContent = [];
tableContent.push(
@@ -192,6 +211,9 @@ window.ApplicationsView = Backbone.View.extend({
},
slideToggle: function() {
+ //apply sorting to checkboxes
+ $('#appsDesc').attr('checked', this.collection.sortOptions.desc);
+
$('#importFoxxToggle').removeClass('activated');
$('#foxxToggle').toggleClass('activated');
$('#foxxDropdownOut').slideToggle(200);
@@ -245,6 +267,9 @@ window.ApplicationsView = Backbone.View.extend({
},
render: function() {
+
+ this.collection.sort();
+
$(this.el).html(this.template.render({}));
var self = this, name;
var versions = {};