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

576 list podcasts #590

Merged
merged 22 commits into from
Mar 23, 2023
Merged

576 list podcasts #590

merged 22 commits into from
Mar 23, 2023

Conversation

a-maci29
Copy link
Contributor

@a-maci29 a-maci29 commented Mar 4, 2023

No description provided.

@a-maci29 a-maci29 self-assigned this Mar 4, 2023
@a-maci29 a-maci29 marked this pull request as ready for review March 16, 2023 17:07
@a-maci29 a-maci29 requested a review from cavis March 16, 2023 17:07
Copy link
Member

@kookster kookster left a comment

Choose a reason for hiding this comment

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

I'd take a look at the erb formatting, seems like those div indents are off?
Maybe thinking about refactoring the ordering options to draw from the same data, but that's not critical.

Comment on lines 37 to 39
</div>
<%= page_entries_info @podcasts %>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

indents look kinda weird here, is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, definitely needs some fixes; I'm on it.

<ul class="dropdown-menu"><a class="dropdown-item active" href="<%= podcasts_path(sort: "Recent") %>">Recent Activity</a></li>
<li><%= link_to "# of Episodes", podcasts_path(sort: "episode_count"), class: "dropdown-item" %></li>
<li><%= link_to "A-Z", podcasts_path(sort: "A-Z"), class: "dropdown-item" %></li>
<li><%= link_to "Z-A", podcasts_path(sort: "Z-A"), class: "dropdown-item" %></li>
Copy link
Member

Choose a reason for hiding this comment

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

Could also get these values from the hash in the controller, instead of duplicating them

<div class="row mt-4 mb-4">
<div class="dashboard header">
<div class="col d-flex align-items-center ">
<h1 class="text-black fw-bold me-4 mb-0">My Podcasts</h1>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a design question, but "My" may not be true - this is podcasts they can access, not some kind of implied ownership

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 deferred to the design, but I can change it if you like

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@brandonhundt any preference?

app/controllers/podcasts_controller.rb Show resolved Hide resolved
Copy link
Member

@cavis cavis left a comment

Choose a reason for hiding this comment

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

👍 This looks/works good to me!

I kind of want to see a test for this... but our integration/systems tests in this repo aren't in good shape right now. So that may have to wait. So onwards!

For fallout-tickets, we should maybe open:

  1. A ticket to i18n-ify these pages (moving all english strings and timestamp/date formatting into en.yml)
  2. A ticket to support the (optional) ?per query param
  3. A ticket to fixup N+1 queries. When I load this page locally, I see ~5 SQL queries per podcast displayed on the page. That's fine to start, but we should optimize that so it doesn't need to run a bunch of similar-looking SQL for each podcast.

# GET /podcasts
def index
@podcasts = Podcast.all.limit(10)
base_query = policy_scope(Podcast).page(params[:page]).per(DEFAULT_PAGE_SIZE)
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't need to happen in this PR, but would be nice to also accept the ?per query param here. (Still defaulting to 10, if it's blank).

<%= link_to "Go to Podcast", podcast_path(podcast), class: "card-link" %>
</div>
<div class="card-footer d-grid g-1 lh-sm fs-sm text-end">
<strong>Last Saved</strong>
Copy link
Member

Choose a reason for hiding this comment

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

Should probably add all these strings (lines 11 thru here) to en.yml. Or open another ticket to do that.

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 can do it as part of this ticket! I was already thinking about it, so might as well just get to it rather than spend the time making another ticket for it.

</div>
<div class="card-footer d-grid g-1 lh-sm fs-sm text-end">
<strong>Last Saved</strong>
<datetime><%= podcast.updated_at.strftime("%-m/%-d/%Y, %-l:%M %p") %></datetime>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a @brandonhundt question... but what format is this? And is this something we use throughout the app?

Generally, we should define a :short and :long format for dates and times (4 total), in en.yml. Or maybe a couple more, if we really need to display dates/times differently for some reason. But they should get defined only there, instead of in the views.


<%= link_to "New podcast", new_podcast_path %>
<%= paginate @podcasts, window: 2, outer_window: 1 %>
Copy link
Member

Choose a reason for hiding this comment

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

Should maybe standardize these window/outer_window configs for all our views. (At some point - doesn't need to happen here).

@brandonhundt
Copy link
Contributor

Hey @a-maci29 great work! Its nice to see the sort function working! Now time for one very picky bit of feedback 🎁!!!

The class .card-body is applying a padding to the left and right of each item causing an extra gap. (Note in the screenshot). Since Bootstrap is applying a gutter to the flex-item, we don't need the extra padding. Feel free to zero it out!

Screenshot 2023-03-21 at 5 00 53 PM

Thank you!!!

@a-maci29
Copy link
Contributor Author

a-maci29 commented Mar 22, 2023

@brandonhundt I pushed up a fix! Go ahead and check it out. :)

Copy link
Member

@cavis cavis left a comment

Choose a reason for hiding this comment

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

👍

@cavis cavis merged commit 7dbdd83 into main Mar 23, 2023
@cavis cavis deleted the 576-list-podcasts branch March 23, 2023 16:15
@a-maci29 a-maci29 restored the 576-list-podcasts branch April 10, 2023 19:04
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.

None yet

5 participants