Skip to content

Commit

Permalink
show username when restricting search to the user
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-TBT committed Apr 24, 2024
1 parent 3739d4b commit 4f53f81
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
12 changes: 11 additions & 1 deletion omero_tagsearch/static/tagsearch/css/webtagging_search.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
padding: 0;
}

.tagnav-user .tagnav-icon {
background: url('../image/icon_user.png') no-repeat;
}

.tagnav-project .tagnav-icon {
background: url('../image/folder16.png') no-repeat;
}
Expand Down Expand Up @@ -89,7 +93,7 @@

.tagnav-project, .tagnav-dataset, .tagnav-screen,
.tagnav-plate, .tagnav-acquisition, .tagnav-well,
.tagnav-image {
.tagnav-image, .tagnav-user {
color: hsl(210,10%,50%);
font-size: 1.2em;
text-shadow: 0 1px 0 white;
Expand All @@ -116,6 +120,12 @@ ul#id_operation li{
display: inline-block;
}

#id_userName {
margin-top: 5px;
margin-bottom: 5px;
display: inline-block;
}

#counts_list li,
#counts_list ul{
margin-top: 2px;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions omero_tagsearch/templates/omero_tagsearch/tagnav.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
<script type="text/javascript">
$(document).ready(function()
{
if ($("#id_userName span").text() === "") {
// hide the user icon if user set to 'All members'
$("#id_userName").remove();
}

var objTypes = ['project', 'dataset', 'image', 'screen', 'plate', 'acquisition', 'well']
$("#id_selectedTags").chosen({placeholder_text:'Choose tags'});
$("#id_excludedTags").chosen({placeholder_text:'Choose tags to exclude'});
Expand Down Expand Up @@ -200,6 +205,7 @@
} else {
$("#selectall_btn").text("Select all");
}

});

});
Expand All @@ -223,6 +229,12 @@
<h2>{% trans "Tag Search" %}</h2>
{# {{ tagnav_form.as_p }} #}
{{ tagnav_form.non_field_errors }}

<div id="id_userName" class="tagnav-user">
<div class="tagnav-icon">&nbsp;</div>
&nbsp;<span>{{ user_name }}</span>
</div>

<div class="fieldWrapper">
<div class="tagSearchDivider">
<div class="field">
Expand Down
6 changes: 6 additions & 0 deletions omero_tagsearch/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ def index(request, conn=None, **kwargs):
myGroups.sort(key=lambda x: x.getName().lower())
new_container_form = ContainerForm()

fullname_d = {exp.getId(): exp for exp in leaders + members}
user_name = ""
if user_id != -1:
user_name = fullname_d[user_id].getFullName()

# Create and set the form

qs = conn.getQueryService()
Expand Down Expand Up @@ -260,6 +265,7 @@ def get_tags(obj, tagset_d):
context["current_url"] = url
context["template"] = template
context["tagnav_form"] = form
context["user_name"] = user_name

return context

Expand Down

0 comments on commit 4f53f81

Please sign in to comment.