Skip to content

Add first pass at CSV docs - #72

Draft
willcosgrove wants to merge 4 commits into
mainfrom
csv-docs
Draft

Add first pass at CSV docs#72
willcosgrove wants to merge 4 commits into
mainfrom
csv-docs

Conversation

@willcosgrove

Copy link
Copy Markdown
Collaborator

I refer exclusively to row_template which is not yet supported, so that needs to get added before we can show these docs off.

I also added a markdown footnotes plugin.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 17, 2025

Copy link
Copy Markdown

Deploying phlex with  Cloudflare Pages  Cloudflare Pages

Latest commit: ba71b66
Status: ✅  Deploy successful!
Preview URL: https://4a1a1f14.phlex.pages.dev
Branch Preview URL: https://csv-docs.phlex.pages.dev

View logs

@joeldrapper joeldrapper 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.

This is great, I added a few comments.

Comment thread miscellaneous/csv.md

## Introduction

Phlex also has a CSV table builder interface that should make you feel right at home if you're already comfortable working within Phlex. It carries over Phlex's design principles of safety, speed, and streamability.

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 think we should talk specifically about streaming from Rails somewhere in this guide.

Comment thread miscellaneous/csv.md
Comment on lines +12 to +15
column("id", user.id)
column("first_name", user.first_name)
column("last_name", user.last_name)
column("email", user.email)

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.

What do you think about dropping the parentheses in this example?

Comment thread miscellaneous/csv.md
Let's take a quick look at a CSV representing an export of users.

```ruby
class UserExport < ApplicationCSV

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 wonder if we should use BaseCSV to be more consistent with how we name the base component.

Comment thread miscellaneous/csv.md

```ruby
class ApplicationCSV < Phlex::CSV
def trim_whitespace? = true

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.

Do you think we should rename this to strip_whitespace to be consistent with Ruby’s method?

Comment thread miscellaneous/csv.md
::: code-group
```ruby
class UserExport < ApplicationCSV
def render_headers? = false

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.

Perhaps here or in the section below about the initializer, we should highlight that you could pass this in as an option if you wanted define a method that points to an ivar.

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.

2 participants