-
Notifications
You must be signed in to change notification settings - Fork 20
Dataset Table: add new template and highlight logic #2620
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
909fb4a
add new template and highlight logic
stephherbers 2c4260f
rearrage row order and add message link
stephherbers 0ec3d7e
add mark_safe so icon is shown rather than string
stephherbers ac63ac2
add to hx-get request
stephherbers 78440a3
use different approach with get_table_kwargs
stephherbers f542210
update templates
stephherbers b519f35
Merge branch 'main' into smh/highlight-dataset-message-row
stephherbers da9d6fe
code rabbit: Improve selector specificity to avoid false positive mat…
stephherbers 0c4444e
Merge branch 'main' into smh/highlight-dataset-message-row
stephherbers 73251aa
refactor: create shared get_highlight_message_id
stephherbers 394aacb
coderabbit: always render ID on table rows
stephherbers df0b300
add pagination
stephherbers 6a66441
don't overrride the template
stephherbers 48dbe7b
fix pagination by adding to pagination config
stephherbers 4b84b77
use querystring tag
stephherbers 9bacc3c
Merge branch 'main' into smh/highlight-dataset-message-row
stephherbers 1270a6f
use existing id attribute
stephherbers e981818
simplify init method
stephherbers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| {% load static %} | ||
| {% load render_table from django_tables2 %} | ||
|
|
||
| {% render_table table "evaluations/dataset_messages_table_render.html" %} | ||
|
|
||
| {% if highlight_message_id %} | ||
| <script> | ||
| function scrollToMessage() { | ||
| const messageId = "{{ highlight_message_id }}"; | ||
| const selectedRow = document.querySelector(`tr[data-message-id="${messageId}"]`); | ||
| if (selectedRow) { | ||
| selectedRow.scrollIntoView({ | ||
| behavior: 'smooth', | ||
| block: 'center', | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| if (document.readyState === 'loading') { | ||
| document.addEventListener('DOMContentLoaded', scrollToMessage); | ||
| } else { | ||
| scrollToMessage(); | ||
| } | ||
| </script> | ||
| {% endif %} | ||
|
|
||
| {% block modal %} | ||
| {% endblock modal %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| {% extends "table/tailwind_js_pagination.html" %} | ||
| {% load django_tables2 %} | ||
|
|
||
| {% block table.tbody %} | ||
| <tbody {{ table.attrs.tbody.as_html }}> | ||
| {% for record in table.page.object_list|default:table.data %} | ||
| <tr class="{% if table.highlight_message_id == record.record.id %}bg-yellow-100 dark:bg-yellow-900/20{% endif %}" | ||
| {% if table.highlight_message_id == record.record.id %}id="message-{{ record.record.id }}"{% endif %} | ||
| data-message-id="{{ record.record.id }}"> | ||
| {% for column, cell in record.items %} | ||
| {% if column.visible %} | ||
| <td {{ column.attrs.td.as_html }}>{{ cell }}</td> | ||
| {% endif %} | ||
| {% endfor %} | ||
| </tr> | ||
| {% empty %} | ||
| {% if table.empty_text %} | ||
| <tr><td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td></tr> | ||
| {% endif %} | ||
| {% endfor %} | ||
| </tbody> | ||
| {% endblock table.tbody %} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.