-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add resource navigation buttons #293 #469
Conversation
Fixes #293 Signed-off-by: Akhil Raj <lf32.dev@gmail.com>
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.
See my comments.
Also, your JavaScript code style is inconsistent. Some lines ends with ;
while some do not.
In doubt, try to follow the codebase conventions when contributing ;)
Also, the logic of the code is broken somehow. |
Signed-off-by: Akhil Raj <lf32.dev@gmail.com>
Signed-off-by: Akhil Raj <lf32.dev@gmail.com>
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.
The new buttons UI look good.
I think the "Next" button should be disabled if there's only 1 match.
<p> | ||
{{ object.name }} | ||
| {{ object.size|filesizeformat }} | ||
| <a class="has-text-white" href="{{ object.get_raw_url }}?as_attachment=1"><i class="fas fa-download"></i></a> | ||
<br> | ||
<span style="font-size: 10px;">{{ object.path }}</span> | ||
</p> | ||
<div> | ||
<button class="button prev-btn is-dark" disabled onclick="previousValue();"><i class="fas fa-arrow-up"></i> Prev</button> |
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.
"Previous" is better than "Prev".
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.
Sure @tdruez.
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.
Fixed this.
<p> | ||
{{ object.name }} | ||
| {{ object.size|filesizeformat }} | ||
| <a class="has-text-white" href="{{ object.get_raw_url }}?as_attachment=1"><i class="fas fa-download"></i></a> | ||
<br> | ||
<span style="font-size: 10px;">{{ object.path }}</span> | ||
</p> | ||
<div> | ||
<button class="button prev-btn is-dark" disabled onclick="previousValue();"><i class="fas fa-arrow-up"></i> Prev</button> |
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.
Inline JavaScript is not consistent with the rest of the codebase, keep the function but assign the click action using the addEventListener.
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.
Added eventlisteners for buttons.
<p> | ||
{{ object.name }} | ||
| {{ object.size|filesizeformat }} | ||
| <a class="has-text-white" href="{{ object.get_raw_url }}?as_attachment=1"><i class="fas fa-download"></i></a> | ||
<br> | ||
<span style="font-size: 10px;">{{ object.path }}</span> | ||
</p> | ||
<div> | ||
<button class="button prev-btn is-dark" disabled onclick="previousValue();"><i class="fas fa-arrow-up"></i> Prev</button> | ||
<button class="button next-btn is-dark" disabled onclick="nextValue();"><i class="fas fa-arrow-down"></i> Next</button> |
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.
Do not use
for formatting/rendering. If you want some space between 2 elements, use the mr-*
CSS classes.
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.
Fixed this.
{% endblock %} |
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.
Please configure your editor to stop adding blank line for template files.
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.
don't we need a blank line at the end of files?
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.
Not for templates.
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.
Ok then, I'll fix this.
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.
Fixed this.
if (valueIndex >= detected_data.length - 1) return false; | ||
valueIndex++; | ||
editor.renderer.scrollToLine(detected_data[valueIndex].start_line - 1); | ||
nextBtn.disabled = (valueIndex == detected_data.length - 1) ? true : false; |
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.
Can be simplified to valueIndex == detected_data.length - 1
.
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.
Fixed this.
if (valueIndex <= 0) return false; | ||
valueIndex--; | ||
editor.renderer.scrollToLine(detected_data[valueIndex].start_line - 1); | ||
prevBtn.disabled = (valueIndex == 0) ? true : false; |
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.
Can be simplified to valueIndex == 0
.
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.
Fixed this.
@@ -102,28 +106,55 @@ | |||
editor.getSession().setAnnotations(annotations); | |||
} | |||
|
|||
const $selectionButtons = getAll('.tabs a'); | |||
let valueIndex = 0; |
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.
scrollPositionIndex
maybe?
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.
Much better, fixed this.
mode: "ace/mode/text", | ||
autoScrollEditorIntoView: true, | ||
wrap: true, | ||
readOnly: true, | ||
showPrintMargin: false, | ||
highlightActiveLine: false, | ||
highlightGutterLine: false, | ||
fontSize: 15, | ||
foldStyle: "manual", | ||
fontFamily: "SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace", |
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.
Why?
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.
Do not change existing style conventions but adapt to it.
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.
Indentation using prettifier
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.
Please revert and adapt to the existing style.
You're making the code review process more painful with those unwanted changes.
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.
I have been using tab of 4 spaces, just switched to 2.
Signed-off-by: Akhil Raj <lf32.dev@gmail.com>
Signed-off-by: Akhil Raj <lf32.dev@gmail.com>
Thanks for your contribution @lf32 ! |
Thanks for the merge @tdruez! |
Fixes #293