Sha256: 37b69344a70df36040db2bd9587e1f1f167b9ffde0aa4473dc778d12c4659cd7

Contents?: true

Size: 878 Bytes

Versions: 1

Compression:

Stored size: 878 Bytes

Contents

export default function <%= inertia_component_name %>({ <%= singular_table_name %> }) {
  return (
    <div>
<% attributes.reject(&:password_digest?).each do |attribute| -%>
      <p>
        <strong><%= attribute.human_name %>:</strong>
<% if attribute.attachment? -%>
        {<%= singular_table_name %>.<%= attribute.column_name %> && (
          <a href={<%= singular_table_name %>.<%= attribute.column_name %>.url}>{<%= singular_table_name %>.<%= attribute.column_name %>.filename}</a>
        )}
      </p>
<% elsif attribute.attachments? -%>
      </p>
      {<%= singular_table_name %>.<%= attribute.column_name %>.map((file, i) => (
        <div key={i}>
          <a href={file.url}>{file.filename}</a>
        </div>
      ))}
<% else -%>
        {<%= singular_table_name %>.<%= attribute.column_name %>?.toString()}
      </p>
<% end -%>
<% end -%>
    </div>
  )
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inertia_rails-3.5.0 lib/generators/inertia_templates/scaffold/templates/react/One.jsx.tt