Skip to content

Group English download links together#1315

Open
yshng wants to merge 6 commits into
mainfrom
61-group-english-agenda-links
Open

Group English download links together#1315
yshng wants to merge 6 commits into
mainfrom
61-group-english-agenda-links

Conversation

@yshng

@yshng yshng commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Overview

When receiving translations, splice off the first RTF translation which is always English by the ordering in the translations app (at least it is for now, maybe I should add a check?) and put it in a special placeholder div in event detail and bill detail pages.

Connects #61

Demo

Should look like this (note that these screenshots were taken from hardcoded versions of the template to show what it should look like when the English RTF div is populated by renderLinks)


Screenshot 2026-07-02 at 10 09 13 AM
Screenshot 2026-07-02 at 10 06 40 AM

Testing Instructions

  • Added jest to test DOM manipulation since I don't have a way to directly verify locally (can't get translations into local translations instance due to Mistral - though I suppose I could point to staging?) But it's good to have tests regardless.
  • Run npm install then npx jest
  • Find an meeting and board report with translations in the preview app,
    • Check that English RTF appears above with PDF, and not with the other RTF translations.
    • Check that wording/formatting is correct

Note that jest testing isn't integrated into our CI workflow yet. Should it be?

yshng added 4 commits July 2, 2026 09:18
Previously the English RTF "translation" was included with the other translations. This
commit gets the English RTF translation and puts it right under the original English PDF link.
Need to test JS functions
Also use append to set text so we don't lose icon using innerHTML, same for non-RTF branch
since it's safer anyway to not parse HTML if we don't need to
@hancush hancush temporarily deployed to la-metro-cou-61-group-e-f9jvgy July 2, 2026 17:01 Inactive
@yshng yshng marked this pull request as ready for review July 2, 2026 17:03
@hancush hancush temporarily deployed to la-metro-cou-61-group-e-f9jvgy July 2, 2026 17:12 Inactive

@xmedr xmedr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Solid stuff! I've got a few suggestions/questons below, but the app works as expected and looks great.

Thanks for adding js tests to this, especially for agendas on the index since that's harder to set up! I think adding jest to CI is a great idea! Would you be able to open an issue for that in this repo?

Also, the 61 you have linked in your Overview is a councilmatic specific issue haha. Try using just the straight up link to an issue when it's in a different repo. Here's the link for translation's issue 61: datamade/la-metro-translations#61

// Special treatment for English RTF
// Languages are ordered so English will always be first
if (file_format === "rtf") {
const [engFile] = linksArr.splice(0,1)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like this line exists to remove the first element of the linksArr and put it into engFile, is that right?

If so, would Array.shift() serve the same purpose and make this a bit easier to read? Maybe something like:

const engFile = linksArr.shift()

Comment on lines +87 to +88
icon.classList.add("fa")
icon.classList.add("fa-file-text-o")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can consolidate these into one .add()!

Suggested change
icon.classList.add("fa")
icon.classList.add("fa-file-text-o")
icon.classList.add("fa", "fa-file-text-o")

<div>
<strong>
<a href='{{board_report.url}}' target="_blank">
<i class="fa fa-file-text-o" aria-hidden="true"></i> Download Board Report (English)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Think this might also need to have PDF at the end similar to the event template

<strong>
<a href='{{agenda.url}}' target="_blank">
<i class="fa fa-file-text-o" aria-hidden="true"></i> Download Agenda (English)
<i class="fa fa-file-text-o" aria-hidden="true"></i> Download Agenda (English) [pdf]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I know Neil had this as lowercase in his screenshot, but I'm realizing we may want to standardize whether we're using PDF/RTF or pdf/rtf on event and bill detail pages. Let's maybe go with making them uppercase, since text elsewhere on the page has PDF written that way. So something like:

Image

@@ -0,0 +1,144 @@
const { IndexTranslationUtils, DetailPageTranslationUtils } = require("./utils")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm currently getting an error after installing and running jest. It's a bit scant on details, but do you have an idea what's going on here?

>>> npx jest
Unexpected token .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants