Conversation
Signed-off-by: Aayush Kumar <code@aayushk.dev>
e1f1bb9 to
f886bda
Compare
tdruez
left a comment
There was a problem hiding this comment.
@aayushkdev Looks good. See my various comment.
You want to inline most of the CSS with existing Bulma classes when possible.
Also, a small visual issue regarding the right side of the search box, no radius. But it appears once we start typing.
| <div class="mb-3 search-container" id="resource-search-container"> | ||
| <div class="field has-addons"> | ||
| <div class="control has-icons-left is-expanded"> | ||
| <input | ||
| id="file-search-input" | ||
| class="input is-small" | ||
| type="text" | ||
| placeholder="Go to file..." | ||
| autocomplete="off" | ||
| hx-get="{% url 'project_resource_tree_search' project.slug %}" | ||
| hx-target="#search-results" | ||
| hx-trigger="input changed delay:200ms" | ||
| hx-include="this" | ||
| name="search" | ||
| > | ||
| <span class="icon is-small is-left"> | ||
| <i class="fas fa-search"></i> | ||
| </span> | ||
| </div> | ||
| <div class="control"> | ||
| <button id="clear-search" class="button is-small is-hidden" type="button" aria-label="Clear search"> | ||
| <span class="icon is-small"> | ||
| <i class="fas fa-times"></i> | ||
| </span> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| <div id="search-results" class="search-dropdown is-hidden"></div> | ||
| </div> |
There was a problem hiding this comment.
A dedicated template would make sense here.
scanpipe/views.py
Outdated
| def get_queryset(self): | ||
| search_query = self.request.GET.get("search", "").strip() | ||
| if not search_query: | ||
| return CodebaseResource.objects.none() |
There was a problem hiding this comment.
Should we use self.model here?
There was a problem hiding this comment.
Yes, I’ve updated it to use super().get_queryset(), which should be better here.
| return context | ||
|
|
||
|
|
||
| class ProjectResourceSearchView( |
There was a problem hiding this comment.
Could you add basic unit testing for this function?
scancodeio/static/main.css
Outdated
| #resource-tree-container .search-container .field { | ||
| margin-bottom: 0; | ||
| } |
There was a problem hiding this comment.
Most of this CSS addition do not need dedicated classes.
For example, in place of
#resource-tree-container .search-results,
.search-dropdown.search-dropdown-portal .search-results {
margin: 0;
}
Simply put m-0 on the HTML element, much easier to maintain and adapt.
Signed-off-by: Aayush Kumar <code@aayushk.dev>
Signed-off-by: Aayush Kumar <code@aayushk.dev>
5c4b5ea to
8f7e8b5
Compare



Issues
Changes
Checklist