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

Ordering front end redesign #4595

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Ordering front end redesign #4595

wants to merge 23 commits into from

Conversation

flooie
Copy link
Contributor

@flooie flooie commented Oct 18, 2024

UI Changes for Opinions Pages and associated view and utility changes.

PR adds

HTML
opinions.html
opinion-tabs.html
add-download-button.html

CSS and JS
base.js to modify footnotes and page numbers across various opinion sources.
override.css - to provide a new UI style for the front end and interactions.

py
Adds or updates new opinion views
for the Opinion, Summaries, Authorities, PDF/HTML document, Cited By and Related Cases

Overhauls the sidebar and orders opinions.
Improves the readability of footnotes and moves the three buttons to the top right for ease of access.

Add multiple tab specific endpoints
Rewrite and waffle the new UI changes
Added a number of methods to fetch and/or store
related and cited by data quickly

Implemented new view opinion with waffles
Generally just override flags to avoid
testing old view opinion page against the new
ui changes.
Remove decorator for selenium tests unaffected
And modify css to only affect scrolling on opinion page
Remove print statement and fix return
for bot or scraping detection
Hide unwanted content during printing
@flooie
Copy link
Contributor Author

flooie commented Oct 18, 2024

Additionally, improves the printing process
Addresses #4278

@flooie
Copy link
Contributor Author

flooie commented Oct 18, 2024

Additionally, addresses #4279

Screenshot 2024-10-18 at 2 11 29 PM

Moving page numbers to the right side of the sidebar

update CSS and base.js to handle more
edge case specific page numbering
@flooie
Copy link
Contributor Author

flooie commented Oct 18, 2024

Should address #1496 the strange intersection of footnotes and pagination in Anon/Tax import cases which appear to have competing and confusing changes.

@flooie
Copy link
Contributor Author

flooie commented Oct 18, 2024

#4379 Adds support for ordered opinions and only displays either the combined opinion or the separated ordered opinions.

@flooie
Copy link
Contributor Author

flooie commented Oct 18, 2024

Adds support for a beautiful new sidebar that orders and helps navigate thru an opinion. Bolds section of the page you are on as you scroll and allows for smooth scrolling between sections

ezgif-7-efcb5a667c

@flooie flooie requested a review from mlissner October 18, 2024 20:09
Copy link
Member

@mlissner mlissner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great and it's lovely to see a number of other bugs getting squashed. A couple quick drive-by comments, then I'm afraid somebody else will need to do the full review.

  1. The CSS is HUGE, and I'm afraid that if there is any extra code in there, we'll be carrying it around forever. I think we should put it in its own file so it's only on opinion pages (even though it'll be cached). On top of that, we should go through it as carefully as humanly possible to see if it can be optimized, documented, cleaned up, etc.

  2. The JS file is also large and doesn't need to be on every page, so it should go in it's own file too.

That's it for me for the moment. Can't wait to see this live.

Move new js and css into own files
Was holding off on removing details but
can re-add it if necessary
Also include the independent sections
if the headmatter is separated out and
the headmatter field is empty
Copy link
Contributor

@ERosendo ERosendo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flooie Here's my first round of comments on the code. Tomorrow, I’ll be diving into the CSS, JavaScript, and performance. So, expect more comments coming your way!

Comment on lines +298 to +302
[id^="A"] {
text-indent: 2em;
display: inline;

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I typically prefer using classes for styling because they're more expressive and easier to understand. When you look at the HTML, it's immediately clear which styles are applied to an element based on its class. This can make debugging and maintenance much simpler compared to using IDs, which can be harder to track and potentially more difficult to manage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree in general that using classes is much better.

Many of the design decisions that you see around css are based upon the HTML that we ingested from harvard.

for example Here is the start of US vs. Miranda opinion

<author id="b537-7">Mr. Chief Justice Warren</author>
<p id="AMNy">delivered the opinion of the Court.</p>

I believe that the harvard dataset does not have classes and so the css was designed around that character.

@@ -5,6 +5,7 @@
from django.contrib.auth.hashers import make_password
from selenium.webdriver.common.by import By
from timeout_decorator import timeout_decorator
from waffle.testutils import override_flag
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using this import, we should clean it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch. thanks ill remove all of those

@@ -10,6 +10,7 @@
from django.urls import reverse
from selenium.webdriver.common.by import By
from timeout_decorator import timeout_decorator
from waffle.testutils import override_flag
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is also unused. We should remove it.

cl/search/tests/tests_es_opinion.py Outdated Show resolved Hide resolved
cl/search/models.py Outdated Show resolved Hide resolved
cl/opinion_page/views.py Outdated Show resolved Hide resolved
cl/opinion_page/utils.py Outdated Show resolved Hide resolved
cl/opinion_page/utils.py Outdated Show resolved Hide resolved
cl/opinion_page/utils.py Outdated Show resolved Hide resolved
cl/opinion_page/utils.py Outdated Show resolved Hide resolved
:param request:The user request
:return:Related Cluster Data
"""
cache = caches["db_cache"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason to use database caching over Redis?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was attempting to be consistent with other elastic cached results

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to do DB caching for larger objects, myself, but it's a fun fact that Django only evicts DB cache entries when you try to access them again later. If you cache something today, it expires, and you never visit it again, it'll take up storage forever. One day we should make a script for Django itself that cleans this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✍🏻In Progress
Development

Successfully merging this pull request may close these issues.

3 participants