Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

At /console/published-projects/ a search tool has been added to the p… #2312

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,23 @@
{% endblock %}

{% block content %}
<script src="{% static 'console/js/generic-filter.js' %}"></script>
<div class="card mb-3">
<div class="card-header">
Published Projects <span class="badge badge-pill badge-info">{{ projects.paginator.count }}</span>
</div>
<div class="card-body">
<div class="table-responsive">
<div class="row">
<div class="col-sm-8">
<label class="font-weight-bold" for="searchbox">Search for project:</label>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<input id="searchbox" type="search" oninput="search();" placeholder="Search...">
</div>
</div>
<div class="table-responsive" id="searchitems">
<table class="table table-bordered">
<thead>
<tr>
Expand Down Expand Up @@ -48,3 +59,23 @@
</div>
</div>
{% endblock %}

{% block local_js_bottom %}
<script>
function search() {
const query = document.getElementById('searchbox').value.toLowerCase();
const rows = document.querySelectorAll('#searchitems tbody tr');

rows.forEach(row => {
const projectTitle = row.querySelector('td a').textContent.toLowerCase();
if (projectTitle.includes(query)) {
row.style.display = '';
} else {
row.style.display = 'none';
}
});
}

document.getElementById('searchbox').addEventListener('input', search);
</script>
{% endblock %}
Loading