Skip to content

Commit

Permalink
Files case-insensitive sorting. Fix button styles
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Mar 7, 2024
1 parent fd95c4b commit 3c4408f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1122,11 +1122,11 @@ <h5 class="modal-title">Open</h5>
<button
title="Refresh file list"
type="button"
class="btn refresh-files"
class="btn btn-default refresh-files"
>
Refresh
</button>
<button type="button" class="btn" data-bs-dismiss="modal">
<button type="button" class="btn btn-default" data-bs-dismiss="modal">
Cancel
</button>
</div>
Expand Down
10 changes: 7 additions & 3 deletions src/js/views/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,19 @@ export var FileListView = Backbone.View.extend({

sort_name: function(event) {
this.render_sort_btn(event);
this.model.comparator = 'name';
this.model.comparator = function(left, right) {
var l = left.get('name').toLowerCase(),
r = right.get('name').toLowerCase();
return l < r ? -1 : l > r ? 1 : 0;
};
this.model.sort();
},

sort_name_reverse: function(event) {
this.render_sort_btn(event);
this.model.comparator = function(left, right) {
var l = left.get('name'),
r = right.get('name');
var l = left.get('name').toLowerCase(),
r = right.get('name').toLowerCase();
return l < r ? 1 : l > r ? -1 : 0;
};
this.model.sort();
Expand Down

0 comments on commit 3c4408f

Please sign in to comment.