Skip to content

Commit

Permalink
Update project/issue pages
Browse files Browse the repository at this point in the history
  • Loading branch information
arkid15r committed Sep 10, 2024
1 parent 8869f51 commit 56068c2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 3 additions & 1 deletion backend/apps/owasp/index/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ProjectIndex(AlgoliaIndex):
fields = (
"idx_companies",
"idx_contributors_count",
"idx_created_at",
"idx_description",
"idx_forks_count",
"idx_languages",
Expand All @@ -39,6 +40,7 @@ class ProjectIndex(AlgoliaIndex):
"desc(idx_contributors_count)",
"desc(idx_forks_count)",
"desc(idx_updated_at)",
"desc(idx_create_at)",
],
"ranking": [
"typo",
Expand All @@ -51,7 +53,7 @@ class ProjectIndex(AlgoliaIndex):
],
"searchableAttributes": [
"unordered(idx_name)",
"unordered(idx_tags, idx_topics, idx_languages)",
"unordered(idx_languages, idx_tags, idx_topics)",
"unordered(idx_description)",
"unordered(idx_companies, idx_leaders, idx_organizations)",
],
Expand Down
5 changes: 5 additions & 0 deletions backend/apps/owasp/models/mixins/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ def idx_companies(self):
"""Return companies for indexing."""
return join_values(fields=(o.company for o in self.organizations.all()))

@property
def idx_created_at(self):
"""Return created at for indexing."""
return self.created_at

@property
def idx_contributors_count(self):
"""Return contributors count for indexing."""
Expand Down
11 changes: 6 additions & 5 deletions backend/apps/owasp/templates/search/issue.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
/>
</head>

<script src="{% static 'js/htmx.min.js' %}"></script>

<h3>
Find an issue to work on
</h3>
<h3>Find an issue to work on</h3>
<input
autocomplete="off"
class="form-control"
Expand All @@ -21,7 +22,7 @@ <h3>
hx-indicator=".htmx-indicator"
hx-swap="none"
hx-target="#search-results"
hx-trigger="load input changed delay:1000ms, search"
hx-trigger="load, input changed delay:1000ms, search"
/>
<span class="htmx-indicator"> Searching... </span>

Expand Down
2 changes: 1 addition & 1 deletion backend/apps/owasp/templates/search/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h3>Find a project</h3>
hx-indicator=".htmx-indicator"
hx-swap="none"
hx-target="#search-results"
hx-trigger="load input changed delay:1000ms, search"
hx-trigger="load, input changed delay:1000ms, search"
/>
<span class="htmx-indicator"> Searching... </span>

Expand Down

0 comments on commit 56068c2

Please sign in to comment.