Skip to content

Commit

Permalink
Show current Group/User filter in column header
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Nov 27, 2024
1 parent 84a09a3 commit 34bf0b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1082,13 +1082,14 @@ <h5 class="modal-title">Open</h5>
</form>
</th>
<th style="width: 12%">
Owner:
<div class="btn-group" title="Filter files by owner">
<button
type="button"
class="btn dropdown-toggle"
class="btn dropdown-toggle btn-outline-secondary"
data-bs-toggle="dropdown"
>
<b>Owner</b> <span class="caret"></span>
<span id="selected_owner">Owner</span> <span class="caret"></span>
</button>
<ul
id="owner-menu"
Expand All @@ -1100,13 +1101,14 @@ <h5 class="modal-title">Open</h5>
</div>
</th>
<th style="width: 12%">
Group:
<div class="btn-group" title="Filter files by group">
<button
type="button"
class="btn dropdown-toggle"
class="btn dropdown-toggle btn-outline-secondary"
data-bs-toggle="dropdown"
>
<b>Group</b> <span class="caret"></span>
<span id="selected_group">Group</span> <span class="caret"></span>
</button>
<ul
id="group-menu"
Expand Down
6 changes: 6 additions & 0 deletions src/js/views/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ export var FileListView = Backbone.View.extend({
</a></li>`;
});
$("#owner-menu").html(ownersHtml);
let owner = owners.find(o => o.id == filter.owner);
let ownerName = owner ? `${owner.firstName} ${owner.lastName}`: "Show All";
$("#selected_owner").html(ownerName);

// render groups chooser
var groups = this.model.pluck("group");
Expand All @@ -304,6 +307,9 @@ export var FileListView = Backbone.View.extend({
${_.escape(name)}
</a></li>`).join('\n');
$("#group-menu").html(groupsHtml);
let group = groups.find(g => g.id == filter.group);
let groupName = group ? group.name: "Show All";
$("#selected_group").html(groupName);
return this;
}
});
Expand Down

0 comments on commit 34bf0b8

Please sign in to comment.