From 4cd2cdb15389e952ae3f326abf66a7627d49c98a Mon Sep 17 00:00:00 2001 From: QA2A <150867722+QA2A@users.noreply.github.com> Date: Sun, 8 Sep 2024 14:33:00 -0400 Subject: [PATCH] refactor: Update search query in JobListView to use description_markdown field --- website/templates/website/job_list.html | 302 +++++++++++++++--------- website/views.py | 2 +- 2 files changed, 186 insertions(+), 118 deletions(-) diff --git a/website/templates/website/job_list.html b/website/templates/website/job_list.html index 2476631..271c9ca 100644 --- a/website/templates/website/job_list.html +++ b/website/templates/website/job_list.html @@ -1,11 +1,10 @@ {% extends "base.html" %} - {% load static %} {% load humanize %} {% load custom_filters %} {% block content %} -{% include 'sidebar.html' %} - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - {% for job in page_obj %} - - - - - - - + /* Style for the dropdown container */ + .dropdown { + position: relative; + display: inline-block; + } -
CompanyRoleLocationSalaryPosted -
-
- {% if job.company.website %} - - {% endif %} - - {{ job.company.name }} - - - email - - - email - -
-
- {% if job.role %} - {{ job.role }} - {% else %} -
- -
- {{job.title}} - {% endif %} -
{% if job.remote %}remote{% endif %} {{ job.location|default:""|truncatechars:20 }}{% if job.salary_min and job.salary_max %} - ${{ job.salary_min|floatformat:0|intcomma }} - ${{ job.salary_max|floatformat:0|intcomma }} - {% endif %} - - {% if job.posted_date %}{{ job.posted_date|timesince }} ago{% endif %} - + /* Style for the dropdown content (the links) */ + .dropdown-content { + display: none; + position: absolute; + background-color: white; + min-width: 160px; + box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); + z-index: 1; + } - {% if job.company.email and job.role %} - - Apply - - {% else %} + /* Style for individual links in the dropdown */ + .dropdown-content a { + color: black; + padding: 12px 16px; + text-decoration: none; + display: block; + } + /* Show the dropdown when hovering */ + .dropdown-content a:hover { + background-color: #ddd; + } + /* Dropdown button (the "..." icon) */ + .dropdown .dropbtn { + border: none; + cursor: pointer; + font-size: 16px; + padding: 0px; + background-color: white; + color:#000; + } + /* Show the dropdown content when the dropdown is clicked */ + .dropdown:hover .dropdown-content { + display: block; + } + +
+ + + + + + + + + + + + + + {% for job in page_obj %} + + + + + + + - - + {% endif %} + + + {% endfor %}
+ 🏢 Company + + 💼 Role + + 🌍 Location + + 💰 Salary + + 📅 Posted +
+
+ {% if job.company.website %} + + {% endif %} + {{ job.company.name }} + +
+
+ {% if job.role %} + {{ job.role }} + {% else %} +
+ +
+ {{ job.title }} + {% endif %} +
+ {% if job.remote %}remote{% endif %} + {{ job.location|default:""|truncatechars:20 }} + + {% if job.salary_min and job.salary_max %} + ${{ job.salary_min|floatformat:0|intcomma }} - ${{ job.salary_max|floatformat:0|intcomma }} + {% endif %} + + {% if job.posted_date %}{{ job.posted_date|timesince }} ago{% endif %} + + {% if job.company.email and job.role %} + + Apply + + {% else %} {% if job.link %} {% if job.link_status_code == 200 %} - - - - Apply - - - {% if prompt and job.description_markdown %} - - - - - - {% endif %} - + + + Apply {% endif %} {% endif %} - {% endif %} - {% if request.user.is_superuser %} - edit - {% endif %} - -
-
- {% if page_obj.paginator.page_range|length > 1 %} -{% include "partials/pagination.html" %} + {% include "partials/pagination.html" %} {% endif %}



- - -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/website/views.py b/website/views.py index 262a576..c68dd16 100644 --- a/website/views.py +++ b/website/views.py @@ -709,7 +709,7 @@ def get_queryset(self): elif search_type == "job" and search_query: # If search_type is 'job', return jobs where the job description contains the query - self.queryset = Job.objects.filter(description__icontains=search_query).select_related("company", "role").distinct() + self.queryset = Job.objects.filter(description_markdown__icontains=search_query).select_related("company", "role").distinct() elif search_query: # For general search query (if no specific search_type is provided)