-
-
Notifications
You must be signed in to change notification settings - Fork 3
Add Download Fleet CSV link to tabs #211
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
base: main
Are you sure you want to change the base?
Changes from all commits
57780f1
a3433b9
2dcb36d
5452da7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,8 +43,18 @@ | |
| <li class="chip"><a href="/tracking/{{ operator.operator_slug }}/start/">Test Live Tracking</a></li> | ||
| {% endif %} | ||
| {% if 'owner' in helper_permissions %} | ||
| <li class="chip"><a href="#" onclick="printTable()">Print Fleet</a></li> | ||
| {% endif %} | ||
| <li> | ||
| <a href="/operator/{{ operator.operator_slug }}/vehicles/export/ | ||
| {% if request.GET.withdrawn or request.GET.depot %}?{% endif %} | ||
| {% if request.GET.withdrawn %}withdrawn={{ request.GET.withdrawn }}{% endif %} | ||
| {% if request.GET.depot %} | ||
| {% if request.GET.withdrawn %}&{% endif %} | ||
| depot={{ request.GET.depot }} | ||
| {% endif %}"> | ||
|
Comment on lines
+47
to
+53
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactor URL construction to prevent whitespace and use proper encoding. The multiline URL construction has two concerns:
🔧 Proposed fix using Django's url encoding- <a href="/operator/{{ operator.operator_slug }}/vehicles/export/
- {% if request.GET.withdrawn or request.GET.depot %}?{% endif %}
- {% if request.GET.withdrawn %}withdrawn={{ request.GET.withdrawn }}{% endif %}
- {% if request.GET.depot %}
- {% if request.GET.withdrawn %}&{% endif %}
- depot={{ request.GET.depot }}
- {% endif %}">
+ <a href="/operator/{{ operator.operator_slug }}/vehicles/export/?{% if request.GET.withdrawn %}withdrawn={{ request.GET.withdrawn|urlencode }}{% endif %}{% if request.GET.depot %}{% if request.GET.withdrawn %}&{% endif %}depot={{ request.GET.depot|urlencode }}{% endif %}">Or better yet, build the query string in the view and pass it to the template, or use Django's
🤖 Prompt for AI Agents🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Find the view handling the vehicles export endpoint and verify parameter handling
# Search for URL pattern definition
echo "=== Searching for export URL pattern ==="
rg -n "vehicles/export" --type=py -C3
# Search for view function/class handling export
echo -e "\n=== Searching for export view implementation ==="
rg -n "def.*export|class.*Export" --type=py -C5 | rg -A5 -B5 "vehicle|fleet"
# Search for CSV export related code
echo -e "\n=== Searching for CSV export logic ==="
rg -n "csv|CSV" --type=py -C3 | rg -A3 -B3 "vehicle|fleet"Repository: NextStopLabs/MyBusTimes Length of output: 11884 🏁 Script executed: #!/bin/bash
# Search for URL configuration files in fleet app
echo "=== Searching for URL routing files ==="
find . -name "urls.py" -type f | head -20
echo -e "\n=== Checking fleet app urls.py ==="
cat -n fleet/urls.py 2>/dev/null || echo "File not found"
echo -e "\n=== Searching for views in fleet app ==="
find fleet -name "views.py" -type f -exec echo "File: {}" \; -exec cat -n {} \;
echo -e "\n=== Searching for operator-related views ==="
rg -n "operator.*vehicles|vehicles.*export" --type=py -A5 -B5
echo -e "\n=== Searching for any export function ==="
rg -n "def export|class.*Export" --type=py -A10Repository: NextStopLabs/MyBusTimes Length of output: 50380 🏁 Script executed: #!/bin/bash
# Search for export-related functions in views
echo "=== Searching for export functions in views ==="
rg -n "def.*export" fleet/views.py
# Also search more broadly
echo -e "\n=== Checking if vehicles_export function exists ==="
rg -n "vehicles.*export|export.*vehicle" --type=py
# Search for CSV writing in views
echo -e "\n=== Looking for HttpResponse with CSV content type ==="
rg -n "text/csv|csv.*response" --type=pyRepository: NextStopLabs/MyBusTimes Length of output: 223 The The template constructs a link to this endpoint with |
||
| Download Fleet CSV | ||
| </a> | ||
| </li> | ||
| {% endif %} | ||
| </ul> | ||
| </div> | ||
| {% endif %} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
class="chip"for styling consistency.The
<li>tag on line 46 is missing theclass="chip"attribute that all other list items in this section use (see lines 28, 31, 34, 37, 40, 43). This creates a visual inconsistency.🎨 Proposed fix
Also applies to: 56-56
🤖 Prompt for AI Agents