mirror of https://gitee.com/bigwinds/arangodb
prep for foxx sorting
This commit is contained in:
parent
8bd979e3e5
commit
5ecabb9001
|
@ -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) {
|
||||
|
||||
|
|
|
@ -44,9 +44,20 @@
|
|||
<input class="css-checkbox" type="checkbox" id="checkInactive">
|
||||
<label class="css-label"></label>Inactive
|
||||
</label>
|
||||
</a></li-->
|
||||
</a></li>-->
|
||||
</ul>
|
||||
|
||||
<!--
|
||||
<ul>
|
||||
<li class="nav-header">Sorting</li>
|
||||
<li><a>
|
||||
<label class="checkbox checkboxLabel">
|
||||
<input class="css-checkbox" type="checkbox" id="appsDesc">
|
||||
<label class="css-label" id="appsDesc"></label>Sort descending
|
||||
</label>
|
||||
</a></li>
|
||||
</ul>-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -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 = {};
|
||||
|
|
Loading…
Reference in New Issue